running `doctest` failes by d-chris · Pull Request #417 · python-validators/validators

@d-chris

Fixes #416

using pytest-doctestplus to resolve the issue

@nandgator

Thanks! Can you add it to the testing group, with any configurations in the pyproject.toml file?

@d-chris

@yozachar your wish is my command 8ddc7fb

running pytest will check now also examples in the docstrings.

d-chris

@nandgator

============================================================================ ERRORS =============================================================================
_________________________________________________________________ ERROR collecting site/conf.py _________________________________________________________________
import file mismatch:
imported module 'conf' has this __file__ attribute:
  ~/validators/docs/conf.py
which is not the same as the test file we want to collect:
  ~/validators/site/conf.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
==================================================================== short test summary info ====================================================================
ERROR site/conf.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================================= 1 error in 0.73s ========================================================================

Shouldn't the package be installed?


pdm add -G testing pytest-doctestplus

Still throws the same error.

@d-chris

@yozachar i did not change any dependencies nor requirements.

  • i basically changed only the docstrings.
  • the command pytest --doctest-modules does not require another 3rd party package.

to your error message try to delete __pycache__

git clean -dx --dry-run

@nandgator

Why is it attempting to import docs/conf.py?

@d-chris

Why is it attempting to import docs/conf.py?

maybe you want to revert my toml File Change?

@nandgator

@d-chris

@yozachar me neither, i specified now testpath in the toml file

run tox locally on windows 10, passed except linting

lint: exit 1 (2.00 seconds) F:\github\validators> ruff check . pid=17048
format: OK ✔ in 28.53 seconds
py311: OK ✔ in 29.52 seconds
sast: OK ✔ in 30.1 seconds
py38: OK ✔ in 30.59 seconds
type: OK ✔ in 32.57 seconds
py39: OK ✔ in 35.76 seconds
py310: OK ✔ in 35.86 seconds
  lint: FAIL code 1 (26.62=setup[24.62]+cmd[2.00] seconds)
  type: OK (32.57=setup[24.47]+cmd[8.10] seconds)
  format: OK (28.52=setup[24.54]+cmd[3.98] seconds)
  sast: OK (30.10=setup[24.75]+cmd[5.35] seconds)
  py38: OK (30.59=setup[24.42]+cmd[6.17] seconds)
  py39: OK (35.76=setup[28.92]+cmd[6.85] seconds)
  py310: OK (35.86=setup[29.18]+cmd[6.68] seconds)
  py311: OK (29.52=setup[24.29]+cmd[5.23] seconds)
  py312: OK (36.04=setup[30.13]+cmd[5.91] seconds)
  evaluation failed :( (37.27 seconds)
warning: Invalid `# noqa` directive on src\validators\crypto_addresses\eth_address.py:52: expected code to consist of uppercase letters followed by digits only (e.g. `F401`)
warning: Invalid `# noqa` directive on src\validators\crypto_addresses\bsc_address.py:29: expected code to consist of uppercase letters followed by digits only (e.g. `F401`)

@nandgator

@d-chris

@d-chris @nandgator

@d-chris @nandgator

- bsc_address.py:20:101: E501 Line too long (103 > 100)
- all tox env passed

@nandgator

@d-chris @nandgator

@nandgator

@nandgator

@nandgator

@nandgator

@nandgator