Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow for running tests with break on error #890

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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