test_params = test.lstrip().split('\n\n', 3)
name_kwargs = test_params.pop(0).split('\n')
if len(name_kwargs) > 1:
- install_cmd_kwargs = ast.literal_eval(name_kwargs[1].strip())
+ val = name_kwargs[1].strip()
+ install_cmd_kwargs = ast.literal_eval(val)
else:
install_cmd_kwargs = {}
name = name_kwargs[0].strip()
expected_requires,
install_cmd_kwargs,
marks=marks))
- return pytest.mark.parametrize('requires,use_setup_cfg,'
- 'expected_requires,install_cmd_kwargs',
- argvalues, ids=idlist)
+ return pytest.mark.parametrize(
+ 'requires,use_setup_cfg,'
+ 'expected_requires,install_cmd_kwargs',
+ argvalues, ids=idlist,
+ )
@RequiresTestHelper.parametrize(
# Format of a test:
# expected contents of requires.txt
'''
+ install_requires_deterministic
+
+ install_requires=["fake-factory==0.5.2", "pytz"]
+
+ [options]
+ install_requires =
+ fake-factory==0.5.2
+ pytz
+
+ fake-factory==0.5.2
+ pytz
+ ''',
+
+ '''
install_requires_with_marker
install_requires=["barbazquux;{mismatch_marker}"],
mismatch_marker=mismatch_marker,
mismatch_marker_alternate=mismatch_marker_alternate,
)
- def test_requires(self, tmpdir_cwd, env,
- requires, use_setup_cfg,
- expected_requires, install_cmd_kwargs):
+ def test_requires(
+ self, tmpdir_cwd, env, requires, use_setup_cfg,
+ expected_requires, install_cmd_kwargs):
self._setup_script_with_requires(requires, use_setup_cfg)
self._run_install_command(tmpdir_cwd, env, **install_cmd_kwargs)
egg_info_dir = os.path.join('.', 'foo.egg-info')
assert install_requires.lstrip() == expected_requires
assert glob.glob(os.path.join(env.paths['lib'], 'barbazquux*')) == []
+ def test_install_requires_unordered_disallowed(self, tmpdir_cwd, env):
+ """
+ Packages that pass unordered install_requires sequences
+ should be rejected as they produce non-deterministic
+ builds. See #458.
+ """
+ req = 'install_requires={"fake-factory==0.5.2", "pytz"}'
+ self._setup_script_with_requires(req)
+ with pytest.raises(AssertionError):
+ self._run_install_command(tmpdir_cwd, env)
+
def test_extras_require_with_invalid_marker(self, tmpdir_cwd, env):
tmpl = 'extras_require={{":{marker}": ["barbazquux"]}},'
req = tmpl.format(marker=self.invalid_marker)