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

Facing issue with pytest plugins from entry_points of multiple packages #12916

Open
4 tasks done
satya-alapati-einfochips opened this issue Oct 25, 2024 · 4 comments
Open
4 tasks done
Labels
stale status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity

Comments

@satya-alapati-einfochips
Copy link

satya-alapati-einfochips commented Oct 25, 2024

My entry_points of multiple packages looks like this,
P1 -

    entry_points=
    {
        "pytest11": [
            "P1_module1 = MainModule.MidModule.SubModule.p1plugin1",
            "P1_module2 = MainModule.MidModule.SubModule.p1plugin2",
        ]
    },

P2 -

    entry_points=
    {
        "pytest11": [
            "P2_module1 = MainModule.MidModule.SubModule.p2plugin1",
            "P2_module2 = MainModule.MidModule.SubModule.p2plugin2",
        ]
    },

Here p1plugin2 is logger module of P1, p2plugin2 is logger module of P2.

I want to import p1plugin2, log data using it's functionality. Same for p2plugin2
If I only have p1plugin2, logs are captured in P1 log files. BUT when I have p2plugin2, logs are by default storing in P2 log files irrespective of importing and using p1plugin2.

Even they both are logger modules, I have given different file names and key names in entry_points. Still seeing same issue,

  1. Is it due to similar functionality in both p1plugin2 and p2plugin2 ??
  2. Or based on the order of setuptools registered plugins ? Alphabetically, p2plugin2 is coming first in setuptools registered plugins

Pip and pytest versions,

Package                       Version
----------------------------- ------------
aenum                         3.1.15
alabaster                     0.7.16
appdirs                       1.4.4
Appium-Python-Client          4.0.0
astroid                       3.3.5
attrs                         24.2.0
babel                         2.16.0
bcrypt                        4.2.0
beautifulsoup4                4.12.3
brainstem                     2.9.2
bstestengine                  3.3.11.4
certifi                       2024.8.30
cffi                          1.17.1
charset-normalizer            3.4.0
colorama                      0.4.6
coverage                      5.5
cryptography                  43.0.3
Cython                        3.0.11
dill                          0.3.9
docutils                      0.20.1
exceptiongroup                1.2.2
func-timeout                  4.3.5
future                        1.0.0
git-pylint-commit-hook        2.6.1
h11                           0.14.0
hidapi                        0.11.0.post2
idna                          3.10
imagesize                     1.4.1
iniconfig                     2.0.0
ipa-deploy                    2.0.1
isort                         5.13.2
janus                         1.0.0
Jinja2                        3.1.4
MarkupSafe                    3.0.2
mccabe                        0.7.0
mock                          5.1.0
msgtools                      0.29.51
numpy                         1.26.1
oschmod                       0.3.12
outcome                       1.3.0.post0
packaging                     24.1
paramiko                      3.4.0
pip                           24.2
platformdirs                  4.3.6
pluggy                        1.5.0
plumbum                       1.9.0
protobuf                      3.20.1
psutil                        5.9.5
py                            1.11.0
pycparser                     2.22
Pygments                      2.18.0
PyJWT                         2.9.0
pylint                        3.3.1
Pyment                        0.3.3
PyNaCl                        1.5.0
Pypubsub                      4.0.3
pyserial                      3.5
PySocks                       1.7.1
pytest                        7.4.4
pytest-html                   3.2.0
pytest-metadata               2.0.4
pytest-order                  1.3.0
pytest-reraise                2.1.1
pytest-variables              2.0.0
python-slugify                8.0.4
PyVISA                        1.13.0
PyVISA-py                     0.6.0
pywin32                       308
PyYAML                        6.0.1
requests                      2.32.3
rpyc                          4.0.1
scipy                         1.13.0
selenium                      4.25.0
setuptools                    57.0.0
sniffio                       1.3.1
snowballstemmer               2.2.0
sortedcontainers              2.4.0
soupsieve                     2.6
Sphinx                        7.2.6
sphinxcontrib-applehelp       2.0.0
sphinxcontrib-devhelp         2.0.0
sphinxcontrib-htmlhelp        2.1.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          2.0.0
sphinxcontrib-serializinghtml 2.0.0
text-unidecode                1.3
tomli                         2.0.2
tomlkit                       0.13.2
trio                          0.27.0
trio-websocket                0.11.1
typing_extensions             4.12.2
urllib3                       2.2.3
websocket-client              1.8.0
websockets                    13.1
wheel                         0.36.2
wsproto                       1.2.0
  • a detailed description of the bug or problem you are having
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible
@RonnyPfannschmidt RonnyPfannschmidt added the status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity label Oct 25, 2024
@RonnyPfannschmidt
Copy link
Member

Without code or a reproducer, there's nothing we can do

@satya-alapati-einfochips
Copy link
Author

TestUtils entry_points,

entry_points=
        {
            "pytest11": [
                "config_parser = TestUtils.ScriptUtils.config_parser",
                "logger_plugin = TestUtils.LoggerUtils.pytest_plugins.logger_plugin",
            ]
        },

Appium entry_points,

entry_points=
        {
            "pytest11": [
                "A_configparser = Appium.utilities.ScriptUtils.configuration_parser",
                "A_loggerplugin = Appium.utilities.LoggerUtils.pytest_plugins.appium_logger_plugin",
            ]
        },

Using pip installing TestUtils and Appium in E2E repo, In site-packages on E2E venv, I can see the entry points.
venv_E2E/Lib/site-packages/TestUtils-X.X.X.dist-info/entry_points.txt,

[pytest11]
config_parser = TestUtils.ScriptUtils.config_parser
logger_plugin = TestUtils.LoggerUtils.pytest_plugins.logger_plugin

venv_E2E/Lib/site-packages/Appium-X.X.X.dist-info/entry_points.txt

[pytest11]
A_configparser = Appium.utilities.ScriptUtils.configuration_parser
A_loggerplugin = Appium.utilities.LoggerUtils.pytest_plugins.appium_logger_plugin

As per TestUtils config, logs should store in tests_info or tests_debug,

TESTS_INFO_LOG_NAME = "tests_info.log"
TESTS_DEBUG_LOG_NAME = "tests_debug.log"

in the same way, As per Appium config, logs should store in appium_logger info or debug,

TESTS_INFO_LOG_NAME = "appium_logger.info"
TESTS_DEBUG_LOG_NAME = "appium_logger.debug"

I have imported ONLY TestUtils logger obj in code,

from TestUtils.LoggerUtils.wearable_logger import logger

logger.info("-" * 30 + f'FOLLOWING TRACEBACK' + "-" * 30)

So logs should store in tests_info or tests_debug as TestUtils logger obj is used, BUT logs are getting stored in appium_logger which was not even imported or used in the code.

Hope this helps !

@satya-alapati-einfochips
Copy link
Author

image

Copy link
Contributor

github-actions bot commented Nov 9, 2024

This issue is stale because it has the status: needs information label and requested follow-up information was not provided for 14 days.

@github-actions github-actions bot added the stale label Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity
Projects
None yet
Development

No branches or pull requests

2 participants