[TESTS] parse_record
returns a list of strings instead of BuildrootPaths
Because the output is directly stored to JSON file.
This commit is contained in:
parent
a5cf74fc41
commit
228f3947df
@ -43,14 +43,13 @@ def parse_record(record_path, record_content):
|
|||||||
(it can also be absolute according to the standard, but not from pip)
|
(it can also be absolute according to the standard, but not from pip)
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
>>> parse_record(BuildrootPath('/usr/lib/python3.7/site-packages/requests-2.22.0.dist-info/RECORD'),
|
||||||
|
... [('requests/sessions.py', 'sha256=xxx', '666')])
|
||||||
|
['/usr/lib/python3.7/site-packages/requests/sessions.py']
|
||||||
|
|
||||||
>>> next(parse_record(BuildrootPath('/usr/lib/python3.7/site-packages/requests-2.22.0.dist-info/RECORD'),
|
>>> parse_record(BuildrootPath('/usr/lib/python3.7/site-packages/tldr-0.5.dist-info/RECORD'),
|
||||||
... [('requests/sessions.py', 'sha256=xxx', '666'), ...]))
|
... [('../../../bin/tldr', 'sha256=yyy', '777')])
|
||||||
BuildrootPath('/usr/lib/python3.7/site-packages/requests/sessions.py')
|
['/usr/bin/tldr']
|
||||||
|
|
||||||
>>> next(parse_record(BuildrootPath('/usr/lib/python3.7/site-packages/tldr-0.5.dist-info/RECORD'),
|
|
||||||
... [('../../../bin/tldr', 'sha256=yyy', '777'), ...]))
|
|
||||||
BuildrootPath('/usr/bin/tldr')
|
|
||||||
"""
|
"""
|
||||||
sitedir = record_path.parent.parent # trough the dist-info directory
|
sitedir = record_path.parent.parent # trough the dist-info directory
|
||||||
# / with absolute right operand will remove the left operand
|
# / with absolute right operand will remove the left operand
|
||||||
|
@ -123,17 +123,17 @@ def test_parse_record_tldr():
|
|||||||
output = list(parse_record(record_path, record_content))
|
output = list(parse_record(record_path, record_content))
|
||||||
pprint(output)
|
pprint(output)
|
||||||
expected = [
|
expected = [
|
||||||
BINDIR / "__pycache__/tldr.cpython-37.pyc",
|
str(BINDIR / "__pycache__/tldr.cpython-37.pyc"),
|
||||||
BINDIR / "tldr",
|
str(BINDIR / "tldr"),
|
||||||
BINDIR / "tldr.py",
|
str(BINDIR / "tldr.py"),
|
||||||
SITELIB / "__pycache__/tldr.cpython-37.pyc",
|
str(SITELIB / "__pycache__/tldr.cpython-37.pyc"),
|
||||||
SITELIB / "tldr-0.5.dist-info/INSTALLER",
|
str(SITELIB / "tldr-0.5.dist-info/INSTALLER"),
|
||||||
SITELIB / "tldr-0.5.dist-info/LICENSE",
|
str(SITELIB / "tldr-0.5.dist-info/LICENSE"),
|
||||||
SITELIB / "tldr-0.5.dist-info/METADATA",
|
str(SITELIB / "tldr-0.5.dist-info/METADATA"),
|
||||||
SITELIB / "tldr-0.5.dist-info/RECORD",
|
str(SITELIB / "tldr-0.5.dist-info/RECORD"),
|
||||||
SITELIB / "tldr-0.5.dist-info/WHEEL",
|
str(SITELIB / "tldr-0.5.dist-info/WHEEL"),
|
||||||
SITELIB / "tldr-0.5.dist-info/top_level.txt",
|
str(SITELIB / "tldr-0.5.dist-info/top_level.txt"),
|
||||||
SITELIB / "tldr.py",
|
str(SITELIB / "tldr.py"),
|
||||||
]
|
]
|
||||||
assert output == expected
|
assert output == expected
|
||||||
|
|
||||||
@ -149,9 +149,9 @@ def test_parse_record_tensorflow():
|
|||||||
output = list(parse_record(record_path, record_content))
|
output = list(parse_record(record_path, record_content))
|
||||||
pprint(output)
|
pprint(output)
|
||||||
expected = [
|
expected = [
|
||||||
BINDIR / "toco_from_protos",
|
str(BINDIR / "toco_from_protos"),
|
||||||
SITELIB / long,
|
str(SITELIB / long),
|
||||||
SITEARCH / "tensorflow-2.1.0.dist-info/METADATA",
|
str(SITEARCH / "tensorflow-2.1.0.dist-info/METADATA"),
|
||||||
]
|
]
|
||||||
assert output == expected
|
assert output == expected
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user