Skip to content

Commit

Permalink
Merge pull request #9 from martinjankoehler/pytest-mark-slow
Browse files Browse the repository at this point in the history
Pytest: mark integration tests as slow
  • Loading branch information
martinjankoehler authored Dec 5, 2024
2 parents b4c781c + adfa628 commit 1316b4a
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 15 deletions.
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pytest-cov = "^6.0.0"
pytest-html = "^4.1.1"
allure-pytest = "^2.13.5"
csv-diff = "^1.2"
coverage = "^7.6.8"

[tool.poetry.group.dev.dependencies]
pylint = "^3.3.1"
Expand All @@ -63,3 +64,11 @@ licenseheaders = "^0.8.8"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.pytest.ini_options]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"serial",
"wip: mark tests as work-in-progress (delect with '-m \"not wip\"')",
]

34 changes: 21 additions & 13 deletions run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,35 @@

DIR=$(dirname -- $(realpath ${BASH_SOURCE}))

export PYTHONPATH=$DIR/:$DIR/build/python:${PYTHONPATH}
## export PYTHONPATH=$DIR/:$DIR/build/python:${PYTHONPATH}

mkdir -p $DIR/build
mkdir -p "$DIR"/build

ALLURE_RESULTS_PATH=$DIR/build/allure-results
ALLURE_REPORT_PATH=$DIR/build/allure-report
COVERAGE_PATH=$DIR/build/coverage-results
ALLURE_RESULTS_PATH="$DIR/build/allure-results"
ALLURE_REPORT_PATH="$DIR/build/allure-report"
COVERAGE_PATH="$DIR/build/coverage-results"

poetry run pytest \
--alluredir $ALLURE_RESULTS_PATH \
--color no \
--cov=$COVERAGE_PATH \
--cov-report=html
set -x
set -e

rm -rf "$ALLURE_RESULTS_PATH"
rm -rf "$ALLURE_REPORT_PATH"
rm -rf "$COVERAGE_PATH"

poetry run coverage run -m pytest -m "not slow" \
--alluredir "$ALLURE_RESULTS_PATH" \
--color no

poetry run coverage html --directory "$COVERAGE_PATH"

allure generate \
--single-file $ALLURE_RESULTS_PATH \
--output $ALLURE_REPORT_PATH \
--single-file "$ALLURE_RESULTS_PATH" \
--output "$ALLURE_REPORT_PATH" \
--clean

if [[ -z "$RUNNER_OS" ]] && [[ -d "/Applications/Safari.app" ]]
then
open -a Safari $ALLURE_REPORT_PATH/index.html
open -a Safari "$ALLURE_REPORT_PATH"/index.html
open -a Safari "$COVERAGE_PATH"/index.html
fi

17 changes: 16 additions & 1 deletion tests/rcx25/rcx25_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import allure
import csv_diff
import os
import pytest
from typing import *
import unittest

import klayout.db as kdb
import klayout.lay as klay
Expand Down Expand Up @@ -129,6 +129,7 @@ def assert_expected_matches_obtained(*path_components,

@allure.parent_suite(parent_suite)
@allure.tag(*tags)
@pytest.mark.slow
def test_single_plate_100um_x_100um_li1_over_substrate():
# MAGIC GIVES (8.3 revision 485):
#_______________________________ NOTE: with halo=8µm __________________________________
Expand All @@ -142,6 +143,8 @@ def test_single_plate_100um_x_100um_li1_over_substrate():

@allure.parent_suite(parent_suite)
@allure.tag(*tags)
@pytest.mark.slow
@pytest.mark.wip
def test_overlap_plates_100um_x_100um_li1_m1():
# MAGIC GIVES (8.3 revision 485):
#_______________________________ NOTE: with halo=8µm __________________________________
Expand All @@ -164,6 +167,8 @@ def test_overlap_plates_100um_x_100um_li1_m1():

@allure.parent_suite(parent_suite)
@allure.tag(*tags)
@pytest.mark.slow
@pytest.mark.wip
def test_overlap_plates_100um_x_100um_li1_m1_m2_m3():
# MAGIC GIVES (8.3 revision 485): (sorting changed to match order)
#_______________________________ NOTE: with halo=8µm __________________________________
Expand Down Expand Up @@ -203,6 +208,8 @@ def test_overlap_plates_100um_x_100um_li1_m1_m2_m3():

@allure.parent_suite(parent_suite)
@allure.tag(*tags)
@pytest.mark.slow
@pytest.mark.wip
def test_sidewall_100um_x_100um_distance_200nm_li1():
# MAGIC GIVES (8.3 revision 485): (sorting changed to match order)
# _______________________________ NOTE: with halo=8µm __________________________________
Expand All @@ -227,6 +234,8 @@ def test_sidewall_100um_x_100um_distance_200nm_li1():

@allure.parent_suite(parent_suite)
@allure.tag(*tags)
@pytest.mark.slow
@pytest.mark.wip
def test_sidewall_net_uturn_l1_redux():
# MAGIC GIVES (8.3 revision 485): (sorting changed to match order)
# _______________________________ NOTE: with halo=8µm __________________________________
Expand All @@ -247,6 +256,8 @@ def test_sidewall_net_uturn_l1_redux():

@allure.parent_suite(parent_suite)
@allure.tag(*tags)
@pytest.mark.slow
@pytest.mark.wip
def test_sidewall_cap_vpp_04p4x04p6_l1_redux():
# MAGIC GIVES (8.3 revision 485): (sorting changed to match order)
# _______________________________ NOTE: with halo=8µm __________________________________
Expand All @@ -267,6 +278,8 @@ def test_sidewall_cap_vpp_04p4x04p6_l1_redux():

@allure.parent_suite(parent_suite)
@allure.tag(*tags)
@pytest.mark.slow
@pytest.mark.wip
def test_near_body_shield_li1_m1():
# MAGIC GIVES (8.3 revision 485): (sorting changed to match order)
#_______________________________ NOTE: with halo=8µm __________________________________
Expand All @@ -292,6 +305,8 @@ def test_near_body_shield_li1_m1():

@allure.parent_suite(parent_suite)
@allure.tag(*tags)
@pytest.mark.slow
@pytest.mark.wip
def test_sideoverlap_simple_plates_li1_m1():
# MAGIC GIVES (8.3 revision 485): (sorting changed to match order)
# _______________________________ NOTE: with halo=8µm __________________________________
Expand Down

0 comments on commit 1316b4a

Please sign in to comment.