Skip to content

Commit d6c56a1

Browse files
committed
Check stderr before stdout
1 parent b45d270 commit d6c56a1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/test_subprocess.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def test_subprocess(tmp_pathplus: PathPlus, monkeypatch):
2323
)
2424

2525
assert result.returncode == 1
26+
assert result.stderr == b''
2627
assert result.stdout == b"""\
2728
code.py:1:1: DALL000 Module lacks __all__.
2829
code.py:2:1: W191 indentation contains tabs
@@ -32,7 +33,6 @@ def test_subprocess(tmp_pathplus: PathPlus, monkeypatch):
3233
code.py:5:1: W293 blank line contains whitespace
3334
code.py:5:2: W292 no newline at end of file
3435
"""
35-
assert result.stderr == b''
3636

3737
with in_directory(tmp_pathplus):
3838
result = subprocess.run(
@@ -42,8 +42,8 @@ def test_subprocess(tmp_pathplus: PathPlus, monkeypatch):
4242
)
4343

4444
assert result.returncode == 1
45-
assert result.stdout == b"code.py:1:1: DALL000 Module lacks __all__.\n"
4645
assert result.stderr == b''
46+
assert result.stdout == b"code.py:1:1: DALL000 Module lacks __all__.\n"
4747

4848
(tmp_pathplus / "tox.ini").write_text("""
4949
@@ -59,8 +59,8 @@ def test_subprocess(tmp_pathplus: PathPlus, monkeypatch):
5959
)
6060

6161
assert result.returncode == 1
62-
assert result.stdout == b"code.py:1:1: DALL000 Module lacks __all__.\n"
6362
assert result.stderr == b''
63+
assert result.stdout == b"code.py:1:1: DALL000 Module lacks __all__.\n"
6464

6565
tox_ini = tmp_pathplus / "tox.ini"
6666
tox_ini.write_text("""
@@ -79,8 +79,8 @@ def test_subprocess(tmp_pathplus: PathPlus, monkeypatch):
7979
)
8080

8181
assert result.returncode == 0
82-
assert result.stdout == b''
8382
assert result.stderr == b''
83+
assert result.stdout == b''
8484

8585

8686
def test_subprocess_noqa(tmp_pathplus: PathPlus, monkeypatch):
@@ -99,6 +99,7 @@ def test_subprocess_noqa(tmp_pathplus: PathPlus, monkeypatch):
9999
)
100100

101101
assert result.returncode == 1
102+
assert result.stderr == b''
102103
assert result.stdout == b"""\
103104
code.py:3:1: W191 indentation contains tabs
104105
code.py:3:1: W293 blank line contains whitespace
@@ -107,7 +108,6 @@ def test_subprocess_noqa(tmp_pathplus: PathPlus, monkeypatch):
107108
code.py:6:1: W293 blank line contains whitespace
108109
code.py:6:2: W292 no newline at end of file
109110
"""
110-
assert result.stderr == b''
111111

112112
with in_directory(tmp_pathplus):
113113
result = subprocess.run(
@@ -117,8 +117,8 @@ def test_subprocess_noqa(tmp_pathplus: PathPlus, monkeypatch):
117117
)
118118

119119
assert result.returncode == 0
120-
assert result.stdout == b''
121120
assert result.stderr == b''
121+
assert result.stdout == b''
122122

123123
(tmp_pathplus / "tox.ini").write_text("""
124124
@@ -134,8 +134,8 @@ def test_subprocess_noqa(tmp_pathplus: PathPlus, monkeypatch):
134134
)
135135

136136
assert result.returncode == 0
137-
assert result.stdout == b''
138137
assert result.stderr == b''
138+
assert result.stdout == b''
139139

140140
tox_ini = tmp_pathplus / "tox.ini"
141141
tox_ini.write_text("""
@@ -154,5 +154,5 @@ def test_subprocess_noqa(tmp_pathplus: PathPlus, monkeypatch):
154154
)
155155

156156
assert result.returncode == 0
157-
assert result.stdout == b''
158157
assert result.stderr == b''
158+
assert result.stdout == b''

0 commit comments

Comments
 (0)