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

Replace tmpdir with tmp_path in tests #126

Merged
merged 1 commit into from
Jan 18, 2021
Merged

Replace tmpdir with tmp_path in tests #126

merged 1 commit into from
Jan 18, 2021

Conversation

eumiro
Copy link
Contributor

@eumiro eumiro commented Jan 18, 2021

As discussed in #125, this replaces tmpdir with tmp_path in all tests (and tmpdir_factory with tmp_path_factory), because the py.path used as tmpdir is in maintenance mode and pytest is also migrating to tmp_path.

This adds some code though because py.path had special functions for almost everything and here they have to be supplied with os and shutil.

Next step would be replacing all os.path/glob/open calls in the main code with pathlib.Path.

@codecov-io
Copy link

codecov-io commented Jan 18, 2021

Codecov Report

Merging #126 (f685b43) into master (4ebb566) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #126   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          466       467    +1     
=========================================
+ Hits           466       467    +1     
Impacted Files Coverage Δ
graphviz/tools.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4ebb566...fba09fa. Read the comment docs.

Copy link
Owner

@xflr6 xflr6 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 PR.

tests/conftest.py Outdated Show resolved Hide resolved
tests/test_backend.py Outdated Show resolved Hide resolved
tests/test_backend.py Outdated Show resolved Hide resolved
tests/test_backend.py Outdated Show resolved Hide resolved
@eumiro
Copy link
Contributor Author

eumiro commented Jan 18, 2021

Thank your for the review, everything updated. Should I squash it to a single commit or do you want to do it in the merge?

Copy link
Owner

@xflr6 xflr6 left a comment

Choose a reason for hiding this comment

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

Thanks. Great work (minor styling comments left)!

Feel free to squash into a single commit (force-push), and maybe we can briefly mention py vs. pathlib in the commit description?

Thanks for your contribution.

graphviz/tools.py Outdated Show resolved Hide resolved
tests/test_backend.py Show resolved Hide resolved
tests/test_backend.py Outdated Show resolved Hide resolved
tests/test_tools.py Show resolved Hide resolved
pytest's tmpdir uses py.path which is in maintenance mode.
Everyone, pytest included, is migrating to tmp_path
returning a stdlib's pathlib.Path object.

I also moved the test data file dot_red.png to an extra
testdata directory.
@eumiro
Copy link
Contributor Author

eumiro commented Jan 18, 2021

@xflr6 thank you for the review, I have committed your latest notes as well and squashed to a single commit with a longer description.

@xflr6 xflr6 merged commit fba09fa into xflr6:master Jan 18, 2021
@eumiro eumiro deleted the tmp_path branch January 18, 2021 20:10
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.

3 participants