From dfc805b89bc2bff81ddb2912e8a1ac91c801f23a Mon Sep 17 00:00:00 2001 From: Moritz Raabe Date: Mon, 9 Nov 2020 13:39:19 +0100 Subject: [PATCH] improvements for PR #355 --- capa/main.py | 6 ++---- tests/test_smda_features.py | 6 ++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/capa/main.py b/capa/main.py index 2be2802d..5b6e1a54 100644 --- a/capa/main.py +++ b/capa/main.py @@ -458,12 +458,10 @@ def main(argv=None): parser = argparse.ArgumentParser( description=desc, epilog=epilog, formatter_class=argparse.RawDescriptionHelpFormatter ) - # TODO: decode won't work for python3 + if sys.version_info >= (3, 0): parser.add_argument( - # in #328 we noticed that the sample path is not handled correctly if it contains non-ASCII characters - # https://stackoverflow.com/a/22947334/ offers a solution and decoding using getfilesystemencoding works - # in our testing, however other sources suggest `sys.stdin.encoding` (https://stackoverflow.com/q/4012571/) + # Python 3 str handles non-ASCII arguments correctly "sample", type=str, help="path to sample to analyze", diff --git a/tests/test_smda_features.py b/tests/test_smda_features.py index ef586278..68790f8d 100644 --- a/tests/test_smda_features.py +++ b/tests/test_smda_features.py @@ -16,7 +16,8 @@ from fixtures import * indirect=["sample", "scope"], ) def test_smda_features(sample, scope, feature, expected): - do_test_feature_presence(get_smda_extractor, sample, scope, feature, expected) + with xfail(sys.version_info < (3, 0), reason="SMDA only works on py3"): + do_test_feature_presence(get_smda_extractor, sample, scope, feature, expected) @parametrize( @@ -25,4 +26,5 @@ def test_smda_features(sample, scope, feature, expected): indirect=["sample", "scope"], ) def test_smda_feature_counts(sample, scope, feature, expected): - do_test_feature_count(get_smda_extractor, sample, scope, feature, expected) + with xfail(sys.version_info < (3, 0), reason="SMDA only works on py3"): + do_test_feature_count(get_smda_extractor, sample, scope, feature, expected)