Skip to content

Commit 4a0a9ce

Browse files
committed
Make the test less fragile and search simply for the presence of a ValueError in the traceback. Closes pypa#4334.
1 parent 7b17049 commit 4a0a9ce

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

setuptools/tests/test_egg_info.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,9 @@ def test_license_is_a_string(self, tmpdir_cwd, env):
213213
with pytest.raises(AssertionError) as exc:
214214
self._run_egg_info_command(tmpdir_cwd, env)
215215

216-
# Hopefully this is not too fragile: the only argument to the
217-
# assertion error should be a traceback, ending with:
218-
# ValueError: ....
219-
#
220-
# assert not 1
221-
tb = exc.value.args[0].split('\n')
222-
assert tb[-3].lstrip().startswith('ValueError')
216+
# The only argument to the assertion error should be a traceback
217+
# containing a ValueError
218+
assert 'ValueError' in exc.value.args[0]
223219

224220
def test_rebuilt(self, tmpdir_cwd, env):
225221
"""Ensure timestamps are updated when the command is re-run."""

0 commit comments

Comments
 (0)