File: assert-after-context-manager-exits

package info (click to toggle)
python-nudatus 0.0.5-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 200 kB
  • sloc: python: 295; makefile: 50; sh: 12
file content (35 lines) | stat: -rw-r--r-- 1,335 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Description: Fix pytest usage: .value can only be used after the context manager exits
Author: Miro HronĨok <miro@hroncok.cz>
Origin: upstream
Bug: https://github.com/ZanderBrown/nudatus/pull/11
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1056488
Applied-Upstream: https://github.com/ZanderBrown/nudatus/commit/d99f07af78fcd57b8151014040dd0d919ef91195
Reviewed-by: Nick Morrott <nickm@debian.org>
Last-Update: 2024-02-21
---
--- a/tests/test_nudatus.py
+++ b/tests/test_nudatus.py
@@ -52,10 +52,10 @@
     with mock.patch("sys.argv", ["nudatus"]):
         with pytest.raises(SystemExit) as ex:
             nudatus.main()
-            assert ex.value.code == 1
-            out, err = capfd.readouterr()
-            assert len(out) == 0
-            assert err == "No file specified"
+        assert ex.value.code == 1
+        out, err = capfd.readouterr()
+        assert len(out) == 0
+        assert err.strip() == "No file specified"
 
 
 def test_main_with_file_without_output_file(capfd):
@@ -95,7 +95,7 @@
     with pytest.raises(SystemExit) as ex:
         with mock.patch("sys.argv", ["nudatus", "tests/bigscript_bad.py"]):
             nudatus.main()
-        assert ex.value.code == 1
+    assert ex.value.code == 1
     out, err = capfd.readouterr()
     assert len(out) == 0
     assert len(err) > 0