Skip to content

Commit

Permalink
Merge pull request #47 from JAlvarezJarreta/jalvarez/rm_tmp_dir
Browse files Browse the repository at this point in the history
Remove tmp_dir fixture as pytest offers tmp_path since v6.2
  • Loading branch information
JAlvarezJarreta authored Apr 29, 2024
2 parents 29dbe7b + 7503da8 commit f17634b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
name = "ensembl-py"
description = "Ensembl Python Base Library"
requires-python = ">= 3.8"
version = "1.2.4"
version = "1.3.0"
readme = "README.md"
authors = [
{name = "Ensembl", email = "[email protected]"},
Expand Down
16 changes: 0 additions & 16 deletions src/python/ensembl/plugins/pytest_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,3 @@ def test_method(..., multi_dbs: Dict[str, UnitTestDB], ...):
key = name if name else src.name
databases[key] = db_factory(src, name)
return databases


@pytest.fixture(scope='session')
def tmp_dir(request: FixtureRequest, tmp_path_factory: TempPathFactory) -> Generator:
"""Yields a :class:`Path` object pointing to a newly created temporary directory.
Args:
request: Access to the requesting test context.
tmp_path_factory: Session-scoped fixture that creates arbitrary temporary directories.
"""
tmpdir = tmp_path_factory.mktemp(f"test_{request.node.name}")
yield tmpdir
# Delete the temporary directory unless the user has requested to keep it
if not request.config.getoption("keep_data"):
shutil.rmtree(tmpdir)

0 comments on commit f17634b

Please sign in to comment.