Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
conda install --file requirements/test.txt
conda install --file requirements/build.txt
python -m pip install -r requirements/pip.txt
python -m pip install -e . --no-deps
python -m pip install . --no-deps

- name: Validate diffpy.pdffit2
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
conda install --file requirements/run.txt
conda install --file requirements/docs.txt
python -m pip install -r requirements/pip.txt
python -m pip install -e . --no-deps
python -m pip install . --no-deps

- name: build documents
run: make -C doc html
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
conda install --file requirements/test.txt
conda install --file requirements/build.txt
python -m pip install -r requirements/pip.txt
python -m pip install -e . --no-deps
python -m pip install . --no-deps

- name: Validate diffpy.pdffit2
run: python -m pytest
2 changes: 1 addition & 1 deletion .github/workflows/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
conda install --file requirements/test.txt
conda install --file requirements/build.txt
python -m pip install -r requirements/pip.txt
python -m pip install -e . --no-deps
python -m pip install . --no-deps

- name: Validate diffpy.pdffit2
run: python -m pytest
5 changes: 0 additions & 5 deletions conda-recipe/run_test.py

This file was deleted.

2 changes: 0 additions & 2 deletions pytest.ini

This file was deleted.

83 changes: 0 additions & 83 deletions src/diffpy/pdffit2/tests/__init__.py

This file was deleted.

19 changes: 0 additions & 19 deletions src/diffpy/pdffit2/tests/conftest.py

This file was deleted.

35 changes: 0 additions & 35 deletions src/diffpy/pdffit2/tests/debug.py

This file was deleted.

53 changes: 0 additions & 53 deletions src/diffpy/pdffit2/tests/pdffit2testutils.py

This file was deleted.

56 changes: 0 additions & 56 deletions src/diffpy/pdffit2/tests/run.py

This file was deleted.

50 changes: 50 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import json
from pathlib import Path

import pytest
import six

import diffpy.pdffit2
import diffpy.pdffit2.output # assuming this is the correct import path


@pytest.fixture
def user_filesystem(tmp_path):
base_dir = Path(tmp_path)
home_dir = base_dir / "home_dir"
home_dir.mkdir(parents=True, exist_ok=True)
cwd_dir = base_dir / "cwd_dir"
cwd_dir.mkdir(parents=True, exist_ok=True)

home_config_data = {"username": "home_username", "email": "[email protected]"}
with open(home_dir / "diffpyconfig.json", "w") as f:
json.dump(home_config_data, f)

yield tmp_path


@pytest.fixture
def datafile():
"""Fixture to dynamically load any test file."""

def _load(filename):
return "tests/testdata/" + filename

return _load


@pytest.fixture
def capture_output():
"""Capture output from pdffit2 engine produced in function call."""

def _capture(f, *args, **kwargs):
savestdout = diffpy.pdffit2.output.stdout
fp = six.StringIO()
diffpy.pdffit2.redirect_stdout(fp)
try:
f(*args, **kwargs)
finally:
diffpy.pdffit2.redirect_stdout(savestdout)
return fp.getvalue()

return _capture
Loading