From 4cb65de3c3aba96d02514b991db6c4ed35993809 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Fri, 8 Jul 2022 12:43:58 -0700 Subject: [PATCH] Fix tox tests so they will actually fail As things stand, the tests never fail when run via tox. `__main__.py` runs each individual test script, but always exits 0, even if a test script exits >0. Signed-off-by: Adam Williamson --- dill/tests/__main__.py | 11 ++++++++--- tox.ini | 3 +-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dill/tests/__main__.py b/dill/tests/__main__.py index 1570b399..21f03cd9 100644 --- a/dill/tests/__main__.py +++ b/dill/tests/__main__.py @@ -23,8 +23,13 @@ if __name__ == '__main__': + failed = 0 for test in tests: p = sp.Popen([python, test], shell=shell).wait() - if not p: - print('.', end='', flush=True) - print() + if p: + print('F', end='') + failed = 1 + else: + print('.', end='') + print('') + exit(failed) diff --git a/tox.ini b/tox.ini index a63d8067..be9a124d 100644 --- a/tox.ini +++ b/tox.ini @@ -18,5 +18,4 @@ whitelist_externals = bash commands = {envpython} -m pip install . - bash -c "failed=0; for test in dill/tests/__main__.py; do echo $test; \ - {envpython} $test || failed=1; done; exit $failed" + {envpython} dill/tests/__main__.py