pytest-dev / pytest-random-order

pytest plugin to randomise the order of tests with some control over the randomness
MIT License
67 stars 10 forks source link

pytest internal error AttributeError: 'Namespace' object has no attribute 'failedfirst' if cacheprovider plugin disabled #54

Closed jhanm12 closed 9 months ago

jhanm12 commented 9 months ago

pytest-random-order - Always assumes that the cacheprovider plugin is always active. It fails in this below case:

In an env:

(env)$ pip list | grep pytest
allure-pytest                 2.13.2
cafy-pytest                   0.1.0
pytest                        7.4.3
pytest-cov                    4.1.0
pytest-ordering               0.6
pytest-random-order           1.1.0
pytest-repeat                 0.9.3

If we run a pytest script with this -p no:cacheprovider

pytest <Any Basic .py Pytest Script> -p no:cacheprovider

Had to disable random order plugin - To make it work when disable cache parameter is set.

-p no:random_order

Please Refer this : https://github.com/pytest-dev/pytest/issues/9250

jhanm12 commented 9 months ago

random order works fine if "-p no:cacheprovider" is not provided.

Working Cases:

pytest test_dummy.py (Works) pytest test_dummy.py --random-order (Works - Random Order Enabled) pytest test_dummy.py -p no:cacheprovider -p no:random_order (Works - Both Cache & Random Order Disabled)

Not Working Cases:

pytest test_dummy.py -p no:cacheprovider (Does Not Work - Only Cache Disabled) pytest test_dummy.py -p no:cacheprovider --random-order (Does Not Work - Cache Disabled & Random Order Enabled)

jhanm12 commented 9 months ago

@jbasko Can you please check this.