diff options
author | Paul Ganssle <paul@ganssle.io> | 2018-12-29 10:53:13 -0500 |
---|---|---|
committer | Paul Ganssle <paul@ganssle.io> | 2018-12-29 11:20:49 -0500 |
commit | 8b8e2c8b3b83151dad1719a8cb676e919766c1c9 (patch) | |
tree | 84b6a716f0d4e1dfe5de2476005420464ca9ad24 | |
parent | 2b038993e835d5a0d328910bc855b53a7c21bc6e (diff) | |
download | external_python_setuptools-8b8e2c8b3b83151dad1719a8cb676e919766c1c9.tar.gz external_python_setuptools-8b8e2c8b3b83151dad1719a8cb676e919766c1c9.tar.bz2 external_python_setuptools-8b8e2c8b3b83151dad1719a8cb676e919766c1c9.zip |
Change how license field ValueError is tested
Both the old and new approaches are deeply unsatisfying to me, but
without reworking how these test commands are run, I think this is
about as close as we can get to enforcing that this specific call
raises ValueError.
-rw-r--r-- | setuptools/tests/test_egg_info.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index e1105044..979ff18e 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -165,9 +165,20 @@ class TestEggInfo: build_files({'setup.py': setup_script, 'setup.cfg': setup_config}) - with pytest.raises(ValueError): + # This command should fail with a ValueError, but because it's + # currently configured to use a subprocess, the actual traceback + # object is lost and we need to parse it from stderr + with pytest.raises(AssertionError) as exc: self._run_egg_info_command(tmpdir_cwd, env) + # Hopefully this is not too fragile: the only argument to the + # assertion error should be a traceback, ending with: + # ValueError: .... + # + # assert not 1 + tb = exc.value.args[0].split('\n') + assert tb[-3].lstrip().startswith('ValueError') + def test_rebuilt(self, tmpdir_cwd, env): """Ensure timestamps are updated when the command is re-run.""" self._create_project() @@ -617,11 +628,8 @@ class TestEggInfo: data_stream=1, env=environ, ) - if code: - if 'ValueError' in data: - raise ValueError(data) - else: - raise AssertionError(data) + assert not code, data + if output: assert output in data |