Files
entropy/lib/tests/run
Sławomir Nizio fabb3e72da [tests] add lib/tests/run-nonpriv-wrapper
- runs as non-root
- does not require being in entropy/portage group
    - in fact, it's better (better isolation) to run as such
- thus does not modify running system

The wrapper script is ugly but very convenient.
2018-08-05 00:40:11 +02:00

51 lines
1.0 KiB
Python
Executable File

#!/usr/bin/python
# -*- coding: utf-8 -*-
# Too run in a (partially) isolated environment and as nonprivileged user, see
# run-nonpriv-wrapper.
import os
import sys
locale_dir = os.path.realpath(os.path.join(os.getcwd(), "i18n"))
os.environ['TEXTDOMAINDIR'] = locale_dir
import unittest
sys.path.insert(0,'../client')
sys.path.insert(0,'../../client')
sys.path.insert(0,'.')
sys.path.insert(0,'../')
# set unit testing mode
from entropy.const import etpSys
etpSys['unittest'] = True
from tests import locks, db, client, server, misc, fetchers, tools, dep, \
i18n, spm, qa, core, security, const
# Add to the list the module to test
mods = [
locks,
db,
client,
server,
misc,
fetchers,
tools,
dep,
i18n,
spm,
qa,
core,
security,
const
]
tests = []
for mod in mods:
tests.append(unittest.TestLoader().loadTestsFromModule(mod))
rc = 0
result = unittest.TextTestRunner(verbosity = 1).run(unittest.TestSuite(tests))
if result.errors or result.failures:
rc = 1
raise SystemExit(rc)