I'm getting
FileNotFoundError at the
open() function call for a valid absolute path in a lcc test. So for debugging, I tried to use the
exists() function provided by the
os module in Python. And to my surprise, the first
print() (which is outside the suite declaration) returns
True (since it is a valid path/file indeed) whereas the second
print() (which is inside the lcc suite/test) returns
False - which implies that the path is rendered invalid inside that lcc suite/test.
Here's what my code looks like (imports have been removed).
CURRENT_PATH = os.getcwd()
TEST_FILE_DIR = os.path.join(CURRENT_PATH, 'resources')
TEST_FILE_PATH = os.path.join(TEST_FILE_DIR, 'my_file.txt'))
print(os.path.exists(TEST_FILE_PATH))
@lcc.suite("My suite")
class MySuite:
@lcc.test("my test")
def verify_something(self):
print(os.path.exists(TEST_FILE_PATH))
with open(TEST_FILE_PATH, 'r') as file:
# do something with the opened file
What could be the issue here?