File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 22from pathlib import Path
33
44import pytest
5+ import six
6+ import diffpy .pdffit2 .output # assuming this is the correct import path
57
68
9+ import diffpy .pdffit2
10+
711@pytest .fixture
812def user_filesystem (tmp_path ):
913 base_dir = Path (tmp_path )
@@ -17,3 +21,27 @@ def user_filesystem(tmp_path):
1721 json .dump (home_config_data , f )
1822
1923 yield tmp_path
24+
25+ @pytest .fixture
26+ def datafile ():
27+ """Fixture to dynamically load any test file."""
28+
29+ def _load (filename ):
30+ return "tests/testdata/" + filename
31+
32+ return _load
33+
34+ @pytest .fixture
35+ def capture_output ():
36+ """Capture output from pdffit2 engine produced in function call."""
37+
38+ def _capture (f , * args , ** kwargs ):
39+ savestdout = diffpy .pdffit2 .output .stdout
40+ fp = six .StringIO ()
41+ diffpy .pdffit2 .redirect_stdout (fp )
42+ try :
43+ f (* args , ** kwargs )
44+ finally :
45+ diffpy .pdffit2 .redirect_stdout (savestdout )
46+ return fp .getvalue ()
47+ return _capture
You can’t perform that action at this time.
0 commit comments