Skip to content

Improve test suite, reorganize to platform classes - #25

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:main
Jul 20, 2021
Merged

gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:main

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

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

@codecov-commenter

codecov-commenter commented Jul 20, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #25 (63aa7bb) into main (9735757) will increase coverage by 7.12%.
The diff coverage is 88.82%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #25      +/-   ##
==========================================
+ Coverage   83.69%   90.82%   +7.12%     
==========================================
  Files           7       12       +5     
  Lines         411      447      +36     
  Branches       85       45      -40     
==========================================
+ Hits          344      406      +62     
+ Misses         47       28      -19     
+ Partials       20       13       -7     
Flag Coverage Δ
tests 90.60% <88.55%> (+7.39%) ⬆️

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

Impacted Files Coverage Δ
src/platformdirs/windows.py 73.11% <73.11%> (ø)
src/platformdirs/unix.py 77.77% <77.77%> (ø)
src/platformdirs/__init__.py 93.33% <90.00%> (+14.60%) ⬆️
src/platformdirs/android.py 100.00% <100.00%> (ø)
src/platformdirs/api.py 100.00% <100.00%> (ø)
src/platformdirs/macos.py 100.00% <100.00%> (ø)
tests/conftest.py 100.00% <100.00%> (ø)
tests/test_android.py 100.00% <100.00%> (ø)
tests/test_api.py 100.00% <100.00%> (ø)
tests/test_comp_with_appdirs.py 100.00% <100.00%> (ø)
... and 6 more

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 9735757...63aa7bb. Read the comment docs.

Comment thread docs/conf.py
"undoc-members": True,
}
autodoc_typehints = "signature"
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should set default_role = "any" to get rid of all the :func: and :meth: role noise.

@RonnyPfannschmidt

Copy link
Copy Markdown

i took a initial look, and i don't see the need to have classes here at all, most of the behaviour is contained to modules in a way that should make a non-class using split straightforward

at first none of the classes have sufficient state/behaviour that makes them a good choice, i'd really like to see a functional approach here

Comment thread src/platformdirs/macos.py
params.append(self.appname)
if self.version:
params.append(self.version)
return os.path.join(of, *params)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why is of still passed if its part of params?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I guess shouldn't but why are the tests not catching this bug 🤔

@gaborbernat

gaborbernat commented Jul 20, 2021 •

Copy link
Copy Markdown
Member Author

i took a initial look, and i don't see the need to have classes here at all, most of the behaviour is contained to modules in a way that should make a non-class using split straightforward

As you might imagine, I strongly disagree. The class is useful in this case to:

  • clearly define the interface for a platform
  • ensure when implementing a new platform, we implement all abstract interface elements
  • group platform level implementation logic in a single module,
  • makes code easier to maintain because you don't have to pass along arguments every time (fewer lines to maintain to pass along arguments, e.g. on macos the roaming arg is never needed),
  • will provide an easy access point to add platform-independent path variant methods (e.g. we can define user_site_path in the base class, and all platforms get it for free).

Also, the classes are not strictly new. Before, we just did an awkward dance of mapping class calls to module-level private method calls.

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.

5 participants