Skip to content

Commit 20e81d6

Browse files
committed
Remove redundant Popen
1 parent 7e9b918 commit 20e81d6

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tests/test_cookiecutter.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@ def package_path(tmp_path_factory):
4040

4141
@pytest.fixture(autouse=True, scope="session")
4242
def pip_install(package_path):
43+
uninstall_cmd = f"pip uninstall -y {config_dict['package_name']}"
44+
dev_formatting = ".[dev]" if platform.system() == "Windows" else "'.[dev]'"
45+
install_cmd = f"pip install -e {dev_formatting}"
46+
4347
# Installs the package using pip
4448
os.chdir(package_path)
45-
4649
# Uninstall and check package not installed
4750
subprocess.run("git init", shell=True)
48-
uninstall_cmd = f"pip uninstall -y {config_dict['package_name']}"
51+
4952
subprocess.run(uninstall_cmd, shell=True)
5053
result = subprocess.Popen(
5154
f"pip show {config_dict['package_name']}",
@@ -59,12 +62,8 @@ def pip_install(package_path):
5962
)
6063

6164
# Install package
62-
dev_formatting = ".[dev]" if platform.system() == "Windows" else "'.[dev]'"
63-
cmd = f"pip install -e {dev_formatting}"
64-
result = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
65-
stdout, __ = result.communicate()
65+
subprocess.run(install_cmd, shell=True)
6666
yield
67-
6867
# Uninstall package
6968
subprocess.run(uninstall_cmd, shell=True)
7069

0 commit comments

Comments
 (0)