Debian Codegraph @

debian/patches/deb_no_utf8

raw
1 From: Yaroslav Halchenko <[email protected]>
2 Subject: Disable unicode strings in commands to be executed in tests
3
4 As you could see largely it is about executing a command with unicode, or later
5 logging it. Whenvever Python2 seems to do it automagical conversions without blowing up,
6 on Python3 I found no reliable way to achieve desired -- logger would not accept bytes,
7 but would puke upon attempt to encode unicode into 'ascii', etc
8
9 Problems go away if UTF-8 locale is configured and set (instead of C or POSIX)
10
11 Last-Update: 2018-06-05
12
13 --- a/datalad/tests/test_config.py
14 +++ b/datalad/tests/test_config.py
15 @@ -63,7 +63,7 @@ novalue
16 empty =
17 myint = 3
18
19 -[onemore "complicated の beast with.dot"]
20 +[onemore "complicated nounicode beast with.dot"]
21 findme = 5.0
22 """
23
24 @@ -138,16 +138,16 @@ def test_something(path=None, new_home=N
25 assert_true(cfg.has_section('something'))
26 assert_false(cfg.has_section('somethingelse'))
27 assert_equal(sorted(cfg.sections()),
28 - [u'onemore.complicated の beast with.dot', 'something'])
29 + [u'onemore.complicated nounicode beast with.dot', 'something'])
30 assert_true(cfg.has_option('something', 'user'))
31 assert_false(cfg.has_option('something', 'us?er'))
32 assert_false(cfg.has_option('some?thing', 'user'))
33 assert_equal(sorted(cfg.options('something')), ['empty', 'myint', 'novalue', 'user'])
34 - assert_equal(cfg.options(u'onemore.complicated の beast with.dot'), ['findme'])
35 + assert_equal(cfg.options(u'onemore.complicated nounicode beast with.dot'), ['findme'])
36
37 assert_equal(
38 sorted(cfg.items()),
39 - [(u'onemore.complicated の beast with.dot.findme', '5.0'),
40 + [(u'onemore.complicated nounicode beast with.dot.findme', '5.0'),
41 ('something.empty', ''),
42 ('something.myint', '3'),
43 ('something.novalue', None),
44 @@ -167,7 +167,7 @@ def test_something(path=None, new_home=N
45 cfg.get('something.user', get_all=True),
46 ('name=Jane Doe', '[email protected]'))
47 assert_raises(KeyError, cfg.__getitem__, 'somedthing.user')
48 - assert_equal(cfg.getfloat(u'onemore.complicated の beast with.dot', 'findme'), 5.0)
49 + assert_equal(cfg.getfloat(u'onemore.complicated nounicode beast with.dot', 'findme'), 5.0)
50 assert_equal(cfg.getint('something', 'myint'), 3)
51 assert_equal(cfg.getbool('something', 'myint'), True)
52 # git demands a key without value at all to be used as a flag, thus True
53 @@ -186,8 +186,8 @@ def test_something(path=None, new_home=N
54 assert_raises(KeyError, cfg.get_value, 'doesnot', 'exist', default=None)
55
56 # modification follows
57 - cfg.add('something.new', 'の')
58 - assert_equal(cfg.get('something.new'), u'の')
59 + cfg.add('something.new', 'nounicode')
60 + assert_equal(cfg.get('something.new'), u'nounicode')
61 # sections are added on demand
62 cfg.add('unheard.of', 'fame')
63 assert_true(cfg.has_section('unheard.of'))
64 --- a/datalad/core/local/tests/test_run.py
65 +++ b/datalad/core/local/tests/test_run.py
66 @@ -184,29 +184,29 @@ def test_py2_unicode_command(path=None):
67 touch_cmd = "import sys; open(sys.argv[1], 'w').write('')"
68 cmd_str = u"{} -c \"{}\" {}".format(sys.executable,
69 touch_cmd,
70 - u"bβ0.dat")
71 + u"bB0.dat")
72 ds.run(cmd_str)
73 assert_repo_status(ds.path)
74 - ok_exists(op.join(path, u"bβ0.dat"))
75 + ok_exists(op.join(path, u"bB0.dat"))
76
77 # somewhat desperate attempt to detect our own Github CI tests on a
78 # crippled filesystem (VFAT) that is so crippled that it doesn't handle
79 # what is needed here. It just goes mad with encoded bytestrings:
80 - # CommandError: ''python -c '"'"'import sys; open(sys.argv[1], '"'"'"'"'"'"'"'"'w'"'"'"'"'"'"'"'"').write('"'"'"'"'"'"'"'"''"'"'"'"'"'"'"'"')'"'"' '"'"' β1 '"'"''' failed with exitcode 1 under /crippledfs/
81 + # CommandError: ''python -c '"'"'import sys; open(sys.argv[1], '"'"'"'"'"'"'"'"'w'"'"'"'"'"'"'"'"').write('"'"'"'"'"'"'"'"''"'"'"'"'"'"'"'"')'"'"' '"'"' B1 '"'"''' failed with exitcode 1 under /crippledfs/
82 if not on_windows and os.environ.get('TMPDIR', None) != '/crippledfs': # FIXME
83 - ds.run([sys.executable, "-c", touch_cmd, u"bβ1.dat"])
84 + ds.run([sys.executable, "-c", touch_cmd, u"bB1.dat"])
85 assert_repo_status(ds.path)
86 - ok_exists(op.join(path, u"bβ1.dat"))
87 + ok_exists(op.join(path, u"bB1.dat"))
88
89 # Send in a list of byte-strings to mimic a py2 command-line
90 # invocation.
91 ds.run([s.encode("utf-8")
92 - for s in [sys.executable, "-c", touch_cmd, u" β1 "]])
93 + for s in [sys.executable, "-c", touch_cmd, u" B1 "]])
94 assert_repo_status(ds.path)
95 - ok_exists(op.join(path, u" β1 "))
96 + ok_exists(op.join(path, u" B1 "))
97
98 assert_in_results(
99 - ds.run(u"bβ2.dat", result_renderer=None, on_failure="ignore"),
100 + ds.run(u"bB2.dat", result_renderer=None, on_failure="ignore"),
101 status="error", action="run")
102
103
104 --- a/datalad/runner/tests/test_witless_runner.py
105 +++ b/datalad/runner/tests/test_witless_runner.py
106 @@ -65,7 +65,7 @@ result_counter = 0
107 @with_tempfile
108 def test_runner(tempfile: str = "") -> None:
109 runner = Runner()
110 - content = 'Testing real run' if on_windows else 'Testing äöü東 real run'
111 + content = 'Testing real run'
112 cmd = 'echo %s > %s' % (content, tempfile)
113 res = runner.run(cmd)
114 assert isinstance(res, dict)
115 --- a/datalad/tests/utils_pytest.py
116 +++ b/datalad/tests/utils_pytest.py
117 @@ -1434,7 +1434,7 @@ with_parametric_batch = pytest.mark.para
118 OBSCURE_PREFIX = os.getenv('DATALAD_TESTS_OBSCURE_PREFIX', '')
119 # Those will be tried to be added to the base name if filesystem allows
120 OBSCURE_FILENAME_PARTS = [' ', '/', '|', ';', '&', '%b5', '{}', "'", '"', '<', '>']
121 -UNICODE_FILENAME = u"ΔЙקم๗あ"
122 +UNICODE_FILENAME = u""
123
124 # OSX is exciting -- some I guess FS might be encoding differently from decoding
125 # so Й might get recoded