Ejemplo n.º 1
0
 def test_run_wrong_arg(self):
     ctxt = Context(self.basedir)
     try:
         ctxt.run(1, 'http://bitten.edgewall.org/tools/sh', 'exec', {'foo':'bar'})
         self.fail("InvalidRecipeError expected")
     except InvalidRecipeError, e:
         self.failUnless("Unsupported argument 'foo'" in str(e))
Ejemplo n.º 2
0
 def setUp(self):
     self.basedir = os.path.realpath(tempfile.mkdtemp())
     self.ctxt = Context(self.basedir)
     self.summary = open(os.path.join(self.basedir, 'test-coverage.txt'),
                         'w')
     self.coverdir = os.path.join(self.basedir, 'coverage')
     os.mkdir(self.coverdir)
Ejemplo n.º 3
0
    def test_vars_basedir(self):
        config = Configuration(properties={'foo.bar': 'baz'})
        ctxt = Context('%s/${path}/${foo.bar}' % os.path.realpath('/foo'),
                        config, {'path': 'bar'})

        self.assertEquals(os.path.realpath('/foo/bar/baz'),
                        os.path.realpath(ctxt.vars['basedir']))
        if os.name == 'nt':
            # Make sure paths are double-escaped
            self.failUnless('\\\\' in ctxt.vars['basedir'])
Ejemplo n.º 4
0
    def test_attach_file_non_existing(self):
        # Verify that it raises error and that it gets logged
        ctxt = Context(self.basedir, Configuration())
        ctxt.attach(file_='nonexisting.txt',
                      description='build build')

        self.assertEquals(1, len(ctxt.output))
        self.assertEquals(Recipe.ERROR, ctxt.output[0][0])
        self.assertEquals('Failed to read file nonexisting.txt as attachment',
                            ctxt.output[0][3])
Ejemplo n.º 5
0
    def test_attach_file_build(self):
        # Verify output from attaching a file to a build
        ctxt = Context(self.basedir, Configuration())

        ctxt.attach(file_='build.txt', description='build build')
        self.assertEquals(1, len(ctxt.output))
        self.assertEquals(Recipe.ATTACH, ctxt.output[0][0])
        attach_xml = ctxt.output[0][3]
        self.assertEquals('<file resource="build" '
                          'description="build build" '
                          'filename="build.txt"/>', str(attach_xml))
Ejemplo n.º 6
0
    def test_attach_file_build(self):
        # Verify output from attaching a file to a build
        ctxt = Context(self.basedir, Configuration())
        test_file = open(os.path.join(self.basedir, 'build.txt'), 'w')
        test_file.write('hello build')
        test_file.close()

        ctxt.attach(file_='build.txt', description='build build')
        self.assertEquals(1, len(ctxt.output))
        self.assertEquals(Recipe.ATTACH, ctxt.output[0][0])
        attach_xml = ctxt.output[0][3]
        self.assertEquals('<file resource="build" '
                          'description="build build" '
                          'filename="build.txt">'
                          'aGVsbG8gYnVpbGQ=\n'
                          '</file>', str(attach_xml))
Ejemplo n.º 7
0
    def test_attach_file_config(self):
        # Verify output from attaching a file to a config
        ctxt = Context(self.basedir, Configuration())
        test_file = open(os.path.join(self.basedir, 'config.txt'), 'w')
        test_file.write('hello config')
        test_file.close()

        ctxt.attach(file_='config.txt', description='config config',
                      resource='config')
        self.assertEquals(1, len(ctxt.output))
        self.assertEquals(Recipe.ATTACH, ctxt.output[0][0])
        attach_xml = ctxt.output[0][3]
        self.assertEquals('<file resource="config" '
                          'description="config config" '
                          'filename="config.txt">'
                          'aGVsbG8gY29uZmln\n'
                          '</file>', str(attach_xml))
Ejemplo n.º 8
0
 def setUp(self):
     self.basedir = os.path.realpath(tempfile.mkdtemp())
     self.ctxt = Context(self.basedir)
Ejemplo n.º 9
0
 def setUp(self):
     self.basedir = os.path.realpath(tempfile.mkdtemp())
     self.ctxt = Context(self.basedir)
     self.results_xml = open(os.path.join(self.basedir, 'test-results.xml'),
                             'w')
Ejemplo n.º 10
0
 def setUp(self):
     self.basedir = os.path.realpath(tempfile.mkdtemp())
     self.ctxt = Context(self.basedir)
     self.summary = open(os.path.join(self.basedir, '.figleaf'), 'w')