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

issue1625, rename getfuncargvalue to getfixturevalue #1626

Merged

Conversation

tomviner
Copy link
Contributor

Fix for #1625

getfuncargvalue will be deprecated but will still be supported for the moment.

@tomviner tomviner force-pushed the issue1625/rename-getfuncargvalue branch from e32b97c to 0c74f4b Compare June 21, 2016 10:22
@coveralls
Copy link

coveralls commented Jun 21, 2016

Coverage Status

Coverage increased (+0.0009%) to 92.206% when pulling 0c74f4b on tomviner:issue1625/rename-getfuncargvalue into 5d8d1db on pytest-dev:master.

@coveralls
Copy link

coveralls commented Jun 21, 2016

Coverage Status

Coverage increased (+0.0009%) to 92.206% when pulling 0c74f4b on tomviner:issue1625/rename-getfuncargvalue into 5d8d1db on pytest-dev:master.

@@ -17,11 +17,16 @@
is specified on the command line together with the ``--pyargs``
option. Thanks to `@taschini`_ for the PR (`#1597`_).

* Rename ``getfuncargvalue`` to ``getfixturevalue``. `getfuncargvalue`
Copy link
Member

Choose a reason for hiding this comment

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

Should probably also use double-backticks with the second getfuncargvalue as well?

@The-Compiler
Copy link
Member

Might make sense to add a test for the old name as well - and a note in the doc somewhere, as well as a changelog entry?

@blueyed
Copy link
Contributor

blueyed commented Jun 21, 2016

We had some discussion about skipping this renaming, if it is supposed to be deprecated later on altogether anyway?! (because fixture factories would be the recommended way)
Because by making it more visible and mentioning it in changelog etc this rather encourages to use it.

@The-Compiler
Copy link
Member

I think @hpk42 also mentioned it's kind of impossible to deprecate/remove it since there are valid usecases without alternatives, and I agree. Some examples:

  • pytest itself uses it so you can use getfixture() in doctests
  • pytest-bdd heavily uses it, and I'm quite sure it's legitimate use as it dynamically generates/uses fixtures (cc @olegpidsadnyi)
  • This snippet uses it to parametrize something with two different fixtures.
  • A lot of users use it

@tomviner tomviner force-pushed the issue1625/rename-getfuncargvalue branch from 0c74f4b to d3a4b2a Compare June 21, 2016 16:03
@coveralls
Copy link

coveralls commented Jun 21, 2016

Coverage Status

Coverage increased (+0.004%) to 92.234% when pulling d3a4b2a on tomviner:issue1625/rename-getfuncargvalue into 406355f on pytest-dev:master.

@tomviner tomviner force-pushed the issue1625/rename-getfuncargvalue branch from d3a4b2a to 2e9b714 Compare June 21, 2016 16:11
@coveralls
Copy link

coveralls commented Jun 21, 2016

Coverage Status

Coverage increased (+0.004%) to 92.234% when pulling 2e9b714 on tomviner:issue1625/rename-getfuncargvalue into 406355f on pytest-dev:master.

@tomviner tomviner force-pushed the issue1625/rename-getfuncargvalue branch from 2e9b714 to 16838af Compare June 21, 2016 16:40
@@ -2723,3 +2726,5 @@ def test_1(arg1):
*def arg1*
""")

def test_getfuncargvalue_is_deprecated(request):
pytest.deprecated_call(request.getfuncargvalue, 'tmpdir')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For some reason the code above passes, but this fails:

def test_getfuncargvalue_is_deprecated_with(request):
    with pytest.deprecated_call():
        request.getfuncargvalue('tmpdir')

@tomviner
Copy link
Contributor Author

Fixes added:

  • Add DeprecationWarning for usage of getfixturevalue
  • DeprecationWarning is sent
  • Parametrize test_getfixturevalue by getfixturevalue and getfuncargvalue, to ensure old version still works.

@coveralls
Copy link

coveralls commented Jun 21, 2016

Coverage Status

Coverage increased (+0.004%) to 92.234% when pulling 16838af on tomviner:issue1625/rename-getfuncargvalue into 61ede09 on pytest-dev:master.

@nicoddemus
Copy link
Member

@tomviner this one is in a conflicted state as well. 😁

@tomviner tomviner force-pushed the issue1625/rename-getfuncargvalue branch from 16838af to 7cc1148 Compare June 22, 2016 07:36
@@ -2723,108 +2726,5 @@ def test_1(arg1):
*def arg1*
""")

class TestParameterizedSubRequest:
Copy link
Member

Choose a reason for hiding this comment

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

Why were these tests removed?

@tomviner tomviner force-pushed the issue1625/rename-getfuncargvalue branch from 7cc1148 to 3719e0c Compare June 22, 2016 07:41
@coveralls
Copy link

coveralls commented Jun 22, 2016

Coverage Status

Coverage decreased (-0.1%) to 92.139% when pulling 3719e0c on tomviner:issue1625/rename-getfuncargvalue into 144dc12 on pytest-dev:master.

@tomviner tomviner force-pushed the issue1625/rename-getfuncargvalue branch from 3719e0c to fda838b Compare June 22, 2016 07:44
@tomviner
Copy link
Contributor Author

@nicoddemus rebased

@nicoddemus
Copy link
Member

Hmmm lots of breakage now 😬, would you take a look please?

@tomviner tomviner force-pushed the issue1625/rename-getfuncargvalue branch 2 times, most recently from 0645648 to 1f059c0 Compare June 22, 2016 11:28
@tomviner
Copy link
Contributor Author

@nicoddemus this PR was still using the old method: getfuncargvalue, and since that makes it one level deeper in the call stack, the frame traversal broke.

@coveralls
Copy link

coveralls commented Jun 22, 2016

Coverage Status

Coverage increased (+0.004%) to 92.242% when pulling 1f059c0 on tomviner:issue1625/rename-getfuncargvalue into 24179dc on pytest-dev:master.

@coveralls
Copy link

coveralls commented Jun 22, 2016

Coverage Status

Coverage increased (+0.004%) to 92.242% when pulling 1f059c0 on tomviner:issue1625/rename-getfuncargvalue into 24179dc on pytest-dev:master.

seanh added a commit to hypothesis/h that referenced this pull request Apr 9, 2018
getfuncargvalue was deprecated in pytest 3.0.0:

* https://docs.pytest.org/en/latest/changelog.html?highlight=getfuncargvalue#id329
* pytest-dev/pytest#1626

The latest, which we use, is pytest 3.5.0.
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.

5 participants