Skip to content

Commit

Permalink
Fix failure in test_utf8_uploads on CircleCI
Browse files Browse the repository at this point in the history
- on CircleCI, otherwise it fails with

STDERR:   File "/home/circleci/project/./tests/test_utf8_uploads.py", line 23, in <module>
STDERR:     from tcms.settings.common import FILE_UPLOAD_MAX_SIZE
STDERR: ModuleNotFoundError: No module named 'tcms'

and it looks like setting PYTHONPATH externally doesn't work. Instead
make sure the test script configures sys.path internally so it can find
all of the imports
  • Loading branch information
atodorov committed Feb 23, 2024
1 parent 32f25fd commit e9f2182
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/test_http.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ username = testadmin
password = password
_EOF_

rlRun -t -c "PYTHONPATH=../Kiwi ./tests/test_utf8_uploads.py -v"
rlRun -t -c "./tests/test_utf8_uploads.py -v"
rlPhaseEnd

rlPhaseStartTest "Should send ETag header"
Expand Down
7 changes: 6 additions & 1 deletion tests/test_utf8_uploads.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/usr/bin/env python3

#
# Copyright (c) 2022-2023 Kiwi TCMS project. All rights reserved.
# Copyright (c) 2022-2024 Kiwi TCMS project. All rights reserved.
# Author: Alexander Todorov <info@kiwitcms.org>
#

import base64
import os
import ssl
import sys
import tempfile
import unittest
from unittest.mock import patch
Expand All @@ -15,6 +17,9 @@
import requests
from tcms_api import TCMS

tcms_root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.append(tcms_root_path)

from tcms.settings.common import FILE_UPLOAD_MAX_SIZE

try:
Expand Down

0 comments on commit e9f2182

Please sign in to comment.