File: pytest-rootdir.patch

package info (click to toggle)
pytest-console-scripts 1.4.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 244 kB
  • sloc: python: 812; makefile: 2
file content (55 lines) | stat: -rw-r--r-- 1,752 bytes parent folder | download | duplicates (2)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Description: Specify the rootdir to pytest subprocesses
Forwarded: https://github.com/kvas-it/pytest-console-scripts/pull/86
Author: Julian Gilbey <jdg@debian.org>
Last-Update: 2024-03-28

--- a/tests/test_run_scripts.py
+++ b/tests/test_run_scripts.py
@@ -93,7 +93,12 @@
     # inner and outer script runners.
 
     result = script_runner.run(
-        ['pytest', test, f'--script-launch-mode={launch_mode}']
+        [
+            'pytest',
+            f'--rootdir={tmp_path}',
+            test,
+            f'--script-launch-mode={launch_mode}'
+        ]
     )
     assert result.success
 
@@ -256,7 +261,12 @@
         """
     )
     result = script_runner.run(
-        ['pytest', test, f'--script-launch-mode={launch_mode}']
+        [
+            'pytest',
+            f'--rootdir={tmp_path}',
+            test,
+            f'--script-launch-mode={launch_mode}'
+        ]
     )
     assert result.success != fail
     if fail:
@@ -312,7 +322,7 @@
     script_runner.run(R'''{console_script}''', print_result=False)
         """
     )
-    result = script_runner.run(['pytest', '-s', test])
+    result = script_runner.run(['pytest', '-s', f'--rootdir={tmp_path}', test])
     assert result.success
     assert 'the answer is 42' not in result.stdout
     assert 'Running console script' not in result.stdout
@@ -333,7 +343,9 @@
     script_runner.run(R'''{console_script}''')
         """
     )
-    result = script_runner.run(['pytest', '-s', '--hide-run-results', test])
+    result = script_runner.run(
+        ['pytest', '-s', '--hide-run-results', f'--rootdir={tmp_path}', test]
+    )
     assert result.success
     assert 'the answer is 42' not in result.stdout
     assert 'Running console script' not in result.stdout