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

Adjust the implprefix DeprecationWarning's stack level #166

Closed
edmorley opened this issue Jul 29, 2018 · 4 comments
Closed

Adjust the implprefix DeprecationWarning's stack level #166

edmorley opened this issue Jul 29, 2018 · 4 comments

Comments

@edmorley
Copy link

Hi!

In #144 a deprecation warning was added for usage of the implprefix argument.

However the warnings.warn() call doesn't set a stacklevel, which means when the warning is output, the blamed line is in pluggy, rather than the plugin that's using implprefix. For example:
https://travis-ci.org/mozilla/treeherder/jobs/409417404#L895

Passing stacklevel=2 would make it clearer as to where the issue lies, and also mean the correct module path can be referenced in eg pytest's filterwarnings (for downstream projects who enable warnings/deprecation warnings as errors).

Many thanks :-)

CC @tgoodlet

@nicoddemus
Copy link
Member

Thanks @edmorley. Perhaps you would like to open a PR with that change?

@goodboy
Copy link
Contributor

goodboy commented Jul 29, 2018

Yeah please do change it if it will help with the deprecation process 👍

@goodboy
Copy link
Contributor

goodboy commented Oct 16, 2018

@nicoddemus should we get this one in for 0.8.0? I can PR it up if you want.

@nicoddemus
Copy link
Member

@nicoddemus should we get this one in for 0.8.0? I can PR it up if you want.

Oh sorry, missed this one in time for 0.8.0, but no matter, we can issue a new release later.

bors bot referenced this issue in mozilla/normandy Jan 15, 2019
1692: Scheduled weekly dependency update for week 02 r=peterbe a=pyup-bot






### Update [botocore](https://pypi.org/project/botocore) from **1.12.74** to **1.12.78**.


<details>
  <summary>Changelog</summary>
  
  
   ### 1.12.78
   ```
   =======

* api-change:``rds-data``: Update rds-data client to latest version
* api-change:``emr``: Update emr client to latest version
   ```
   
  
  
   ### 1.12.77
   ```
   =======

* api-change:``iot``: Update iot client to latest version
* api-change:``ec2``: Update ec2 client to latest version
* api-change:``codedeploy``: Update codedeploy client to latest version
* api-change:``sagemaker``: Update sagemaker client to latest version
   ```
   
  
  
   ### 1.12.76
   ```
   =======

* api-change:``docdb``: Update docdb client to latest version
* api-change:``redshift``: Update redshift client to latest version
   ```
   
  
  
   ### 1.12.75
   ```
   =======

* api-change:``appmesh``: Update appmesh client to latest version
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/botocore
  - Changelog: https://pyup.io/changelogs/botocore/
  - Repo: https://github.com/boto/botocore
</details>





### Update [mohawk](https://pypi.org/project/mohawk) from **0.3.4** to **1.0.0**.


*The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)*

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/mohawk
  - Repo: https://github.com/kumar303/mohawk
</details>





### Update [pluggy](https://pypi.org/project/pluggy) from **0.8.0** to **0.8.1**.


<details>
  <summary>Changelog</summary>
  
  
   ### 0.8.1
   ```
   =========================

Trivial/Internal Changes
------------------------

- `166 &lt;https://github.com/pytest-dev/pluggy/issues/166&gt;`_: Add ``stacklevel=2`` to implprefix warning so that the reported location of warning is the caller of PluginManager.
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pluggy
  - Changelog: https://pyup.io/changelogs/pluggy/
  - Repo: https://github.com/pytest-dev/pluggy
</details>





### Update [pyparsing](https://pypi.org/project/pyparsing) from **2.3.0** to **2.3.1**.


