Add a test for preinstalled data directory checking
This commit is contained in:
parent
e2f523d2b7
commit
e3d2bf24c7
|
@ -13,7 +13,8 @@ install:
|
|||
- python -m pip install -U pip wheel setuptools
|
||||
- python -m pip install -U isort flake8
|
||||
- python -m pip install -r requirements.txt
|
||||
- python -m pip install -e .
|
||||
- python -Wd setup.py sdist
|
||||
- python -Wd -m pip install dist/py3-validate-email-*.tar.gz
|
||||
|
||||
# command to run tests
|
||||
script:
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
from pathlib import Path
|
||||
from subprocess import check_output
|
||||
from unittest.case import TestCase
|
||||
|
||||
try:
|
||||
# OSX Homebrew fix: https://stackoverflow.com/a/53190037/1067833
|
||||
from sys import _base_executable as executable
|
||||
except ImportError:
|
||||
from sys import executable
|
||||
|
||||
|
||||
class InstallTest(TestCase):
|
||||
'Testing package installation.'
|
||||
|
||||
def test_datadir_is_in_place(self):
|
||||
'Data directory should be in the virtualenv.'
|
||||
output = check_output([
|
||||
executable, '-c', (
|
||||
'import sys;sys.path.remove("");import validate_email;'
|
||||
'print(validate_email.updater.BLACKLIST_FILEPATH_INSTALLED);'
|
||||
'print(validate_email.updater.ETAG_FILEPATH_INSTALLED, end="")'
|
||||
)]).decode('ascii')
|
||||
bl_path, etag_path = output.split('\n')
|
||||
self.assertTrue(
|
||||
expr=Path(bl_path).exists(), msg=f'{bl_path!r} doesn\'t exist.')
|
||||
self.assertTrue(
|
||||
expr=Path(etag_path).exists(),
|
||||
msg=f'{etag_path!r} doesn\'t exist.')
|
Loading…
Reference in New Issue