Skip to content

Commit 6d0d9e7

Browse files
try workflow for testing (#161)
* workflow for testing * test unittest * try Xvfb * try to remove no test ran line * [pre-commit.ci] auto fixes from pre-commit hooks * try to remove no test ran line * try pytest --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 0652110 commit 6d0d9e7

23 files changed

+39
-189
lines changed

Diff for: .github/workflows/main.yml

+34-23
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,42 @@ jobs:
2323
path: .
2424
fetch-depth: 0 # avoid shallow clone with no tags
2525

26-
- name: Install Mamba
27-
run: |
28-
wget "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh" -O mambaforge.sh
29-
bash mambaforge.sh -b -p $HOME/mambaforge
30-
echo "$HOME/mambaforge/bin" >> $GITHUB_PATH
31-
source $HOME/mambaforge/etc/profile.d/conda.sh
32-
conda init bash
26+
- name: initialize miniconda
27+
# this uses a marketplace action that sets up miniconda in a way that makes
28+
# it easier to use. I tried setting it up without this and it was a pain
29+
uses: conda-incubator/setup-miniconda@v2
30+
with:
31+
activate-environment: test
32+
# environment.yml file is needed by this action. Because I don't want
33+
# maintain this but rather maintain the requirements files it just has
34+
# basic things in it like conda and pip
35+
environment-file: ./environment.yml
36+
python-version: 3
37+
auto-activate-base: false
3338

34-
- name: Create conda environment
39+
- name: install diffpy.pdfgui requirements
40+
shell: bash -l {0}
3541
run: |
36-
source $HOME/mambaforge/etc/profile.d/conda.sh
37-
conda create -n test_env python=3.12 xonsh regolith -c conda-forge -y
38-
conda activate test_env
39-
pip install case_insensitive_dict
42+
conda config --set always_yes yes --set changeps1 no
43+
conda config --add channels conda-forge
44+
conda activate test
45+
conda install --file requirements/run.txt
46+
conda install --file requirements/test.txt
47+
pip install .
48+
49+
- name: Install Xvfb
50+
run: sudo apt-get install -y xvfb
4051

41-
- name: Install dependencies
52+
- name: Start Xvfb
4253
run: |
43-
source $HOME/mambaforge/etc/profile.d/conda.sh
44-
conda activate test_env
45-
mamba install --file requirements/run.txt
46-
mamba install --file requirements/test.txt
47-
pip install -e .
54+
export DISPLAY=:99
55+
Xvfb :99 -screen 0 1024x768x16 &
4856
49-
- name: Use Xvfb Action
50-
uses: GabrielBB/xvfb-action@v1
51-
with:
52-
run: |
53-
bash -c "source $HOME/mambaforge/etc/profile.d/conda.sh && conda activate test_env && python -m run_tests.py"
57+
- name: Validate diffpy.pdfgui
58+
shell: bash -l {0}
59+
run: |
60+
export DISPLAY=:99
61+
conda activate test
62+
coverage run -m pytest -vv -s
63+
coverage report -m
64+
codecov

Diff for: run_tests.py

-5
This file was deleted.

Diff for: setup.py

-161
This file was deleted.

Diff for: src/diffpy/pdfgui/tests/conftest.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import json
2+
import subprocess
23
from pathlib import Path
34

45
import pytest
56

67

8+
def pytest_collection_modifyitems(session, config, items):
9+
subprocess.run(["python", "-m", "diffpy.pdfgui.tests.rundeps"], check=True)
10+
11+
712
@pytest.fixture
813
def user_filesystem(tmp_path):
914
base_dir = Path(tmp_path)
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)