indrajithi / tiny-web-crawler

A simple and easy to use web crawler for Python
MIT License
55 stars 11 forks source link

Can't run tests on local machine #41

Closed Mews closed 1 week ago

Mews commented 1 week ago

On my machine, I can't run the unit tests. When I do poetry run pytest, or when the tests are ran through the push hook, it raises

_______________________________________ ERROR collecting tests/networking/test_validator.py ________________________________________
ImportError while importing test module 'C:\Users\Public\codg\forks\tiny-web-crawler\tests\networking\test_validator.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\Tiago Charrão\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests\networking\test_validator.py:1: in <module>
    from tiny_web_crawler.networking.validator import is_valid_url
E   ModuleNotFoundError: No module named 'tiny_web_crawler'

For every test file.

Steps to reproduce

  1. Create a virtual environment with py -m venv .
  2. Install the dependencies with poetry install --with dev
  3. Install the pre-commit hooks with pre-commit install pre-commit install --hook-type pre-push
  4. Run poetry run pytest

Additional info The tests still run fine on the ci. I was able to run them by replacing from tiny_web_crawler.etc... with from src.tiny_web_crawler.etc...

Mews commented 1 week ago

Fixed: I had to run poetry install --with dev again