<details>
  <summary>Changelog</summary>
  
  
   ### 2.3.1
   ```
   -----------------------------
- POSSIBLE API CHANGE: this release fixes a bug when results names were
  attached to a MatchFirst or Or object containing an And object.
  Previously, a results name on an And object within an enclosing MatchFirst
  or Or could return just the first token in the And. Now, all the tokens
  matched by the And are correctly returned. This may result in subtle
  changes in the tokens returned if you have this condition in your pyparsing
  scripts.

- New staticmethod ParseException.explain() to help diagnose parse exceptions
  by showing the failing input line and the trace of ParserElements in
  the parser leading up to the exception. explain() returns a multiline
  string listing each element by name. (This is still an experimental
  method, and the method signature and format of the returned string may
  evolve over the next few releases.)

  Example:
         define a parser to parse an integer followed by an
         alphabetic word
        expr = pp.Word(pp.nums).setName(&quot;int&quot;)
               + pp.Word(pp.alphas).setName(&quot;word&quot;)
        try:
             parse a string with a numeric second value instead of alpha
            expr.parseString(&quot;123 355&quot;)
        except pp.ParseException as pe:
            print_(pp.ParseException.explain(pe))

  Prints:
        123 355
            ^
        ParseException: Expected word (at char 4), (line:1, col:5)
        __main__.ExplainExceptionTest
        pyparsing.And - {int word}
        pyparsing.Word - word

  explain() will accept any exception type and will list the function
  names and parse expressions in the stack trace. This is especially
  useful when an exception is raised in a parse action.

  Note: explain() is only supported under Python 3.

- Fix bug in dictOf which could match an empty sequence, making it
  infinitely loop if wrapped in a OneOrMore.

- Added unicode sets to pyparsing_unicode for Latin-A and Latin-B ranges.

- Added ability to define custom unicode sets as combinations of other sets
  using multiple inheritance.

    class Turkish_set(pp.pyparsing_unicode.Latin1, pp.pyparsing_unicode.LatinA):
        pass

    turkish_word = pp.Word(Turkish_set.alphas)

- Updated state machine import examples, with state machine demos for:
  . traffic light
  . library book checkin/checkout
  . document review/approval

  In the traffic light example, you can use the custom &#39;statemachine&#39; keyword
  to define the states for a traffic light, and have the state classes
  auto-generated for you:

      statemachine TrafficLightState:
          Red -&gt; Green
          Green -&gt; Yellow
          Yellow -&gt; Red

  Similar for state machines with named transitions, like the library book
  state example:

      statemachine LibraryBookState:
          New -(shelve)-&gt; Available
          Available -(reserve)-&gt; OnHold
          OnHold -(release)-&gt; Available
          Available -(checkout)-&gt; CheckedOut
          CheckedOut -(checkin)-&gt; Available

  Once the classes are defined, then additional Python code can reference those
  classes to add class attributes, instance methods, etc.

  See the examples in examples/statemachine

- Added an example parser for the decaf language. This language is used in
  CS compiler classes in many colleges and universities.

- Fixup of docstrings to Sphinx format, inclusion of test files in the source
  package, and convert markdown to rst throughout the distribution, great job
  by Matěj Cepl!

- Expanded the whitespace characters recognized by the White class to include
  all unicode defined spaces. Suggested in Issue 51 by rtkjbillo.

- Added optional postParse argument to ParserElement.runTests() to add a
  custom callback to be called for test strings that parse successfully. Useful
  for running tests that do additional validation or processing on the parsed
  results. See updated chemicalFormulas.py example.

- Removed distutils fallback in setup.py. If installing the package fails,
  please update to the latest version of setuptools. Plus overall project code
  cleanup (CRLFs, whitespace, imports, etc.), thanks Jon Dufresne!

- Fix bug in CaselessKeyword, to make its behavior consistent with
  Keyword(caseless=True). Fixes Issue 65 reported by telesphore.
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pyparsing
  - Changelog: https://pyup.io/changelogs/pyparsing/
  - Repo: https://github.com/pyparsing/pyparsing/
  - Docs: https://pythonhosted.org/pyparsing/
</details>





### Update [googleapis-common-protos](https://pypi.org/project/googleapis-common-protos) from **1.5.5** to **1.5.6**.


*The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)*

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/googleapis-common-protos
  - Repo: https://github.com/googleapis/googleapis
</details>





### Update [boto3](https://pypi.org/project/boto3) from **1.9.74** to **1.9.78**.


<details>
  <summary>Changelog</summary>
  
  
   ### 1.9.78
   ```
   ======

* api-change:``rds-data``: [``botocore``] Update rds-data client to latest version
* api-change:``emr``: [``botocore``] Update emr client to latest version
   ```
   
  
  
   ### 1.9.77
   ```
   ======

