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

Change -p so it is possible to early load setuptools plugins #4727

Merged
merged 1 commit into from
Feb 25, 2019

Conversation

nicoddemus
Copy link
Member

@nicoddemus nicoddemus commented Feb 6, 2019

Related to pytest-dev/pluggy#189

Fixes #4718

Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

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

while this works, this breaks refactoring where a plugin is moved but the plugin name doesn't change

we definitively should look if a plugin name is a entrypoint instead

@nicoddemus
Copy link
Member Author

while this works, this breaks refactoring where a plugin is moved but the plugin name doesn't change

Hmm that did not occur to me, could you provide an example?

we definitively should look if a plugin name is a entrypoint instead

Not sure I get this, can you elaborate?

@RonnyPfannschmidt
Copy link
Member

@nicoddemus

while this works, this breaks refactoring where a plugin is moved but the plugin name doesn't change

Hmm that did not occur to me, could you provide an example?

if someone moves xdist = xdist.pytest_plugin to say xdist = xdist.core then a user would have to change invocations to keep it working, from my pov that limitation is something we should try hard to avoid

we definitively should look if a plugin name is a entrypoint instead

Not sure I get this, can you elaborate?

when passing -p pytest_cov we should look if there is a setuptools entrypoint with that name as well

@nicoddemus
Copy link
Member Author

Oh got it! Sure sure, that makes much more sense. 👍 I was not 100% happy with the solution either because it is not explicitly obvious what the user should be passing.

I will get to it.

@codecov
Copy link

codecov bot commented Feb 7, 2019

Codecov Report

Merging #4727 into features will increase coverage by 0.02%.
The diff coverage is 96.77%.

Impacted file tree graph

@@             Coverage Diff              @@
##           features    #4727      +/-   ##
============================================
+ Coverage     95.61%   95.64%   +0.02%     
============================================
  Files           113      113              
  Lines         25163    25216      +53     
  Branches       2498     2504       +6     
============================================
+ Hits          24060    24117      +57     
+ Misses          776      775       -1     
+ Partials        327      324       -3
Flag Coverage Δ
#docs 29.53% <8.06%> (+0.03%) ⬆️
#doctesting 29.53% <8.06%> (+0.03%) ⬆️
#linting 29.53% <8.06%> (+0.03%) ⬆️
#linux 95.48% <96.77%> (+0.02%) ⬆️
#nobyte 92.21% <96.77%> (+0.01%) ⬆️
#numpy 93% <96.77%> (+0.02%) ⬆️
#pexpect 41.88% <8.06%> (-0.08%) ⬇️
#pluggymaster 93.56% <96.77%> (+0.08%) ⬆️
#py27 93.67% <96.77%> (+0.02%) ⬆️
#py34 91.6% <96.77%> (+0.01%) ⬆️
#py35 91.63% <96.77%> (+0.01%) ⬆️
#py36 91.65% <96.77%> (+0.01%) ⬆️
#py37 93.82% <96.77%> (+0.03%) ⬆️
#trial 93% <96.77%> (+0.02%) ⬆️
#windows 93.57% <96.77%> (ø) ⬆️
#xdist 93.7% <96.77%> (ø) ⬆️
Impacted Files Coverage Δ
src/_pytest/helpconfig.py 97.29% <ø> (ø) ⬆️
src/_pytest/config/__init__.py 93.82% <100%> (+0.02%) ⬆️
testing/acceptance_test.py 98.01% <100%> (+0.15%) ⬆️
testing/test_config.py 99.46% <87.5%> (-0.17%) ⬇️
src/_pytest/terminal.py 91.74% <0%> (+0.82%) ⬆️

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 c9e6943...a020727. Read the comment docs.

if attempt_entry_point:
infos = len(self.list_plugin_distinfo())
new_infos = self.load_setuptools_entrypoints("pytest11", name=modname)
loaded = new_infos > infos
Copy link
Member Author

Choose a reason for hiding this comment

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

😷

Copy link
Member

Choose a reason for hiding this comment

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

this allows 2 extra kex features a s followup

a) putting pytests own plugins into entrypoints (using a own entrypoint limited to pytest core)
b) inventing a naming mechanism for plugins that do not autoload, but should have a short name to autoload

it may be necessary to go a step further on pluggy and externalizing the plugin loader concept for a better behavioral envelope

nicoddemus added a commit to nicoddemus/pluggy that referenced this pull request Feb 8, 2019
@nicoddemus nicoddemus force-pushed the early-load-4718 branch 2 times, most recently from 1f64faa to e30a8b5 Compare February 8, 2019 22:44
@nicoddemus
Copy link
Member Author

Applied all the changes I wanted.

This works locally when using together with pytest-dev/pluggy#189, so we will have to wait for that to get merged and released before we can merge this one. 👍

@nickwilliams-eventbrite

Excited to see this land! Thanks for all of this!

@nicoddemus nicoddemus changed the title WIP Change -p so it is possible to early load setuptools plugins Change -p so it is possible to early load setuptools plugins Feb 24, 2019
@nicoddemus
Copy link
Member Author

Rebased now that pluggy 0.9 is out. 👍

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