kopia lustrzana https://github.com/corrscope/corrscope
Fix pytest working dir in Pycharm (#199)
My unit tests assume cwd = /, in order to locate wav files. But Pycharm uses the wrong working dir whenever you "rerun failed tests" or "run tests in file". This runs `chdir(correct dir)`.pull/357/head
rodzic
18e13ea9d1
commit
2aaf1452ac
|
@ -6,6 +6,7 @@ Integration tests found in:
|
|||
|
||||
import os
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
|
@ -14,6 +15,11 @@ if TYPE_CHECKING:
|
|||
import pytest_mock
|
||||
|
||||
|
||||
# Pycharm sets cwd to /tests/.
|
||||
# To ensure tests can find WAV files (based on /), jump from /tests/conftest.py to /.
|
||||
os.chdir(Path(__file__).parent.parent)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def Popen(mocker: "pytest_mock.MockFixture"):
|
||||
real_Popen = subprocess.Popen
|
||||
|
|
Ładowanie…
Reference in New Issue