* api-change:``iot``: [``botocore``] Update iot client to latest version
* api-change:``ec2``: [``botocore``] Update ec2 client to latest version
* api-change:``codedeploy``: [``botocore``] Update codedeploy client to latest version
* api-change:``sagemaker``: [``botocore``] Update sagemaker client to latest version
   ```
   
  
  
   ### 1.9.76
   ```
   ======

* api-change:``docdb``: [``botocore``] Update docdb client to latest version
* api-change:``redshift``: [``botocore``] Update redshift client to latest version
   ```
   
  
  
   ### 1.9.75
   ```
   ======

* api-change:``appmesh``: [``botocore``] Update appmesh client to latest version
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/boto3
  - Changelog: https://pyup.io/changelogs/boto3/
  - Repo: https://github.com/boto/boto3
</details>





### Update [newrelic](https://pypi.org/project/newrelic) from **4.8.0.110** to **4.10.0.112**.


*The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)*

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/newrelic
  - Changelog: https://pyup.io/changelogs/newrelic/
  - Homepage: http://newrelic.com/docs/python/new-relic-for-python
</details>





### Update [pytest](https://pypi.org/project/pytest) from **4.1.0** to **4.1.1**.


<details>
  <summary>Changelog</summary>
  
  
   ### 4.1.1
   ```
   =========================

Bug Fixes
---------

- `2256 &lt;https://github.com/pytest-dev/pytest/issues/2256&gt;`_: Show full repr with ``assert a==b`` and ``-vv``.


- `3456 &lt;https://github.com/pytest-dev/pytest/issues/3456&gt;`_: Extend Doctest-modules to ignore mock objects.


- `4617 &lt;https://github.com/pytest-dev/pytest/issues/4617&gt;`_: Fixed ``pytest.warns`` bug when context manager is reused (e.g. multiple parametrization).


- `4631 &lt;https://github.com/pytest-dev/pytest/issues/4631&gt;`_: Don&#39;t rewrite assertion when ``__getattr__`` is broken



Improved Documentation
----------------------

- `3375 &lt;https://github.com/pytest-dev/pytest/issues/3375&gt;`_: Document that using ``setup.cfg`` may crash other tools or cause hard to track down problems because it uses a different parser than ``pytest.ini`` or ``tox.ini`` files.



Trivial/Internal Changes
------------------------

- `4602 &lt;https://github.com/pytest-dev/pytest/issues/4602&gt;`_: Uninstall ``hypothesis`` in regen tox env.
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pytest
  - Changelog: https://pyup.io/changelogs/pytest/
  - Homepage: https://docs.pytest.org/en/latest/
</details>







Co-authored-by: pyup-bot <github-bot@pyup.io>
Co-authored-by: Mike Cooper <mythmon@gmail.com>
bors bot referenced this issue in mozilla/normandy Jan 15, 2019
1692: Scheduled weekly dependency update for week 02 r=peterbe a=pyup-bot






### Update [botocore](https://pypi.org/project/botocore) from **1.12.74** to **1.12.78**.


<details>
  <summary>Changelog</summary>
  
  
   ### 1.12.78
   ```
   =======

* api-change:``rds-data``: Update rds-data client to latest version
* api-change:``emr``: Update emr client to latest version
   ```
   
  
  
   ### 1.12.77
   ```
   =======

* api-change:``iot``: Update iot client to latest version
* api-change:``ec2``: Update ec2 client to latest version
* api-change:``codedeploy``: Update codedeploy client to latest version
* api-change:``sagemaker``: Update sagemaker client to latest version
   ```
   
  
  
   ### 1.12.76
   ```
   =======

* api-change:``docdb``: Update docdb client to latest version
* api-change:``redshift``: Update redshift client to latest version
   ```
   
  
  
   ### 1.12.75
   ```
   =======

* api-change:``appmesh``: Update appmesh client to latest version
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/botocore
  - Changelog: https://pyup.io/changelogs/botocore/
  - Repo: https://github.com/boto/botocore
</details>





### Update [mohawk](https://pypi.org/project/mohawk) from **0.3.4** to **1.0.0**.


*The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)*

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/mohawk
  - Repo: https://github.com/kumar303/mohawk
</details>





### Update [pluggy](https://pypi.org/project/pluggy) from **0.8.0** to **0.8.1**.


<details>
  <summary>Changelog</summary>
  
  
   ### 0.8.1
   ```
   =========================

