source: sasview/test/run_one.py @ 861f1880

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 861f1880 was aaad4c95, checked in by Ricardo Ferraz Leal <ricleal@…>, 8 years ago

Log for tests is now on the test directory

  • Property mode set to 100644
File size: 1003 bytes
Line 
1#!/usr/bin/env python
2
3import os
4import sys
5import xmlrunner
6import unittest
7import imp
8from os.path import abspath, dirname, split as splitpath, join as joinpath
9
10import logging
11logger = logging.getLogger(__name__)
12if not logger.root.handlers:
13    import logging.config
14    LOGGER_CONFIG_FILE = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'logging.ini')
15    logging.config.fileConfig(LOGGER_CONFIG_FILE, disable_existing_loggers=False)
16
17if len(sys.argv) < 2:
18    logger.error("Use %s <filename to test>",sys.argv[0])
19    sys.exit(-1)
20
21run_py = joinpath(dirname(dirname(abspath(__file__))), 'run.py')
22run = imp.load_source('sasview_run', run_py)
23run.prepare()
24#print "\n".join(sys.path)
25test_path,test_file = splitpath(abspath(sys.argv[1]))
26print "=== testing:",sys.argv[1]
27#print test_path, test_file
28sys.argv = [sys.argv[0]]
29os.chdir(test_path)
30sys.path.insert(0, test_path)
31test = imp.load_source('tests',test_file)
32unittest.main(test, testRunner=xmlrunner.XMLTestRunner(output='logs'))
Note: See TracBrowser for help on using the repository browser.