-
Notifications
You must be signed in to change notification settings - Fork 123
/
conftest.py
49 lines (38 loc) · 1.38 KB
/
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import inspect
import os
import sys
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(current_dir)
sys.path.insert(0, parent_dir)
import pytest
import k3d
from k3d.headless import k3d_remote, get_headless_driver
import subprocess
def pytest_configure(config):
"""
Allows plugins and conftest files to perform initial configuration.
This hook is called for every plugin and initial conftest
file after command line options have been parsed.
"""
process = subprocess.Popen('webpack', cwd=os.path.abspath('./../js/'), shell=True)
process.wait()
def pytest_sessionstart(session):
"""
Called after the Session object has been created and
before performing collection and entering the run test loop.
"""
pytest.plot = k3d.plot(screenshot_scale=1.0, antialias=2, camera_auto_fit=False,
colorbar_object_id=0)
print(pytest.plot.get_static_path())
pytest.headless = k3d_remote(pytest.plot, get_headless_driver())
pytest.headless.browser.execute_script("window.randomMul = 0.0;")
def pytest_sessionfinish(session, exitstatus):
"""
Called after whole test run finished, right before
returning the exit status to the system.
"""
pytest.headless.close()
def pytest_unconfigure(config):
"""
called before test process is exited.
"""