Ejemplo n.º 1
0
# IMPORTS
#---------------------------------------

from os import path

import test

from pymake2 import *

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

FILENAME = 'tempfile.xyz'

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

try:
    with open(FILENAME, 'w') as f:
        f.write('foo')
except:
    test.fail("could not write to file")

test.true(path.exists(FILENAME) and path.isfile(FILENAME), "temp should exist")
test.true(delete_file(FILENAME), "could not delete file")
test.false(path.exists(FILENAME) and path.isfile(FILENAME), "temp file found")

test.success()
Ejemplo n.º 2
0
#!/usr/bin/python3

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

from os import path

import test

from pymake3 import *

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

# Directory is created by the func_create_dir test.
PATH = 'tempdir'

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

test.true(delete_dir(PATH), "could not delete dir")
test.false(path.exists(PATH) and path.isdir(PATH), "temp dir found")

test.success()
Ejemplo n.º 3
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()
Ejemplo n.º 4
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()
#!/usr/bin/env python

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

from os import path

import test

from pymake2 import *

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

PATH = 'tempdir'

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

create_dir(PATH)

test.true(path.exists(PATH) and path.isdir(PATH), "temp dir not found")

test.success()