You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Kenneth Knowles (Jira)" <ji...@apache.org> on 2022/02/24 18:53:00 UTC

[jira] [Updated] (BEAM-12568) Unable to Run Pytest in Dev Env

     [ https://issues.apache.org/jira/browse/BEAM-12568?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kenneth Knowles updated BEAM-12568:
-----------------------------------
    Component/s: sdk-py-core

> Unable to Run Pytest in Dev Env
> -------------------------------
>
>                 Key: BEAM-12568
>                 URL: https://issues.apache.org/jira/browse/BEAM-12568
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-core, testing
>         Environment: Mac OS 11.4
> Docker version 20.10.7, build f0df350
>            Reporter: Heidi Hurst
>            Priority: P3
>
> After spinning up the Docker envt using {{start-build-env.sh}} and following the instructions to create a virtual environment for python testing [here|https://cwiki.apache.org/confluence/display/BEAM/Python+Tips], I repeatedly received the error {{ImportError: cannot import name 'console_main'}} when trying to run pytest. This seems to be due to the pytest version or Dockerfile setup, unclear (see [this pytest issue|https://github.com/pytest-dev/pytest/issues/7650] or [this thread|https://github.com/web-platform-tests/wpt/issues/24880] for similar examples).
> Changing {{console_main}} to {{main}} in {{/usr/local/bin/pytest}} as below, i.e. from
> {code:python}
> import re
> import sys
> from pytest import main
> if __name__ == '__console_main__':
>     sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
>     sys.exit(console_main())
> {code}
> to the following
> {code:python}
> import re
> import sys
> from pytest import main
> if __name__ == '__main__':
>     sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
>     sys.exit(main())
> {code}
> allowed me to run pytest within my environment without issue.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)