From a43d2c115fc589cfc095d903125ea137495aa9ca Mon Sep 17 00:00:00 2001 From: Willi Ballenthin Date: Thu, 6 Jul 2023 19:04:53 +0200 Subject: [PATCH] tests: fix fixture imports --- .github/ruff.toml | 8 ++++++++ tests/test_binja_features.py | 1 + tests/test_dnfile_features.py | 6 +++--- tests/test_dotnet_features.py | 6 +++--- tests/test_dotnetfile_features.py | 14 ++++++++++---- tests/test_main.py | 4 ++++ tests/test_pefile_features.py | 4 ++-- tests/test_proto.py | 1 + tests/test_result_document.py | 1 + tests/test_viv_features.py | 1 + 10 files changed, 34 insertions(+), 12 deletions(-) diff --git a/.github/ruff.toml b/.github/ruff.toml index c6a66b08..3a5254a9 100644 --- a/.github/ruff.toml +++ b/.github/ruff.toml @@ -49,5 +49,13 @@ exclude = [ # F401: `foo` imported but unused # F811 Redefinition of unused `foo` "tests/test_main.py" = ["F401", "F811"] +"tests/test_proto.py" = ["F401", "F811"] "tests/test_freeze.py" = ["F401", "F811"] "tests/test_function_id.py" = ["F401", "F811"] +"tests/test_viv_features.py" = ["F401", "F811"] +"tests/test_binja_features.py" = ["F401", "F811"] +"tests/test_pefile_features.py" = ["F401", "F811"] +"tests/test_dnfile_features.py" = ["F401", "F811"] +"tests/test_dotnet_features.py" = ["F401", "F811"] +"tests/test_result_document.py" = ["F401", "F811"] +"tests/test_dotnetfile_features.py" = ["F401", "F811"] diff --git a/tests/test_binja_features.py b/tests/test_binja_features.py index 9bc5a995..378eb644 100644 --- a/tests/test_binja_features.py +++ b/tests/test_binja_features.py @@ -10,6 +10,7 @@ import logging import pytest import fixtures +from fixtures import scope, sample import capa.main diff --git a/tests/test_dnfile_features.py b/tests/test_dnfile_features.py index 664b699b..5ffa2ead 100644 --- a/tests/test_dnfile_features.py +++ b/tests/test_dnfile_features.py @@ -7,10 +7,10 @@ # See the License for the specific language governing permissions and limitations under the License. import fixtures -from fixtures import parametrize +from fixtures import scope, sample -@parametrize( +@fixtures.parametrize( "sample,scope,feature,expected", fixtures.FEATURE_PRESENCE_TESTS_DOTNET, indirect=["sample", "scope"], @@ -19,7 +19,7 @@ def test_dnfile_features(sample, scope, feature, expected): fixtures.do_test_feature_presence(fixtures.get_dnfile_extractor, sample, scope, feature, expected) -@parametrize( +@fixtures.parametrize( "sample,scope,feature,expected", fixtures.FEATURE_COUNT_TESTS_DOTNET, indirect=["sample", "scope"], diff --git a/tests/test_dotnet_features.py b/tests/test_dotnet_features.py index 5227c892..af633386 100644 --- a/tests/test_dotnet_features.py +++ b/tests/test_dotnet_features.py @@ -7,10 +7,10 @@ # See the License for the specific language governing permissions and limitations under the License. import fixtures -from fixtures import parametrize +from fixtures import scope, sample, b9f5b_dotnetfile_extractor, mixed_mode_64_dotnetfile_extractor -@parametrize( +@fixtures.parametrize( "sample,scope,feature,expected", fixtures.FEATURE_PRESENCE_TESTS_DOTNET, indirect=["sample", "scope"], @@ -19,7 +19,7 @@ def test_dnfile_features(sample, scope, feature, expected): fixtures.do_test_feature_presence(fixtures.get_dnfile_extractor, sample, scope, feature, expected) -@parametrize( +@fixtures.parametrize( "extractor,function,expected", [ ("b9f5b_dotnetfile_extractor", "is_dotnet_file", True), diff --git a/tests/test_dotnetfile_features.py b/tests/test_dotnetfile_features.py index a4af0da0..3b4858a1 100644 --- a/tests/test_dotnetfile_features.py +++ b/tests/test_dotnetfile_features.py @@ -8,14 +8,20 @@ import pytest import fixtures -from fixtures import parametrize +from fixtures import ( + FEATURE_PRESENCE_TESTS_DOTNET, + scope, + sample, + b9f5b_dotnetfile_extractor, + mixed_mode_64_dotnetfile_extractor, +) import capa.features.file -@parametrize( +@fixtures.parametrize( "sample,scope,feature,expected", - fixtures.FEATURE_PRESENCE_TESTS_DOTNET, + FEATURE_PRESENCE_TESTS_DOTNET, indirect=["sample", "scope"], ) def test_dotnetfile_features(sample, scope, feature, expected): @@ -28,7 +34,7 @@ def test_dotnetfile_features(sample, scope, feature, expected): fixtures.do_test_feature_presence(fixtures.get_dotnetfile_extractor, sample, scope, feature, expected) -@parametrize( +@fixtures.parametrize( "extractor,function,expected", [ ("b9f5b_dotnetfile_extractor", "is_dotnet_file", True), diff --git a/tests/test_main.py b/tests/test_main.py index e76ee4ed..bda9271b 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -11,6 +11,10 @@ import textwrap import fixtures from fixtures import ( + z499c2_extractor, + z9324d_extractor, + pma16_01_extractor, + pingtaest_extractor, _692f_dotnetfile_extractor, _1c444_dotnetfile_extractor, _039a6_dotnetfile_extractor, diff --git a/tests/test_pefile_features.py b/tests/test_pefile_features.py index 6f4a59bf..1abcbdb8 100644 --- a/tests/test_pefile_features.py +++ b/tests/test_pefile_features.py @@ -7,12 +7,12 @@ # See the License for the specific language governing permissions and limitations under the License. import pytest import fixtures -from fixtures import parametrize +from fixtures import scope, sample import capa.features.file -@parametrize( +@fixtures.parametrize( "sample,scope,feature,expected", fixtures.FEATURE_PRESENCE_TESTS, indirect=["sample", "scope"], diff --git a/tests/test_proto.py b/tests/test_proto.py index 06476c15..43a0ad78 100644 --- a/tests/test_proto.py +++ b/tests/test_proto.py @@ -9,6 +9,7 @@ import copy from typing import Any import pytest +from fixtures import a3f3bbc_rd, a076114_rd, pma0101_rd, al_khaserx64_rd, al_khaserx86_rd, dotnet_1c444e_rd import capa.rules import capa.render diff --git a/tests/test_result_document.py b/tests/test_result_document.py index 1a1b656f..161628ff 100644 --- a/tests/test_result_document.py +++ b/tests/test_result_document.py @@ -9,6 +9,7 @@ import copy import pytest import fixtures +from fixtures import a3f3bbc_rd, a076114_rd, pma0101_rd, al_khaserx64_rd, al_khaserx86_rd, dotnet_1c444e_rd import capa import capa.engine as ceng diff --git a/tests/test_viv_features.py b/tests/test_viv_features.py index ca26f693..1e07ca74 100644 --- a/tests/test_viv_features.py +++ b/tests/test_viv_features.py @@ -6,6 +6,7 @@ # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and limitations under the License. import fixtures +from fixtures import scope, sample @fixtures.parametrize(