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

testpaths + pyargs regression in 4.0.0 #4405

Closed
ipmb opened this Issue Nov 16, 2018 · 9 comments

Comments

Projects
None yet
3 participants
@ipmb

ipmb commented Nov 16, 2018

I was using the following config to test specific modules, but it looks like they are now assumed to be relative paths instead of pyargs:

addopts = --pyargs
testpaths =
    module_one
    module_two

The exact error is:

ERROR: file or package not found: /path/to/cwd/module_one (missing __init__.py?)

Previously, module_one would be found on the PYTHONPATH instead of looking in the current working directory.

git bisect reports:

3137c89cf1232d5c68802cdc187354b8d9909f31 is the first bad commit
commit 3137c89cf1232d5c68802cdc187354b8d9909f31
Author: Daniel Hahler <git@thequod.de>
Date:   Thu Nov 8 00:54:51 2018 +0100

    Fix/improve handling of chdir with no-args and testpaths

    Fixes https://github.com/pytest-dev/pytest/issues/4332.

:040000 040000 b838be74b2381e8099fdcfe8ee11b65072583236 e10eb4bba2c6061029ac829ad9cd4c3a32ca273c M	src
:040000 040000 4710f7fa341f181287e744bbf5c4175a4bc57835 f1feab1f0c834e3a89ca914a5df7b437dce731b7 M	testing
bisect run success
@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Nov 16, 2018

interesting find and very unexpected combination

@ipmb

This comment has been minimized.

ipmb commented Nov 16, 2018

Is there a more standard way to accomplish the same thing? I'm doing something like this in conftest.py to dynamically adjust the testpaths based on the environment:

def pytest_configure(config):
    """Adds custom apps to testpaths"""
    # ...
    if condition_x:
        config.args.remove('module_two')
    if condition_y:
        config.args.append('module_three')
@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Nov 16, 2018

@ipmb its not quite clear what your actual use-case is - without a better understanding of the actual goal i cant even remotely approach giving a sound/sane suggestion

@ipmb

This comment has been minimized.

ipmb commented Nov 16, 2018

When I run pytest I want it to test different modules in my project based on the current environment (defined via environment variables and/or a config file). I've defined a default set of modules in setup.cfg like so:

[tool:pytest]
addopts = --pyargs
# Additional paths are dynamically appended in conftest.py
testpaths =
    module_one
    module_two

At runtime, I use the pytest_configure function to inspect the current environment and adjust the testpaths accordingly as shown in my previous comment.

@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Nov 16, 2018

@ipmb and why are those picked based on env vars? thats a key point for suggesting a solution

@ipmb

This comment has been minimized.

ipmb commented Nov 16, 2018

Long story, but the project with the pytest configuration serves as an umbrella project for many unique deployments/environments used by customers. Different customers have different configurations and may be bringing in their own modules which we want to test as well.

The project architecture predates any pytest usage, I am trying to bring in pytest with minimal changes in the existing projects and configurations

@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Nov 16, 2018

@ipmb i see - then off hand i have no good solution either , i might get an idea with a good night of sleep tho

@blueyed

This comment has been minimized.

Contributor

blueyed commented Nov 17, 2018

The use case is valid, and #4411 should fix it.

@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Nov 17, 2018

@blueyed great job 👍

peterbe added a commit to mozilla-services/tecken that referenced this issue Nov 26, 2018

