Fix is_iso_date pattern and add tests#15
Conversation
Signed-off-by: FeRD (Frank Dana) <ferdnyc@gmail.com>
|
@ferdnyc Thanks! good catch... it also means we should have a few tests for this pattern. Do you mind to add some? |
|
Done. (Along with a commit to add I've confirmed that they pass on this branch, but fail when cherry-picked into |
pombredanne
left a comment
There was a problem hiding this comment.
Thanks the tests! ... just a tiny nit wrt. setuptools
setup.cfg
Outdated
|
|
||
| [options.extras_require] | ||
| testing = | ||
| setuptools >= 50 |
There was a problem hiding this comment.
Why do you need this? We do not have any hard dependency in tests on setuptools, do we?
And FWIW, we typically use this base repo and we merge it for the boilerplate files: https://github.com/nexB/skeleton
In all cases we are progressively moving away from setuptools to use a new build tool called flot https://github.com/nexB/flot that is grown from flit.
There was a problem hiding this comment.
Apparently, yes. This fails with a missing setuptools:
$ python3 -m venv venv3.12
$ . ./venv3.12/bin/activate
$ pip install -e '.[testing]'
$ pytestThe build system depending on setuptools doesn't install it when not building the package, is the problem.
There was a problem hiding this comment.
The pytest output without setuptools, specifically, is:
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.2.2, pluggy-1.5.0
rootdir: /var/tmp/saneyaml
configfile: pyproject.toml
plugins: xdist-3.6.1
collected 24 items / 1 error
==================================== ERRORS ====================================
__________________________ ERROR collecting setup.py ___________________________
ImportError while importing test module '/var/tmp/saneyaml/setup.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.12/importlib/__init__.py:90: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
setup.py:3: in <module>
import setuptools
E ModuleNotFoundError: No module named 'setuptools'
=========================== short test summary info ============================
ERROR setup.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.35s ===============================
There was a problem hiding this comment.
Arguably pytest shouldn't be picking up setup.py, so an exclusion in the pytest config in setup.cfg or pyproject.yaml might be an alternate way to go.
There was a problem hiding this comment.
There was a problem hiding this comment.
Anyway, I'll drop that commit, since it only affects local testing.
There was a problem hiding this comment.
An exclusion in setup.cfg looks best indeed.
Signed-off-by: FeRD (Frank Dana) <ferdnyc@gmail.com>
These are non-valid ISO dates but we do not validate fully just a surface validation using a regex. This captures the weird cases we accept. Reference: aboutcode-org#14 Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com> Co-authored-by: Frank Dana <ferdnyc@gmail.com> Signed-off-by: FeRD (Frank Dana) <ferdnyc@gmail.com>
Fixes #14