mwouts / jupytext

Jupyter Notebooks as Markdown Documents, Julia, Python or R scripts
https://jupytext.readthedocs.io
MIT License
6.66k stars 386 forks source link

Regression tests are breaking on non-English locales #636

Closed joequant closed 4 years ago

joequant commented 4 years ago

If you set LC_ALL and LANG to a non-English locale, the "untitled" string changes, and the regression tests break. I've tried to get it to work by setting the locale and environment variables to "C" but there's something about pytest that causing this not to work.

mwouts commented 4 years ago

Ha ha this one is funny enough! Thank you @joequant . And I confirm that I can reproduce the issue:

(jupytext-dev) marc@zenbook:~/GitHub/jupytext$ LANG=zh_CN.UTF-8 LC_ALL=zh_CN.UTF-8 pytest -n 3 -x
===================================================================================================== test session starts =====================================================================================================
platform linux -- Python 3.8.5, pytest-6.0.2, py-1.9.0, pluggy-0.13.1
rootdir: /home/marc/GitHub/jupytext
plugins: cov-2.10.1, xdist-2.1.0, forked-1.3.0
gw0 [2518] / gw1 [2518] / gw2 [2518]
...................................................................s................................................................................................................................................... [  8%]
....................................................................................................................................................................................................................... [ 17%]
...........................................................................s..........................................................ss........................................................................sss.... [ 25%]
.................................................................................................sss................................................................................................................... [ 34%]
...................................................................................................................................................................................................F
========================================================================================================== FAILURES ===========================================================================================================
______________________________________________________________________________________________________ test_new_untitled ______________________________________________________________________________________________________
[gw0] linux -- Python 3.8.5 /home/marc/miniconda3/envs/jupytext-dev/bin/python

tmpdir = local('/tmp/pytest-of-marc/pytest-0/popen-gw0/test_new_untitled0')

    def test_new_untitled(tmpdir):
        cm = jupytext.TextFileContentsManager()
        cm.root_dir = str(tmpdir)

>       assert cm.new_untitled(type="notebook")["path"] == "Untitled.ipynb"
E       AssertionError: assert '未命名.ipynb' == 'Untitled.ipynb'
E         - Untitled.ipynb
E         + 未命名.ipynb

/home/marc/GitHub/jupytext/tests/test_contentsmanager.py:1709: AssertionError
====================================================================================================== warnings summary =======================================================================================================
tests/test_cli.py::test_format_prefix_suffix
  /home/marc/GitHub/jupytext/jupytext/cli.py:377: UserWarning: You have passed a file name to the '--to' option, when a format description was expected. Maybe you want to use the '-o' option instead?
    warnings.warn(

tests/test_cm_config.py::test_incorrect_config_message[jupytext.toml-not_a_jupytext_option = true]
tests/test_cm_config.py::test_incorrect_config_message[jupytext.toml-not_a_jupytext_option = true]
tests/test_cm_config.py::test_incorrect_config_message[.jupytext.py-c.not_a_jupytext_option = True]
tests/test_cm_config.py::test_incorrect_config_message[.jupytext.py-c.not_a_jupytext_option = True]
  /home/marc/miniconda3/envs/jupytext-dev/lib/python3.8/site-packages/traitlets/config/configurable.py:79: DeprecationWarning: Passing unrecognized arguments to super(JupytextConfiguration).__init__(not_a_jupytext_option=True).
  object.__init__() takes exactly one argument (the instance to initialize)
  This is deprecated in traitlets 4.2.This error will be raised in a future release of traitlets.
    super(Configurable, self).__init__(**kwargs)

-- Docs: https://docs.pytest.org/en/stable/warnings.html
=================================================================================================== short test summary info ===================================================================================================
FAILED tests/test_contentsmanager.py::test_new_untitled - AssertionError: assert '未命名.ipynb' == 'Untitled.ipynb'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! xdist.dsession.Interrupted: stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=================================================================================== 1 failed, 1045 passed, 10 skipped, 5 warnings in 31.22s ===================================================================================