Skip to content

Commit 9d7a4c3

Browse files
authored
Merge pull request #88 from xsuite/dev
Version 0.11.13
2 parents e441da3 + c0525bd commit 9d7a4c3

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ jobs:
66
pytest:
77
runs-on: ubuntu-24.04
88
strategy:
9+
fail-fast: false
910
matrix:
1011
python-version: [ '3.9', '3.10', '3.11', '3.12' ] # , '3.13'
1112
dep-versions: [ '' ] # 'numpy1'

tests/test_utils.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import pytest
22
import pytest_benchmark
3+
import pytest_benchmark.plugin
4+
from pytest_benchmark.utils import NameWrapper
5+
from pytest_benchmark.fixture import BenchmarkFixture
36
import numpy as np
47
from numpy.testing import assert_equal
58
import xplt.util
@@ -8,8 +11,27 @@
811
@pytest.fixture(scope="function")
912
def benchmark_ref(request):
1013
# See https://github.com/ionelmc/pytest-benchmark/issues/166
11-
bm = pytest_benchmark.plugin.benchmark.__pytest_wrapped__.obj(request)
12-
return next(bm) if hasattr(bm, "__next__") else bm
14+
# code below is a copy of `pytest_benchmark.plugin.benchmark` fixture
15+
bs = request.config._benchmarksession
16+
17+
if bs.skip:
18+
pytest.skip("Benchmarks are skipped (--benchmark-skip was used).")
19+
else:
20+
node = request.node
21+
marker = node.get_closest_marker("benchmark")
22+
options = dict(marker.kwargs) if marker else {}
23+
if "timer" in options:
24+
options["timer"] = NameWrapper(options["timer"])
25+
fixture = BenchmarkFixture(
26+
node,
27+
add_stats=bs.benchmarks.append,
28+
logger=bs.logger,
29+
warner=request.node.warn,
30+
disabled=bs.disabled,
31+
**dict(bs.options, **options),
32+
)
33+
request.addfinalizer(fixture._cleanup)
34+
return fixture
1335

1436

1537
@pytest.mark.parametrize(

xplt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
__contact__ = "[email protected]"
66

77

8-
__version__ = "0.11.12"
8+
__version__ = "0.11.13"
99

1010

1111
# expose the following in global namespace

xplt/line.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,9 @@ def ang(a):
368368
RT - ARC / 2 + HELICITY * np.pi / 2
369369
) # angle between plot x-axis and radial vector of bending
370370

371-
LENGTH = get(survey, "length", np.zeros_like(NAME))
372-
IS_THICK = get(survey, "isthick", np.zeros_like(NAME))
373-
ORDER = get(survey, "order", -np.ones_like(NAME))
371+
LENGTH = get(survey, "length", np.zeros(len(NAME)))
372+
IS_THICK = get(survey, "isthick", np.zeros(len(NAME), "bool"))
373+
ORDER = get(survey, "order", -np.ones(len(NAME), "int"))
374374
if (TYPE := get(survey, "element_type", None)) is not None:
375375
# map element type to order when order is not in survey
376376
for type, o in {

0 commit comments

Comments
 (0)