dspy icon indicating copy to clipboard operation
dspy copied to clipboard

Bug: Unable to run tests locally

Open isaacbmiller opened this issue 11 months ago • 2 comments

Bug: Getting Unable to import dspy when trying to run the new tests

Steps to reproduce:

  1. Clone main branch
  2. python -m venv .env
  3. source .env/bin/activate
  4. pip install -r requirements.txt
  5. pytest tests/predict/test_predict.py

Alternate steps to reproduce:

  1. Clone main branch
  2. poetry install
  3. poetry shell
  4. pytest tests/predict/test_predict.py

This throws a ModuleNotFoundError: No module named 'dspy'

Why does this matter? 2 Reasons:

  1. I was going to help Cyrus with part of the backend refactor, but can't test my code locally
  2. We can't integrate the tests into CI

Full trace:

==================================================================================== test session starts ====================================================================================
platform darwin -- Python 3.11.4, pytest-7.4.0, pluggy-1.0.0
rootdir: /Users/isaac/Projects/dspy
plugins: anyio-3.5.0
collected 0 items / 1 error                                                                                                                                                                 

========================================================================================== ERRORS ===========================================================================================
______________________________________________________________________ ERROR collecting tests/predict/test_predict.py _______________________________________________________________________
ImportError while importing test module '/Users/isaac/Projects/dspy/tests/predict/test_predict.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../anaconda3/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/predict/test_predict.py:1: in <module>
    import dspy
E   ModuleNotFoundError: No module named 'dspy'

This could totally be wrong with how I understand local python builds or some other mistake. Regardless, there should be a little section in the readme about how to run the tests, and get the env setup locally for development

isaacbmiller avatar Feb 26 '24 00:02 isaacbmiller

I think it is because we need to add pytest as a dev dependency for poetry

isaacbmiller avatar Feb 26 '24 00:02 isaacbmiller

Ahh great catch. Happy to merge any fixes

okhat avatar Feb 26 '24 00:02 okhat