Verified Commit b5f59adb authored by Jelle van der Waa's avatar Jelle van der Waa 🚧
Browse files

Make pytest-pacman fixtures scope session

The shared fixtures should be scoped session so consumers can define
their own desired scope.
parent b99ae327
Pipeline #1198 passed with stage
in 24 seconds
...@@ -72,7 +72,7 @@ def generate_syncdb(pkgs, dbfile): ...@@ -72,7 +72,7 @@ def generate_syncdb(pkgs, dbfile):
os.chdir(cwd) os.chdir(cwd)
@pytest.fixture @pytest.fixture(scope="session")
def generate_localdb(tmpdir_factory): def generate_localdb(tmpdir_factory):
'''Generates a localdb in provided location or when not provided pytest tmpdir '''Generates a localdb in provided location or when not provided pytest tmpdir
...@@ -10,13 +10,13 @@ import pytest ...@@ -10,13 +10,13 @@ import pytest
pytest_plugins = "pytest_pacman.plugin" pytest_plugins = "pytest_pacman.plugin"
@pytest.fixture @pytest.fixture(scope="session")
def core_data(): def core_data():
curpath = os.path.dirname(os.path.realpath(__file__)) curpath = os.path.dirname(os.path.realpath(__file__))
return json.load(open(f'{curpath}/core.json')) return json.load(open(f'{curpath}/core.json'))
@pytest.fixture(scope="session") @pytest.fixture
def localdb(tmpdir_factory, core_data, generate_localdb): def localdb(tmpdir_factory, core_data, generate_localdb):
dbpath = str(tmpdir_factory.mktemp('dbpath')) dbpath = str(tmpdir_factory.mktemp('dbpath'))
return generate_localdb(core_data, dbpath) return generate_localdb(core_data, dbpath)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment