Skip to content

Commit

Permalink
refactor test entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
SunnyR committed Jun 4, 2024
1 parent ebe4e18 commit 926c4a2
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
- name: Security
run: poetry run bandit -c pyproject.toml -r .
- name: Testing
run: python -m unittest discover
run: python ./runtests.py
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ lint:
flake8 . --extend-ignore=D,E501,W601 --extend-exclude=docs/ --statistics --count

test:
(cd testing; python manage.py test)
python ./runtests.py
2 changes: 0 additions & 2 deletions keyvaluestore/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@
class KeyValueStoreAdmin(admin.ModelAdmin):
list_display = ("key", "value")
search_fields = ("key", "value")


6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ classifiers=[
]
packages = [
{ include = "keyvaluestore" },
{ include = "testing", format = "sdist" },
{ include = "tests", format = "sdist" },
]
exclude = [
"keyvaluestore/**/tests",
"testing"
"tests"
]

[tool.poetry.dependencies]
Expand Down Expand Up @@ -62,5 +62,5 @@ build-backend = "poetry.core.masonry.api"

[tool.bandit]
exclude_dirs = [
'./testing/',
'./tests/',
]
15 changes: 15 additions & 0 deletions runtests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env python
import os
import sys

from django.core.management import execute_from_command_line


def runtests():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings")
argv = sys.argv[:1] + ["test"] + sys.argv[1:]
execute_from_command_line(argv)


if __name__ == "__main__":
runtests()
15 changes: 0 additions & 15 deletions testing/manage.py

This file was deleted.

Empty file removed testing/tests/__init__.py
Empty file.
File renamed without changes.
2 changes: 1 addition & 1 deletion testing/settings.py → tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "testing.db",
"NAME": "tests_db",
"USER": "",
"PASSWORD": "",
"HOST": "",
Expand Down
File renamed without changes.

0 comments on commit 926c4a2

Please sign in to comment.