Skip to content

Commit

Permalink
Fix pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
vshampor committed Aug 23, 2023
1 parent 992c4fa commit 94db719
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tests/common/test_framework_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@
import importlib
import logging
import re
import sys
import unittest
from importlib import import_module
from importlib.machinery import ModuleSpec
from typing import List
from unittest import mock
from unittest.mock import MagicMock

import pytest
Expand All @@ -35,7 +32,7 @@ def __init__(self, mocked_modules: List[str], hidden_modules: List[str]):
def __call__(self, fullname, path=None, target=None):
if fullname in self._hidden_modules:
return None
elif fullname in self._mocked_modules:
if fullname in self._mocked_modules:
return ModuleSpec(fullname, loader=MagicMock(), origin="foo/bar")
return _REAL_FIND_SPEC(fullname, path, target)

Expand All @@ -44,7 +41,7 @@ def __call__(self, fullname, path=None, target=None):
def test_frameworks_detected(ref_available_frameworks: List[str], nncf_caplog, mocker):
unavailable_frameworks = [fw for fw in SUPPORTED_FRAMEWORKS if fw not in ref_available_frameworks]
failer = FailForModules(ref_available_frameworks, unavailable_frameworks)
with unittest.mock.patch("importlib.util.find_spec", wraps=failer) as mocked_fs:
with unittest.mock.patch("importlib.util.find_spec", wraps=failer):
with nncf_caplog.at_level(logging.INFO):
importlib.reload(nncf)
matches = re.search(r"Supported frameworks detected: (.*)", nncf_caplog.text)
Expand Down

0 comments on commit 94db719

Please sign in to comment.