diff options
| author | 2024-04-23 00:38:24 -0400 | |
|---|---|---|
| committer | 2024-04-23 00:38:24 -0400 | |
| commit | 0199f695e93782d728bd31857afe54f4df92f351 (patch) | |
| tree | 34e9030a05a89461d222172615c74891fba1e5ef /tests/test_test_helper.py | |
| parent | 22b8f5dae59e876643e8e3002f72282f3e8608c5 (diff) | |
| parent | 9b0e86a8e74768c4fe848fb5ce8d754292db4e3e (diff) | |
Update upstream source from tag 'upstream/8.3.0'
Update to upstream version '8.3.0'
with Debian dir bc13791b86ab63e4473e92288f1749c55a6ad540
Diffstat (limited to 'tests/test_test_helper.py')
| -rw-r--r-- | tests/test_test_helper.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_test_helper.py b/tests/test_test_helper.py new file mode 100644 index 0000000..e836ad1 --- /dev/null +++ b/tests/test_test_helper.py @@ -0,0 +1,22 @@ +import os + +from .helper import cd + + +class SomeTestError(Exception): + """An arbitrary error to be thrown by the test.""" + pass + + +def test_test_helper(): + """Check that the cd test helper duly resets the directory even in spite of an error.""" + old_dir = os.getcwd() + exception_seen = False + try: + with cd(".."): + raise SomeTestError("Just raising an exception, as failing tests sometimes do.") + except SomeTestError: + now_dir = os.getcwd() + assert old_dir == now_dir + exception_seen = True + assert exception_seen |
