forked from dlubal-software/RFEM_Python_Client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
27 lines (23 loc) · 774 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Pytest fixtures
import os
import sys
PROJECT_ROOT = os.path.abspath(os.path.join(
os.path.dirname(__file__),
os.pardir)
)
sys.path.append(PROJECT_ROOT)
from RFEM.initModel import Model, closeAllModels
from RFEM.connectionGlobals import cacheLoc
def pytest_exception_interact():
'''
Called when an exception is raised which can potentially be interactively handled,
in our case after the failed test.
'''
# This ensures that the tests executed after failed test are not affected.
if Model.clientModel:
closeAllModels()
if os.path.exists(cacheLoc):
for file in os.listdir(cacheLoc):
filePath = os.path.join(cacheLoc, file)
os.remove(filePath)
Model()