Add test for testing datadir not in sdist
This commit is contained in:
parent
f47ca3be93
commit
96a6939b6c
2 changed files with 11 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from subprocess import check_output
|
from subprocess import check_output
|
||||||
|
from tarfile import TarInfo
|
||||||
|
from tarfile import open as tar_open
|
||||||
from unittest.case import TestCase
|
from unittest.case import TestCase
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -26,3 +28,11 @@ class InstallTest(TestCase):
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
expr=Path(etag_path).exists(),
|
expr=Path(etag_path).exists(),
|
||||||
msg=f'{etag_path!r} doesn\'t exist.')
|
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)
|
||||||
|
|
|
@ -119,7 +119,7 @@ class BlacklistUpdater(object):
|
||||||
except HTTPError as exc:
|
except HTTPError as exc:
|
||||||
if exc.code == 304:
|
if exc.code == 304:
|
||||||
# Not modified, update date on the tmp file
|
# 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()
|
BLACKLIST_FILEPATH_TMP.touch()
|
||||||
return
|
return
|
||||||
raise
|
raise
|
||||||
|
|
Loading…
Reference in a new issue