Skip to content

Commit

Permalink
allow for running tests with break on error
Browse files Browse the repository at this point in the history
  • Loading branch information
jeking3 committed Oct 25, 2021
1 parent d8e5602 commit 8215eb9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Full list of changes:
- Improve performance of ``history.diff_against`` by reducing number of queries to 0 in most cases (gh-776)
- Added Czech translations (gh-885)
- Added pre-commit for better commit quality (gh-896)
- Added ability to break into debugger on unit test failure (gh-890)

3.0.0 (2021-04-16)
------------------
Expand Down
16 changes: 9 additions & 7 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ def __getitem__(self, item):

def main():
parser = ArgumentParser(description="Run package tests.")
parser.add_argument("--tag", action="append", nargs="?")
parser.add_argument("--database", action="store", nargs="?", default="sqlite3")
parser.add_argument("--failfast", action="store_true")
parser.add_argument("--pdb", action="store_true")
parser.add_argument("--tag", action="append", nargs="?")
namespace = parser.parse_args()
db_settings = DATABASE_NAME_TO_DATABASE_SETTINGS[namespace.database]
if not settings.configured:
Expand All @@ -157,12 +159,12 @@ def main():
django.setup()

tags = namespace.tag
failures = DiscoverRunner(failfast=False, tags=tags).run_tests(
["simple_history.tests"]
)
failures |= DiscoverRunner(failfast=False, tags=tags).run_tests(
["simple_history.registry_tests"]
)
failures = DiscoverRunner(
failfast=bool(namespace.failfast), pdb=bool(namespace.pdb), tags=tags
).run_tests(["simple_history.tests"])
failures |= DiscoverRunner(
failfast=bool(namespace.failfast), pdb=bool(namespace.pdb), tags=tags
).run_tests(["simple_history.registry_tests"])
sys.exit(failures)


Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ deps =
mariadb: -rrequirements/mysql.txt

commands =
sqlite3: coverage run -a runtests.py
postgres: coverage run -a runtests.py --database=postgres
mysql: coverage run -a runtests.py --database=mysql
mariadb: coverage run -a runtests.py --database=mariadb
sqlite3: coverage run -a runtests.py {posargs}
postgres: coverage run -a runtests.py --database=postgres {posargs}
mysql: coverage run -a runtests.py --database=mysql {posargs}
mariadb: coverage run -a runtests.py --database=mariadb {posargs}
coverage report

[testenv:format]
Expand Down

0 comments on commit 8215eb9

Please sign in to comment.