Skip to content

Commit e7319a6

Browse files
committed
#390 Test that extractcode cli extracts archives with unicode names
Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent fb20492 commit e7319a6

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

tests/scancode/test_extract_cli.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
from click.testing import CliRunner
3131

3232
from commoncode.fileutils import as_posixpath
33-
34-
from scancode import extract_cli
33+
from commoncode.fileutils import file_iter
3534
from commoncode.testcase import FileDrivenTesting
3635
from commoncode.system import on_windows
36+
from scancode import extract_cli
3737

3838
test_env = FileDrivenTesting()
3939
test_env.test_data_dir = os.path.join(os.path.dirname(__file__), 'data')
@@ -155,9 +155,10 @@ def test_extractcode_command_works_with_relative_paths_verbose(monkeypatch):
155155
finally:
156156
fileutils.delete(test_src_dir)
157157

158+
158159
def test_usage_and_help_return_a_correct_script_name_on_all_platforms(monkeypatch):
159-
runner = CliRunner()
160160
monkeypatch.setattr(click._termui_impl, 'isatty', lambda _: True)
161+
runner = CliRunner()
161162
result = runner.invoke(extract_cli.extractcode, ['--help'])
162163
assert 'Usage: extractcode [OPTIONS]' in result.output
163164
# this was showing up on Windows
@@ -171,3 +172,14 @@ def test_usage_and_help_return_a_correct_script_name_on_all_platforms(monkeypatc
171172
result = runner.invoke(extract_cli.extractcode, ['-xyz'])
172173
# this was showing up on Windows
173174
assert 'extractcode-script.py' not in result.output
175+
176+
177+
def test_extractcode_command_can_extract_archive_with_unicode_names(monkeypatch):
178+
monkeypatch.setattr(click._termui_impl, 'isatty', lambda _: True)
179+
test_dir = test_env.get_test_loc('extract_unicodepath', copy=True)
180+
runner = CliRunner()
181+
result = runner.invoke(extract_cli.extractcode, ['--verbose', test_dir])
182+
assert result.exit_code == 0
183+
assert 'Izgradnja' in result.output
184+
resultf = list(file_iter(test_dir,))
185+
assert 4 == len(resultf)

0 commit comments

Comments
 (0)