Consider using fixtures in tests #447
Comments
Addresses poliastro#338. Now trying to import OrbitPlotter directly from poliastro.plotting fails, because it's the "old" backend and users are encouraged to use OrbitPlotter2D and OrbitPlotter3D instead, which use plotly and not matplotlib behind the scenes. This does not address: * Updates in documentation * Failing test because OrbitPlotter2D has no set_frame method (poliastro#480) * Test simplification and refactoring (poliastro#448 and poliastro#447) Also, notice that poliastro#281 should be fixed first.
Addresses poliastro#338. Now trying to import OrbitPlotter directly from poliastro.plotting fails, because it's the "old" backend and users are encouraged to use OrbitPlotter2D and OrbitPlotter3D instead, which use plotly and not matplotlib behind the scenes. This does not address: * Updates in documentation * Failing test because OrbitPlotter2D has no set_frame method (poliastro#480) * Test simplification and refactoring (poliastro#448 and poliastro#447) Also, notice that poliastro#281 should be fixed first.
Addresses poliastro#338. Now trying to import OrbitPlotter directly from poliastro.plotting fails, because it's the "old" backend and users are encouraged to use OrbitPlotter2D and OrbitPlotter3D instead, which use plotly and not matplotlib behind the scenes. This does not address: * Updates in documentation * Failing test because OrbitPlotter2D has no set_frame method (poliastro#480) * Test simplification and refactoring (poliastro#448 and poliastro#447) Also, notice that poliastro#281 should be fixed first.
Working on #451 I remembered that I may have left this issue half solved. I will search for the tests where I can use fixtures. Please let me know if you have any modules in mind. |
While reviewing this, I realized that perhaps we could take https://github.com/poliastro/poliastro/blob/master/src/poliastro/tests/tests_twobody/test_angles.py and replace
|
I don't see many places to replace current tests with fixtures. I imagine we could think about cases to improve or expand the tests by testing more kinds of orbits, but I am not sure whether In fact, I am going to close this issue, because it's "a solution in search of a problem" and might push us in the wrong direction. |
There are a lot of repeated code in the tests, mainly sample data for orbits. I have been experimenting with pytest fixtures lately and I think they are a great idea. They can even be parametrized, which might help repeating the same test with different kinds of orbits.
https://docs.pytest.org/en/3.8.0/fixture.html
The text was updated successfully, but these errors were encountered: