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

running doctest failes #417

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

d-chris
Copy link

@d-chris d-chris commented Mar 18, 2025

Fixes #416

using pytest-doctestplus to resolve the issue

@yozachar
Copy link
Collaborator

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

@yozachar yozachar added waiting Issue/PR: Wating for reply documentation Issue/PR: Any changes in documentation labels Mar 29, 2025
@d-chris
Copy link
Author

d-chris commented Mar 29, 2025

@yozachar your wish is my command 8ddc7fb

running pytest will check now also examples in the docstrings.

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

yozachar commented Mar 29, 2025

============================================================================ 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
Copy link
Author

d-chris commented Mar 29, 2025

@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

@yozachar
Copy link
Collaborator

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

@d-chris
Copy link
Author

d-chris commented Mar 29, 2025

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

maybe you want to revert my toml File Change?

@yozachar
Copy link
Collaborator

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

maybe you want to revert my toml File Change?

I do not see how 3529dcd is related to https://github.com/python-validators/validators/actions/runs/14146186209/job/39633755493?pr=417#step:5:20

@d-chris
Copy link
Author

d-chris commented Mar 29, 2025

@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`)

@yozachar
Copy link
Collaborator

This is odd. Locally, tox is all green. Anything amiss here: https://github.com/python-validators/validators/blob/master/.github/workflows/pycqa.yaml ?

@d-chris
Copy link
Author

d-chris commented Mar 29, 2025

mh don't see any obvious.

due the nature of your package i used pdm in the CI to set everything up.

all green... https://github.com/d-chris/validators/actions/runs/14147791659

@yozachar maybe --doctest-modules requires the package itself to be installed?
add in your action pip install . after you install the requirements?

@yozachar yozachar removed the waiting Issue/PR: Wating for reply label Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Issue/PR: Any changes in documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

running doctest failes
2 participants