15
0
forked from pool/python-evtx

- Add pytest4.patch making the testsuite running again.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-evtx?expand=0&rev=16
This commit is contained in:
2019-11-04 14:06:37 +00:00
committed by Git OBS Bridge
parent fb16583888
commit e05ab2d7ff
3 changed files with 66 additions and 1 deletions

60
pytest4.patch Normal file
View File

@@ -0,0 +1,60 @@
--- a/tests/fixtures.py
+++ b/tests/fixtures.py
@@ -21,7 +21,7 @@ def system_path():
@pytest.yield_fixture
-def system():
+def system(system_path):
'''
yields the contents of the system.evtx test file.
the returned value is a memory map of the contents,
@@ -30,8 +30,7 @@ def system():
Returns:
mmap.mmap: the contents of the test file.
'''
- p = system_path()
- with open(p, 'rb') as f:
+ with open(system_path, 'rb') as f:
with contextlib.closing(mmap.mmap(f.fileno(), 0,
access=mmap.ACCESS_READ)) as buf:
yield buf
@@ -52,7 +51,7 @@ def security_path():
@pytest.yield_fixture
-def security():
+def security(security_path):
'''
yields the contents of the security.evtx test file.
the returned value is a memory map of the contents,
@@ -61,8 +60,7 @@ def security():
Returns:
mmap.mmap: the contents of the test file.
'''
- p = security_path()
- with open(p, 'rb') as f:
+ with open(security_path, 'rb') as f:
with contextlib.closing(mmap.mmap(f.fileno(), 0,
access=mmap.ACCESS_READ)) as buf:
yield buf
--- a/tests/test_records.py
+++ b/tests/test_records.py
@@ -248,7 +248,7 @@ def test_parse_record(system):
['EndOfStreamNode']]]]],
['Substitutions', None, [
['WstringTypeNode', 'System'],
- ['WstringTypeNode', 'C:\Windows\System32\Winevt\Logs\Archive-System-2012-03-14-04-17-39-932.evtx']]]]]]]]]]]
+ ['WstringTypeNode', 'C:\\Windows\\System32\\Winevt\\Logs\\Archive-System-2012-03-14-04-17-39-932.evtx']]]]]]]]]]]
assert extract_structure(record.root()) == expected
@@ -264,7 +264,7 @@ def test_render_record(system):
chunk = one(fh.chunks())
record = one(chunk.records())
- xml = record.xml()
+ xml = record.xml()
assert xml == textwrap.dedent('''\
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"><System><Provider Name="Microsoft-Windows-Eventlog" Guid="{fc65ddd8-d6ef-4962-83d5-6e5cfe9ce148}"></Provider>
<EventID Qualifiers="">105</EventID>

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 4 15:05:59 CET 2019 - Matej Cepl <mcepl@suse.com>
- Add pytest4.patch making the testsuite running again.
-------------------------------------------------------------------
Thu Aug 22 14:11:28 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>

View File

@@ -27,7 +27,7 @@ URL: https://github.com/williballenthin/python-evtx
Source: https://github.com/williballenthin/python-evtx/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires: %{python_module hexdump}
BuildRequires: %{python_module lxml}
BuildRequires: %{python_module pytest < 4}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: dos2unix
BuildRequires: fdupes