Skip to content

Bug: Unable to run tests locally #456

@isaacbmiller

Description

@isaacbmiller

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions