summaryrefslogtreecommitdiff
blob: a6f3b8f1c6051312e1f85d479852276b4369786b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/python
# runTests.py -- Portage Unit Test Functionality
# Copyright 2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

import os, sys
import os.path as osp

# Insert our parent dir so we can do shiny import "tests"
# This line courtesy of Marienz and Pkgcore ;)
sys.path.insert(0, osp.dirname(osp.dirname(osp.dirname(osp.abspath(__file__)))))

import portage

# Ensure that we don't instantiate portage.settings, so that tests should
# work the same regardless of global configuration file state/existence.
portage._disable_legacy_globals()

import portage.tests as tests
from portage.const import PORTAGE_BIN_PATH
path = os.environ.get("PATH", "").split(":")
path = [x for x in path if x]
if not path or not os.path.samefile(path[0], PORTAGE_BIN_PATH):
	path.insert(0, PORTAGE_BIN_PATH)
	os.environ["PATH"] = ":".join(path)
del path


if __name__ == "__main__":
	result = tests.main()
	if not result.wasSuccessful():
		sys.exit(1)