Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-12568

Unable to Run Pytest in Dev Env

Details

    • Bug
    • Status: Open
    • P3
    • Resolution: Unresolved
    • None
    • None
    • sdk-py-core, testing
    • None
    • Mac OS 11.4
      Docker version 20.10.7, build f0df350

    Description

      After spinning up the Docker envt using start-build-env.sh and following the instructions to create a virtual environment for python testing here, 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 or this thread for similar examples).

      Changing console_main to main in /usr/local/bin/pytest as below, i.e. from

      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())
      

      to the following

      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())
      

      allowed me to run pytest within my environment without issue.

      Attachments

        Activity

          People

            Unassigned Unassigned
            heidi_pachama Heidi Hurst
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: