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

Fix some broken tests (and improve developer experience) #91

Merged
merged 5 commits into from
Dec 20, 2024

Conversation

n-takumasa
Copy link
Contributor

@n-takumasa n-takumasa commented Dec 20, 2024

Ruff claims some errors, but fixes are not included in this PR.

Additional information:
The number of stencil elements differs between windows and macos.
https://github.com/n-takumasa/findiff/actions/runs/12427590734/job/34697664219

tests/test_bugs.py:132: in assert_dict_almost_equal
    self.assertEqual(len(actual), len(expected))
E   AssertionError: 4 != 5
        actual     = {(-2, 0): 0.08333333333333333,
 (-1, 0): -0.6666666666666666,
 (1, 0): 0.6666666666666666,
 (2, 0): -0.08333333333333333}
        expected   = {(np.int64(-2), np.int64(0)): np.float64(0.08333333333333334),
 (np.int64(-1), np.int64(0)): np.float64(-0.6666666666666667),
 (np.int64(0), np.int64(0)): np.float64(2.379049338482478e-16),
 (np.int64(1), np.int64(0)): np.float64(0.6666666666666665),
 (np.int64(2), np.int64(0)): np.float64(-0.08333333333333333)}
        places     = 7
        self       = <tests.test_bugs.TestOldBugs testMethod=test_accuracy_should_be_passed_down_to_stencil>
=========================== short test summary info ============================
FAILED tests/test_bugs.py::TestOldBugs::test_accuracy_should_be_passed_down_to_stencil - AssertionError: 4 != 5
=================== 1 failed, 157 passed, 3 skipped in 1.75s ===================
Error: Process completed with exit code 1.


[tool.coverage]
run.source_pkgs = ["findiff", "tests"]
Copy link
Owner

Choose a reason for hiding this comment

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

Why include "tests" in source_pkgs? In the workflow, the command that is called for coverage is:

pytest --cov=findiff --cov-report=html tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I consider it a best practice because unexecuted lines in a test file smell like a bug.
This can detect function name collisions. (test_calc_accuracy_from_offsets_symbolic)

@maroba maroba merged commit e5c623d into maroba:master Dec 20, 2024
9 checks passed
Copy link

codecov bot commented Dec 20, 2024

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@n-takumasa n-takumasa deleted the dx branch December 22, 2024 23:27
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.

2 participants