Ejemplo n.º 1
0
"""
Test adding a string through the API.
"""

import bundle_test_helper
import repyhelper
repyhelper.translate_and_import('bundle.repy')

TEST_BUNDLE_FN = 'test.bundle.repy'

# Make sure the bundle doesn't exist to test bundle creation
bundle_test_helper.remove_files_from_directory([TEST_BUNDLE_FN])

TEST_STRING = 'this is a test string'
TEST_STRING_FN = 'teststring'

bundle = bundle_Bundle(TEST_BUNDLE_FN, 'w')
bundle.add_string(TEST_STRING_FN, TEST_STRING)
bundle.close()

# Make sure the added file is inside the bundle
bundle = bundle_Bundle(TEST_BUNDLE_FN, 'r')
if not TEST_STRING_FN in bundle.list():
    print "Added string not found when listing bundle contents"

# Make sure added file matches original file contents
added_file_contents = bundle.extract_to_string(TEST_STRING_FN)
if added_file_contents != TEST_STRING:
    print "Added string contents does not match string contents"

# Now run the test script!
"""
Test for adding a single file to a bundle on the command line
"""

import bundle_test_helper

TEST_BUNDLE_FN = "testresult.bundle.repy"
TEST_FILENAMES = ['src1', 'src2', 'src3']
TEST_COPY_FILENAMES = ['src1copy', 'src2copy', 'src3copy']

# Make sure the bundle doesn't exist to test bundle creation
bundle_test_helper.remove_files_from_directory([TEST_BUNDLE_FN])

bundle_test_helper.prepare_test_sourcefiles()

# First create the bundle
bundle_test_helper.run_program("bundler.py", ["create", TEST_BUNDLE_FN])

# Add multiple files
bundle_test_helper.run_program("bundler.py", ["add", TEST_BUNDLE_FN, TEST_COPY_FILENAMES[0]])

# Now run the test script!
bundle_test_helper.run_repy_program(TEST_BUNDLE_FN, [TEST_FILENAMES[0]])
"""
Test the extracting of a single file in a bundle through the command line.
"""

import bundle_test_helper

TEST_BUNDLE_FN = 'test_readonly.bundle.repy'
TEST_FILENAMES = ['src1', 'src2', 'src3']
TEST_COPY_FILENAMES = ['src1copy', 'src2copy', 'src3copy']

# Make sure the bundle doesn't exist to test bundle creation
bundle_test_helper.remove_files_from_directory(TEST_COPY_FILENAMES)

bundle_test_helper.run_program("bundler.py", ["extract", TEST_BUNDLE_FN, TEST_COPY_FILENAMES[0]])

bundle_test_helper.run_repy_program('testscript.repy', [TEST_FILENAMES[0]])
Ejemplo n.º 4
0
"""
Test the extracting of all files in a bundle through the API.
"""

import bundle_test_helper
import repyhelper
repyhelper.translate_and_import('bundle.repy')

TEST_BUNDLE_FN = 'test_readonly.bundle.repy'
FILENAMES = ['src1', 'src2', 'src3']

# Make sure the extracted files don't exist
bundle_test_helper.remove_files_from_directory([FILENAMES])

# src1copy ... src3copy is extracted
bundle = bundle_Bundle(TEST_BUNDLE_FN, 'r')
bundle.extract_all()
bundle.close()

# Check that the extracted files make sense
bundle_test_helper.run_repy_program('testscript.repy', FILENAMES)
Ejemplo n.º 5
0
"""
Test the extracting of all files in a bundle through the command line.
"""

import bundle_test_helper

TEST_BUNDLE_FN = 'test_readonly.bundle.repy'
TEST_FILENAMES = ['src1', 'src2', 'src3']
TEST_COPY_FILENAMES = ['src1copy', 'src2copy', 'src3copy']

# Make sure the bundle doesn't exist to test bundle creation
bundle_test_helper.remove_files_from_directory(TEST_COPY_FILENAMES)

bundle_test_helper.run_program("bundler.py", ["extract-all", TEST_BUNDLE_FN])

bundle_test_helper.run_repy_program('testscript.repy', TEST_FILENAMES)