Skip to content

Unix: Fallback to default if XDG environment variable is empty - #30

Merged
gaborbernat merged 8 commits into
tox-dev:mainfrom
papr:fix-#29
Jul 29, 2021
Merged

gaborbernat merged 8 commits into
tox-dev:mainfrom
papr:fix-#29

Conversation

@papr

@papr papr commented Jul 28, 2021 •

Copy link
Copy Markdown
Contributor

Fixes #29 using https://github.com/pypa/pip/blob/867bbb00ccb0506095e19a0e111ce06ce71a2495/tools/vendoring/patches/appdirs.patch#L47-L54 as a reference implementation.

Open questions:

  • How to test this properly?
  • How to test compatibility with appdirs if appdirs is not implementing this behavior?

Todo:

  • Tests
  • Changelog

@codecov-commenter

codecov-commenter commented Jul 28, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #30 (9543cb1) into main (f9c2074) will increase coverage by 3.18%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #30      +/-   ##
==========================================
+ Coverage   90.70%   93.89%   +3.18%     
==========================================
  Files          12       13       +1     
  Lines         495      524      +29     
  Branches       44       44              
==========================================
+ Hits          449      492      +43     
+ Misses         32       26       -6     
+ Partials       14        6       -8     
Flag Coverage Δ
tests 93.51% <100.00%> (+3.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/platformdirs/unix.py 96.82% <100.00%> (+22.22%) ⬆️
tests/test_unix.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 f9c2074...9543cb1. Read the comment docs.

Comment thread src/platformdirs/unix.py Resolved
@papr

papr commented Jul 28, 2021 •

Copy link
Copy Markdown
Contributor Author

I will need help with the failing type checks. I am able to run tox -e type but it is raising more errors than logged in the Github Actions. Some of them affect files that I did not change here but in #27 where the type check ran successfully. What am I missing?

Signed-off-by: Bernát Gábor <[email protected]>

@gaborbernat gaborbernat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree of inline-ing the new functionality, because we don't want to call the expesnive relatively os.path.expanduser unless we must. The tests just needed some type annotation, and you cannot use the Platformdir class directly as type because is dynamically calculated and mypy cannot deduce it. You'd need to type it as the ABC variant, but in this case we can just always run the tests on all platforms and annotate it as Unix, because the functionality you've added is tied to the Unix class, not anything else in the __init__.py file.

@gaborbernat
gaborbernat requested a review from ofek July 28, 2021 23:25
Signed-off-by: Bernát Gábor <[email protected]>
@gaborbernat
gaborbernat merged commit 0a61690 into tox-dev:main Jul 29, 2021
@papr
papr deleted the fix-#29 branch July 29, 2021 07:49
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.

Linux: Empty environment variables should use defaults

4 participants