Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help pytest find tests #362

Merged
merged 7 commits into from
Nov 17, 2023
Merged

Help pytest find tests #362

merged 7 commits into from
Nov 17, 2023

Conversation

rileyjmurray
Copy link
Collaborator

@rileyjmurray rileyjmurray commented Nov 3, 2023

This should resolve #361.

This branch has latest develop as its base. It had 6 failing tests when I started. Five of those failing tests were due to a wrong version of a dependency (qibo) I got when I installed pyGSTi. The other failing test was due to a missing dependency. I've modified this last failing test so that it handles the missing dependency gracefully. I'd like it if the other five tests also gracefully handled a wrong dependency version, but I'll put that off for now as issue #363.

The initial change I made in this PR was just to pytest.ini. Then I needed to fix some broken tests.

@rileyjmurray
Copy link
Collaborator Author

rileyjmurray commented Nov 13, 2023

Documenting where I am on this. Here are the currently failing tests.

=========================================================================== short test summary info ===========================================================================
FAILED test/unit/modelmembers/test_operation.py::LinearOpTester::test_copy - NotImplementedError: to_dense(...) not implemented for LinearOperator objects!
FAILED test/unit/modelmembers/test_operation.py::LinearOpTester::test_deriv_wrt_params - AttributeError: 'LinearOperator' object has no attribute 'size'
FAILED test/unit/modelmembers/test_operation.py::LinearOpTester::test_diamonddist - NotImplementedError: to_dense(...) not implemented for LinearOperator objects!
FAILED test/unit/modelmembers/test_operation.py::LinearOpTester::test_frobeniusdist - NotImplementedError: to_dense(...) not implemented for LinearOperator objects!
FAILED test/unit/modelmembers/test_operation.py::LinearOpTester::test_jtracedist - NotImplementedError: to_dense(...) not implemented for LinearOperator objects!
FAILED test/unit/modelmembers/test_operation.py::LinearOpTester::test_pickle - NotImplementedError: to_dense(...) not implemented for LinearOperator objects!
FAILED test/unit/modelmembers/test_operation.py::LinearOpTester::test_raise_on_invalid_method - AssertionError: `dim` must be a perfect square: 2 is not
FAILED test/unit/modelmembers/test_operation.py::LinearOpTester::test_tosparse - NotImplementedError: to_sparse(...) not implemented for LinearOperator objects!

FAILED test/unit/objects/test_objectivefns.py::RawObjectiveFunctionTester::test_value - AttributeError: 'RawObjectiveFunctionTester' object has no attribute 'objfns'
FAILED test/unit/objects/test_objectivefns.py::RawObjectiveFunctionTester::test_derivative - AttributeError: 'RawObjectiveFunctionTester' object has no attribute 'objfns'
FAILED test/unit/objects/test_objectivefns.py::RawObjectiveFunctionTester::test_hessian - AttributeError: 'RawObjectiveFunctionTester' object has no attribute 'objfns'

FAILED test/unit/objects/test_objectivefns.py::TimeIndependentMDSObjectiveFunctionTester::test_builder - AttributeError: 'TimeIndependentMDSObjectiveFunctionTester' object has no attribute 'objfns'
FAILED test/unit/objects/test_objectivefns.py::TimeIndependentMDSObjectiveFunctionTester::test_value - AttributeError: 'TimeIndependentMDSObjectiveFunctionTester' object has no attribute 'objfns'
FAILED test/unit/objects/test_objectivefns.py::TimeIndependentMDSObjectiveFunctionTester::test_derivative - AttributeError: 'TimeIndependentMDSObjectiveFunctionTester' object has no attribute 'objfns'
FAILED test/unit/objects/test_objectivefns.py::TimeIndependentMDSObjectiveFunctionTester::test_approximate_hessian - AttributeError: 'TimeIndependentMDSObjectiveFunctionTester' object has no attribute 'enable_hessian_tests'
FAILED test/unit/objects/test_objectivefns.py::TimeIndependentMDSObjectiveFunctionTester::test_hessian - AttributeError: 'TimeIndependentMDSObjectiveFunctionTester' object has no attribute 'enable_hessian_tests'

FAILED test/unit/objects/test_objectivefns.py::TimeDependentMDSObjectiveFunctionTester::test_lsvec - AttributeError: 'TimeDependentMDSObjectiveFunctionTester' object has no attribute 'objfns'
FAILED test/unit/objects/test_objectivefns.py::TimeDependentMDSObjectiveFunctionTester::test_dlsvec - AttributeError: 'TimeDependentMDSObjectiveFunctionTester' object has no attribute 'objfns'
================================================== 18 failed, 1820 passed, 76 skipped, 159435 warnings in 212.70s (0:03:32) ===================================================

@rileyjmurray
Copy link
Collaborator Author

It seems that all failing tests mentioned in my last comment where due to incomplete classes having the Tester suffix. I changed Tester to TesterBase on the offending classes. I also added a function that raises a NotImplementedError to clearly indicate that these classes are in fact base classes.

@rileyjmurray
Copy link
Collaborator Author

IMO this is ready to merge.

@sserita
Copy link
Contributor

sserita commented Nov 13, 2023

Thanks, I'll try to look at this in the next few days.

Copy link
Contributor

@sserita sserita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the nice work!

@sserita sserita merged commit 5c0bc65 into develop Nov 17, 2023
13 checks passed
@sserita sserita deleted the help-pytest-find-tests branch November 17, 2023 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants