~doanac/uci-engine/runner-refactor

575.2.1 by Vincent Ladeuil
Move run-tests under testing as a python module so tests can be written (they need to be able import the module).
1
#!/usr/bin/env python
2
# Ubuntu CI Engine
3
# Copyright 2014 Canonical Ltd.
4
5
# This program is free software: you can redistribute it and/or modify it
6
# under the terms of the GNU Affero General Public License version 3, as
7
# published by the Free Software Foundation.
8
9
# This program is distributed in the hope that it will be useful, but
10
# WITHOUT ANY WARRANTY; without even the implied warranties of
11
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12
# PURPOSE.  See the GNU Affero General Public License for more details.
13
14
# You should have received a copy of the GNU Affero General Public License
15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
"""The CI Engine test runner."""
17
import os
18
import sys
19
616.3.1 by Evan Dandrea
Wrap run-tests in a virtualenv.
20
from testing import venv
21
# Ensure this program runs within a virtualenv, if one hasn't been provided.
22
venv.install()
575.2.1 by Vincent Ladeuil
Move run-tests under testing as a python module so tests can be written (they need to be able import the module).
23
24
HERE = os.path.abspath(os.path.dirname(__file__))
25
575.2.2 by Vincent Ladeuil
Add style tests to bootstrap, fixing pep8 issue as a drive-by.
26
# We want to be able to import from the branch root
27
sys.path.append(HERE)
28
from testing import run_tests
575.2.1 by Vincent Ladeuil
Move run-tests under testing as a python module so tests can be written (they need to be able import the module).
29
30
31
if __name__ == '__main__':
616.3.5 by Evan Dandrea
Clean up after the temporary venv.
32
    retval = run_tests.main(sys.argv[1:], sys.stdout, sys.stderr)
33
    venv.delete()
34
    sys.exit(retval)