Skip to content

Commit

Permalink
run tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Feb 13, 2025
1 parent 590786e commit 8febed7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
# On macos, the up-to-date git may not be first on the path
# N.B. setting includes a final ":", to simplify the path setting command
gitpath-prepend: "/opt/homebrew/bin:"
- os: windows-latest
version: py313
platform: win
steps:
- name: "Checkout"
uses: actions/checkout@v4
Expand Down Expand Up @@ -105,6 +108,21 @@ jobs:
path: ${{ github.workspace }}/.tox
key: ${{ runner.os }}-tox-${{ env.ENV_NAME }}-${{ matrix.version }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.TOX_INI) }}

# setuptools can't find shared library installed by conda on windows
# so we need to prepare environment variables for it
- name: Export environment variables for UDUNITS2 lookup
if: runner.os == 'Windows'
uses: actions/github-script@v7
with:
script: |
const path = require('path')
const base = path.join('.tox/${{ matrix.version }}-${{ matrix.platform }}-test')
core.exportVariable('UDUNITS2_INCDIR', path.join(base, 'Library/include/'));
core.exportVariable('UDUNITS2_LIBDIR', path.join(base, 'Library/lib/'));
core.exportVariable('UDUNITS2_XML_PATH', path.join(base, 'Library/share/udunits/udunits2.xml'));
- name: "Run ${{ matrix.os }} on ${{ matrix.version}} tests"
run: |
export PATH=${{ matrix.gitpath-prepend }}$PATH
Expand Down
2 changes: 1 addition & 1 deletion cf_units/tests/test_coding_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_license_headers(self):
and full_fname.is_file()
and not any(fnmatch(fname, pat) for pat in exclude_patterns)
):
with open(full_fname) as fh:
with open(full_fname, encoding="utf-8") as fh:
content = fh.read()
if not content.startswith(LICENSE_TEMPLATE):
print(
Expand Down
5 changes: 4 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ conda_deps =
description =
Create explicit environment specification conda lock files for cf-units dependencies.
platform =
linux|darwin
linux|darwin|win32
setenv =
LOCKDIR = {toxinidir}{/}requirements{/}locks
TMPFILE = {envtmpdir}{/}cf-units.yml
Expand Down Expand Up @@ -50,6 +50,9 @@ description =
Perform cf-units unit/integration tests.
passenv =
CYTHON_COVERAGE
UDUNITS2_INCDIR
UDUNITS2_LIBDIR
UDUNITS2_XML_PATH
usedevelop =
true
commands =
Expand Down

0 comments on commit 8febed7

Please sign in to comment.