Skip to content

Commit

Permalink
Update tests to match new expectation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Apr 11, 2024
1 parent 005ba4b commit be32fec
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions distutils/tests/test_sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ def test_prune_file_list(self):
# now let's check what we have
dist_folder = join(self.tmp_dir, 'dist')
files = os.listdir(dist_folder)
assert files == ['fake-1.0.zip']
assert files == ['fake-1.zip']

zip_file = zipfile.ZipFile(join(dist_folder, 'fake-1.0.zip'))
zip_file = zipfile.ZipFile(join(dist_folder, 'fake-1.zip'))
try:
content = zip_file.namelist()
finally:
Expand All @@ -135,7 +135,7 @@ def test_prune_file_list(self):
'somecode/',
'somecode/__init__.py',
]
assert sorted(content) == ['fake-1.0/' + x for x in expected]
assert sorted(content) == ['fake-1/' + x for x in expected]

@pytest.mark.usefixtures('needs_zlib')
@pytest.mark.skipif("not find_executable('tar')")
Expand All @@ -153,10 +153,10 @@ def test_make_distribution(self):
dist_folder = join(self.tmp_dir, 'dist')
result = os.listdir(dist_folder)
result.sort()
assert result == ['fake-1.0.tar', 'fake-1.0.tar.gz']
assert result == ['fake-1.tar', 'fake-1.tar.gz']

os.remove(join(dist_folder, 'fake-1.0.tar'))
os.remove(join(dist_folder, 'fake-1.0.tar.gz'))
os.remove(join(dist_folder, 'fake-1.tar'))
os.remove(join(dist_folder, 'fake-1.tar.gz'))

# now trying a tar then a gztar
cmd.formats = ['tar', 'gztar']
Expand All @@ -166,7 +166,7 @@ def test_make_distribution(self):

result = os.listdir(dist_folder)
result.sort()
assert result == ['fake-1.0.tar', 'fake-1.0.tar.gz']
assert result == ['fake-1.tar', 'fake-1.tar.gz']

@pytest.mark.usefixtures('needs_zlib')
def test_add_defaults(self):
Expand Down Expand Up @@ -219,9 +219,9 @@ def test_add_defaults(self):
# now let's check what we have
dist_folder = join(self.tmp_dir, 'dist')
files = os.listdir(dist_folder)
assert files == ['fake-1.0.zip']
assert files == ['fake-1.zip']

zip_file = zipfile.ZipFile(join(dist_folder, 'fake-1.0.zip'))
zip_file = zipfile.ZipFile(join(dist_folder, 'fake-1.zip'))
try:
content = zip_file.namelist()
finally:
Expand All @@ -247,7 +247,7 @@ def test_add_defaults(self):
'somecode/doc.dat',
'somecode/doc.txt',
]
assert sorted(content) == ['fake-1.0/' + x for x in expected]
assert sorted(content) == ['fake-1/' + x for x in expected]

# checking the MANIFEST
manifest = pathlib.Path(self.tmp_dir, 'MANIFEST').read_text(encoding='utf-8')
Expand Down Expand Up @@ -420,16 +420,16 @@ def test_manual_manifest(self):

assert list(clean_lines(cmd.manifest)) == ['README.manual']

archive_name = join(self.tmp_dir, 'dist', 'fake-1.0.tar.gz')
archive_name = join(self.tmp_dir, 'dist', 'fake-1.tar.gz')
archive = tarfile.open(archive_name)
try:
filenames = [tarinfo.name for tarinfo in archive]
finally:
archive.close()
assert sorted(filenames) == [
'fake-1.0',
'fake-1.0/PKG-INFO',
'fake-1.0/README.manual',
'fake-1',
'fake-1/PKG-INFO',
'fake-1/README.manual',
]

@pytest.mark.usefixtures('needs_zlib')
Expand All @@ -449,7 +449,7 @@ def test_make_distribution_owner_group(self):
cmd.run()

# making sure we have the good rights
archive_name = join(self.tmp_dir, 'dist', 'fake-1.0.tar.gz')
archive_name = join(self.tmp_dir, 'dist', 'fake-1.tar.gz')
archive = tarfile.open(archive_name)
try:
for member in archive.getmembers():
Expand All @@ -467,7 +467,7 @@ def test_make_distribution_owner_group(self):
cmd.run()

# making sure we have the good rights
archive_name = join(self.tmp_dir, 'dist', 'fake-1.0.tar.gz')
archive_name = join(self.tmp_dir, 'dist', 'fake-1.tar.gz')
archive = tarfile.open(archive_name)

# note that we are not testing the group ownership here
Expand Down

0 comments on commit be32fec

Please sign in to comment.