colander icon indicating copy to clipboard operation
colander copied to clipboard

Fixes #194: colander.All must support Invalid.msg being None or a list

Open RangelReale opened this issue 5 years ago • 9 comments
trafficstars

RangelReale avatar Jan 08 '20 18:01 RangelReale

@RangelReale before this PR can be considered, would you please do the following?

  1. The build must pass with 100% test coverage. One line fails. https://travis-ci.org/Pylons/colander/jobs/634377178#L295
  2. Sign https://github.com/Pylons/colander/blob/master/CONTRIBUTORS.txt
  3. Add a change note, under a new heading "Unreleased" in https://github.com/Pylons/colander/blob/master/CHANGES.rst

Thank you!

stevepiercy avatar Jan 08 '20 22:01 stevepiercy

Please also add a new test that validates the change and makes sure we can't accidentally regress on this.

digitalresistor avatar Jan 09 '20 03:01 digitalresistor

Coverage is still failing. https://travis-ci.org/Pylons/colander/jobs/634880892

Do you run the tests locally before pushing to ensure coverage is satisfied?

stevepiercy avatar Jan 09 '20 22:01 stevepiercy

Coverage is still failing. https://travis-ci.org/Pylons/colander/jobs/634880892

Do you run the tests locally before pushing to ensure coverage is satisfied?

I am new to python, I tried running tox locally in Windows, but it gave many errors, and didn't find python3, so I assumed that I just needed to create a test for my change, but it seems I will need to learn how to fix it.

RangelReale avatar Jan 10 '20 13:01 RangelReale

tox is nice, but if you don't want or need to run and test on multiple Python versions, then it is better to just run tests via the test runner used as specified in the tox.ini:

https://github.com/Pylons/colander/blob/670d15394bf158cc974a9cdf4b9c7b496e2d5322/tox.ini#L38-L42

After installing test dependencies, then run coverage run --source=colander {envbindir}/nosetests substituting your environment's bin directory. This is the build step that fails on Travis.

If you want to install and test on multiple Python versions on Windows, there is a fork of pyenv called pyenv-win. Several of us use pyenv on macos and linux to do that locally, and it saves a lot of time while developing. I think it's pretty cool, and you will impress your friends and neighbors that you have multiple pythons installed and are not afraid to use them. 💪

Hope that helps.

stevepiercy avatar Jan 10 '20 13:01 stevepiercy

tox is nice, but if you don't want or need to run and test on multiple Python versions, then it is better to just run tests via the test runner used as specified in the tox.ini:

https://github.com/Pylons/colander/blob/670d15394bf158cc974a9cdf4b9c7b496e2d5322/tox.ini#L38-L42

After installing test dependencies, then run coverage run --source=colander {envbindir}/nosetests substituting your environment's bin directory. This is the build step that fails on Travis.

If you want to install and test on multiple Python versions on Windows, there is a fork of pyenv called pyenv-win. Several of us use pyenv on macos and linux to do that locally, and it saves a lot of time while developing. I think it's pretty cool, and you will impress your friends and neighbors that you have multiple pythons installed and are not afraid to use them. 💪

Hope that helps.

I must be doing something terribly wrong, as I am not able to run the testsuite by itself using nose. Looking at the source code, the tests seem to be using unittest, not nose. If I run with python -m unittest, the tests works (but gives lots os errors).

(venv) M:\prog\api\venv\src\colander\colander>nosetests


Ran 0 tests in 0.000s

OK

(venv) M:\prog\api\venv\src\colander\colander>python -m unittest ................................................................................................................................F...F..F.FF...F...FFF.....F............................................................................................................................................................................................................. ......................................................................................................................

(some errors)


Ran 478 tests in 0.326s

FAILED (failures=10)

RangelReale avatar Jan 10 '20 18:01 RangelReale

Indeed, I ran into a similar issue. I had to look in tox.ini and parse it out.

First set an environment variable venv to the path of your virtual environment.

export venv=/path/to/virtual/environment

Set another environment variable to the coverage file.

export COVERAGE_FILE=.coverage

Then run through these commands for Python 3.6:

$venv/bin/coverage run --source=colander $venv/bin/nosetests
Ran 479 tests in 0.134s

OK
$venv/bin/coverage xml -o py36-cover.xml
$venv/bin/coverage xml
$venv/bin/coverage report --show-missing --fail-under=100
Name                                Stmts   Miss  Cover   Missing
-----------------------------------------------------------------
colander/__init__.py                 1089      3    99%   265, 2606-2608
colander/compat.py                     22      4    82%   8-9, 25-26
colander/interfaces.py                  5      0   100%
colander/tests/__init__.py              1      0   100%
colander/tests/test_colander.py      3242      2    99%   185-187
colander/tests/test_interfaces.py       2      0   100%
-----------------------------------------------------------------
TOTAL                                4361      9    99%

You can ignore the coverage misses for compat.py because they only run under Python 2.

Hope that helps you get over the hurdle.

stevepiercy avatar Jan 11 '20 07:01 stevepiercy

I'm having a hard time understanding that travis output, I fixed the coverage problem on the test I made, but I don't know if this will fix everything.

RangelReale avatar Jan 13 '20 13:01 RangelReale

@RangelReale which part do you not understand? It is not tox output, but I figured out the correct sequence of commands that tox issues, although for macos not Windows. I can explain whichever does not make sense.

The remaining failures indicate:

  • https://travis-ci.org/Pylons/colander/jobs/636365910#L288 colander/__init__.py 1089 1 99% 265 means line 265 in colander/__init__.py is not covered by tests.
  • https://travis-ci.org/Pylons/colander/jobs/636365912#L374-L376 My request to add reStructuredText markup in CHANGES.rst is incorrect and should be reverted. Sorry about that. I've made a couple of new suggestions. This can be tested locally, as described in https://stackoverflow.com/a/44186594/2214933

Thank you for your patience with a crash course in Python, testing, and packaging. I hope this doesn't scare you away. 😉

stevepiercy avatar Jan 13 '20 21:01 stevepiercy