ipwnponies / pytest-antilru

Bust functools.lru_cache when running pytest to avoid test pollution
MIT License
22 stars 3 forks source link

[bug] setup.py pytest entrypoints bug collides with other pytest plugins #22

Closed Kache closed 2 years ago

Kache commented 2 years ago

https://github.com/ipwnponies/pytest-antilru/blob/6531862cd7194d8344fd0c38bdcfb61730ec08f6/setup.py#L22=

Should instead be something like:

    entry_points={'pytest11': ['antilru = pytest_antilru.main']},

e.g. what pytest-mock and pytest-asyncio do

The output of:

pytest --trace-config

Will show what name a plugin as been registered with, and pytest-antilru has been registered with name_of_plugin, which collides with other pytest plugins that have made the same mistake, e.g. https://github.com/aresponses/aresponses/issues/71

ipwnponies commented 2 years ago

Such is what happens when example code tries to be realistic but also isn't blatantly example-y enough. Thanks for discovering, fixing, and also fixing at the root (pytest documentation)!

Kache commented 2 years ago

👍 have you taken a look at #23?

ipwnponies commented 2 years ago

@Kache this is on my TODO list, has not been forgotten. Life has been hectic. I'm shooting to get to this in a few days, by end of this week.

ipwnponies commented 2 years ago

Reproed issue with .tox/py39-pytest7/bin/pytest --trace-config:

setuptools registered plugins:
  pytest-antilru-1.1.0 at /Users/ipwnponies/repos/pytest-antilru/.tox/py39-pytest7/lib/python3.9/site-packages/pytest_antilru/main.py
active plugins:
    4562081680          : <_pytest.config.PytestPluginManager object at 0x10febd790>
    pytestconfig        : <_pytest.config.Config object at 0x11077dbb0>
    mark                : /Users/ipwnponies/repos/pytest-antilru/.tox/py39-pytest7/lib/python3.9/site-packages/_pytest/mark/__init__.py
    main                : /Users/ipwnponies/repos/pytest-antilru/.tox/py39-pytest7/lib/python3.9/site-packages/_pytest/main.py
    runner              : /Users/ipwnponies/repos/pytest-antilru/.tox/py39-pytest7/lib/python3.9/site-packages/_pytest/runner.py
    fixtures            : /Users/ipwnponies/repos/pytest-antilru/.tox/py39-pytest7/lib/python3.9/site-packages/_pytest/fixtures.py
    ...
    threadexception     : /Users/ipwnponies/repos/pytest-antilru/.tox/py39-pytest7/lib/python3.9/site-packages/_pytest/threadexception.py
    faulthandler        : /Users/ipwnponies/repos/pytest-antilru/.tox/py39-pytest7/lib/python3.9/site-packages/_pytest/faulthandler.py
    name_of_plugin      : /Users/ipwnponies/repos/pytest-antilru/.tox/py39-pytest7/lib/python3.9/site-packages/pytest_antilru/main.py
ipwnponies commented 2 years ago

New patch is uploaded to pypi: https://github.com/ipwnponies/pytest-antilru/releases/tag/v1.1.1 and https://pypi.org/project/pytest-antilru/1.1.1/

Thanks for your patience!