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

TST: convert unittests to pytest #601

Merged
merged 2 commits into from Oct 23, 2023
Merged

Conversation

martinfleis
Copy link
Member

Closes #595

Mostly done automagically using pytestify with some of manual fixes. I also occasionally sorted imports with ruff and changed Test_Rook to TestRook to make ruff happy but not consistently.

I have removed all optional skips based on missing pandas, geopandas or shapely since all are hard dependencies now.

@codecov
Copy link

codecov bot commented Oct 23, 2023

Codecov Report

Merging #601 (9805c84) into main (1689fcc) will increase coverage by 83.9%.
The diff coverage is 97.6%.

Impacted file tree graph

@@           Coverage Diff           @@
##           main    #601      +/-   ##
=======================================
+ Coverage      0   83.9%   +83.9%     
=======================================
  Files         0     127     +127     
  Lines         0   14804   +14804     
=======================================
+ Hits          0   12420   +12420     
- Misses        0    2384    +2384     
Files Coverage Δ
libpysal/cg/ops/tests/test_accessors.py 100.0% <100.0%> (ø)
libpysal/cg/ops/tests/test_tabular.py 100.0% <100.0%> (ø)
libpysal/cg/tests/test_ashapes.py 97.4% <100.0%> (ø)
libpysal/cg/tests/test_geoJSON.py 100.0% <100.0%> (ø)
libpysal/cg/tests/test_locators.py 100.0% <100.0%> (ø)
libpysal/cg/tests/test_polygonQuadTreeStructure.py 100.0% <100.0%> (ø)
libpysal/cg/tests/test_rtree.py 100.0% <100.0%> (ø)
libpysal/cg/tests/test_segmentLocator.py 100.0% <100.0%> (ø)
libpysal/cg/tests/test_sphere.py 100.0% <100.0%> (ø)
libpysal/cg/tests/test_voronoi.py 100.0% <100.0%> (ø)
... and 41 more

... and 76 files with indirect coverage changes

@@ -18,8 +18,8 @@


@skipIf(GEOPANDAS_EXTINCT, "Geopandas is missing, so test will not run.")
class Test_Alpha_Shapes(TestCase):
def setUp(self):
class Test_Alpha_Shapes:
Copy link
Member

Choose a reason for hiding this comment

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

I also occasionally sorted imports with ruff and changed Test_Rook to TestRook to make ruff happy but not consistently.

So are we OK with underscored class names for now or in general? I have no problem with "for now," especially not in this PR, but probably we'll want to take care of that soon. And I can loop that in with #589.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd change private bits like tests. We can have a discussion about public but I would probably keep those intact to avoid unnecessary deprecations.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed.

Copy link
Member

@jGaboardi jGaboardi left a comment

Choose a reason for hiding this comment

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

@martinfleis Absolutely amazing. Never heard of pytestify.

@jGaboardi jGaboardi merged commit b6a03f2 into pysal:main Oct 23, 2023
10 checks passed
@martinfleis
Copy link
Member Author

Never heard of pytestify.

Neither did I until today 😄. It is not perfect but goes a long way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert all testing from unittest to pytest.
2 participants