Skip to content

Commit d5b55e8

Browse files
committed
Dry
1 parent 6617881 commit d5b55e8

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

tests/test_project.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
import subprocess
33
from pathlib import Path
44
from shutil import which
5-
from sys import platform, executable
5+
from sys import platform
66
from typing import Sequence
77

88
import pytest
99

10+
IS_WINDOWS = platform.startswith("win")
11+
IS_WINDOWS_CI = IS_WINDOWS and os.environ.get('CI', False)
12+
1013

1114
def test_project_folder(cookies):
1215
project = cookies.bake()
@@ -31,15 +34,15 @@ def run(args: Sequence[str], dirpath: os.PathLike) -> subprocess.CompletedProces
3134
@pytest.fixture
3235
def baked_with_development_dependencies(cookies):
3336
result = cookies.bake()
34-
if platform.startswith("win") and os.environ.get('CI', False):
37+
if IS_WINDOWS_CI:
3538
# Creating virtualenv does not work on Windows CI,
3639
# falling back to using current pip3 dir
3740
pip = Path(which('pip3'))
3841
bin_dir = str(pip.parent) + '\\'
3942
else:
4043
env_output = run(['python3', '-m', 'venv', 'env'], result.project)
4144
assert env_output.returncode == 0
42-
bin_dir = 'env/Scripts/' if platform.startswith("win") else 'env/bin/'
45+
bin_dir = 'env/Scripts/' if IS_WINDOWS else 'env/bin/'
4346
latest_pip_output = run([f'{bin_dir}pip3', 'install', '--upgrade', 'pip', 'setuptools'], result.project)
4447
assert latest_pip_output.returncode == 0
4548
pip_output = run([f'{bin_dir}pip3', 'install', '--editable', '.[dev]'], result.project)
@@ -66,7 +69,7 @@ def test_subpackage(baked_with_development_dependencies):
6669
subsubpackage.mkdir()
6770
(subsubpackage / '__init__.py').write_text('FOO = "bar"', encoding="utf-8")
6871

69-
if platform.startswith("win") and os.environ.get('CI', False):
72+
if IS_WINDOWS_CI:
7073
# On Windows CI python and pip executable are in different paths
7174
bin_dir = ''
7275
build_output = run([f'{bin_dir}python', 'setup.py', 'build'], project_dir)

0 commit comments

Comments
 (0)