""" 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 listing of files in a bundle through the command line. """ import bundle_test_helper TEST_BUNDLE_FN = 'test_readonly.bundle.repy' bundle_test_helper.run_program("bundler.py", ["list", TEST_BUNDLE_FN]) #pragma out Bundle contents: #pragma out Filename Size (bytes) #pragma out src1copy 87 #pragma out src2copy 100 #pragma out src3copy 461
""" Test for creating bundles from an existing on the command line """ import bundle_test_helper TEST_SRC_FN = "testscript.repy" TEST_BUNDLE_FN = "testresult.bundle.repy" # Make sure the bundle doesn't exist to test bundle creation bundle_test_helper.remove_files_from_directory([TEST_BUNDLE_FN]) bundle_test_helper.run_program("bundler.py", ["create", TEST_SRC_FN, TEST_BUNDLE_FN]) # Now run the test script! bundle_test_helper.run_repy_program(TEST_BUNDLE_FN)
""" 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]])
Test the removing of multiple files in a bundle through the command line. """ import bundle_test_helper import repyhelper repyhelper.translate_and_import("bundle.repy") ORIGINAL_BUNDLE_FN = "test_readonly.bundle.repy" # We make a local copy of the test bundle so that we # don't affect the execution of other tests TEST_BUNDLE_FN = "test.bundle.repy" FILENAMES = ["src1copy", "src2copy", "src3copy"] # This must be done in binary mode. Otherwise, differences of filesize due to # \r\n and \n on different OSes will cause the bundler to look for data at the # wrong places. _bundle_copy_file(ORIGINAL_BUNDLE_FN, TEST_BUNDLE_FN) bundle_test_helper.run_program("bundler.py", ["remove", TEST_BUNDLE_FN] + FILENAMES) # We shouldn't see ANY files in this list... # pragma out {} bundle = bundle_Bundle(TEST_BUNDLE_FN, "r") print bundle.list() bundle.close() # Now run the test script! bundle_test_helper.run_repy_program(TEST_BUNDLE_FN)
""" Test for creating bundles from an existing on the command line """ import os import sys import subprocess import bundle_test_helper TEST_SRC_FN = "testscript.repy" TEST_BUNDLE_FN = "testresult.bundle.repy" # Make sure the bundle doesn't exist to test bundle creation bundle_test_helper.remove_files_from_directory([TEST_BUNDLE_FN]) # Create a bundle bundle_test_helper.run_program('bundler.py', ['create', TEST_SRC_FN, TEST_BUNDLE_FN]) # Now run the test script! bundle_test_helper.run_repy_program(TEST_BUNDLE_FN)
""" Test the removing of multiple files in a bundle through the command line. """ import bundle_test_helper import repyhelper repyhelper.translate_and_import('bundle.repy') ORIGINAL_BUNDLE_FN = 'test_readonly.bundle.repy' # We make a local copy of the test bundle so that we # don't affect the execution of other tests TEST_BUNDLE_FN = 'test.bundle.repy' FILENAMES = ['src1copy', 'src2copy', 'src3copy'] # This must be done in binary mode. Otherwise, differences of filesize due to # \r\n and \n on different OSes will cause the bundler to look for data at the # wrong places. _bundle_copy_file(ORIGINAL_BUNDLE_FN, TEST_BUNDLE_FN) bundle_test_helper.run_program("bundler.py", ["remove", TEST_BUNDLE_FN] + FILENAMES) # We shouldn't see ANY files in this list... #pragma out {} bundle = bundle_Bundle(TEST_BUNDLE_FN, 'r') print bundle.list() bundle.close() # Now run the test script! bundle_test_helper.run_repy_program(TEST_BUNDLE_FN)
""" Test to ensure we display a meaningful message when user gives bad input for creating a bundle on the command line. """ import bundle_test_helper #pragma out Expected Arguments: {source_filename} bundle_filename bundle_test_helper.run_program("bundler.py", ["create"])
""" 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)
""" 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]])