Trivial/Internal Changes
------------------------

- `166 &lt;https://github.com/pytest-dev/pluggy/issues/166&gt;`_: Add ``stacklevel=2`` to implprefix warning so that the reported location of warning is the caller of PluginManager.
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pluggy
  - Changelog: https://pyup.io/changelogs/pluggy/
  - Repo: https://github.com/pytest-dev/pluggy
</details>





### Update [pyparsing](https://pypi.org/project/pyparsing) from **2.3.0** to **2.3.1**.


<details>
  <summary>Changelog</summary>
  
  
   ### 2.3.1
   ```
   -----------------------------
- POSSIBLE API CHANGE: this release fixes a bug when results names were
  attached to a MatchFirst or Or object containing an And object.
  Previously, a results name on an And object within an enclosing MatchFirst
  or Or could return just the first token in the And. Now, all the tokens
  matched by the And are correctly returned. This may result in subtle
  changes in the tokens returned if you have this condition in your pyparsing
  scripts.

- New staticmethod ParseException.explain() to help diagnose parse exceptions
  by showing the failing input line and the trace of ParserElements in
  the parser leading up to the exception. explain() returns a multiline
  string listing each element by name. (This is still an experimental
  method, and the method signature and format of the returned string may
  evolve over the next few releases.)

  Example:
         define a parser to parse an integer followed by an
         alphabetic word
        expr = pp.Word(pp.nums).setName(&quot;int&quot;)
               + pp.Word(pp.alphas).setName(&quot;word&quot;)
        try:
             parse a string with a numeric second value instead of alpha
            expr.parseString(&quot;123 355&quot;)
        except pp.ParseException as pe:
            print_(pp.ParseException.explain(pe))

  Prints:
        123 355
            ^
        ParseException: Expected word (at char 4), (line:1, col:5)
        __main__.ExplainExceptionTest
        pyparsing.And - {int word}
        pyparsing.Word - word

  explain() will accept any exception type and will list the function
  names and parse expressions in the stack trace. This is especially
  useful when an exception is raised in a parse action.

  Note: explain() is only supported under Python 3.

- Fix bug in dictOf which could match an empty sequence, making it
  infinitely loop if wrapped in a OneOrMore.

- Added unicode sets to pyparsing_unicode for Latin-A and Latin-B ranges.

- Added ability to define custom unicode sets as combinations of other sets
  using multiple inheritance.

    class Turkish_set(pp.pyparsing_unicode.Latin1, pp.pyparsing_unicode.LatinA):
        pass

    turkish_word = pp.Word(Turkish_set.alphas)

- Updated state machine import examples, with state machine demos for:
  . traffic light
  . library book checkin/checkout
  . document review/approval

  In the traffic light example, you can use the custom &#39;statemachine&#39; keyword
  to define the states for a traffic light, and have the state classes
  auto-generated for you:

      statemachine TrafficLightState:
          Red -&gt; Green
          Green -&gt; Yellow
          Yellow -&gt; Red

  Similar for state machines with named transitions, like the library book
  state example:

      statemachine LibraryBookState:
          New -(shelve)-&gt; Available
          Available -(reserve)-&gt; OnHold
          OnHold -(release)-&gt; Available
          Available -(checkout)-&gt; CheckedOut
          CheckedOut -(checkin)-&gt; Available

  Once the classes are defined, then additional Python code can reference those
  classes to add class attributes, instance methods, etc.

  See the examples in examples/statemachine

- Added an example parser for the decaf language. This language is used in
  CS compiler classes in many colleges and universities.

- Fixup of docstrings to Sphinx format, inclusion of test files in the source
  package, and convert markdown to rst throughout the distribution, great job
  by Matěj Cepl!

- Expanded the whitespace characters recognized by the White class to include
  all unicode defined spaces. Suggested in Issue 51 by rtkjbillo.

- Added optional postParse argument to ParserElement.runTests() to add a
  custom callback to be called for test strings that parse successfully. Useful
  for running tests that do additional validation or processing on the parsed
  results. See updated chemicalFormulas.py example.

- Removed distutils fallback in setup.py. If installing the package fails,
  please update to the latest version of setuptools. Plus overall project code
  cleanup (CRLFs, whitespace, imports, etc.), thanks Jon Dufresne!

- Fix bug in CaselessKeyword, to make its behavior consistent with
  Keyword(caseless=True). Fixes Issue 65 reported by telesphore.
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pyparsing
  - Changelog: https://pyup.io/changelogs/pyparsing/
  - Repo: https://github.com/pyparsing/pyparsing/
  - Docs: https://pythonhosted.org/pyparsing/
</details>





### Update [googleapis-common-protos](https://pypi.org/project/googleapis-common-protos) from **1.5.5** to **1.5.6**.


*The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)*

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/googleapis-common-protos
  - Repo: https://github.com/googleapis/googleapis
</details>





### Update [boto3](https://pypi.org/project/boto3) from **1.9.74** to **1.9.78**.


<details>
  <summary>Changelog</summary>
  
  
   ### 1.9.78
   ```
   ======

