aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ08nY2023-08-08 13:38:21 +0200
committerJ08nY2023-08-08 13:38:21 +0200
commit5e3b6529f8c868b01a1407a6adc2c6b1a74771fb (patch)
treeae301d2789a8759cfdc55def0d9a8874e90ce6e2
parentfe5cb9f7d579d2407d03ae58fcabd70d4147efa9 (diff)
downloadpyecsca-5e3b6529f8c868b01a1407a6adc2c6b1a74771fb.tar.gz
pyecsca-5e3b6529f8c868b01a1407a6adc2c6b1a74771fb.tar.zst
pyecsca-5e3b6529f8c868b01a1407a6adc2c6b1a74771fb.zip
-rw-r--r--Makefile20
-rw-r--r--pyecsca/ec/curve.py2
-rw-r--r--test/data/__init__.py0
-rw-r--r--test/data/divpoly/__init__.py0
-rw-r--r--test/data/ec/__init__.py0
-rw-r--r--test/data/ec/curve.json (renamed from test/data/curve.json)0
-rw-r--r--test/data/ec/curves.json (renamed from test/data/curves.json)0
-rw-r--r--test/data/ec/ecgen_secp128r1.json (renamed from test/data/ecgen_secp128r1.json)0
-rw-r--r--test/data/ec/ectester_secp128r1.csv (renamed from test/data/ectester_secp128r1.csv)0
-rw-r--r--test/data/sca/__init__.py0
-rw-r--r--test/data/sca/chipwhisperer_keylist.npy (renamed from test/data/chipwhisperer_keylist.npy)bin112 -> 112 bytes
-rw-r--r--test/data/sca/chipwhisperer_knownkey.npy (renamed from test/data/chipwhisperer_knownkey.npy)bin96 -> 96 bytes
-rw-r--r--test/data/sca/chipwhisperer_settings.cwset (renamed from test/data/chipwhisperer_settings.cwset)0
-rw-r--r--test/data/sca/chipwhisperer_textin.npy (renamed from test/data/chipwhisperer_textin.npy)bin112 -> 112 bytes
-rw-r--r--test/data/sca/chipwhisperer_textout.npy (renamed from test/data/chipwhisperer_textout.npy)bin214 -> 214 bytes
-rw-r--r--test/data/sca/chipwhisperer_traces.npy (renamed from test/data/chipwhisperer_traces.npy)bin384080 -> 384080 bytes
-rw-r--r--test/data/sca/config_chipwhisperer_.cfg (renamed from test/data/config_chipwhisperer_.cfg)0
-rw-r--r--test/data/sca/example.trs (renamed from test/data/example.trs)bin26250885 -> 26250885 bytes
-rwxr-xr-xtest/data/sca/target.py (renamed from test/data/target.py)5
-rw-r--r--test/data/sca/test.h5 (renamed from test/data/test.h5)bin6592 -> 6592 bytes
-rw-r--r--test/data/sca/test.pickle (renamed from test/data/test.pickle)bin463 -> 463 bytes
-rw-r--r--test/ec/test_divpoly.py4
-rw-r--r--test/ec/test_params.py32
-rw-r--r--test/sca/perf_combine.py41
-rw-r--r--test/sca/test_align.py20
-rw-r--r--test/sca/test_target.py45
-rw-r--r--test/sca/test_traceset.py52
27 files changed, 124 insertions, 97 deletions
diff --git a/Makefile b/Makefile
index bf60189..a89fd12 100644
--- a/Makefile
+++ b/Makefile
@@ -1,24 +1,24 @@
-EC_TESTS = ec.test_context ec.test_configuration ec.test_curve ec.test_formula \
-ec.test_params ec.test_key_agreement ec.test_key_generation ec.test_mod ec.test_model \
-ec.test_mult ec.test_naf ec.test_op ec.test_point ec.test_signature ec.test_transformations ec.test_regress \
-ec.test_divpoly
+EC_TESTS = test.ec.test_context test.ec.test_configuration test.ec.test_curve test.ec.test_formula \
+test.ec.test_params test.ec.test_key_agreement test.ec.test_key_generation test.ec.test_mod test.ec.test_model \
+test.ec.test_mult test.ec.test_naf test.ec.test_op test.ec.test_point test.ec.test_signature test.ec.test_transformations test.ec.test_regress \
+test.ec.test_divpoly
-SCA_TESTS = sca.test_align sca.test_combine sca.test_edit sca.test_filter sca.test_match sca.test_process \
-sca.test_sampling sca.test_target sca.test_test sca.test_trace sca.test_traceset sca.test_plot sca.test_rpa \
-sca.test_zvp sca.test_stacked_combine sca.test_leakage_models
+SCA_TESTS = test.sca.test_align test.sca.test_combine test.sca.test_edit test.sca.test_filter test.sca.test_match test.sca.test_process \
+test.sca.test_sampling test.sca.test_target test.sca.test_test test.sca.test_trace test.sca.test_traceset test.sca.test_plot test.sca.test_rpa \
+test.sca.test_zvp test.sca.test_stacked_combine test.sca.test_leakage_models
TESTS = ${EC_TESTS} ${SCA_TESTS}
PERF_SCRIPTS = test.ec.perf_mod test.ec.perf_formula test.ec.perf_mult test.sca.perf_combine
test:
- nose2 -s test -E "not slow and not disabled" -C -v ${TESTS}
+ nose2 -E "not slow and not disabled" -C -v ${TESTS}
test-plots:
- env PYECSCA_TEST_PLOTS=1 nose2 -s test -E "not slow and not disabled" -C -v ${TESTS}
+ env PYECSCA_TEST_PLOTS=1 nose2 -E "not slow and not disabled" -C -v ${TESTS}
test-all:
- nose2 -s test -C -v ${TESTS}
+ nose2 -C -v ${TESTS}
typecheck:
mypy --namespace-packages -p pyecsca --ignore-missing-imports --show-error-codes --check-untyped-defs
diff --git a/pyecsca/ec/curve.py b/pyecsca/ec/curve.py
index aae491d..fb567e8 100644
--- a/pyecsca/ec/curve.py
+++ b/pyecsca/ec/curve.py
@@ -5,7 +5,7 @@ from copy import copy
from typing import MutableMapping, Union, List, Optional, Dict
from public import public
-from sympy import FF, symbols, Poly, sympify
+from sympy import FF, sympify
from .coordinates import CoordinateModel, AffineCoordinateModel
from .error import raise_unsatisified_assumption
diff --git a/test/data/__init__.py b/test/data/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/data/__init__.py
diff --git a/test/data/divpoly/__init__.py b/test/data/divpoly/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/data/divpoly/__init__.py
diff --git a/test/data/ec/__init__.py b/test/data/ec/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/data/ec/__init__.py
diff --git a/test/data/curve.json b/test/data/ec/curve.json
index c965c90..c965c90 100644
--- a/test/data/curve.json
+++ b/test/data/ec/curve.json
diff --git a/test/data/curves.json b/test/data/ec/curves.json
index 978ab36..978ab36 100644
--- a/test/data/curves.json
+++ b/test/data/ec/curves.json
diff --git a/test/data/ecgen_secp128r1.json b/test/data/ec/ecgen_secp128r1.json
index a1c4796..a1c4796 100644
--- a/test/data/ecgen_secp128r1.json
+++ b/test/data/ec/ecgen_secp128r1.json
diff --git a/test/data/ectester_secp128r1.csv b/test/data/ec/ectester_secp128r1.csv
index f86a00d..f86a00d 100644
--- a/test/data/ectester_secp128r1.csv
+++ b/test/data/ec/ectester_secp128r1.csv
diff --git a/test/data/sca/__init__.py b/test/data/sca/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/data/sca/__init__.py
diff --git a/test/data/chipwhisperer_keylist.npy b/test/data/sca/chipwhisperer_keylist.npy
index c709dc7..c709dc7 100644
--- a/test/data/chipwhisperer_keylist.npy
+++ b/test/data/sca/chipwhisperer_keylist.npy
Binary files differ
diff --git a/test/data/chipwhisperer_knownkey.npy b/test/data/sca/chipwhisperer_knownkey.npy
index 82c97cd..82c97cd 100644
--- a/test/data/chipwhisperer_knownkey.npy
+++ b/test/data/sca/chipwhisperer_knownkey.npy
Binary files differ
diff --git a/test/data/chipwhisperer_settings.cwset b/test/data/sca/chipwhisperer_settings.cwset
index e6d0ad4..e6d0ad4 100644
--- a/test/data/chipwhisperer_settings.cwset
+++ b/test/data/sca/chipwhisperer_settings.cwset
diff --git a/test/data/chipwhisperer_textin.npy b/test/data/sca/chipwhisperer_textin.npy
index 22b93e1..22b93e1 100644
--- a/test/data/chipwhisperer_textin.npy
+++ b/test/data/sca/chipwhisperer_textin.npy
Binary files differ
diff --git a/test/data/chipwhisperer_textout.npy b/test/data/sca/chipwhisperer_textout.npy
index 0ac8831..0ac8831 100644
--- a/test/data/chipwhisperer_textout.npy
+++ b/test/data/sca/chipwhisperer_textout.npy
Binary files differ
diff --git a/test/data/chipwhisperer_traces.npy b/test/data/sca/chipwhisperer_traces.npy
index df72f86..df72f86 100644
--- a/test/data/chipwhisperer_traces.npy
+++ b/test/data/sca/chipwhisperer_traces.npy
Binary files differ
diff --git a/test/data/config_chipwhisperer_.cfg b/test/data/sca/config_chipwhisperer_.cfg
index dcc3129..dcc3129 100644
--- a/test/data/config_chipwhisperer_.cfg
+++ b/test/data/sca/config_chipwhisperer_.cfg
diff --git a/test/data/example.trs b/test/data/sca/example.trs
index a432e69..a432e69 100644
--- a/test/data/example.trs
+++ b/test/data/sca/example.trs
Binary files differ
diff --git a/test/data/target.py b/test/data/sca/target.py
index 72fc463..3ed71d1 100755
--- a/test/data/target.py
+++ b/test/data/sca/target.py
@@ -4,7 +4,10 @@ from sys import stdout
if __name__ == "__main__":
while True:
- line = input()
+ try:
+ line = input()
+ except EOFError:
+ break
char = line[0]
content = line[1:]
if char == "d":
diff --git a/test/data/test.h5 b/test/data/sca/test.h5
index f51b5fd..f51b5fd 100644
--- a/test/data/test.h5
+++ b/test/data/sca/test.h5
Binary files differ
diff --git a/test/data/test.pickle b/test/data/sca/test.pickle
index 43f7f07..43f7f07 100644
--- a/test/data/test.pickle
+++ b/test/data/sca/test.pickle
Binary files differ
diff --git a/test/ec/test_divpoly.py b/test/ec/test_divpoly.py
index 9773624..f09fdf0 100644
--- a/test/ec/test_divpoly.py
+++ b/test/ec/test_divpoly.py
@@ -1,6 +1,8 @@
from unittest import TestCase
import json
+from importlib.resources import files
+import test.data.divpoly
from sympy import FF
from pyecsca.ec.divpoly import a_invariants, b_invariants, divpoly0, divpoly, mult_by_n
from pyecsca.ec.model import ShortWeierstrassModel
@@ -172,7 +174,7 @@ class DivpolyTests(TestCase):
def test_mult_by_n_large(self):
K = FF(self.secp128r1.curve.prime)
mx, my = mult_by_n(self.secp128r1.curve, 21)
- with open("test/data/divpoly/mult_21.json") as f:
+ with files(test.data.divpoly).joinpath("mult_21.json").open("r") as f:
sage_data = json.load(f)
sage_data["mx"][0] = {eval(key): K(val) for key, val in sage_data["mx"][0].items()}
sage_data["mx"][1] = {eval(key): K(val) for key, val in sage_data["mx"][1].items()}
diff --git a/test/ec/test_params.py b/test/ec/test_params.py
index 23cac3f..9f18ded 100644
--- a/test/ec/test_params.py
+++ b/test/ec/test_params.py
@@ -1,7 +1,9 @@
from unittest import TestCase
from parameterized import parameterized
+from importlib.resources import files, as_file
+import test.data.ec
from pyecsca.ec.mod import Mod
from pyecsca.ec.point import Point, InfinityPoint
from pyecsca.misc.cfg import TemporaryConfig
@@ -57,25 +59,29 @@ class DomainParameterTests(TestCase):
get_category(name, coords)
def test_load_params(self):
- params = load_params("test/data/curve.json", "projective")
- try:
- assert params.curve.is_on_curve(params.generator)
- except NotImplementedError:
- pass
+ with as_file(files(test.data.ec).joinpath("curve.json")) as path:
+ params = load_params(path, "projective")
+ try:
+ assert params.curve.is_on_curve(params.generator)
+ except NotImplementedError:
+ pass
def test_load_params_ectester(self):
- params = load_params_ectester("test/data/ectester_secp128r1.csv", "projective")
- assert params.curve.is_on_curve(params.generator)
- self.assertEqual(params, self.secp128r1)
+ with as_file(files(test.data.ec).joinpath("ectester_secp128r1.csv")) as path:
+ params = load_params_ectester(path, "projective")
+ assert params.curve.is_on_curve(params.generator)
+ self.assertEqual(params, self.secp128r1)
def test_load_params_ecgen(self):
- params = load_params_ecgen("test/data/ecgen_secp128r1.json", "projective")
- assert params.curve.is_on_curve(params.generator)
- self.assertEqual(params, self.secp128r1)
+ with as_file(files(test.data.ec).joinpath("ecgen_secp128r1.json")) as path:
+ params = load_params_ecgen(path, "projective")
+ assert params.curve.is_on_curve(params.generator)
+ self.assertEqual(params, self.secp128r1)
def test_load_category(self):
- category = load_category("test/data/curves.json", "yz")
- self.assertEqual(len(category), 1)
+ with as_file(files(test.data.ec).joinpath("curves.json")) as path:
+ category = load_category(path, "yz")
+ self.assertEqual(len(category), 1)
@parameterized.expand(
[
diff --git a/test/sca/perf_combine.py b/test/sca/perf_combine.py
index 9b934d7..42163c8 100644
--- a/test/sca/perf_combine.py
+++ b/test/sca/perf_combine.py
@@ -1,7 +1,9 @@
#!/usr/bin/env python
import click
+from importlib.resources import files, as_file
from test.utils import Profiler
+import test.data.sca
from pyecsca.sca import (
InspectorTraceSet,
average,
@@ -24,25 +26,26 @@ from pyecsca.sca import (
envvar="DIR",
)
def main(profiler, operations, directory):
- traces = InspectorTraceSet.read("test/data/example.trs")
- with Profiler(profiler, directory, f"combine_average_example_{operations}"):
- for _ in range(operations):
- average(*traces)
- with Profiler(profiler, directory, f"combine_condavg_example_{operations}"):
- for _ in range(operations):
- conditional_average(*traces, condition=lambda trace: trace[0] > 0)
- with Profiler(profiler, directory, f"combine_variance_example_{operations}"):
- for _ in range(operations):
- variance(*traces)
- with Profiler(profiler, directory, f"combine_stddev_example_{operations}"):
- for _ in range(operations):
- standard_deviation(*traces)
- with Profiler(profiler, directory, f"combine_add_example_{operations}"):
- for _ in range(operations):
- add(*traces)
- with Profiler(profiler, directory, f"combine_subtract_example_{operations}"):
- for _ in range(operations):
- subtract(traces[0], traces[1])
+ with as_file(files(test.data.sca).joinpath("example.trs")) as path:
+ traces = InspectorTraceSet.read(path)
+ with Profiler(profiler, directory, f"combine_average_example_{operations}"):
+ for _ in range(operations):
+ average(*traces)
+ with Profiler(profiler, directory, f"combine_condavg_example_{operations}"):
+ for _ in range(operations):
+ conditional_average(*traces, condition=lambda trace: trace[0] > 0)
+ with Profiler(profiler, directory, f"combine_variance_example_{operations}"):
+ for _ in range(operations):
+ variance(*traces)
+ with Profiler(profiler, directory, f"combine_stddev_example_{operations}"):
+ for _ in range(operations):
+ standard_deviation(*traces)
+ with Profiler(profiler, directory, f"combine_add_example_{operations}"):
+ for _ in range(operations):
+ add(*traces)
+ with Profiler(profiler, directory, f"combine_subtract_example_{operations}"):
+ for _ in range(operations):
+ subtract(traces[0], traces[1])
if __name__ == "__main__":
diff --git a/test/sca/test_align.py b/test/sca/test_align.py
index 1db71b3..aca0f2f 100644
--- a/test/sca/test_align.py
+++ b/test/sca/test_align.py
@@ -1,4 +1,5 @@
import numpy as np
+from importlib.resources import files, as_file
from pyecsca.sca import (
align_correlation,
align_peaks,
@@ -8,6 +9,7 @@ from pyecsca.sca import (
Trace,
InspectorTraceSet,
)
+import test.data.sca
from .utils import Plottable, slow
@@ -43,17 +45,19 @@ class AlignTests(Plottable):
@slow
def test_large_align(self):
- example = InspectorTraceSet.read("test/data/example.trs")
- result, _ = align_correlation(
- *example, reference_offset=100000, reference_length=20000, max_offset=15000
- )
- self.assertIsNotNone(result)
+ with as_file(files(test.data.sca).joinpath("example.trs")) as path:
+ example = InspectorTraceSet.read(path)
+ result, _ = align_correlation(
+ *example, reference_offset=100000, reference_length=20000, max_offset=15000
+ )
+ self.assertIsNotNone(result)
@slow
def test_large_dtw_align(self):
- example = InspectorTraceSet.read("test/data/example.trs")
- result = align_dtw(*example[:5])
- self.assertIsNotNone(result)
+ with as_file(files(test.data.sca).joinpath("example.trs")) as path:
+ example = InspectorTraceSet.read(path)
+ result = align_dtw(*example[:5])
+ self.assertIsNotNone(result)
def test_peak_align(self):
first_arr = np.array(
diff --git a/test/sca/test_target.py b/test/sca/test_target.py
index 9da3473..fa09eb7 100644
--- a/test/sca/test_target.py
+++ b/test/sca/test_target.py
@@ -4,9 +4,10 @@ from copy import copy
from os.path import realpath, dirname, join
from typing import Optional
from unittest import TestCase, SkipTest
+from importlib.resources import files, as_file
from smartcard.pcsc.PCSCExceptions import BaseSCardException
-
+import test.data.sca
from pyecsca.ec.key_agreement import ECDH_SHA1
from pyecsca.ec.key_generation import KeyGeneration
from pyecsca.ec.mod import Mod
@@ -44,31 +45,31 @@ class TestTarget(SimpleSerialTarget, BinaryTarget):
class BinaryTargetTests(TestCase):
def test_basic_target(self):
- target_path = join(dirname(realpath(__file__)), "..", "data", "target.py")
- target = TestTarget(["python", target_path])
- target.connect()
- resp = target.send_cmd(SimpleSerialMessage("d", ""), 500)
- self.assertIn("r", resp)
- self.assertIn("z", resp)
- self.assertEqual(resp["r"].data, "01020304")
- target.disconnect()
-
- def test_debug(self):
- target_path = join(dirname(realpath(__file__)), "..", "data", "target.py")
- target = TestTarget(["python", target_path], debug_output=True)
- with redirect_stdout(io.StringIO()):
+ with as_file(files(test.data.sca).joinpath("target.py")) as target_path:
+ target = TestTarget(["python", target_path])
target.connect()
- target.send_cmd(SimpleSerialMessage("d", ""), 500)
+ resp = target.send_cmd(SimpleSerialMessage("d", ""), 500)
+ self.assertIn("r", resp)
+ self.assertIn("z", resp)
+ self.assertEqual(resp["r"].data, "01020304")
target.disconnect()
+ def test_debug(self):
+ with as_file(files(test.data.sca).joinpath("target.py")) as target_path:
+ target = TestTarget(["python", target_path], debug_output=True)
+ with redirect_stdout(io.StringIO()):
+ target.connect()
+ target.send_cmd(SimpleSerialMessage("d", ""), 500)
+ target.disconnect()
+
def test_no_connection(self):
- target_path = join(dirname(realpath(__file__)), "..", "data", "target.py")
- target = TestTarget(target_path)
- with self.assertRaises(ValueError):
- target.write(bytes([1, 2, 3, 4]))
- with self.assertRaises(ValueError):
- target.read(5)
- target.disconnect()
+ with as_file(files(test.data.sca).joinpath("target.py")) as target_path:
+ target = TestTarget(str(target_path))
+ with self.assertRaises(ValueError):
+ target.write(bytes([1, 2, 3, 4]))
+ with self.assertRaises(ValueError):
+ target.read(5)
+ target.disconnect()
class ECTesterTargetTests(TestCase):
diff --git a/test/sca/test_traceset.py b/test/sca/test_traceset.py
index e79e5d2..01fadda 100644
--- a/test/sca/test_traceset.py
+++ b/test/sca/test_traceset.py
@@ -1,10 +1,12 @@
import os.path
import shutil
import tempfile
+from importlib.resources import files, as_file
from unittest import TestCase
import numpy as np
+import test.data.sca
from pyecsca.sca import (
TraceSet,
InspectorTraceSet,
@@ -33,25 +35,27 @@ class TraceSetTests(TestCase):
class InspectorTraceSetTests(TestCase):
def test_load_fname(self):
- result = InspectorTraceSet.read("test/data/example.trs")
- self.assertIsNotNone(result)
- self.assertEqual(result.global_title, "Example trace set")
- self.assertEqual(len(result), 10)
- self.assertEqual(len(list(result)), 10)
- self.assertIn("InspectorTraceSet", str(result))
- self.assertIs(result[0].trace_set, result)
- self.assertEqual(result.sampling_frequency, 12500000)
+ with as_file(files(test.data.sca).joinpath("example.trs")) as path:
+ result = InspectorTraceSet.read(path)
+ self.assertIsNotNone(result)
+ self.assertEqual(result.global_title, "Example trace set")
+ self.assertEqual(len(result), 10)
+ self.assertEqual(len(list(result)), 10)
+ self.assertIn("InspectorTraceSet", str(result))
+ self.assertIs(result[0].trace_set, result)
+ self.assertEqual(result.sampling_frequency, 12500000)
def test_load_file(self):
- with open("test/data/example.trs", "rb") as f:
+ with files(test.data.sca).joinpath("example.trs").open("rb") as f:
self.assertIsNotNone(InspectorTraceSet.read(f))
def test_load_bytes(self):
- with open("test/data/example.trs", "rb") as f:
+ with files(test.data.sca).joinpath("example.trs").open("rb") as f:
self.assertIsNotNone(InspectorTraceSet.read(f.read()))
def test_save(self):
- trace_set = InspectorTraceSet.read("test/data/example.trs")
+ with as_file(files(test.data.sca).joinpath("example.trs")) as path:
+ trace_set = InspectorTraceSet.read(path)
with tempfile.TemporaryDirectory() as dirname:
path = os.path.join(dirname, "out.trs")
trace_set.write(path)
@@ -61,18 +65,21 @@ class InspectorTraceSetTests(TestCase):
class ChipWhispererTraceSetTests(TestCase):
def test_load_fname(self):
- result = ChipWhispererTraceSet.read("test/data/config_chipwhisperer_.cfg")
- self.assertIsNotNone(result)
- self.assertEqual(len(result), 2)
+ with as_file(files(test.data.sca).joinpath("config_chipwhisperer_.cfg")) as path:
+ # This will not work if the test package is not on the file system directly.
+ result = ChipWhispererTraceSet.read(path)
+ self.assertIsNotNone(result)
+ self.assertEqual(len(result), 2)
class PickleTraceSetTests(TestCase):
def test_load_fname(self):
- result = PickleTraceSet.read("test/data/test.pickle")
- self.assertIsNotNone(result)
+ with as_file(files(test.data.sca).joinpath("test.pickle")) as path:
+ result = PickleTraceSet.read(path)
+ self.assertIsNotNone(result)
def test_load_file(self):
- with open("test/data/test.pickle", "rb") as f:
+ with files(test.data.sca).joinpath("test.pickle").open("rb") as f:
self.assertIsNotNone(PickleTraceSet.read(f))
def test_save(self):
@@ -86,17 +93,18 @@ class PickleTraceSetTests(TestCase):
class HDF5TraceSetTests(TestCase):
def test_load_fname(self):
- result = HDF5TraceSet.read("test/data/test.h5")
- self.assertIsNotNone(result)
+ with as_file(files(test.data.sca).joinpath("test.h5")) as path:
+ result = HDF5TraceSet.read(path)
+ self.assertIsNotNone(result)
def test_load_file(self):
- with open("test/data/test.h5", "rb") as f:
+ with files(test.data.sca).joinpath("test.h5").open("rb") as f:
self.assertIsNotNone(HDF5TraceSet.read(f))
def test_inplace(self):
- with tempfile.TemporaryDirectory() as dirname:
+ with tempfile.TemporaryDirectory() as dirname, as_file(files(test.data.sca).joinpath("test.h5")) as orig_path:
path = os.path.join(dirname, "test.h5")
- shutil.copy("test/data/test.h5", path)
+ shutil.copy(orig_path, path)
trace_set = HDF5TraceSet.inplace(path)
self.assertIsNotNone(trace_set)
test_trace = Trace(