Skip to content

Commit 3aa2d57

Browse files
committed
Fix pesky test
1 parent cb18737 commit 3aa2d57

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

setuptools/tests/test_easy_install.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -670,11 +670,11 @@ def test_setup_requires_override_nspkg(self, use_setup_cfg):
670670

671671
with contexts.save_pkg_resources_state():
672672
with contexts.tempdir() as temp_dir:
673-
foobar_1_archive = os.path.join(temp_dir, 'foo.bar-0.1.tar.gz')
674-
make_nspkg_sdist(foobar_1_archive, 'foo.bar', '0.1')
673+
foobar_1_archive = os.path.join(temp_dir, 'foo_bar-0.1.tar.gz')
674+
make_nspkg_sdist(foobar_1_archive, 'foo_bar', '0.1')
675675
# Now actually go ahead an extract to the temp dir and add the
676676
# extracted path to sys.path so foo.bar v0.1 is importable
677-
foobar_1_dir = os.path.join(temp_dir, 'foo.bar-0.1')
677+
foobar_1_dir = os.path.join(temp_dir, 'foo_bar-0.1')
678678
os.mkdir(foobar_1_dir)
679679
with tarfile.open(foobar_1_archive) as tf:
680680
tf.extraction_filter = lambda member, path: member
@@ -697,14 +697,14 @@ def test_setup_requires_override_nspkg(self, use_setup_cfg):
697697
len(foo.__path__) == 2):
698698
print('FAIL')
699699
700-
if 'foo.bar-0.2' not in foo.__path__[0]:
700+
if 'foo_bar-0.2' not in foo.__path__[0]:
701701
print('FAIL')
702702
"""
703703
)
704704

705705
test_pkg = create_setup_requires_package(
706706
temp_dir,
707-
'foo.bar',
707+
'foo_bar',
708708
'0.2',
709709
make_nspkg_sdist,
710710
template,
@@ -1120,8 +1120,10 @@ def make_nspkg_sdist(dist_path, distname, version):
11201120
package with the same name as distname. The top-level package is
11211121
designated a namespace package).
11221122
"""
1123-
1124-
parts = distname.split('.')
1123+
# The project name might not contain periods. Replace dashes and
1124+
# underscores with periods before constructing the namespace.
1125+
namespace = distname.replace('-', '.').replace('_', '.')
1126+
parts = namespace.split('.')
11251127
nspackage = parts[0]
11261128

11271129
packages = ['.'.join(parts[:idx]) for idx in range(1, len(parts) + 1)]

0 commit comments

Comments
 (0)