Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions tests/examples/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ def examples_temp_data(tmp_path_factory):
:type tmp_path: Path
:return: temporary path containing examples files
:rtype: Path

Yields:
-------
the temp dir

Changes back to the cwd afterwards
"""
data_path = Path(__file__).parent.parent.parent / "examples"
tmp_path = tmp_path_factory.mktemp("examples")
Expand All @@ -27,12 +33,15 @@ def examples_temp_data(tmp_path_factory):
ignore=ignore_patterns("*.md", "*log", "__pycache__", "*.ipynb*"),
)

cwd = Path.cwd()
# This change of directory is undone by the return_to_root fixture, hence we do not
# need to change back directories here
os.chdir(tmp_path / "examples")

# Return tmp_path/examples, now containing files copied from examples dir
return tmp_path / "examples"
# yield tmp_path/examples, now containing files copied from examples dir
yield tmp_path / "examples"

os.chdir(cwd)


def _get_location(loc, name):
Expand Down
Loading