Commit cb5b3a23 authored by Antoine Berchet's avatar Antoine Berchet
Browse files

Test artifacts

parent 18fb3674
......@@ -89,16 +89,14 @@ article:
# - pip freeze
script:
# - python3 setup.py install
- >
pytest -s -m "(dummy and article and inversion and not adjtltest) or (fwd and ref_config)"
--html reports/pytest.html --self-contained-html --basetemp=/tmp/pytest/ ./
# - >
# pytest -s -m "(dummy and article and inversion and not adjtltest) or (fwd and ref_config)"
# --html reports/pytest.html --self-contained-html --basetemp=/tmp/pytest/ ./
- rm -rf artifact_tests
- mkdir artifact_tests
- echo ARTICLE > artifact_tests/article
after_script:
- cp -r /tmp/pytest/examples configs_article_artifacts
- mkdir figures_artifacts
- cp /tmp/pytest/*pdf figures_artifacts/
artifacts:
when: always
paths:
......
......@@ -56,11 +56,11 @@ def dummy_config_adjtltest(dummy_config_inversion, request):
+ request.param.get("testspace", "control") + "-testspace_" \
+ ("fullperiod" if request.param.get("tresol", "5D") else
"subperiod")
# current_dir = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
# example_dir = \
# os.path.abspath(os.path.join(current_dir, "../../../examples/dummy/"))
example_dir = tmpdir_str + "../examples/dummy"
current_dir = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
example_dir = \
os.path.abspath(os.path.join(current_dir,
"../../examples_artifact/dummy/"))
Path(example_dir).mkdir(parents=True, exist_ok=True)
dummy_config_file = \
......
......@@ -89,10 +89,10 @@ def dummy_config_fwd(ref_dummy, request):
"/tmp/CIF/model_sources/dummy_gauss/Pasquill-Gifford.txt"
# Dump configuration into CIF examples
# current_dir = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
# example_dir = \
# os.path.abspath(os.path.join(current_dir, "../../../examples/dummy/"))
example_dir = tmpdir_str + "../examples/dummy"
current_dir = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
example_dir = \
os.path.abspath(os.path.join(current_dir,
"../../examples_artifact/dummy/"))
Path(example_dir).mkdir(parents=True, exist_ok=True)
dummy_config_file = \
......
......@@ -2,6 +2,8 @@ import pytest
import matplotlib.pyplot as plt
import sys
import io
import os
from pathlib import Path
import xarray as xr
import pandas as pd
import numpy as np
......@@ -78,7 +80,13 @@ def plot_inversion(pytestconfig):
ax[0].tight_layout()
ax[0].savefig("{}/../cost_only_curve.pdf".format(dir_ref),
current_dir = os.path.abspath(
os.path.dirname(os.path.realpath(__file__)))
figure_dir = \
os.path.abspath(os.path.join(current_dir,
"../../figures_artifact/"))
Path(figure_dir).mkdir(parents=True, exist_ok=True)
ax[0].savefig("{}/cost_only_curve.pdf".format(figure_dir),
bbox_inches="tight")
plt.close()
......
import os
from pathlib import Path
import numpy as np
import pytest
import xarray as xr
......@@ -93,8 +93,14 @@ def test_integration_fwd(dummy_config_fwd, pytestconfig):
cb2 = plt.colorbar(sc, cax=ax2)
plt.yticks(fontsize=25)
plt.ylabel("Station altitude (m a.g.l)", fontsize=30)
plt.savefig("{}/../map_flx_obs.pdf".format(tmpdir))
current_dir = os.path.abspath(
os.path.dirname(os.path.realpath(__file__)))
figure_dir = \
os.path.abspath(os.path.join(current_dir,
"../../figures_artifact/"))
Path(figure_dir).mkdir(parents=True, exist_ok=True)
plt.savefig("{}/map_flx_obs.pdf".format(figure_dir))
plt.close()
# Show the fluxes
......@@ -118,8 +124,14 @@ def test_integration_fwd(dummy_config_fwd, pytestconfig):
cb2 = plt.colorbar(sc, cax=ax2)
plt.yticks(fontsize=25)
plt.ylabel("Station altitude (m a.g.l)", fontsize=30)
plt.savefig("{}/../map_flxperturb_obs.pdf".format(tmpdir))
current_dir = os.path.abspath(
os.path.dirname(os.path.realpath(__file__)))
figure_dir = \
os.path.abspath(os.path.join(current_dir,
"../../figures_artifact/"))
Path(figure_dir).mkdir(parents=True, exist_ok=True)
plt.savefig("{}/map_flxperturb_obs.pdf".format(figure_dir))
plt.close()
......
......@@ -57,11 +57,11 @@ def test_integration_adjtltest(dummy_config_inversion, settings):
+ settings.get("testspace", "control") + "-testspace_" \
+ ("fullperiod" if settings.get("tresol", "5D") else
"subperiod")
# current_dir = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
# example_dir = \
# os.path.abspath(os.path.join(current_dir, "../../examples/dummy/"))
example_dir = tmpdir + "../examples/dummy"
current_dir = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
example_dir = \
os.path.abspath(os.path.join(current_dir,
"../../examples_artifact/dummy/"))
Path(example_dir).mkdir(parents=True, exist_ok=True)
dummy_config_file = \
......
......@@ -150,10 +150,10 @@ def test_integration_inversion(dummy_config_inversion, settings, pytestconfig):
"" if settings["mode"] != "4dvar"
else settings["minimizer"])
# current_dir = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
# example_dir = \
# os.path.abspath(os.path.join(current_dir, "../../examples/dummy/"))
example_dir = tmpdir + "../examples/dummy"
current_dir = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
example_dir = \
os.path.abspath(os.path.join(current_dir,
"../../examples_artifact/dummy/"))
Path(example_dir).mkdir(parents=True, exist_ok=True)
dummy_config_file = \
......@@ -294,5 +294,12 @@ def test_integration_inversion(dummy_config_inversion, settings, pytestconfig):
plt.ylabel("Station altitude (m a.g.l)", fontsize=30)
ax0.set_title(title, fontsize=45)
plt.savefig("{}/../map_dx_{}_{}.pdf".format(tmpdir, title, resol))
current_dir = os.path.abspath(
os.path.dirname(os.path.realpath(__file__)))
figure_dir = \
os.path.abspath(os.path.join(current_dir,
"../../figures_artifact/"))
Path(figure_dir).mkdir(parents=True, exist_ok=True)
plt.savefig("{}/map_dx_{}_{}.pdf".format(figure_dir, title, resol))
plt.close()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment