Skip to content

Commit

Permalink
Use tmp_path for download tests so the root dir isn't polluted
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Wouda committed Oct 13, 2024
1 parent 071334f commit c24eb46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tests/download/test_download_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
from vrplib import download_instance


def test_deprecation_warning():
def test_deprecation_warning(tmp_path):
"""
Checks if a deprecation warning is raised when the function is called.
"""
with pytest.warns(DeprecationWarning):
download_instance("X-n101-k25", "tmp")
download_instance("X-n101-k25", tmp_path / "tmp")


@pytest.mark.filterwarnings("ignore:The function")
def test_raise_invalid_name():
def test_raise_invalid_name(tmp_path):
"""
Raise an error if the passed-in name is invalid.
"""
with pytest.raises(ValueError):
download_instance("invalid_name", "tmp")
download_instance("invalid_name", tmp_path / "tmp")


@pytest.mark.filterwarnings("ignore:The function")
Expand Down
8 changes: 4 additions & 4 deletions tests/download/test_download_solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
from vrplib import download_solution


def test_deprecation_warning():
def test_deprecation_warning(tmp_path):
"""
Checks if a deprecation warning is raised when the function is called.
"""
with pytest.warns(DeprecationWarning):
download_solution("X-n101-k25", "tmp")
download_solution("X-n101-k25", tmp_path / "tmp")


@pytest.mark.filterwarnings("ignore:The function")
def test_raise_invalid_name():
def test_raise_invalid_name(tmp_path):
"""
Raise an error if the passed-in name is invalid.
"""
with assert_raises(ValueError):
download_solution("invalid_name", "tmp")
download_solution("invalid_name", tmp_path / "tmp")


@pytest.mark.filterwarnings("ignore:The function")
Expand Down

0 comments on commit c24eb46

Please sign in to comment.