pytest-dev / pytest-dev/pytest

compat::getfuncargnames removes self from instance method twice by mistake

Open
#6,750 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic: fixtures type: bug
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

  • a detailed description of the bug or suggestion
    I have a pyfuncitem which is an instance method and its signature looks like this:
    def run_test(self, testbed_obj): <== This testbed_obj is a fixture
    When getfuncargnames got called to return the argnames, it removed this testbed_obj in line 168 of compat.py, which I think is wrong, because the parameter got from line 146 of compat.py has self removed from the signature.
  • output of pip list from the virtual environment you are using
    Package Version Location

astroid 1.4.9
atomicwrites 1.3.0
attrs 19.3.0
automatos-tool-library 15
avro 1.9.1
backports.functools-lru-cache 1.6.1
backports.shutil-get-terminal-size 1.0.0
backports.ssl-match-hostname 3.7.0.1
bcrypt 3.1.7
certifi 2019.11.28
cffi 1.13.2
chardet 3.0.4
colorama 0.4.3
configparser 4.0.2
confluent-kafka 1.3.0
contextlib2 0.6.0.post1
coverage 5.0.3
cryptography 2.8
decorator 4.4.1
dicttoxml 1.7.4
docker-py 1.10.6
docker-pycreds 0.4.0
enum34 1.1.6
filelock 3.0.12
flake8 3.6.0
FormEncode 1.3.1
funcsigs 1.0.2
future 0.18.2
futures 3.3.0
gitdb2 2.0.6
GitPython 2.1.14
httpretty 0.9.7
idna 2.8
importlib-metadata 1.5.0
ipaddress 1.0.23
isort 4.3.21
lazy-object-proxy 1.4.3
logutils 0.3.5
mccabe 0.6.1
mock 3.0.5
more-itertools 5.0.0
ndg-httpsclient 0.5.1
packaging 20.1
paramiko 2.7.1
pathlib2 2.3.5
pip 20.0.2
pluggy 0.13.1
py 1.8.1
pyasn1 0.4.8
pybase64 0.5.0
pycodestyle 2.4.0
pycparser 2.19
pycyclone 0.9.277
pyflakes 2.0.0
pylint 1.6.4
PyNaCl 1.3.0
pyOpenSSL 19.1.0
pyparsing 2.4.6
pysftp 0.2.9
pytest 4.6.9
pytest-html 1.22.0
pytest-metadata 1.8.0
python-nmap 0.6.1
pytz 2019.3
pyvmomi 6.7.3
PyYAML 5.3
redis 2.10.6
requests 2.22.0
requests-mock 1.6.0
requests-toolbelt 0.9.1
retrying 1.3.3
scandir 1.10.0
setuptools 44.0.0
setuptools-scm 3.2.0
six 1.14.0
smmap2 2.0.5
spur 0.3.21
suds 0.4
toml 0.10.0
tox 3.14.3
urllib3 1.23
uuid 1.30
validators 0.11.3
virtualenv 16.7.9
waiting 1.4.1
walrus 0.3.5
wcwidth 0.1.8
websocket-client 0.57.0
wheel 0.34.2
wrapt 1.11.2
xmltodict 0.12.0
zipp 1.1.0
We have some private Python packages that I don't want to list here.

  • pytest and operating system versions
    pytest 4.6.9
    Windows 10
  • minimal example if possible
    class MyTest(BaseTestCase):
    def run_test(self, testbed_obj):

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in compat.py around lines 146 and 168 and trace getfuncargnames for the provided MyTest.run_test(self, testbed_obj) example. Verify the returned argument names with an instance method and add coverage showing that testbed_obj is retained rather than removed twice; done when the regression passes under pytest 4.6.9.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.