Update pytest to 4.0.1 (#1359)
This PR updates [pytest](https://pypi.org/project/pytest) from **4.0.0** to **4.0.1**.



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

Bug Fixes
---------

- `3952 &lt;https://github.com/pytest-dev/pytest/issues/3952&gt;`_: Display warnings before &quot;short test summary info&quot; again, but still later warnings in the end.


- `4386 &lt;https://github.com/pytest-dev/pytest/issues/4386&gt;`_: Handle uninitialized exceptioninfo in repr/str.


- `4393 &lt;https://github.com/pytest-dev/pytest/issues/4393&gt;`_: Do not create ``.gitignore``/``README.md`` files in existing cache directories.


- `4400 &lt;https://github.com/pytest-dev/pytest/issues/4400&gt;`_: Rearrange warning handling for the yield test errors so the opt-out in 4.0.x correctly works.


- `4405 &lt;https://github.com/pytest-dev/pytest/issues/4405&gt;`_: Fix collection of testpaths with ``--pyargs``.


- `4412 &lt;https://github.com/pytest-dev/pytest/issues/4412&gt;`_: Fix assertion rewriting involving ``Starred`` + side-effects.


- `4425 &lt;https://github.com/pytest-dev/pytest/issues/4425&gt;`_: Ensure we resolve the absolute path when the given ``--basetemp`` is a relative path.



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

- `4315 &lt;https://github.com/pytest-dev/pytest/issues/4315&gt;`_: Use ``pkg_resources.parse_version`` instead of ``LooseVersion`` in minversion check.


- `4440 &lt;https://github.com/pytest-dev/pytest/issues/4440&gt;`_: Adjust the stack level of some internal pytest warnings.
   ```
   
  
</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>

bors bot added a commit to mozilla/normandy that referenced this issue Nov 26, 2018

Merge #1629
1629: Scheduled weekly dependency update for week 47 r=mythmon a=pyup-bot






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


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

* api-change:``amplify``: Update amplify client to latest version
* api-change:``transfer``: Update transfer client to latest version
* api-change:``snowball``: Update snowball client to latest version
* api-change:``robomaker``: Update robomaker client to latest version
* api-change:``s3``: Update s3 client to latest version
* api-change:``datasync``: Update datasync client to latest version
   ```
   
  
  
   ### 1.12.50
   ```
   =======

* api-change:``rekognition``: Update rekognition client to latest version
   ```
   
  
  
   ### 1.12.49
   ```
   =======

* api-change:``autoscaling-plans``: Update autoscaling-plans client to latest version
* api-change:``xray``: Update xray client to latest version
* api-change:``devicefarm``: Update devicefarm client to latest version
* api-change:``ssm``: Update ssm client to latest version
* api-change:``medialive``: Update medialive client to latest version
* api-change:``redshift``: Update redshift client to latest version
* api-change:``rds-data``: Update rds-data client to latest version
* api-change:``appsync``: Update appsync client to latest version
* api-change:``cloudwatch``: Update cloudwatch client to latest version
* api-change:``quicksight``: Update quicksight client to latest version
* api-change:``cloudfront``: Update cloudfront client to latest version
   ```
   
  
  
   ### 1.12.48
   ```
   =======

* api-change:``lightsail``: Update lightsail client to latest version
* api-change:``workspaces``: Update workspaces client to latest version
* api-change:``workdocs``: Update workdocs client to latest version
* api-change:``batch``: Update batch client to latest version
* api-change:``ec2``: Update ec2 client to latest version
* api-change:``devicefarm``: Update devicefarm client to latest version
* api-change:``rds``: Update rds client to latest version
* api-change:``cloudformation``: Update cloudformation client to latest version
* api-change:``lambda``: Update lambda client to latest version
* api-change:``config``: Update config client to latest version
* api-change:``cloudtrail``: Update cloudtrail client to latest version
* api-change:``mediaconvert``: Update mediaconvert client to latest version
* api-change:``iot``: Update iot 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 [Pygments](https://pypi.org/project/Pygments) from **2.2.0** to **2.3.0**.


<details>
  <summary>Changelog</summary>
  
  
   ### 2.3.0
   ```
   -------------
(released Nov 25, 2018)

- Added lexers:

  * Fennel (PR783)
  * HLSL (PR675)

- Updated lexers:

  * Dockerfile (PR714)

- Minimum Python versions changed to 2.7 and 3.5
- Added support for Python 3.7 generator changes (PR772)
- Fix incorrect token type in SCSS for single-quote strings (1322)
- Use `terminal256` formatter if `TERM` contains `256` (PR666)
- Fix incorrect handling of GitHub style fences in Markdown (PR741, 1389)
- Fix `%a` not being highlighted in Python3 strings (PR727)
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pygments
  - Changelog: https://pyup.io/changelogs/pygments/
  - Homepage: http://pygments.org/
</details>





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


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

* api-change:``amplify``: [``botocore``] Update amplify client to latest version
* api-change:``transfer``: [``botocore``] Update transfer client to latest version
* api-change:``snowball``: [``botocore``] Update snowball client to latest version
* api-change:``robomaker``: [``botocore``] Update robomaker client to latest version
* api-change:``s3``: [``botocore``] Update s3 client to latest version
* api-change:``datasync``: [``botocore``] Update datasync client to latest version
   ```
   
  
  
   ### 1.9.50
   ```
   ======

* api-change:``rekognition``: [``botocore``] Update rekognition client to latest version
   ```
   
  
  
   ### 1.9.49
   ```
   ======

* api-change:``autoscaling-plans``: [``botocore``] Update autoscaling-plans client to latest version
* api-change:``xray``: [``botocore``] Update xray client to latest version
* api-change:``devicefarm``: [``botocore``] Update devicefarm client to latest version
* api-change:``ssm``: [``botocore``] Update ssm client to latest version
* api-change:``medialive``: [``botocore``] Update medialive client to latest version
* api-change:``redshift``: [``botocore``] Update redshift client to latest version
* api-change:``rds-data``: [``botocore``] Update rds-data client to latest version
* api-change:``appsync``: [``botocore``] Update appsync client to latest version
* api-change:``cloudwatch``: [``botocore``] Update cloudwatch client to latest version
* api-change:``quicksight``: [``botocore``] Update quicksight client to latest version
* api-change:``cloudfront``: [``botocore``] Update cloudfront client to latest version
   ```
   
  
  
   ### 1.9.48
   ```
   ======

* api-change:``lightsail``: [``botocore``] Update lightsail client to latest version
* api-change:``workspaces``: [``botocore``] Update workspaces client to latest version
* api-change:``workdocs``: [``botocore``] Update workdocs client to latest version
* api-change:``batch``: [``botocore``] Update batch client to latest version
* api-change:``ec2``: [``botocore``] Update ec2 client to latest version
* api-change:``devicefarm``: [``botocore``] Update devicefarm client to latest version
* api-change:``rds``: [``botocore``] Update rds client to latest version
* api-change:``cloudformation``: [``botocore``] Update cloudformation client to latest version
* api-change:``lambda``: [``botocore``] Update lambda client to latest version
* api-change:``config``: [``botocore``] Update config client to latest version
* api-change:``cloudtrail``: [``botocore``] Update cloudtrail client to latest version
* api-change:``mediaconvert``: [``botocore``] Update mediaconvert client to latest version
* api-change:``iot``: [``botocore``] Update iot 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 [pytest](https://pypi.org/project/pytest) from **4.0.0** to **4.0.1**.


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

Bug Fixes
---------

- `3952 &lt;https://github.com/pytest-dev/pytest/issues/3952&gt;`_: Display warnings before &quot;short test summary info&quot; again, but still later warnings in the end.


- `4386 &lt;https://github.com/pytest-dev/pytest/issues/4386&gt;`_: Handle uninitialized exceptioninfo in repr/str.


- `4393 &lt;https://github.com/pytest-dev/pytest/issues/4393&gt;`_: Do not create ``.gitignore``/``README.md`` files in existing cache directories.


- `4400 &lt;https://github.com/pytest-dev/pytest/issues/4400&gt;`_: Rearrange warning handling for the yield test errors so the opt-out in 4.0.x correctly works.


- `4405 &lt;https://github.com/pytest-dev/pytest/issues/4405&gt;`_: Fix collection of testpaths with ``--pyargs``.


- `4412 &lt;https://github.com/pytest-dev/pytest/issues/4412&gt;`_: Fix assertion rewriting involving ``Starred`` + side-effects.


- `4425 &lt;https://github.com/pytest-dev/pytest/issues/4425&gt;`_: Ensure we resolve the absolute path when the given ``--basetemp`` is a relative path.



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

- `4315 &lt;https://github.com/pytest-dev/pytest/issues/4315&gt;`_: Use ``pkg_resources.parse_version`` instead of ``LooseVersion`` in minversion check.


- `4440 &lt;https://github.com/pytest-dev/pytest/issues/4440&gt;`_: Adjust the stack level of some internal pytest warnings.
   ```
   
  
</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>





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


<details>
  <summary>Changelog</summary>
  
  
   ### 4.1.2
   ```
   ------

 * Add correct MIME type for WebAssembly, which is required for files to be
   executed (thanks `mdboom &lt;https://github.com/mdboom&gt;`_ ).
 * Stop accessing the FILE_CHARSET Django setting which was almost entirely
   unused and is now deprecated (thanks `timgraham
   &lt;https://github.com/timgraham&gt;`_).
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/whitenoise
  - Changelog: https://pyup.io/changelogs/whitenoise/
  - Homepage: http://whitenoise.evans.io
</details>





### Update [backoff](https://pypi.org/project/backoff) from **1.6.0** to **1.7.0**.


<details>
  <summary>Changelog</summary>
  
  
   ### 1.7.0
   ```
   Changed

- Support Python 3.7
- Drop support for async in Python 3.4
- Drop support for Python 2.6
- Update development dependencies
- Use poetry for dependencies and packaging
   ```
   
  
</details>


 

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







Co-authored-by: pyup-bot <github-bot@pyup.io>

bors bot added a commit to rehandalal/therapist that referenced this issue Nov 27, 2018

Merge #47
47: Update pytest to 4.0.1 r=rehandalal a=pyup-bot


This PR updates [pytest](https://pypi.org/project/pytest) from **4.0.0** to **4.0.1**.



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

Bug Fixes
---------

- `3952 &lt;https://github.com/pytest-dev/pytest/issues/3952&gt;`_: Display warnings before &quot;short test summary info&quot; again, but still later warnings in the end.


- `4386 &lt;https://github.com/pytest-dev/pytest/issues/4386&gt;`_: Handle uninitialized exceptioninfo in repr/str.


- `4393 &lt;https://github.com/pytest-dev/pytest/issues/4393&gt;`_: Do not create ``.gitignore``/``README.md`` files in existing cache directories.


- `4400 &lt;https://github.com/pytest-dev/pytest/issues/4400&gt;`_: Rearrange warning handling for the yield test errors so the opt-out in 4.0.x correctly works.


- `4405 &lt;https://github.com/pytest-dev/pytest/issues/4405&gt;`_: Fix collection of testpaths with ``--pyargs``.


- `4412 &lt;https://github.com/pytest-dev/pytest/issues/4412&gt;`_: Fix assertion rewriting involving ``Starred`` + side-effects.


- `4425 &lt;https://github.com/pytest-dev/pytest/issues/4425&gt;`_: Ensure we resolve the absolute path when the given ``--basetemp`` is a relative path.



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

- `4315 &lt;https://github.com/pytest-dev/pytest/issues/4315&gt;`_: Use ``pkg_resources.parse_version`` instead of ``LooseVersion`` in minversion check.


- `4440 &lt;https://github.com/pytest-dev/pytest/issues/4440&gt;`_: Adjust the stack level of some internal pytest warnings.
   ```
   
  
</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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment