mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-01-26 22:49:01 -06:00
Development: fix unreachable code around assertRaises blocks (#11365)
* tests: general cleanup and fixes for runnning under docker This now allows tests to be run under a locally built or production docker image with something like: `docker run --rm -v $PWD:/usr/src/paperless --entrypoint=bash paperlessngx/paperless-ngx:latest -c "uv run pytest"` Specific fixes: - fix unreachable code around `assertRaises` blocks - fix `assertInt` typos - fix `str(e)` vs `str(e.exception)` issues - skip permission-based checks when root (in a docker container) - catch `OSError` problems when instantiating `INotify` and skip inotify-based tests when it's unavailable. * Reverts most files to dev while keeping the exception assert fixes --------- Co-authored-by: Trenton H <797416+stumpylog@users.noreply.github.com>
This commit is contained in:
@@ -34,7 +34,7 @@ class TestFuzzyMatchCommand(TestCase):
|
||||
"""
|
||||
with self.assertRaises(CommandError) as e:
|
||||
self.call_command("--ratio", "-1")
|
||||
self.assertIn("The ratio must be between 0 and 100", str(e))
|
||||
self.assertIn("The ratio must be between 0 and 100", str(e.exception))
|
||||
|
||||
def test_invalid_ratio_upper_limit(self):
|
||||
"""
|
||||
@@ -47,7 +47,7 @@ class TestFuzzyMatchCommand(TestCase):
|
||||
"""
|
||||
with self.assertRaises(CommandError) as e:
|
||||
self.call_command("--ratio", "101")
|
||||
self.assertIn("The ratio must be between 0 and 100", str(e))
|
||||
self.assertIn("The ratio must be between 0 and 100", str(e.exception))
|
||||
|
||||
def test_invalid_process_count(self):
|
||||
"""
|
||||
@@ -60,7 +60,7 @@ class TestFuzzyMatchCommand(TestCase):
|
||||
"""
|
||||
with self.assertRaises(CommandError) as e:
|
||||
self.call_command("--processes", "0")
|
||||
self.assertIn("There must be at least 1 process", str(e))
|
||||
self.assertIn("There must be at least 1 process", str(e.exception))
|
||||
|
||||
def test_no_matches(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user