diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f63e628..335ee99 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,13 +56,13 @@ jobs: - uses: actions/checkout@v2 - name: Install python version - uses: gabrielfalcao/pyenv-action@v7 + uses: gabrielfalcao/pyenv-action@v13 with: - default: 3.9.0 + default: 3.10.6 command: pip install -U pip # upgrade pip after installing python - name: create environment - run: pyenv local 3.9.0 && python -mvenv .venv390 + run: pyenv local 3.10.6 && python -mvenv .venv390 - name: Install dependencies run: | @@ -88,7 +88,7 @@ jobs: fail-fast: false matrix: os: [ "ubuntu-latest" ] - python-version: [ "3.9" ] + python-version: [ "3.10" ] steps: - uses: actions/checkout@v2 - uses: conda-incubator/setup-miniconda@v2 diff --git a/conda/conda_build_config.yaml b/conda/conda_build_config.yaml index 8d03891..30c7120 100644 --- a/conda/conda_build_config.yaml +++ b/conda/conda_build_config.yaml @@ -1,2 +1,2 @@ python: - - 3.9 \ No newline at end of file + - 3.10 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index f9a1274..d07f474 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -carculator-utils==1.2.0.dev0 +carculator-utils>=1.2.0.dev5 prettytable \ No newline at end of file diff --git a/setup.py b/setup.py index f7b59db..9ceecc8 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,8 @@ def package_files(directory): package_data={ "carculator_truck": package_files(os.path.join("carculator_truck", "data")) }, - install_requires=["carculator_utils==1.2.0.dev0", "prettytable"], + python_requires=">=3.10", + install_requires=["carculator_utils>=1.2.0.dev5", "prettytable"], url="https://github.com/romainsacchi/carculator_truck", description="Prospective environmental and economic life cycle assessment" "of medium and heavy goods vehicles", diff --git a/tests/test_inventory.py b/tests/test_inventory.py index c880ee8..72f6428 100644 --- a/tests/test_inventory.py +++ b/tests/test_inventory.py @@ -63,13 +63,13 @@ def test_fuel_blend(): "share": [0.93, 0.93, 0.93, 0.93, 0.93, 0.93], }, "secondary": { - "type": "biodiesel - cooking oil", + "type": "diesel - biodiesel - cooking oil", "share": [0.07, 0.07, 0.07, 0.07, 0.07, 0.07], }, }, - "cng": { + "methane": { "primary": { - "type": "biogas - sewage sludge", + "type": "methane - biomethane - sewage sludge", "share": [1, 1, 1, 1, 1, 1], } }, @@ -88,37 +88,36 @@ def test_fuel_blend(): tm.fuel_blend["diesel"]["secondary"]["share"], [0.07, 0.07, 0.07, 0.07, 0.07, 0.07], ) - assert np.allclose(tm.fuel_blend["cng"]["primary"]["share"], [1, 1, 1, 1, 1, 1]) - # assert np.sum(ic.fuel_blends["cng"]["secondary"]["share"]) == 0 + assert np.allclose(tm.fuel_blend["methane"]["primary"]["share"], [1, 1, 1, 1, 1, 1]) ic.calculate_impacts() for fuels in [ - ("diesel", "electrolysis", "cng"), + ("diesel", "hydrogen - electrolysis - PEM", "methane"), ( - "biodiesel - palm oil", - "smr - natural gas", - "biogas - sewage sludge", + "diesel - biodiesel - palm oil", + "hydrogen - smr - natural gas", + "methane - biomethane - sewage sludge", ), ( - "biodiesel - rapeseed oil", - "smr - natural gas with CCS", - "biogas - biowaste", + "diesel - biodiesel - rapeseed oil", + "hydrogen - smr - natural gas with CCS", + "methane - synthetic - coal", ), ( - "biodiesel - cooking oil", - "wood gasification with EF with CCS", - "biogas - biowaste", + "diesel - biodiesel - cooking oil", + "hydrogen - wood gasification", + "methane - synthetic - biological", ), ( - "biodiesel - algae", - "atr - biogas", - "biogas - biowaste", + "diesel - synthetic - FT - coal - economic allocation", + "hydrogen - atr - biogas", + "methane - synthetic - biological - MSWI", ), ( - "synthetic diesel - energy allocation", - "wood gasification with EF with CCS", - "syngas", + "diesel - synthetic - methanol - cement - economic allocation", + "hydrogen - wood gasification with CCS", + "methane - synthetic - electrochemical - MSWI", ), ]: fb = { @@ -126,7 +125,7 @@ def test_fuel_blend(): "primary": {"type": fuels[0], "share": [1, 1, 1, 1, 1, 1]}, }, "hydrogen": {"primary": {"type": fuels[1], "share": [1, 1, 1, 1, 1, 1]}}, - "cng": {"primary": {"type": fuels[2], "share": [1, 1, 1, 1, 1, 1]}}, + "methane": {"primary": {"type": fuels[2], "share": [1, 1, 1, 1, 1, 1]}}, } tm = TruckModel(array, cycle="Long haul", country="CH", fuel_blend=fb) @@ -163,12 +162,7 @@ def test_endpoint(): def test_sulfur_concentration(): ic = InventoryTruck(tm, method="recipe", indicator="endpoint") - ic.get_sulfur_content("RER", "diesel", 2000) - ic.get_sulfur_content("foo", "diesel", 2000) - - with pytest.raises(ValueError) as wrapped_error: - ic.get_sulfur_content("FR", "diesel", "jku") - assert wrapped_error.type == ValueError + ic.get_sulfur_content("RER", "diesel") def test_custom_electricity_mix():