Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python Measure Unit Test Action #19

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9e7aee7
Add python unit tests job
jslane-h Oct 23, 2024
d224b15
Fix deprecated command
jslane-h Oct 23, 2024
d92b6b0
Update python_measure_dirs format
jslane-h Oct 23, 2024
07fa9d3
Add copper dependency
jslane-h Oct 23, 2024
e26c295
Fix measure import
jslane-h Oct 23, 2024
93b3843
Add constrain import
jslane-h Oct 23, 2024
e8acb50
Update test_file path
jslane-h Oct 23, 2024
3fd135c
Remove pythonpath var
jslane-h Oct 24, 2024
b92ceb9
WIP: Add measure check
jslane-h Nov 25, 2024
9e59393
Install openstudio cli in action
jslane-h Nov 25, 2024
12b0819
Test to see if able to build container with openstudio
jslane-h Nov 27, 2024
ffcaf53
Update dockerfile
jslane-h Nov 27, 2024
41e3934
Fix dockerfile
jslane-h Nov 27, 2024
dfe1e65
Update build docker image step
jslane-h Nov 27, 2024
342487b
Update action
jslane-h Nov 27, 2024
3bb2fd3
Update action
jslane-h Nov 27, 2024
d53eca0
Test action
jslane-h Nov 27, 2024
ee83fc4
Update action
jslane-h Nov 27, 2024
c5e0cad
Debug action
jslane-h Nov 27, 2024
cc58c0a
Test action
jslane-h Nov 27, 2024
30bc55b
Test storing test results in github workspace due to file permissions
jslane-h Dec 2, 2024
d11abaa
Use github workspace as working directory
jslane-h Dec 2, 2024
e21faab
Change github workspace var
jslane-h Dec 4, 2024
3e03ddb
Update github workspace var
jslane-h Dec 4, 2024
4fe2f52
try checkout v4
jslane-h Dec 4, 2024
6ea224d
move Dockerfile to actions folder
jslane-h Dec 4, 2024
7bec849
debug
jslane-h Dec 4, 2024
5ec527f
debug
jslane-h Dec 4, 2024
8dffb8d
Create action yaml
jslane-h Dec 4, 2024
8e0cd62
test
jslane-h Dec 4, 2024
9e4f096
Use $GITHUB_WORKSPACE in container
jslane-h Dec 4, 2024
9bab626
Add entrypoint file
jslane-h Dec 4, 2024
52678b0
Fix entrypoint
jslane-h Dec 4, 2024
ab27c8a
Fix entrypoint script
jslane-h Dec 4, 2024
b9cd8bb
Output to test_results folder (it is finally working)
jslane-h Dec 4, 2024
6380b54
Test update measure xml's
jslane-h Dec 20, 2024
2ab05ea
Auto-update measure.xml files by GitHub Actions
actions-user Dec 20, 2024
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
37 changes: 37 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
push:
branches: [ '*' ]

jobs:
run-python-unit-tests:
name: Run python unit tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install openstudio
pip install copper-bem
pip install constrain

- name: Find directories containing measure.py
id: find_python_measure_dirs
run: |
python_measure_dirs=$(find . -type f -name 'measure.py' -exec dirname {} \; | uniq | tr '\n' ' ')
echo "python_measure_dirs=$python_measure_dirs" >> $GITHUB_OUTPUT

- name: Run tests
run: |
for dir in ${{ steps.find_python_measure_dirs.outputs.python_measure_dirs }}; do
pytest $dir
done
6 changes: 3 additions & 3 deletions lib/measures/GenerateConStrainReport/tests/test_measure.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import openstudio
import pathlib
from ..measure import GenerateConStrainReport
from measure import GenerateConStrainReport
import logging


Expand Down Expand Up @@ -31,8 +31,8 @@ def test_good_argument_values(self):
argument_map = openstudio.measure.convertOSArgumentVectorToMap(arguments)

args_dict = {}
args_dict["workflow_path"] = (
"tests/test_files/G36_demo_workflow.json"
args_dict["workflow_path"] = str(
pathlib.Path(__file__).parent.absolute() / "test_files" / "G36_demo_workflow.json"
)

for arg in arguments:
Expand Down
Loading