Skip to content

Commit

Permalink
test tests (#131)
Browse files Browse the repository at this point in the history
* pin numpy to 1.x for now

* add environment.yml

* test tests

* trigger

* try again with requirements

* try again with requirements

* now update test reqs

* try and handle xwindow display issue

* try using xfvb action

* refactor xvfb action commands

* source activate?

* different tack, generate error and work on test?

* again

* again

* chatgpt method

* supress running qc of meta.yaml in conda-forge by renaming

* try new pyproject.toml

* again2

* forgot to install diffpy.pdfgui!

* back to setup.py
  • Loading branch information
sbillinge authored and cadenmyers13 committed Jul 26, 2024
1 parent 052adb5 commit 38b37fa
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 29 deletions.
51 changes: 25 additions & 26 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,31 @@ jobs:
path: .
fetch-depth: 0 # avoid shallow clone with no tags

- name: initialize miniconda
# this uses a marketplace action that sets up miniconda in a way that makes
# it easier to use. I tried setting it up without this and it was a pain
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test
# environment.yml file is needed by this action. Because I don't want
# maintain this but rather maintain the requirements files it just has
# basic things in it like conda and pip
environment-file: ./environment.yml
python-version: 3
auto-activate-base: false
- name: Install Mamba
run: |
wget "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh" -O mambaforge.sh
bash mambaforge.sh -b -p $HOME/mambaforge
echo "$HOME/mambaforge/bin" >> $GITHUB_PATH
source $HOME/mambaforge/etc/profile.d/conda.sh
conda init bash
- name: install diffpy.pdfgui requirements
shell: bash -l {0}
- name: Create conda environment
run: |
conda config --set always_yes yes --set changeps1 no
conda config --add channels conda-forge
conda activate test
conda install --file requirements/run.txt
conda install --file requirements/test.txt
pip install .
- name: Validate diffpy.pdfgui
shell: bash -l {0}
source $HOME/mambaforge/etc/profile.d/conda.sh
conda create -n test_env python=3.12 xonsh regolith -c conda-forge -y
conda activate test_env
pip install case_insensitive_dict
- name: Install dependencies
run: |
conda activate test
coverage run -m pytest -vv -s
coverage report -m
codecov
source $HOME/mambaforge/etc/profile.d/conda.sh
conda activate test_env
mamba install --file requirements/run.txt
mamba install --file requirements/test.txt
pip install -e .
- name: Use Xvfb Action
uses: GabrielBB/xvfb-action@v1
with:
run: |
bash -c "source $HOME/mambaforge/etc/profile.d/conda.sh && conda activate test_env && python -m run_tests.py"
File renamed without changes.
2 changes: 1 addition & 1 deletion conda-recipe/meta.yaml → conda-recipe/meta.suppress_yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test:
# entry points work.


# You can also put a file called run_test.py in the recipe that will be run
# You can also put a file called dont_run.py in the recipe that will be run
# at test time.

# requires:
Expand Down
6 changes: 6 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: diffpy.pdfgui
channels:
- conda-forge
dependencies:
- python=3
- pip
2 changes: 1 addition & 1 deletion requirements/run.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy
numpy==1.26
wxpython
diffpy.pdffit2
diffpy.utils
Expand Down
2 changes: 2 additions & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
pytest
freezegun
coverage
codecov
5 changes: 5 additions & 0 deletions run_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python

import diffpy.pdfgui.tests

assert diffpy.pdfgui.tests.testdeps().wasSuccessful()
4 changes: 3 additions & 1 deletion src/diffpy/pdfgui/gui/aboutdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# PDFgui by DANSE Diffraction group
# Simon J. L. Billinge
# (c) 2006 trustees of the Michigan State University.
# (c) 2024 trustees of the Columbia University in the City
# of New York
# All rights reserved.
#
# File coded by: Dmitriy Bryndin
Expand Down Expand Up @@ -233,7 +235,7 @@ def onColumbiaLogo(self, event): # wxGlade: DialogAbout.<event_handler>

# end of class DialogAbout

##### testing code ###########################################################
# #### testing code ###########################################################

if __name__ == "__main__":
app = wx.App()
Expand Down
1 change: 1 addition & 0 deletions src/diffpy/pdfgui/gui/adddatapanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# PDFgui by DANSE Diffraction group
# Simon J. L. Billinge
# (c) 2006 trustees of the Michigan State University.
# (c) 2024 trustees of the Columbia University in the City
# All rights reserved.
#
# File coded by: Chris Farrow
Expand Down

0 comments on commit 38b37fa

Please sign in to comment.