Skip to content
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

[Pytest] Fix bad import to use relative instead @ module_test #298

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ggcr
Copy link

@ggcr ggcr commented Jan 11, 2025

This fixes a bad import at module_test

Steps to reproduce

Clone the main repo

$ git clone https://github.com/bigcode-project/bigcode-evaluation-harness.git
$ cd bigcode-evaluation-harness/

I am using conda envs

$ conda create -n bc-harness python=3.11
$ conda activate bc-harness
$ pip install -r requirements.txt && pip install pytest

Then as suggested by the GUIDE.md we should run pytest:

### Running Unit Tests
To run the entire test suite, use:
```sh
pytest
```

However when running a bad import error triggers:

# pytest                                                                                            (bc-harnes) 
============================================= test session starts ==============================================
platform darwin -- Python 3.11.11, pytest-8.3.4, pluggy-1.5.0
rootdir: /private/tmp/bigcode-evaluation-harness
collected 3 items / 1 error                                                                                    

==================================================== ERRORS ====================================================
______ ERROR collecting bigcode_eval/tasks/custom_metrics/multiple_metrics/safe_subprocess/module_test.py ______ImportError while importing test module '/private/tmp/bigcode-evaluation-harness/bigcode_eval/tasks/custom_metrics/multiple_metrics/safe_subprocess/module_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/Users/ggcr/miniconda3/envs/bc-harnes/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
bigcode_eval/tasks/custom_metrics/multiple_metrics/safe_subprocess/module_test.py:4: in <module>
    from safe_subprocess import run
E   ModuleNotFoundError: No module named 'safe_subprocess'
=============================================== warnings summary ===============================================bigcode_eval/tasks/humanevalpack.py:179
  /private/tmp/bigcode-evaluation-harness/bigcode_eval/tasks/humanevalpack.py:179: DeprecationWarning: invalid escape sequence '\ '
    stop_words = ["<BEF>", "<MSG>", "<DFF>", "\ No newline at end of file"]

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================================== short test summary info ============================================ERROR bigcode_eval/tasks/custom_metrics/multiple_metrics/safe_subprocess/module_test.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!========================================= 1 warning, 1 error in 24.32s ========================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant