diff --git a/.gitignore b/.gitignore index d487b7e..8ac2af1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ chromedriver_installer.egg-info/ *.pyc MANIFEST .cache/ +venv/ +.pytest_cache/ +__pycache__/ diff --git a/requirements.txt b/requirements.txt index b654c22..642edbd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ +pytest tox \ No newline at end of file diff --git a/tests.py b/tests.py index 9690787..e026aa9 100644 --- a/tests.py +++ b/tests.py @@ -60,7 +60,7 @@ class Base(object): def _uninstall(self): try: subprocess.check_call( - shlex.split('pip uninstall chromedriver_installer -y') + self._get_popen_args('pip uninstall chromedriver_installer -y') ) except subprocess.CalledProcessError: pass @@ -78,7 +78,13 @@ def teardown(self): def _not_available(self): with pytest.raises(OSError): - subprocess.check_call(shlex.split('chromedriver --version')) + subprocess.check_call(self._get_popen_args('chromedriver --version')) + + def _get_popen_args(self, command): + if os.name == 'posix': + return self._get_popen_args(command, posix=os.name == 'posix') + else: + return command class TestFailure(Base): @@ -91,7 +97,7 @@ def test_bad_checksum(self): ) error_message = subprocess.Popen( - shlex.split(command), + self._get_popen_args(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, ).communicate()[0] @@ -120,11 +126,11 @@ def _test_version(self, version, cached): self._assert_cached_files_exist(cached, remove=not cached) # After installation... - subprocess.check_call(shlex.split(self._get_install_command())) + subprocess.check_call(self._get_popen_args(self._get_install_command())) # ...the chromedriver executable should be available... expected_version, error = subprocess.Popen( - shlex.split('chromedriver -v'), + self._get_popen_args('chromedriver -v'), stdout=subprocess.PIPE ).communicate() diff --git a/tox.ini b/tox.ini index d496ece..a61f164 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,6 @@ envlist=py27, py36 [testenv] skip_install=True -deps= - pytest +deps = -rrequirements.txt commands= - py.test -vv tests.py + py.test -vv tests.py {posargs}