Make project xml class and tests use pathlib instead of os
This commit is contained in:
@@ -24,6 +24,8 @@ import sys
|
||||
import pytest
|
||||
import shutil
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from mock import MockGuiMain
|
||||
from tools import cleanProject
|
||||
|
||||
@@ -62,6 +64,35 @@ def tmpDir():
|
||||
return theDir
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def tstPaths(tmpDir):
|
||||
"""Returns an object that can provide the various paths needed for
|
||||
running tests.
|
||||
"""
|
||||
class _Store:
|
||||
testDir = Path(__file__).parent
|
||||
filesDir = testDir / "files"
|
||||
refDir = testDir / "reference"
|
||||
outDir = testDir / tmpDir / "results"
|
||||
|
||||
store = _Store()
|
||||
store.outDir.mkdir(exist_ok=True)
|
||||
|
||||
return store
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def fncPath(tmpDir):
|
||||
"""A temporary folder for a single test function.
|
||||
"""
|
||||
fncPath = Path(tmpDir) / "f_temp"
|
||||
if fncPath.is_dir():
|
||||
shutil.rmtree(fncPath)
|
||||
if not fncPath.is_dir():
|
||||
fncPath.mkdir()
|
||||
return fncPath
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def refDir():
|
||||
"""The folder where all the reference files are stored for verifying
|
||||
|
||||
Reference in New Issue
Block a user