|
36 | 36 | # from click.testing import CliRunner |
37 | 37 |
|
38 | 38 | from commoncode import fileutils |
| 39 | +from commoncode.fileutils import path_to_bytes |
39 | 40 | from commoncode.testcase import FileDrivenTesting |
40 | 41 | from commoncode.system import on_linux |
41 | 42 | from commoncode.system import on_mac |
|
47 | 48 | from scancode.cli_test_utils import run_scan_plain |
48 | 49 |
|
49 | 50 | from scancode import cli |
50 | | -from commoncode.fileutils import path_to_bytes |
51 | | -from commoncode.fileutils import path_to_unicode |
52 | 51 |
|
53 | 52 |
|
54 | 53 | test_env = FileDrivenTesting() |
@@ -207,23 +206,23 @@ def test_scan_mark_source_without_info(monkeypatch): |
207 | 206 | result_file = test_env.get_temp_file('json') |
208 | 207 | expected_file = test_env.get_test_loc('mark_source/without_info.expected.json') |
209 | 208 |
|
210 | | - result = run_scan_click(['--mark-source', test_dir, result_file], monkeypatch) |
| 209 | + _result = run_scan_click(['--mark-source', test_dir, result_file], monkeypatch) |
211 | 210 | check_json_scan(expected_file, result_file) |
212 | 211 |
|
213 | 212 | def test_scan_mark_source_with_info(monkeypatch): |
214 | 213 | test_dir = test_env.extract_test_tar('mark_source/JGroups.tgz') |
215 | 214 | result_file = test_env.get_temp_file('json') |
216 | 215 | expected_file = test_env.get_test_loc('mark_source/with_info.expected.json') |
217 | 216 |
|
218 | | - result = run_scan_click(['--info', '--mark-source', test_dir, result_file], monkeypatch) |
| 217 | + _result = run_scan_click(['--info', '--mark-source', test_dir, result_file], monkeypatch) |
219 | 218 | check_json_scan(expected_file, result_file) |
220 | 219 |
|
221 | 220 | def test_scan_only_findings(monkeypatch): |
222 | 221 | test_dir = test_env.extract_test_tar('info/basic.tgz') |
223 | 222 | result_file = test_env.get_temp_file('json') |
224 | 223 | expected_file = test_env.get_test_loc('only_findings/expected.json') |
225 | 224 |
|
226 | | - result = run_scan_click(['--only-findings', test_dir, result_file], monkeypatch) |
| 225 | + _result = run_scan_click(['--only-findings', test_dir, result_file], monkeypatch) |
227 | 226 | check_json_scan(expected_file, result_file) |
228 | 227 |
|
229 | 228 |
|
@@ -452,13 +451,17 @@ def test_scan_does_not_fail_when_scanning_unicode_files_and_paths(): |
452 | 451 | check_json_scan(test_env.get_test_loc(expected), result_file, strip_dates=True, regen=False) |
453 | 452 |
|
454 | 453 |
|
455 | | -@skipIf(on_windows, 'Tar cannot extract some files on Windows') |
| 454 | +@skipIf(on_windows, 'Python tar cannot extract these files on Windows') |
456 | 455 | def test_scan_does_not_fail_when_scanning_unicode_test_files_from_express(): |
457 | | - if on_linux: |
458 | | - test_dir = test_env.extract_test_tar_raw(b'unicode_fixtures.tar.gz') |
459 | | - test_dir = path_to_bytes(test_dir) |
460 | | - else: |
461 | | - test_dir = test_env.extract_test_tar_unicode('unicode_fixtures.tar.gz') |
| 456 | + |
| 457 | + # On Windows, Python tar cannot extract these files. Other |
| 458 | + # extractors either fail or change the file name, making the test |
| 459 | + # moot. Git cannot check these files. So for now it makes no sense |
| 460 | + # to test this on Windows at all. Extractcode works fine, but does |
| 461 | + # rename the problematic files. |
| 462 | + |
| 463 | + test_dir = test_env.extract_test_tar_raw(b'unicode_fixtures.tar.gz') |
| 464 | + test_dir = path_to_bytes(test_dir) |
462 | 465 |
|
463 | 466 | args = ['-n0', '--info', '--license', '--copyright', |
464 | 467 | '--package', '--email', '--url', '--strip-root', |
|
0 commit comments