3
3
import re
4
4
import sys
5
5
from contextlib import contextmanager
6
- from typing import Callable , Any , Tuple , Generator , Type
6
+ from typing import Any
7
+ from typing import Callable
8
+ from typing import Generator
9
+ from typing import Tuple
10
+ from typing import Type
7
11
from unittest .mock import MagicMock
8
12
9
13
import pytest
10
- from pytest_mock import MockerFixture , PytestMockWarning
14
+
15
+ from pytest_mock import MockerFixture
16
+ from pytest_mock import PytestMockWarning
11
17
12
18
pytest_plugins = "pytester"
13
19
@@ -249,7 +255,8 @@ def bar(self, arg):
249
255
),
250
256
)
251
257
def test_instance_method_spy_exception (
252
- exc_cls : Type [BaseException ], mocker : MockerFixture ,
258
+ exc_cls : Type [BaseException ],
259
+ mocker : MockerFixture ,
253
260
) -> None :
254
261
class Foo :
255
262
def bar (self , arg ):
@@ -627,12 +634,12 @@ def test_foo(mocker):
627
634
628
635
629
636
def test_parse_ini_boolean () -> None :
630
- import pytest_mock
637
+ from pytest_mock . _util import parse_ini_boolean
631
638
632
- assert pytest_mock . parse_ini_boolean ("True" ) is True
633
- assert pytest_mock . parse_ini_boolean ("false" ) is False
639
+ assert parse_ini_boolean ("True" ) is True
640
+ assert parse_ini_boolean ("false" ) is False
634
641
with pytest .raises (ValueError ):
635
- pytest_mock . parse_ini_boolean ("foo" )
642
+ parse_ini_boolean ("foo" )
636
643
637
644
638
645
def test_patched_method_parameter_name (mocker : MockerFixture ) -> None :
@@ -651,8 +658,7 @@ def request(cls, method, args):
651
658
652
659
653
660
def test_monkeypatch_native (testdir : Any ) -> None :
654
- """Automatically disable monkeypatching when --tb=native.
655
- """
661
+ """Automatically disable monkeypatching when --tb=native."""
656
662
testdir .makepyfile (
657
663
"""
658
664
def test_foo(mocker):
@@ -676,8 +682,7 @@ def test_foo(mocker):
676
682
677
683
678
684
def test_monkeypatch_no_terminal (testdir : Any ) -> None :
679
- """Don't crash without 'terminal' plugin.
680
- """
685
+ """Don't crash without 'terminal' plugin."""
681
686
testdir .makepyfile (
682
687
"""
683
688
def test_foo(mocker):
@@ -692,8 +697,7 @@ def test_foo(mocker):
692
697
693
698
694
699
def test_standalone_mock (testdir : Any ) -> None :
695
- """Check that the "mock_use_standalone" is being used.
696
- """
700
+ """Check that the "mock_use_standalone" is being used."""
697
701
testdir .makepyfile (
698
702
"""
699
703
def test_foo(mocker):
@@ -713,8 +717,7 @@ def test_foo(mocker):
713
717
714
718
@pytest .mark .usefixtures ("needs_assert_rewrite" )
715
719
def test_detailed_introspection (testdir : Any ) -> None :
716
- """Check that the "mock_use_standalone" is being used.
717
- """
720
+ """Check that the "mock_use_standalone" is being used."""
718
721
testdir .makepyfile (
719
722
"""
720
723
def test(mocker):
@@ -755,8 +758,7 @@ def test(mocker):
755
758
)
756
759
@pytest .mark .usefixtures ("needs_assert_rewrite" )
757
760
def test_detailed_introspection_async (testdir : Any ) -> None :
758
- """Check that the "mock_use_standalone" is being used.
759
- """
761
+ """Check that the "mock_use_standalone" is being used."""
760
762
testdir .makepyfile (
761
763
"""
762
764
import pytest
0 commit comments