Closed CurtLH closed 6 years ago
Interesting. This is almost certainly due to some environment variables that Babel is using to determine the locale (and therefore the correct way to format dates and datetimes).
I had hoped this was fixed by #46. Could you perhaps checkout the tests_envvars_check
branch and run the tests again, then post here the DEBUG: env vars
section at the top?
Ignore. See https://github.com/plumdog/flask_table/issues/110#issuecomment-410180848 below.
Huh.
So for reasons I don't understand:
LANG=en_US.UTF-8 python -m unittest discover
fails for me while
LANG=en_US.UTF-8 python setup.py test
passes.
Does just a plain python setup.py test
pass for you?
Actually, I bet I know why this is - I bet it is because unittest is importing everything so it can discover the tests.
I added a print to the top of flask_table/__init__.py
and to the top of tests/__init__.py
and ran both test commands:
❯ python setup.py test 2>&1 | grep 'Importing'
Importing tests/__init__.py
Importing flask_table/__init__.py
❯ python -m unittest discover 2>&1 | grep 'Importing'
Importing flask_table/__init__.py
Importing tests/__init__.py
So discover is importing the library before it imports the tests, so the environment variables are not overridden when Babel is imported (Babel configures things at import time), and so it loads based on your local environment.
If you run python -m unittest tests
, it won't look for the tests in the library code, and - I hope - the tests will pass for you. Or just run python setup.py tests
.
(Assuming all of that is correct and works for you as I think it will, I'll add a bit to the documentation to explain.)
Thanks for looking into this @plumdog. As you assumed, using the commands you mentioned above, everything passed as expected.
θ63° [curtis:~/github/flask_table] [py35] master ± python -m unittest tests
........................................................................................
----------------------------------------------------------------------
Ran 88 tests in 0.081s
OK
Great stuff - I'll add a bit to the readme to make this clear.
I just cloned this repo and when I ran the tests, I noticed that two of the tests are failing.