summaryrefslogtreecommitdiff
path: root/tools/Testing.py
blob: f1115979513b48151af6973f3c35a202a76ddee2 (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
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-

import glob
import os
import tempfile

import Pkg


currently_testing = 0
output = []

def isTest():
    return currently_testing

def startTest():
    global currently_testing
    global output
    output = []
    currently_testing = 1

def addOutput(s):
    global output
    output.append(s)

def getOutput():
    global output
    return output

def getTestedPackage(name):
    pkg_path = glob.glob(os.environ['TESTPATH'] + '/' + name + '-*.rpm')[0]
    return Pkg.Pkg(pkg_path, tempfile.gettempdir())

def getTestedSpecPackage(name):
    pkg_path = glob.glob(os.environ['TESTPATH'] + '/' + name + '.spec')[0]
    return Pkg.FakePkg(pkg_path)

# Local variables:
# indent-tabs-mode: nil
# py-indent-offset: 4
# End:
# ex: ts=4 sw=4 et