-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add custom doctest wrapper This should make sure that doctests pass for various versions of numpy and python. * Bump workflow version * Make set_printoptions test override more strict
- Loading branch information
Showing
4 changed files
with
29 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[project] | ||
name = "lofarantpos" | ||
version = "0.7.0" | ||
version = "0.7.1" | ||
description = "Access, query, and manipulate LOFAR antenna positions" | ||
authors = [ | ||
{name = "Tammo Jan Dijkema", email = "[email protected]"}, | ||
|
@@ -31,3 +31,7 @@ requires=[ | |
|
||
[project.urls] | ||
Homepage = "https://github.com/lofar-astron/lofar-antenna-positions" | ||
|
||
[tool.pytest.ini_options] | ||
doctest_optionflags = "ELLIPSIS" | ||
addopts = "--doctest-modules --doctest-continue-on-failure --ignore=scripts --ignore=docs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import doctest | ||
import pytest | ||
import re | ||
|
||
|
||
class NumpyOutputChecker(doctest.OutputChecker): | ||
def check_output(self, want, got, optionflags): | ||
# Remove the np.float64 wrapper from both want and got | ||
want = re.sub(r'np\.float64\(([\d.-]*)\)', r'\1', want) | ||
got = re.sub(r'np\.float64\(([\d.-]*)\)', r'\1', got) | ||
|
||
# numpy.set_printoptions started producing output in some version | ||
if got.strip().startswith("<Token") and want == "": | ||
return True | ||
|
||
return super().check_output(want, got, optionflags) | ||
|
||
@pytest.hookimpl(tryfirst=True) | ||
def pytest_configure(config): | ||
doctest.OutputChecker = NumpyOutputChecker |