Skip to content

Trying to execute tests (following contribution guideline) fails with ModuleNotFoundError #909

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

Closed
atodorov opened this issue Feb 2, 2021 · 2 comments

Comments

@atodorov
Copy link

atodorov commented Feb 2, 2021

Following your contribution guide I did:

  1. pip install -e . -r requirements/dev.txt inside a fresh venv
  2. pre-commit install

Didn't see any errors. This is on Linux with Python 3.6. Then:

$ pytest
ImportError while loading conftest '/home/atodorov/private/repos/github/mlh/flask-sqlalchemy/tests/conftest.py'.
tests/conftest.py:6: in <module>
    from flask_sqlalchemy import SQLAlchemy
E   ModuleNotFoundError: No module named 'flask_sqlalchemy'

Expected Behavior

Tests would execute.

Actual Behavior

ModuleNotFoundError

Environment

  • Python version: 3.6

tox also seemed to fail:

(mlh-flask-sqlalchemy) [atodorov@aero flask-sqlalchemy]$ tox
GLOB sdist-make: /home/atodorov/private/repos/github/mlh/flask-sqlalchemy/setup.py
py38 create: /home/atodorov/private/repos/github/mlh/flask-sqlalchemy/.tox/py38
SKIPPED: InterpreterNotFound: python3.8
py37 create: /home/atodorov/private/repos/github/mlh/flask-sqlalchemy/.tox/py37
SKIPPED: InterpreterNotFound: python3.7
py36 create: /home/atodorov/private/repos/github/mlh/flask-sqlalchemy/.tox/py36
py36 installdeps: -rrequirements/tests.txt
WARNING: Discarding $PYTHONPATH from environment, to override specify PYTHONPATH in 'passenv' in your configuration.
py36 inst: /home/atodorov/private/repos/github/mlh/flask-sqlalchemy/.tox/.tmp/package/1/Flask-SQLAlchemy-3.0.0.dev0.zip
WARNING: Discarding $PYTHONPATH from environment, to override specify PYTHONPATH in 'passenv' in your configuration.
ERROR: invocation failed (exit code 1), logfile: /home/atodorov/private/repos/github/mlh/flask-sqlalchemy/.tox/py36/log/py36-2.log
=============================================================== log start ================================================================
Processing ./.tox/.tmp/package/1/Flask-SQLAlchemy-3.0.0.dev0.zip
    ERROR: Command errored out with exit status 1:
     command: /home/atodorov/private/repos/github/mlh/flask-sqlalchemy/.tox/py36/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-or6vzxsq/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-or6vzxsq/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-_5xcx6_h
         cwd: /tmp/pip-req-build-or6vzxsq/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-or6vzxsq/setup.py", line 5, in <module>
        with open("src/flask_sqlalchemy/__init__.py", encoding="utf8") as f:
    FileNotFoundError: [Errno 2] No such file or directory: 'src/flask_sqlalchemy/__init__.py'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 21.0.1 is available.
You should consider upgrading via the '/home/atodorov/private/repos/github/mlh/flask-sqlalchemy/.tox/py36/bin/python -m pip install --upgrade pip' command.
@davidism
Copy link
Member

davidism commented Feb 2, 2021

This is because pip's new resolver doesn't handle -e . -r file the same way as the old one. pypa/pip#8307 Instead, do pip install -r requirements/dev.txt && pip install -e ..

@davidism
Copy link
Member

davidism commented Feb 9, 2021

fixed in #911

@davidism davidism closed this as completed Feb 9, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants