Ejemplo n.º 1
0
def main():
	# use the testsuite module from our checkout, not the one in PYTHONPATH
	filePath = os.path.realpath( os.path.dirname( __file__ ) )
	momDirectory = os.path.abspath( os.path.join( filePath, '..', '..' ) )

	sys.path.insert( 0, momDirectory )
	print "Using sys.path: {0}".format( sys.path )

	# important: import testsuite module *after* modifying sys.path to load the correct module!
	import testsuite
	testsuite.main()
Ejemplo n.º 2
0
def pom_bw_junit_xml(argv, parser):
    transitive = False
    path = ""
    product = ""
    if len(argv) < 3:
        print("Missing path")
        exit()
    if argv[2] == "--transitive":
        transitive = True
        if len(argv) < 4:
            print("Missing path")
            exit()
        path = argv[3]
        try:
            product = argv[4]
            if len(argv) > 5:
                print("Bad arguments! For help use: ./da-cli.py --help")
        except IndexError:
            if len(argv) > 4:
                print("Bad arguments! For help use: ./da-cli.py --help")
    else:
        path = argv[2]
        try:
            product = argv[3]
            if len(argv) > 4:
                print("Bad arguments! For help use: ./da-cli.py --help")
        except IndexError:
            if len(argv) > 5:
                print("Bad arguments! For help use: ./da-cli.py --help")

    command = "cd " + path + " && mvn dependency:list -DappendOutput=true"
    if transitive:
        command += " -DexcludeTransitive=true"
    try:
        output = subprocess.check_output(command, shell=True)
    except (subprocess.CalledProcessError):
        print("Path does not exist!")
        exit()
    packages = set()
    for line in output.splitlines():
        line = line.replace("[INFO]    ", "")
        if (line.find("[INFO]") == -1):
            if matchGAPCVS(line):
                gav = line.split(":", 5)[0] + ":" + line.split(
                    ":", 5)[1] + ":" + line.split(":", 5)[3]
                packages.add(gav)
            else:
                exit()
    testsuite.main(packages, "junit.xml", product)
Ejemplo n.º 3
0
def pom_bw_junit_xml(argv, parser):
    transitive = False
    path = ""
    product = ""
    if len(argv) < 3:
        print("Missing path")
        exit()
    if argv[2] == "--transitive":
        transitive = True
        if len(argv) < 4:
            print("Missing path")
            exit()
        path = argv[3]
        try:
            product = argv[4]
            if len(argv) > 5:
                print("Bad arguments! For help use: ./da-cli.py --help")
        except IndexError:
            if len(argv) > 4:
                print("Bad arguments! For help use: ./da-cli.py --help")
    else:
        path = argv[2]
        try:
            product = argv[3]
            if len(argv) > 4:
                print("Bad arguments! For help use: ./da-cli.py --help")
        except IndexError:
            if len(argv) > 5:
                print("Bad arguments! For help use: ./da-cli.py --help")
  
    command = "cd "+path +" && mvn dependency:list -DappendOutput=true"
    if transitive:
        command += " -DexcludeTransitive=true"
    try:
        output = subprocess.check_output(command, shell=True)
    except (subprocess.CalledProcessError):
        print("Path does not exist!")
        exit()
    packages = set()
    for line in output.splitlines():
        line = line.replace("[INFO]    ","")
        if (line.find("[INFO]") == -1):
            if matchGAPCVS(line):
                gav = line.split(":",5)[0] +":" + line.split(":",5)[1] + ":" + line.split(":",5)[3]
                packages.add(gav)
            else:
                exit()
    testsuite.main(packages, "junit.xml", product)
Ejemplo n.º 4
0
        private = True

        image = images.BaseImage(isPrivate_rBuilder = private)
        ret = hndlr.toXml(image, prettyPrint = False)
        self.assertEquals(ret, """<?xml version='1.0' encoding='UTF-8'?>\n<image xmlNodeHash="31bcb37a0b7e503677f7443481b823c4e540d15a"><isPrivate_rBuilder>true</isPrivate_rBuilder></image>""")

        newImage =  hndlr.parseString(ret)
        self.assertEquals(newImage.isPrivate_rBuilder.getText(), 'true')
        self.assertEquals(newImage.getIsPrivate_rBuilder(), True)

    def testProductCodes(self):
        hndlr = images.Handler()
        productCodes = [("a", "aa"),
                        ("b", "bb"),
                        ("c", "cc")]
        image = images.BaseImage(productCode = productCodes)
        ret = hndlr.toXml(image, prettyPrint = False)
        self.assertEquals(ret, """<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<image xmlNodeHash="9cc1b06978e42d8cdb83397ce89339357ed7b49f"><productCode><code>a</code><url>aa</url></productCode><productCode><code>b</code><url>bb</url></productCode><productCode><code>c</code><url>cc</url></productCode></image>""")

        newImage = hndlr.parseString(ret)
        self.failUnless(isinstance(newImage.productCode,
                                   images.xmlNode.MultiItemList),
                                   newImage.productCode)
        self.assertEquals(
            [ (x.code.getText(), x.url.getText())
                for x in newImage.getProductCode()],
            productCodes)

if __name__ == "__main__":
    testsuite.main()
Ejemplo n.º 5
0
    def _runTests(self, archivePath):
        a = Archive(archivePath, self._log)
        a.extract()
        self.failUnlessEqual(sorted(x.name for x in a),
            [
                'subdir/foo.ovf', 'subdir/subsubdir1/a/b/c/deep.data',
                'subdir/subsubdir1/bar1.data',
                'subdir/subsubdir2/bar1.data', 'subdir/subsubdir2/bar2.data'])
        # Get one of the files
        member = [ x for x in a if x.name.endswith('deep.data') ][0]
        # Make sure we have a size member
        self.failUnlessEqual(member.size, 4)
        self.failUnlessEqual(member.name, 'subdir/subsubdir1/a/b/c/deep.data')
        # Make sure we can extract data
        fobj = a.extractfile(member)
        self.failUnlessEqual(fobj.name, 'subdir/subsubdir1/a/b/c/deep.data')
        self.failUnlessEqual(fobj.size, 4)
        self.failUnlessEqual(fobj.read(2), "de")
        self.failUnlessEqual(fobj.read(2), "ep")
        fobj = a.extractfile(member)
        self.failUnlessEqual(fobj.size, 4)
        self.failUnlessEqual(fobj.read(), "deep")
        self.failUnlessEqual(fobj.tell(), 4)
        fobj.seek(1)
        self.failUnlessEqual(fobj.tell(), 1)
        fobj.close()

if __name__ == "__main__":
    testsuite.main()
Ejemplo n.º 6
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from testsuite import main
main()
Ejemplo n.º 7
0
from testsuite import main

app, socketio = main()
socketio.run(app, host='0.0.0.0', port=5000, debug=True, use_reloader=True)