package = <module 'swh.lister.phabricator.tests.data' from '/var/lib/jenkins/workspace/DLS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/lister/phabricator/tests/data/__init__.py'>
resource = 'api_first_response.json', encoding = 'utf-8', errors = 'strict'
def open_text(package: Package,
resource: Resource,
encoding: str = 'utf-8',
errors: str = 'strict') -> TextIO:
"""Return a file-like object opened for text reading of the resource."""
resource = _normalize_path(resource)
package = _get_package(package)
reader = _get_resource_reader(package)
if reader is not None:
return TextIOWrapper(reader.open_resource(resource), encoding, errors)
_check_location(package)
absolute_package_path = os.path.abspath(package.__spec__.origin)
package_path = os.path.dirname(absolute_package_path)
full_path = os.path.join(package_path, resource)
try:
> return open(full_path, mode='r', encoding=encoding, errors=errors)
E FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/jenkins/workspace/DLS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/lister/phabricator/tests/data/api_first_response.json'
/usr/lib/python3.7/importlib/resources.py:131: FileNotFoundError
During handling of the above exception, another exception occurred:
def test_get_repo_url():
with importlib.resources.open_text(
> "swh.lister.phabricator.tests.data", "api_first_response.json"
) as f:
.tox/py3/lib/python3.7/site-packages/swh/lister/phabricator/tests/test_lister.py:31:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
package = <module 'swh.lister.phabricator.tests.data' from '/var/lib/jenkins/workspace/DLS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/lister/phabricator/tests/data/__init__.py'>
resource = 'api_first_response.json', encoding = 'utf-8', errors = 'strict'
def open_text(package: Package,
resource: Resource,
encoding: str = 'utf-8',
errors: str = 'strict') -> TextIO:
"""Return a file-like object opened for text reading of the resource."""
resource = _normalize_path(resource)
package = _get_package(package)
reader = _get_resource_reader(package)
if reader is not None:
return TextIOWrapper(reader.open_resource(resource), encoding, errors)
_check_location(package)
absolute_package_path = os.path.abspath(package.__spec__.origin)
package_path = os.path.dirname(absolute_package_path)
full_path = os.path.join(package_path, resource)
try:
return open(full_path, mode='r', encoding=encoding, errors=errors)
except OSError:
# Just assume the loader is a resource loader; all the relevant
# importlib.machinery loaders are and an AttributeError for
# get_data() will make it clear what is needed from the loader.
loader = cast(ResourceLoader, package.__spec__.loader)
data = None
if hasattr(package.__spec__.loader, 'get_data'):
with suppress(OSError):
data = loader.get_data(full_path)
if data is None:
package_name = package.__spec__.name
message = '{!r} resource not found in {!r}'.format(
resource, package_name)
> raise FileNotFoundError(message)
E FileNotFoundError: 'api_first_response.json' resource not found in 'swh.lister.phabricator.tests.data'
/usr/lib/python3.7/importlib/resources.py:145: FileNotFoundError
TEST RESULT
TEST RESULT
- Run At
- Jan 14 2021, 2:56 PM