def main():
"""Entry point"""
try:
- os.makedirs('/var/lib/xtesting/results/')
+ os.makedirs(constants.RESULTS_DIR)
except OSError as ex:
if ex.errno != errno.EEXIST:
- six.print_("Cannot create /var/lib/xtesting/results/")
+ six.print_("{} {}".format("Cannot create", constants.RESULTS_DIR))
return testcase.TestCase.EX_RUN_ERROR
if env.get('DEBUG').lower() == 'true':
logging.config.fileConfig(pkg_resources.resource_filename(
- 'xtesting', 'ci/logging.debug.ini'))
+ 'xtesting', constants.DEBUG_INI_PATH))
else:
logging.config.fileConfig(pkg_resources.resource_filename(
- 'xtesting', 'ci/logging.ini'))
+ 'xtesting', constants.INI_PATH))
logging.captureWarnings(True)
parser = RunTestsParser()
args = parser.parse_args(sys.argv[1:])
from xtesting.core import testcase
from xtesting.utils import env
+from xtesting.utils import constants
__author__ = "Cedric Ollivier <cedric.ollivier@orange.com>"
os.makedirs(testcase.TestCase.dir_results)
if env.get('DEBUG').lower() == 'true':
logging.config.fileConfig(pkg_resources.resource_filename(
- 'xtesting', 'ci/logging.debug.ini'))
+ 'xtesting', constants.DEBUG_INI_PATH))
else:
logging.config.fileConfig(pkg_resources.resource_filename(
- 'xtesting', 'ci/logging.ini'))
+ 'xtesting', constants.INI_PATH))
logging.captureWarnings(True)
Campaign.zip_campaign_files()
import requests
from xtesting.core import testcase
+from xtesting.utils import constants
__author__ = "Cedric Ollivier <cedric.ollivier@orange.com>"
mock.call().meta.client.head_bucket(Bucket='xtesting'),
mock.call().Bucket('xtesting'),
mock.call().Bucket().upload_file(
- '/var/lib/xtesting/results/xtesting.log',
- 'prefix/xtesting.log',
+ constants.LOG_PATH,
+ os.path.join('prefix', os.path.basename(constants.LOG_PATH)),
Config=mock.ANY,
ExtraArgs={'ContentType': 'application/octet-stream'}),
mock.call().Bucket('xtesting'),
mock.call().Bucket().upload_file(
- '/var/lib/xtesting/results/xtesting.debug.log',
- 'prefix/xtesting.debug.log',
+ constants.DEBUG_LOG_PATH,
+ os.path.join('prefix',
+ os.path.basename(constants.DEBUG_LOG_PATH)),
Config=mock.ANY,
ExtraArgs={'ContentType': 'application/octet-stream'}),
mock.call().Bucket('xtesting'),
mock.call().Bucket().upload_file(
- '/var/lib/xtesting/results/bar', 'prefix/bar',
+ os.path.join(constants.RESULTS_DIR, 'bar'),
+ 'prefix/bar',
Config=mock.ANY,
ExtraArgs={'ContentType': 'application/octet-stream'})]
self.assertEqual(args[1].mock_calls, expected)
mock.call().meta.client.head_bucket(Bucket='xtesting'),
mock.call().Bucket('xtesting'),
mock.call().Bucket().upload_file(
- '/var/lib/xtesting/results/xtesting.log',
- 'prefix/xtesting.log',
+ constants.LOG_PATH,
+ os.path.join('prefix', os.path.basename(constants.LOG_PATH)),
Config=mock.ANY,
ExtraArgs={'ContentType': 'text/plain'}),
mock.call().Bucket('xtesting'),
mock.call().Bucket().upload_file(
- '/var/lib/xtesting/results/xtesting.debug.log',
- 'prefix/xtesting.debug.log',
+ constants.DEBUG_LOG_PATH,
+ os.path.join('prefix',
+ os.path.basename(constants.DEBUG_LOG_PATH)),
Config=mock.ANY,
ExtraArgs={'ContentType': 'text/plain'}),
mock.call().Bucket('xtesting'),
mock.call().Bucket().upload_file(
- '/var/lib/xtesting/results/bar', 'prefix/bar',
+ os.path.join(constants.RESULTS_DIR, 'bar'),
+ 'prefix/bar',
Config=mock.ANY,
ExtraArgs={'ContentType': 'text/plain'})]
self.assertEqual(args[1].mock_calls, expected)