22from os import path
33
44import pytest
5+ from mockito .matchers import Any
6+
57from DynamicLibrary import DynamicLibrary
68from DynamicTypesLibrary import DynamicTypesLibrary
7- from mockito . matchers import Any
9+ from robotlibcore import PY2
810
911
1012@pytest .fixture (scope = 'module' )
@@ -21,6 +23,7 @@ def lib_types():
2123def cur_dir ():
2224 return path .dirname (__file__ )
2325
26+
2427@pytest .fixture (scope = 'module' )
2528def lib_path (cur_dir ):
2629 return path .normpath (path .join (cur_dir , '..' , 'atest' , 'DynamicLibrary.py' ))
@@ -46,6 +49,12 @@ def test_location_in_class(lib, lib_path_components):
4649 assert source == '%s:15' % lib_path_components
4750
4851
52+ @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
53+ def test_decorator_wrapper (lib_types , lib_path_types ):
54+ source = lib_types .get_keyword_source ('keyword_wrapped' )
55+ assert source == '%s:76' % lib_path_types
56+
57+
4958def test_location_in_class_custom_keyword_name (lib , lib_path_components ):
5059 source = lib .get_keyword_source ('Custom name' )
5160 assert source == '%s:19' % lib_path_components
@@ -72,7 +81,7 @@ def test_no_path_and_no_line_number(lib, when):
7281
7382def test_def_in_decorator (lib_types , lib_path_types ):
7483 source = lib_types .get_keyword_source ('keyword_with_def_deco' )
75- assert source == '%s:62 ' % lib_path_types
84+ assert source == '%s:70 ' % lib_path_types
7685
7786
7887def test_error_in_getfile (lib , when ):
@@ -84,4 +93,4 @@ def test_error_in_getfile(lib, when):
8493def test_error_in_line_number (lib , when , lib_path ):
8594 when (inspect ).getsourcelines (Any ()).thenRaise (IOError ('Some message' ))
8695 source = lib .get_keyword_source ('keyword_in_main' )
87- assert source == lib_path
96+ assert source == lib_path
0 commit comments