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

chore(ci): Cleanup failing CI #83

Merged
merged 4 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
13 changes: 0 additions & 13 deletions .coveragerc

This file was deleted.

11 changes: 6 additions & 5 deletions .github/workflows/ci-cd-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
matrix:
# no mac binary for CICERO so fails code coverage
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: [3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9, "3.10", 3.11]
env:
MIN_COVERAGE: 90

Expand All @@ -82,7 +82,7 @@ jobs:
env:
MAGICC_EXECUTABLE_7: bin/magicc/magicc-v7.5.3/bin/magicc
run: |
pytest tests -r a --cov=openscm_runner --cov-report='' --cov-fail-under=$MIN_COVERAGE
pytest tests -r a --cov=openscm_runner --cov-report='term-missing' --cov-fail-under=$MIN_COVERAGE
- name: Test with pytest macOS
if: runner.os == 'macOS'
env:
Expand All @@ -97,14 +97,15 @@ jobs:
- name: Test with pytest Windows
if: runner.os == 'Windows'
run: |
pytest tests -r a --cov=openscm_runner --cov-report='' --cov-fail-under=$env:MIN_COVERAGE
# Not strictly testing coverage under windows as MAGICC isn't available
pytest tests -r a --cov=openscm_runner --cov-report='term-missing' --cov-fail-under=70

test-notebooks:
runs-on: ubuntu-latest
environment: CI
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9, "3.10", 3.11]

steps:
- name: Checkout repository
Expand Down Expand Up @@ -134,7 +135,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9, "3.10", 3.11]

steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-conda-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: [3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9, "3.10", 3.11]

steps:
- name: Setup conda
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-pypi-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9, "3.10", 3.11]

steps:
- name: Setup python
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ The changes listed in this file are categorised as follows:
Master
------

Added
~~~~~

- (`#83 <https://github.com/openscm/openscm-runner/pull/83>`_) Added support for Python v3.10 and v3.11

Changed
~~~~~~~

- (`#83 <https://github.com/openscm/openscm-runner/pull/83>`_) Fix failing CI. ``fair`` is now pinned to < 2

v0.12.0 - 2023-05-12
--------------------

Expand Down
27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,30 @@ requires = [
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]

[tool.coverage.run]
branch = true
source = [
"src/openscm_runner"
]
omit = [
"*_version.py",
# TODO: remove the exclusion for MAGICC
"*adapters/magicc7*",
"*testing.py"
]
concurrency = ["multiprocessing"]
parallel = true
sigterm = true

[tool.coverage.report]
fail_under = 90
skip_empty = true
show_missing = true
ignore_errors = true

# Regexes for lines to exclude from consideration in addition to the defaults
exclude_also = [
# Don't complain about missing type checking code:
"if TYPE_CHECKING",
]
6 changes: 4 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ classifiers =
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Scientific/Engineering

[options]
Expand All @@ -54,7 +56,7 @@ where = src

[options.extras_require]
fair =
fair
fair < 2

magicc =
pymagicc >= 2.0.0, < 3
Expand All @@ -74,7 +76,7 @@ notebooks =

tests =
codecov
coverage
coverage>=7
nbval
pytest-cov
pytest>=4.0
Expand Down
2 changes: 1 addition & 1 deletion src/openscm_runner/adapters/ciceroscm_adapter/ciceroscm.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def get_version(cls):
os.path.join(os.path.dirname(__file__), "utils_templates", "run_dir")
)
try:
check_output(executable)
check_output(executable) # nosec
except OSError as orig_exc:
raise OSError(
"CICERO-SCM is not available on your operating system"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
try:
import ciceroscm as cscmpy

HAS_CICEROSCM = True
HAS_CICEROSCM_PY = True
except ImportError:
cscmpy = None
HAS_CICEROSCM_PY = False
6 changes: 5 additions & 1 deletion src/openscm_runner/adapters/magicc7/magicc7.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,11 @@ def get_version(cls):
str
The MAGICC7 version id
"""
return check_output([cls._executable(), "--version"]).decode("utf-8").strip()
return (
check_output([cls._executable(), "--version"]) # nosec
.decode("utf-8")
.strip()
)

@classmethod
def _executable(cls):
Expand Down
14 changes: 8 additions & 6 deletions src/openscm_runner/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,20 @@ def test_run(self, test_scenarios):
out_config=None,
)

assert isinstance(res, ScmRun)
assert res["run_id"].min() == 0 # pylint: disable=compare-to-zero
assert res["run_id"].min() == 0 # pylint: disable=compare-to-zero
assert res["run_id"].max() == 8
assert isinstance(res, ScmRun) # nosec
assert res["run_id"].min() == 0 # pylint: disable=compare-to-zero # nosec
assert res["run_id"].min() == 0 # pylint: disable=compare-to-zero # nosec
assert res["run_id"].max() == 8 # nosec

assert res.get_unique_meta("climate_model", no_duplicates=True) == "model_name"
assert (
res.get_unique_meta("climate_model", no_duplicates=True) == "model_name"
) # nosec

assert set(res.get_unique_meta("variable")) == {
"expected",
"output",
"variables",
}
} # nosec

# output value checks e.g.
npt.assert_allclose(
Expand Down