Skip to content

Commit

Permalink
Merge pull request #164 from brightway-lca/fix-pipeline
Browse files Browse the repository at this point in the history
Fix pipeline
  • Loading branch information
BenPortner authored Apr 10, 2024
2 parents 47dfb54 + f717c29 commit d2630b0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 78 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ venv.bak/

# mypy
.mypy_cache/

# PyCharm
.idea
98 changes: 24 additions & 74 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ pr:
autoCancel: true
branches:
include:
- master
- main

jobs:
- job:
displayName: ubuntu-20.04-conda
displayName: ubuntu-latest conda
pool:
vmImage: 'ubuntu-20.04'
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python310:
Expand All @@ -23,13 +23,13 @@ jobs:

- bash: |
conda config --set always_yes yes
conda install -q -c conda-forge mamba
mamba create -q --name bw2
conda create -q --name bw2
displayName: Create Anaconda environment
- bash: |
source activate bw2
mamba install --yes --quiet -c defaults -c conda-forge -c cmutel --name bw2 bw_processing python=$PYTHON_VERSION peewee tqdm brightway25 pytest pytest-azurepipelines">=1.0" pytest-cov pip
conda install --yes --quiet -c defaults -c conda-forge -c cmutel python=$PYTHON_VERSION brightway25 pytest pytest-azurepipelines">=1.0" pytest-cov
pip install -e .
displayName: Install Anaconda packages
- bash: |
Expand All @@ -38,9 +38,9 @@ jobs:
displayName: pytest
- job:
displayName: ubuntu-20.04-pip
displayName: ubuntu-latest pip
pool:
vmImage: 'ubuntu-20.04'
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python310:
Expand All @@ -57,19 +57,20 @@ jobs:
- bash: |
python --version
pip --version
pip install --pre bw2data bw2io bw2analyzer bw2calc numpy pandas pytest pytest-azurepipelines
pip install --pre -r requirements-test.txt
echo "which pytest"
which pytest
echo "pytest version"
pytest --version
pip install -e .
displayName: Install packages
- bash: |
pytest --color=yes -vv
displayName: pytest
- job:
displayName: macOS 11 Big Sur-conda
displayName: macOS-latest conda
pool:
vmImage: 'macOS-latest'
strategy:
Expand All @@ -84,13 +85,13 @@ jobs:

- bash: |
conda config --set always_yes yes
conda install -q -c conda-forge mamba
mamba create -q --name bw2
conda create -q --name bw2
displayName: Create Anaconda environment
- bash: |
source activate bw2
mamba install --yes -c defaults -c conda-forge -c cmutel --name bw2 python=$PYTHON_VERSION bw_processing pytest peewee tqdm brightway25 pytest-azurepipelines">=1.0" pip
conda install --yes -c defaults -c conda-forge -c cmutel python=$PYTHON_VERSION pytest brightway25 pytest-azurepipelines">=1.0"
pip install -e .
displayName: Install Anaconda packages
- bash: |
Expand All @@ -99,7 +100,7 @@ jobs:
displayName: pytest
- job:
displayName: macOS 11 Big Sur-pip
displayName: macOS-latest pip
pool:
vmImage: 'macOS-latest'
strategy:
Expand All @@ -115,69 +116,16 @@ jobs:

- bash: |
python --version
pip3 install --pre bw2data bw2io bw2analyzer bw2calc numpy pandas pytest pytest-azurepipelines
pip3 install --pre -r requirements-test.txt
pip3 install -e .
displayName: Install packages
- bash: |
pytest --color=yes -vv
displayName: pytest
- job:
displayName: macOS X Catalina 10.15-conda
pool:
vmImage: 'macOS-10.15'
strategy:
matrix:
Python310:
python.version: '3.10'

timeoutInMinutes: 20
steps:
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add conda to PATH

- bash: |
conda config --set always_yes yes
conda install -q -c conda-forge mamba
mamba create -q --name bw2
displayName: Create Anaconda environment
- bash: |
source activate bw2
mamba install --yes -c defaults -c conda-forge -c cmutel --name bw2 python=$PYTHON_VERSION bw_processing pytest peewee tqdm brightway25 pytest-azurepipelines">=1.0" pip
displayName: Install Anaconda packages
- bash: |
source activate bw2
pytest --color=yes -vv
displayName: pytest
- job:
displayName: macOS X Catalina 10.15-pip
pool:
vmImage: 'macOS-10.15'
strategy:
matrix:
Python310:
python.version: '3.10'

timeoutInMinutes: 20
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'

- bash: |
python --version
pip3 install --pre bw2data bw2io bw2analyzer bw2calc numpy pandas pytest pytest-azurepipelines
displayName: Install packages
- bash: |
pytest --color=yes -vv
displayName: pytest
- job:
displayName: Windows Server 2022 with Visual Studio 2022-conda
displayName: windows-latest conda
pool:
vmImage: 'windows-latest'
strategy:
Expand All @@ -198,7 +146,8 @@ jobs:
- script: |
call activate bw2
conda install --yes -c defaults -c conda-forge -c cmutel -c haasad --name bw2 python=%PYTHON_VERSION% bw_processing pytest peewee tqdm brightway25 pytest-azurepipelines">=1.0" pywin32 pip
conda install --yes -c defaults -c conda-forge -c cmutel -c haasad python=%PYTHON_VERSION% pytest brightway25 pytest-azurepipelines">=1.0"
pip install -e .
displayName: Install Anaconda packages
- script: |
Expand All @@ -207,7 +156,7 @@ jobs:
displayName: pytest
- job:
displayName: Windows Server 2022 with Visual Studio 2022-pip
displayName: windows-latest pip
pool:
vmImage: 'windows-latest'
strategy:
Expand All @@ -223,9 +172,10 @@ jobs:

- script: |
python --version
pip install --pre bw2data bw2io bw2analyzer bw2calc numpy pandas pytest pytest-azurepipelines
pip install --pre -r requirements-test.txt
pip install -e .
displayName: Install packages
- script: |
pytest --color=yes -vv
displayName: pytest
displayName: pytest
13 changes: 9 additions & 4 deletions tests/exchange_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import pytest
import stats_arrays as sa
from pandas.testing import assert_frame_equal
import warnings


@pytest.fixture
Expand Down Expand Up @@ -475,10 +476,12 @@ def test_valid_exchange_type():
amount=0, input=b, type="technosphere", formula="foo * bar + 4"
)

with pytest.warns(None) as warning_list:
# assert that no warnings are raised
# https://docs.pytest.org/en/8.0.x/how-to/capture-warnings.html
with warnings.catch_warnings():
warnings.simplefilter("error")
exc.save()

assert len(warning_list) == 0

@bw2test
def test_valid_exchange_key():
Expand All @@ -493,10 +496,12 @@ def test_valid_exchange_key():
amount=11, input=b, type="technosphere", temporal_distribution=[]
)

with pytest.warns(None) as warning_list:
# assert that no warnings are raised
# https://docs.pytest.org/en/8.0.x/how-to/capture-warnings.html
with warnings.catch_warnings():
warnings.simplefilter("error")
exc.save()

assert len(warning_list) == 0

@bw2test
def test_typo_exchange_type_multiple_corrections():
Expand Down

0 comments on commit d2630b0

Please sign in to comment.