Code Monkey home page Code Monkey logo

Comments (3)

crkrenn avatar crkrenn commented on July 28, 2024 1

Thanks very much for your quick reply!

python -m pytest did work. As well as manually putting the venv/bin directory at the front of my search path.

I actually had run into this problem before, but had forgotten how to solve it. It seems to be some strangeness with either OS X or anaconda:

(venv_36) (base) ➜  itu.algs4 git:(master) ✗ which python
/Users/crkrenn/Dropbox/code/itu.algs4/venv_36/bin/python

(venv_36) (base) ➜  itu.algs4 git:(master) ✗ which pytest
/opt/anaconda3/bin/pytest

(venv_36) (base) ➜  itu.algs4 git:(master) ✗ echo $PATH
/Users/crkrenn/Dropbox/code/itu.algs4/venv_36/bin:/opt/anaconda3/bin:/opt/anaconda3/condabin:/opt/anaconda3/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMwareFusion.app/Contents/Public:/Library/TeX/texbin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/opt/X11/bin:/Library/Apple/usr/bin

(venv_36) (base) ➜  itu.algs4 git:(master) ✗ export PATH=/Users/crkrenn/Dropbox/code/itu.algs4/venv_36/bin:${PATH}

(venv_36) (base) ➜  itu.algs4 git:(master) ✗ which pytest
/Users/crkrenn/Dropbox/code/itu.algs4/venv_36/bin/pytest

from itu.algs4.

holgerdell avatar holgerdell commented on July 28, 2024

I am unable to reproduce this error using Python 3.9.0 and pytest-6.2.1 on Linux. Can you provide more details? I think this is an issue with how your version of pytest resolves paths.

Perhaps this subcomment helps?
https://stackoverflow.com/questions/41748464/pytest-cannot-import-module-while-python-can#comment77079570_41752043
That is, try to add an empty file tests/init.py. In any case, if you solve it, please let us know how.

Moreover, thanks for this, we should probably add your idea for opening a virtual environment to CONTRIBUTING.md.

from itu.algs4.

holgerdell avatar holgerdell commented on July 28, 2024

Please also try whether python -m pytest works. This seems to resolve paths differently than running pytest directly.

from itu.algs4.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.