Skip to content

Commit

Permalink
Coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Bull committed Nov 24, 2022
1 parent 0ad2544 commit a25d1b0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/actions-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ jobs:
black --check --verbose -l 88 geomeppy tests docs
- name: Test with pytest
run: |
pytest --fixtures -v --cov-config .coveragerc --cov=geomeppy tests --cov-report=xml
pytest -v --cov-config .coveragerc --cov=geomeppy tests --cov-report=xml
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
fail_ci_if_error: true
- name: Build and publish to test pypi
if: github.ref == 'refs/heads/develop'
uses: JRubics/[email protected]
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,6 @@ dist
.mypy_cache

venv

coverage
coverage.xml
7 changes: 7 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
"""A module containing pytest fixtures that are used in multiple places in the test suite."""
import os

import pytest
from eppy.iddcurrent import iddcurrent
from six import StringIO

from geomeppy.idf import IDF


def on_ci():
"""Helper to check if we're running on a CI platform."""
return os.environ.get("CI", "") != "0"


base_idf_txt = """
Version, 8.5;
Building, Building 1, , , , , , , ;
Expand Down
7 changes: 4 additions & 3 deletions tests/test_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from geomeppy import IDF
from geomeppy.extractor import copy_constructions
from tests.conftest import on_ci

_, EPLUS_HOME = paths_from_version("9-1-0")

Expand Down Expand Up @@ -37,7 +38,7 @@ def tmp_dir():
shutil.rmtree(p)


@pytest.mark.skipif(os.environ.get("CI"), reason="Running without EnergyPlus installed")
@pytest.mark.skipif(on_ci(), reason="Running without EnergyPlus installed")
@pytest.mark.usefixtures("tmp_dir")
def test_tutorial_1():
IDF.setiddname(f"{EPLUS_HOME}/Energy+.idd", testing=True)
Expand All @@ -53,7 +54,7 @@ def test_tutorial_1():
idf.run(output_directory="tests/tutorial")


@pytest.mark.skipif(os.environ.get("CI"), reason="Running without EnergyPlus installed")
@pytest.mark.skipif(on_ci(), reason="Running without EnergyPlus installed")
@pytest.mark.usefixtures("tmp_dir")
def test_tutorial_2():
IDF.setiddname(f"{EPLUS_HOME}/Energy+.idd", testing=True)
Expand Down Expand Up @@ -121,7 +122,7 @@ def test_tutorial_2():
print(row_format.format(*row))


@pytest.mark.skipif(os.environ.get("CI"), reason="Running without EnergyPlus installed")
@pytest.mark.skipif(on_ci(), reason="Running without EnergyPlus installed")
@pytest.mark.usefixtures("tmp_dir")
def test_tutorial_3():
IDF.setiddname(f"{EPLUS_HOME}/Energy+.idd", testing=True)
Expand Down

0 comments on commit a25d1b0

Please sign in to comment.