11#
2- # Copyright (c) 2015 nexB Inc. and others. All rights reserved.
2+ # Copyright (c) 2017 nexB Inc. and others. All rights reserved.
33# http://nexb.com and https://github.com/nexB/scancode-toolkit/
44# The ScanCode software is licensed under the Apache License version 2.0.
55# Data generated with ScanCode require an acknowledgment.
2222# ScanCode is a free software code scanning tool from nexB Inc. and others.
2323# Visit https://github.com/nexB/scancode-toolkit/ for support and download.
2424
25+ """
26+ FIXME: TEMPORARY COPY of commoncode.testcase to handle new semantics for get_test_loc
27+ """
2528
2629from __future__ import absolute_import
2730from __future__ import print_function
@@ -92,7 +95,7 @@ def to_os_native_path(path):
9295 return path
9396
9497
95- def get_test_loc (test_path , test_data_dir , debug = False ):
98+ def get_test_loc (test_path , test_data_dir , debug = False , exists = True ):
9699 """
97100 Given a `test_path` relative to the `test_data_dir` directory, return the
98101 location to a test file or directory for this path. No copy is done.
@@ -112,7 +115,7 @@ def get_test_loc(test_path, test_data_dir, debug=False):
112115 tpath = to_os_native_path (test_path )
113116 test_loc = os .path .abspath (os .path .join (test_data_dir , tpath ))
114117
115- if not os .path .exists (test_loc ):
118+ if exists and not os .path .exists (test_loc ):
116119 raise IOError ("[Errno 2] No such file or directory: "
117120 "test_path not found: '%(test_loc)s'" % locals ())
118121
0 commit comments