Add test for testing datadir not in sdist

This commit is contained in:
László Károlyi 2020-04-13 21:55:54 +02:00
parent f47ca3be93
commit 96a6939b6c
Signed by: karolyi
GPG Key ID: 2DCAF25E55735BFE
2 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,7 @@
from pathlib import Path
from subprocess import check_output
from tarfile import TarInfo
from tarfile import open as tar_open
from unittest.case import TestCase
try:
@ -26,3 +28,11 @@ class InstallTest(TestCase):
self.assertTrue(
expr=Path(etag_path).exists(),
msg=f'{etag_path!r} doesn\'t exist.')
def test_sdist_excludes_datadir(self):
'The created sdist should not contain the data dir.'
latest_sdist = list(Path('dist').glob(pattern='*.tar.gz'))[-1]
tar_file = tar_open(name=latest_sdist, mode='r:gz')
for tarinfo in tar_file: # type: TarInfo
self.assertNotIn(
member='/validate_email/data/', container=tarinfo.name)

View File

@ -119,7 +119,7 @@ class BlacklistUpdater(object):
except HTTPError as exc:
if exc.code == 304:
# Not modified, update date on the tmp file
LOGGER.debug(msg=f'Local file is fresh enough (same ETag).')
LOGGER.debug(msg='Local file is fresh enough (same ETag).')
BLACKLIST_FILEPATH_TMP.touch()
return
raise