Esempio n. 1
0
import test

test.equal(4, 5)
test.equal(5, 5)
test.output("Hello", "World", 42, expected="Hello World 42")

test.summary()
Esempio n. 2
0
def my_target2(bar='789', foo="xyz"):
    test.equal(foo, "123", "foo has wrong value 2")
    test.equal(bar, "abc", "bar has wrong value 2")

    global counter
    counter += 1
Esempio n. 3
0
from pymake3 import *

#---------------------------------------
# GLOBALS
#---------------------------------------

var = 0

#---------------------------------------
# FUNCTIONS
#---------------------------------------


@target
def my_target(conf):
    global var
    var += 1


#---------------------------------------
# SCRIPT
#---------------------------------------

pymake3({}, ['my_target'])
pymake3({}, ['my_target'])
pymake3({}, ['my_target'])

test.equal(var, 3, "my_target was not made three times")
test.success()
Esempio n. 4
0
# FUNCTIONS
#---------------------------------------


@target
def my_target1(foo=None, bar=None):
    test.equal(foo, "123", "foo has wrong value 1")
    test.equal(bar, "abc", "bar has wrong value 1")

    global counter
    counter += 1


@target
def my_target2(bar='789', foo="xyz"):
    test.equal(foo, "123", "foo has wrong value 2")
    test.equal(bar, "abc", "bar has wrong value 2")

    global counter
    counter += 1


#---------------------------------------
# SCRIPT
#---------------------------------------

pymake3({"foo": "123", "bar": "abc"}, ['my_target1', 'my_target2'])

test.equal(counter, 2, "both targets were not made properly")
test.success()
Esempio n. 5
0
def my_target1(foo=None, bar=None):
    test.equal(foo, "123", "foo has wrong value 1")
    test.equal(bar, "abc", "bar has wrong value 1")

    global counter
    counter += 1
def my_target_2(conf):
    test.equal(conf.value, '123abc', "conf.value should be immutable")
Esempio n. 7
0
import test

from pymake3 import *

#---------------------------------------
# CONSTANTS
#---------------------------------------

# Test files are copied into this folder by the fs_copy test.
PATH = 'files2'

#---------------------------------------
# SCRIPT
#---------------------------------------

files = find_files(PATH, '*.txt')

test.equal(len(files), 3, "incorrect number of files found")

test.true(join(PATH, 'file1.txt') in files, "file1.txt not found")
test.true(join(PATH, 'file2.txt') in files, "file2.txt not found")
test.true(join(PATH, 'dir1', 'file3.txt') in files, "file4.txt not found")

test.false(join(PATH, 'foo.zzz') in files, "foo.zzz found")
test.false(join(PATH, 'dir1', 'bar.zzz') in files, "bar.zzz found")

delete_dir(PATH)

test.success()
#---------------------------------------
# IMPORTS
#---------------------------------------

from os import path

import test

from pymake2 import *

#---------------------------------------
# SCRIPT
#---------------------------------------

r = run_program('python', ['--version'])
test.equal(r, 0, 'run_program() returned incorrect value')

test.success()
def my_target_1(conf):
    test.equal(conf.value, '123abc', "conf.value is incorrect")

    conf.value = 'xyz456'
Esempio n. 10
0
def my_target(conf):
    test.equal(conf.abc, '123', "conf.abc should equal 123")
    test.success()
def my_target_5(conf):
    test.equal(var_1, 1, "target 1 made incorrect number of times")
    test.equal(var_2, 1, "target 2 made incorrect number of times")
    test.equal(var_3, 1, "target 3 made incorrect number of times")
    test.equal(var_4, 1, "target 4 made incorrect number of times")
    test.equal(var_5, '1234', "targets made in incorrect order")
Esempio n. 12
0
def my_target2(conf):
    test.equal(conf.foo, 'abc', "conf.foo should equal 'abc'")
    test.success()
Esempio n. 13
0
def my_target1(conf):
    test.equal(conf.foo, '123', "conf.foo should equal '123'")

    conf.foo = 'abc'
    make('my_target2', conf)
Esempio n. 14
0
def my_target_2(conf):
    test.equal(conf.foo, 'xyz', "conf.foo is incorrect")
Esempio n. 15
0
def my_target_1(conf):
    test.equal(conf.foo, '123', "conf.foo is incorrect")
Esempio n. 16
0
#!/usr/bin/python3

#---------------------------------------
# IMPORTS
#---------------------------------------

import os

import test

from pymake3 import *

#---------------------------------------
# CONSTANTS
#---------------------------------------

SRCDIR = 'files'
DESTDIR = 'files2'

#---------------------------------------
# SCRIPT
#---------------------------------------

test.true(os.path.exists(SRCDIR), "test files missing")
test.false(os.path.exists(DESTDIR), "temp dir should not exist yet")

# The directory will be removed by the fs_find_files test.
test.equal(copy(SRCDIR, DESTDIR, '*.txt'), 3, "wrong number of files copied")

test.success()