Skip to content

Commit

Permalink
Merge branch 'ripple' into Gamma_c
Browse files Browse the repository at this point in the history
  • Loading branch information
unalmis committed Oct 17, 2024
2 parents d5f4473 + 59235b0 commit 1797fcc
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,12 @@ repos:
rev: v3.2.0
hooks:
- id: pyupgrade
- repo: local
hooks:
- id: check_unmarked_tests
name: check_unmarked_tests
entry: devtools/check_unmarked_tests.sh
language: script
files: ^tests/
types: [python]
pass_filenames: true
22 changes: 22 additions & 0 deletions devtools/check_unmarked_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

# Start the timer using date (in seconds since epoch)
start_time=$(date +%s)

echo "Files to check: $@"
# Collect unmarked tests for the specific file and suppress errors
unmarked=$(pytest "$@" --collect-only -m "not unit and not regression" -q 2> /dev/null | head -n -2)

# Count the number of unmarked tests found, ignoring empty lines
num_unmarked=$(echo "$unmarked" | sed '/^\s*$/d' | wc -l)

# If there are any unmarked tests, print them and exit with status 1
if [ "$num_unmarked" -gt 0 ]; then
echo "----found unmarked tests----"
echo "$unmarked"
# Calculate the elapsed time and print with a newline
end_time=$(date +%s)
elapsed_time=$((end_time - start_time))
printf "\nTime taken: %d seconds" "$elapsed_time"
exit 1
fi
Binary file modified tests/baseline/test_fsa_F_normalized.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tests/test_curves.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ def test_from_input_file(self):
np.testing.assert_allclose(curve3.NFP, curve4.NFP)
np.testing.assert_allclose(curve3.sym, curve4.sym)

@pytest.mark.unit
def test_to_FourierRZCurve(self):
"""Test conversion to FourierRZCurve."""
xyz = FourierXYZCurve(modes=[-1, 1], X_n=[0, 10], Y_n=[10, 0], Z_n=[0, 0])
Expand Down
4 changes: 4 additions & 0 deletions tests/test_objective_funs.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,7 @@ def test(coil, grid=None):
test(mixed_coils)
test(nested_coils, grid=grid)

@pytest.mark.unit
def test_coil_type_error(self):
"""Tests error when objective is not passed a coil."""
curve = FourierPlanarCurve(r_n=2, basis="rpz")
Expand Down Expand Up @@ -1104,6 +1105,7 @@ def test(

# TODO: add more complex test case with a stellarator and/or MixedCoilSet

@pytest.mark.unit
def test_quadratic_flux(self):
"""Test calculation of quadratic flux on the boundary."""
t_field = ToroidalMagneticField(1, 1)
Expand Down Expand Up @@ -2979,6 +2981,7 @@ def test_asymmetric_normalization():
assert np.all(np.isfinite(val))


@pytest.mark.unit
def test_objective_print_widths():
"""Test that the objective's name is shorter than max."""
subclasses = _Objective.__subclasses__()
Expand Down Expand Up @@ -3007,6 +3010,7 @@ def test_objective_print_widths():
)


@pytest.mark.unit
def test_objective_docstring():
"""Test that the objective docstring and collect_docs are consistent."""
objective_docs = _Objective.__doc__.rstrip()
Expand Down

0 comments on commit 1797fcc

Please sign in to comment.