Skip to content

Commit 046957e

Browse files
committed
fix disable_curdir_processing decorator
1 parent 98ed6ac commit 046957e

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/robot/parsing/__init__.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def print_suite(suite):
5454
from .lexer import TestCaseFileLexer, ResourceFileLexer
5555
from .nodes import TestCaseSection
5656
from .parser import RobotFrameworkParser
57+
from . import lexerwrapper
5758

5859

5960
# TODO: remove/inline
@@ -74,12 +75,10 @@ def get_resource_file_ast(source):
7475
def disable_curdir_processing(method):
7576
"""Decorator to disable processing `${CURDIR}` variable."""
7677
def decorated(*args, **kwargs):
77-
pass
78-
# FIXME
79-
# original = populators.PROCESS_CURDIR
80-
# populators.PROCESS_CURDIR = False
81-
# try:
82-
# return method(*args, **kwargs)
83-
# finally:
84-
# populators.PROCESS_CURDIR = original
85-
return method
78+
original = lexerwrapper.PROCESS_CURDIR
79+
lexerwrapper.PROCESS_CURDIR = False
80+
try:
81+
return method(*args, **kwargs)
82+
finally:
83+
lexerwrapper.PROCESS_CURDIR = original
84+
return decorated

src/robot/parsing/lexerwrapper.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
from robot.utils import Utf8Reader, get_error_message
2121

2222

23+
PROCESS_CURDIR = True
24+
25+
2326
class LexerWrapper(object):
2427

2528
def __init__(self, lexer, source):
@@ -42,7 +45,7 @@ def token(self):
4245
if token and token.type == token.ERROR:
4346
self._report_error(token)
4447
return self._next_token_after_eos()
45-
if token and '${CURDIR}' in token.value:
48+
if token and '${CURDIR}' in token.value and PROCESS_CURDIR:
4649
token.value = token.value.replace('${CURDIR}', self.curdir)
4750
return token
4851

0 commit comments

Comments
 (0)