Open LourensVeen opened 8 months ago
We've actually retired nose for testing in favour of pytest, but clearly this change hasn't propagated to all the documentation yet.
see #196
Ah, I can confirm that pytest also seems to run the tests, so it's indeed just a documentation issue. Farther down it suggests running pysetest
, which I guess is some weird hybrid of the two :smile:.
I might as well add another issue about the same page here: the test doesn't work because instance.find_nearest_neighbors(x,y,z)
returns only 3 values, not the n0, n1, n2, error
we are expecting. Possibly the API changed?
If I remove those checks, then it still fails, because of an off-by-one indexing error. It seems like the test expects the indexes returned in n0
to be 1-based, while the C++ code returns 0-based indexes. I guess this was copy-pasted from the Fortran side maybe? Does AMUSE have a standard for whether indexes are 0- or 1-based?
In interface.py
I need to write
def define_methods(self, handler):
handler.add_method(
"find_nearest_neighbors",
(
generic_unit_system.length,
generic_unit_system.length,
generic_unit_system.length
),
(
handler.INDEX,
handler.INDEX,
handler.INDEX
)
)
without the additional handler.ERROR_CODE
to get test3
to work. I'm not sure however if error handling has been automated completely and manually declaring that output is no longer necessary, or if removing it disables error handling.
Oh, and the test file needs a from amuse.units import generic_unit_system
to get that symbol to resolve.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 28 days if no further activity occurs. Thank you for your contributions.
Let's keep this open and consider it a documentation issue. I've been working on getting tests to run in combination with the new packaging work, so that's a separate thing, and then there's another potential separate project in removing the custom infrastructure from the tests and use the facilities that pytest offers. I've made #1044 for the latter.
Ah, thanks. I guess you need to remove stale
to keep it from closing, and add keep-open
to keep it from getting marked as stale?
Yes I guess so…
Describe the bug The tutorial at https://amuse.readthedocs.io/en/latest/tutorial/c_code.html guides the user to run the tests for the package using
nosetests
. This command is from thenose
package, which is unmaintained and obsolete and doesn't work on recent Python versions. It's been succeeded bynose2
, which at least for the trivial example tests seems to do work.To Reproduce
Expected behavior
Logs
Environment (please complete the following information): Kubuntu 22.04 GCC 11.4.0
Additional context This works at least for this trivial test: