From d3d8ee34cc4398a057feef2059a487f60d9aaf19 Mon Sep 17 00:00:00 2001 From: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com> Date: Fri, 26 Jul 2024 14:10:06 +0530 Subject: [PATCH 1/3] Using pytest-github-actions-annotate-failures Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com> Adding comment Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com> --- .github/workflows/test_on_push.yml | 2 +- noxfile.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index 97c37e8c28..52a98aa515 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -31,7 +31,7 @@ jobs: pre-commit run -a run_unit_integration_and_coverage_tests: - needs: style +# needs: style runs-on: ${{ matrix.os }} strategy: fail-fast: false diff --git a/noxfile.py b/noxfile.py index 7237786ef6..68b3c745ac 100644 --- a/noxfile.py +++ b/noxfile.py @@ -69,6 +69,9 @@ def run_coverage(session): set_environment_variables(PYBAMM_ENV, session=session) session.install("setuptools", silent=False) session.install("coverage", silent=False) + # Adding a comment + if "CI" in os.environ: + session.install("pytest-github-actions-annotate-failures") session.install("-e", ".[all,dev,jax]", silent=False) session.run("pytest", "--cov=pybamm", "--cov-report=xml", "tests/unit") @@ -78,6 +81,8 @@ def run_integration(session): """Run the integration tests.""" set_environment_variables(PYBAMM_ENV, session=session) session.install("setuptools", silent=False) + if "CI" in os.environ and sys.version_info[:2] == (3, 12) and sys.platform == "linux": + session.install("pytest-github-actions-annotate-failures") session.install("-e", ".[all,dev,jax]", silent=False) session.run("python", "run-tests.py", "--integration") From 03cc38cff58f15103d54d82a2a320a24538e534f Mon Sep 17 00:00:00 2001 From: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com> Date: Fri, 26 Jul 2024 23:29:02 +0530 Subject: [PATCH 2/3] Adding test to fail Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com> --- tests/unit/test_mockfail.py | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/unit/test_mockfail.py diff --git a/tests/unit/test_mockfail.py b/tests/unit/test_mockfail.py new file mode 100644 index 0000000000..1f0677928d --- /dev/null +++ b/tests/unit/test_mockfail.py @@ -0,0 +1,2 @@ +def add(): + assert 1 + 1 == 0 \ No newline at end of file From 19a6e4c216143169bb36ad4e12958b35ac79012c Mon Sep 17 00:00:00 2001 From: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com> Date: Sat, 27 Jul 2024 15:49:09 +0530 Subject: [PATCH 3/3] using test_add Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com> --- tests/unit/test_mockfail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_mockfail.py b/tests/unit/test_mockfail.py index 1f0677928d..ede6a440f5 100644 --- a/tests/unit/test_mockfail.py +++ b/tests/unit/test_mockfail.py @@ -1,2 +1,2 @@ -def add(): +def test_add(): assert 1 + 1 == 0 \ No newline at end of file