aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-05-16 21:45:40 -0400
committerJason R. Coombs <jaraco@jaraco.com>2020-05-16 21:45:40 -0400
commit55456fe32ab2b5d7a4d476149ba935dbfd6e5fca (patch)
tree23fb29bd59cbde84f99dbebd78456ed95952056f
parent4c62d634784a935eb0fbeedc174a25b82f05e1d6 (diff)
downloadexternal_python_setuptools-55456fe32ab2b5d7a4d476149ba935dbfd6e5fca.tar.gz
external_python_setuptools-55456fe32ab2b5d7a4d476149ba935dbfd6e5fca.tar.bz2
external_python_setuptools-55456fe32ab2b5d7a4d476149ba935dbfd6e5fca.zip
Try constructing the fake package at the beginning of the test.
-rw-r--r--setuptools/tests/test_config.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py
index eeac32ce..77b853eb 100644
--- a/setuptools/tests/test_config.py
+++ b/setuptools/tests/test_config.py
@@ -54,6 +54,7 @@ def fake_env(
' return [3, 4, 5, "dev"]\n'
'\n'
)
+
return package_dir, config
@@ -268,11 +269,23 @@ class TestMetadata:
def test_version(self, tmpdir):
- _, config = fake_env(
+ package_dir, config = fake_env(
tmpdir,
'[metadata]\n'
'version = attr: fake_package.VERSION\n'
)
+
+ sub_a = package_dir.mkdir('subpkg_a')
+ sub_a.join('__init__.py').write('')
+ sub_a.join('mod.py').write('VERSION = (2016, 11, 26)')
+
+ sub_b = package_dir.mkdir('subpkg_b')
+ sub_b.join('__init__.py').write('')
+ sub_b.join('mod.py').write(
+ 'import third_party_module\n'
+ 'VERSION = (2016, 11, 26)'
+ )
+
with get_dist(tmpdir) as dist:
assert dist.metadata.version == '1.2.3'
@@ -290,10 +303,6 @@ class TestMetadata:
with get_dist(tmpdir) as dist:
assert dist.metadata.version == '1'
- sub_a = tmpdir.join('fake_package').mkdir('subpkg_a')
- sub_a.join('__init__.py').write('')
- sub_a.join('mod.py').write('VERSION = (2016, 11, 26)')
-
config.write(
'[metadata]\n'
'version = attr: fake_package.subpkg_a.mod.VERSION\n'
@@ -301,13 +310,6 @@ class TestMetadata:
with get_dist(tmpdir) as dist:
assert dist.metadata.version == '2016.11.26'
- sub_b = tmpdir.join('fake_package').mkdir('subpkg_b')
- sub_b.join('__init__.py').write('')
- sub_b.join('mod.py').write(
- 'import third_party_module\n'
- 'VERSION = (2016, 11, 26)'
- )
-
config.write(
'[metadata]\n'
'version = attr: fake_package.subpkg_b.mod.VERSION\n'