* api-change:``rds-data``: [``botocore``] Update rds-data client to latest version
* api-change:``emr``: [``botocore``] Update emr client to latest version
   ```
   
  
  
   ### 1.9.77
   ```
   ======

* api-change:``iot``: [``botocore``] Update iot client to latest version
* api-change:``ec2``: [``botocore``] Update ec2 client to latest version
* api-change:``codedeploy``: [``botocore``] Update codedeploy client to latest version
* api-change:``sagemaker``: [``botocore``] Update sagemaker client to latest version
   ```
   
  
  
   ### 1.9.76
   ```
   ======

* api-change:``docdb``: [``botocore``] Update docdb client to latest version
* api-change:``redshift``: [``botocore``] Update redshift client to latest version
   ```
   
  
  
   ### 1.9.75
   ```
   ======

* api-change:``appmesh``: [``botocore``] Update appmesh client to latest version
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/boto3
  - Changelog: https://pyup.io/changelogs/boto3/
  - Repo: https://github.com/boto/boto3
</details>





### Update [newrelic](https://pypi.org/project/newrelic) from **4.8.0.110** to **4.10.0.112**.


*The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)*

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/newrelic
  - Changelog: https://pyup.io/changelogs/newrelic/
  - Homepage: http://newrelic.com/docs/python/new-relic-for-python
</details>





### Update [pytest](https://pypi.org/project/pytest) from **4.1.0** to **4.1.1**.


<details>
  <summary>Changelog</summary>
  
  
   ### 4.1.1
   ```
   =========================

Bug Fixes
---------

- `2256 &lt;https://github.com/pytest-dev/pytest/issues/2256&gt;`_: Show full repr with ``assert a==b`` and ``-vv``.


- `3456 &lt;https://github.com/pytest-dev/pytest/issues/3456&gt;`_: Extend Doctest-modules to ignore mock objects.


- `4617 &lt;https://github.com/pytest-dev/pytest/issues/4617&gt;`_: Fixed ``pytest.warns`` bug when context manager is reused (e.g. multiple parametrization).


- `4631 &lt;https://github.com/pytest-dev/pytest/issues/4631&gt;`_: Don&#39;t rewrite assertion when ``__getattr__`` is broken



Improved Documentation
----------------------

- `3375 &lt;https://github.com/pytest-dev/pytest/issues/3375&gt;`_: Document that using ``setup.cfg`` may crash other tools or cause hard to track down problems because it uses a different parser than ``pytest.ini`` or ``tox.ini`` files.



Trivial/Internal Changes
------------------------

- `4602 &lt;https://github.com/pytest-dev/pytest/issues/4602&gt;`_: Uninstall ``hypothesis`` in regen tox env.
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pytest
  - Changelog: https://pyup.io/changelogs/pytest/
  - Homepage: https://docs.pytest.org/en/latest/
</details>







Co-authored-by: pyup-bot <github-bot@pyup.io>
Co-authored-by: Mike Cooper <mythmon@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants