本文整理汇总了Python中core.osutils.folder.Folder.copy方法的典型用法代码示例。如果您正苦于以下问题:Python Folder.copy方法的具体用法?Python Folder.copy怎么用?Python Folder.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.osutils.folder.Folder
的用法示例。
在下文中一共展示了Folder.copy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_200_tns_run_android_extending_class_inside_file_containing_dots
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import copy [as 别名]
def test_200_tns_run_android_extending_class_inside_file_containing_dots(self):
"""Test for https://github.com/NativeScript/android-runtime/issues/761"""
# Copy the app folder (app is modified in order to get some console logs on loaded)
source = os.path.join('data', 'apps', 'livesync-hello-world-ng', 'src')
target = os.path.join(self.app_name, 'src')
Folder.cleanup(target)
Folder.copy(src=source, dst=target)
source_html = os.path.join('data', 'issues', 'android-runtime-761', 'items.component.html')
target_html = os.path.join(self.app_name, 'src', 'app', 'item', 'items.component.html')
File.copy(src=source_html, dest=target_html)
source_ts = os.path.join('data', 'issues', 'android-runtime-761', 'items.component.ts')
target_ts = os.path.join(self.app_name, 'src', 'app', 'item', 'items.component.ts')
File.copy(src=source_ts, dest=target_ts)
source_xml = os.path.join('data', 'issues', 'android-runtime-761', 'AndroidManifest.xml')
target_xml = os.path.join(self.app_name, 'App_Resources', 'Android', 'src', 'main', 'AndroidManifest.xml')
File.copy(src=source_xml, dest=target_xml)
# Verify the app is running
log = Tns.run_android(attributes={'--path': self.app_name, '--device': EMULATOR_ID}, wait=False,
assert_success=False)
strings = ['Project successfully built',
'Successfully installed on device with identifier', EMULATOR_ID,
'Successfully synced application']
Tns.wait_for_log(log_file=log, string_list=strings, timeout=180, check_interval=10)
示例2: test_280_tns_run_android_console_time
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import copy [as 别名]
def test_280_tns_run_android_console_time(self):
# Copy the app folder (app is modified in order to get some console logs on loaded)
source = os.path.join('data', 'apps', 'livesync-hello-world-ng', 'src')
target = os.path.join(self.app_name, 'src')
Folder.cleanup(target)
Folder.copy(src=source, dst=target)
# Replace app.component.ts to use console.time() and console.timeEnd()
source = os.path.join('data', 'issues', 'ios-runtime-843', 'app.component.ts')
target = os.path.join(self.app_name, 'src', 'app', 'app.component.ts')
File.copy(src=source, dest=target)
# `tns run android` and wait until app is deployed
log = Tns.run_android(attributes={'--path': self.app_name, '--device': EMULATOR_ID}, wait=False,
assert_success=False)
# Verify the app is running
strings = ['Successfully synced application',
'Application loaded!',
'Home page loaded!']
Tns.wait_for_log(log_file=log, string_list=strings, timeout=180, check_interval=10, clean_log=False)
# Verify initial state of the app
Device.screen_match(device_name=EMULATOR_NAME, device_id=EMULATOR_ID,
expected_image='ng-hello-world-home-white', tolerance=5.0)
# Verify console.time() works
console_time = ['JS: startup:']
Tns.wait_for_log(log_file=log, string_list=console_time)
示例3: test_210_tns_run_ios_add_remove_files_and_folders
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import copy [as 别名]
def test_210_tns_run_ios_add_remove_files_and_folders(self):
"""
New files and folders should be synced properly.
"""
log = Tns.run_ios(attributes={'--path': self.app_name, '--device': self.DEVICE_ID}, wait=False,
assert_success=False)
strings = ['Successfully synced application', self.DEVICE_ID]
Tns.wait_for_log(log_file=log, string_list=strings, timeout=120, check_interval=10)
# Add new files
new_file_name = 'app2.css'
source_file = os.path.join(self.app_name, 'app', 'app.css')
destination_file = os.path.join(self.app_name, 'app', new_file_name)
File.copy(source_file, destination_file)
strings = ['Successfully transferred', new_file_name, 'Refreshing application']
Tns.wait_for_log(log_file=log, string_list=strings)
# Revert changes(rename file and delete file)
# File.copy(destination_file, source_file)
# File.remove(destination_file)
# strings = ['Successfully transferred', new_file_name]
# Tns.wait_for_log(log_file=log, string_list=strings)
# Add folder
new_folder_name = 'test2'
source_file = os.path.join(self.app_name, 'app', 'test')
destination_file = os.path.join(self.app_name, 'app', new_folder_name)
Folder.copy(source_file, destination_file)
strings = ['Successfully transferred test.txt', 'Successfully synced application']
Tns.wait_for_log(log_file=log, string_list=strings)
示例4: setUp
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import copy [as 别名]
def setUp(self):
BaseClass.setUp(self)
Tns.kill()
# Replace app folder between tests.
app_folder = os.path.join(self.app_name, 'app')
Folder.cleanup(app_folder)
Folder.copy(src=self.TEMP_FOLDER, dst=app_folder)
示例5: setUpClass
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import copy [as 别名]
def setUpClass(cls):
BaseClass.setUpClass(cls.__name__)
if CURRENT_OS != OSType.OSX:
raise NameError("Can not run iOS tests on non OSX OS.")
else:
Simulator.stop()
Tns.create_app(cls.app_name)
Tns.platform_add_ios(attributes={"--path": cls.app_name, "--frameworkPath": IOS_PACKAGE})
Folder.copy(TEST_RUN_HOME + "/" + cls.app_name, TEST_RUN_HOME + "/data/TestApp")
示例6: test_210_tns_run_android_add_remove_files_and_folders
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import copy [as 别名]
def test_210_tns_run_android_add_remove_files_and_folders(self):
"""
New files and folders should be synced properly.
"""
log = Tns.run_android(attributes={'--path': self.app_name, '--device': self.DEVICE_ID}, wait=False,
assert_success=False)
strings = ['Successfully synced application', self.DEVICE_ID]
Tns.wait_for_log(log_file=log, string_list=strings, timeout=120, check_interval=10)
# Add new files
new_file_name = 'main-page2.xml'
source_file = os.path.join(self.app_name, 'app', 'main-page.xml')
destination_file = os.path.join(self.app_name, 'app', new_file_name)
File.copy(source_file, destination_file)
strings = ['Successfully transferred main-page2.xml', 'Successfully synced application', self.DEVICE_ID]
Tns.wait_for_log(log_file=log, string_list=strings)
# Verify new file is synced and available on device.
error_message = 'Newly created file {0} not found on {1}'.format(new_file_name, self.DEVICE_ID)
app_id = Tns.get_app_id(app_name=self.app_name)
path = 'app/{0}'.format(new_file_name)
assert Adb.path_exists(device_id=self.DEVICE_ID, package_id=app_id, path=path), error_message
# Revert changes(rename file and delete file)
File.copy(destination_file, source_file)
File.remove(destination_file)
strings = ['Successfully transferred main-page.xml', 'Successfully synced application', self.DEVICE_ID]
Tns.wait_for_log(log_file=log, string_list=strings)
# Verify new file is synced and available on device.
error_message = '{0} was deleted, but still available on {1}'.format(new_file_name, self.DEVICE_ID)
assert Adb.path_does_not_exist(device_id=self.DEVICE_ID, package_id=app_id, path=path), error_message
# Add folder
new_folder_name = 'feature2'
source_file = os.path.join(self.app_name, 'app', 'feature1')
destination_file = os.path.join(self.app_name, 'app', new_folder_name)
Folder.copy(source_file, destination_file)
strings = ['Successfully transferred', 'Successfully transferred', 'feature1.js', self.DEVICE_ID]
Tns.wait_for_log(log_file=log, string_list=strings)
# Verify new folder is synced and available on device.
error_message = 'Newly created folder {0} not found on {1}'.format(new_folder_name, self.DEVICE_ID)
path = 'app/{0}'.format(new_folder_name)
assert Adb.path_exists(device_id=self.DEVICE_ID, package_id=app_id, path=path, timeout=20), error_message
path = 'app/{0}/{1}'.format(new_folder_name, 'feature1.js')
assert Adb.path_exists(device_id=self.DEVICE_ID, package_id=app_id, path=path, timeout=20), error_message
# Delete folder
Folder.cleanup(destination_file)
strings = ['Successfully synced application', self.DEVICE_ID]
Tns.wait_for_log(log_file=log, string_list=strings)
# Verify new folder is deleted from device.
error_message = 'Deleted folder {0} is still available on {1}'.format(new_folder_name, self.DEVICE_ID)
assert Adb.path_does_not_exist(device_id=self.DEVICE_ID, package_id=app_id, path=path), error_message
示例7: ensure_app_resources
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import copy [as 别名]
def ensure_app_resources(path):
app_resources_path = os.path.join(path, "app", "App_Resources")
if File.exists(app_resources_path):
pass
else:
print "AppResources not found. Will copy from default template..."
src = os.path.join(TEST_RUN_HOME, "sut", "template-hello-world", "app", "App_Resources")
dest = os.path.join(TEST_RUN_HOME, path, "app", "App_Resources")
Folder.copy(src, dest)
示例8: setUp
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import copy [as 别名]
def setUp(self):
BaseClass.setUp(self)
Folder.cleanup(self.source_app)
if CURRENT_OS != OSType.WINDOWS:
Folder.copy(self.temp_app, self.source_app)
else:
Tns.create_app(self.app_name,
attributes={'--template': os.path.join('data', 'apps', 'livesync-hello-world.tgz')},
update_modules=True)
Tns.platform_add_android(attributes={'--path': self.app_name, '--frameworkPath': ANDROID_PACKAGE})
Emulator.ensure_available()
示例9: setUpClass
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import copy [as 别名]
def setUpClass(cls):
BaseClass.setUpClass(cls.__name__)
Emulator.stop()
Simulator.stop()
cls.SIMULATOR_ID = Simulator.ensure_available(simulator_name=SIMULATOR_NAME)
Folder.cleanup(cls.app_name)
Tns.create_app(cls.app_name,
attributes={'--template': os.path.join('data', 'apps', 'livesync-hello-world.tgz')},
update_modules=True)
Tns.platform_add_ios(attributes={'--path': cls.app_name, '--frameworkPath': IOS_PACKAGE})
Folder.cleanup(TEST_RUN_HOME + "/data/TestApp")
Folder.copy(TEST_RUN_HOME + "/" + cls.app_name, TEST_RUN_HOME + "/data/TestApp")
示例10: setUpClass
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import copy [as 别名]
def setUpClass(cls):
BaseClass.setUpClass(cls.__name__)
Emulator.stop()
Emulator.ensure_available()
Tns.create_app(BaseClass.app_name)
Tns.platform_add_android(attributes={"--path": BaseClass.app_name, "--frameworkPath": ANDROID_PACKAGE})
Tns.update_webpack(BaseClass.app_name)
Folder.copy(os.path.join(TEST_RUN_HOME, BaseClass.app_name), os.path.join(TEST_RUN_HOME, "data", "TestApp"))
#Download bundletool
url = 'https://github.com/google/bundletool/releases/download/0.8.0/bundletool-all-0.8.0.jar'
urllib.urlretrieve(url, os.path.join(SUT_FOLDER, 'bundletool.jar'))
示例11: setUpClass
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import copy [as 别名]
def setUpClass(cls):
BaseClass.setUpClass(cls.__name__)
Emulator.stop()
Simulator.stop()
Device.ensure_available(platform=Platform.IOS)
Device.uninstall_app(app_prefix='org.nativescript.', platform=Platform.IOS)
Folder.cleanup(cls.app_name)
Tns.create_app(cls.app_name,
attributes={'--template': os.path.join('data', 'apps', 'livesync-hello-world.tgz')},
update_modules=True)
Folder.copy(src=os.path.join(cls.app_name, 'app'), dst=cls.TEMP_FOLDER)
Tns.platform_add_ios(attributes={'--path': cls.app_name, '--frameworkPath': IOS_PACKAGE})
示例12: setUpClass
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import copy [as 别名]
def setUpClass(cls):
BaseClass.setUpClass(cls.__name__)
Tns.kill()
Emulator.stop()
Emulator.ensure_available()
Device.uninstall_app(app_prefix="org.nativescript.", platform=Platform.ANDROID)
if CURRENT_OS != OSType.WINDOWS:
Tns.create_app(cls.app_name,
attributes={'--template': os.path.join('data', 'apps', 'livesync-hello-world.tgz')},
update_modules=True)
Tns.platform_add_android(attributes={'--path': cls.app_name, '--frameworkPath': ANDROID_PACKAGE})
Folder.cleanup(cls.temp_app)
Folder.copy(cls.source_app, cls.temp_app)
示例13: test_003_tns_resources_generate_icons_apetools
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import copy [as 别名]
def test_003_tns_resources_generate_icons_apetools(self):
#https://github.com/NativeScript/nativescript-cli/issues/3666
Folder.cleanup(os.path.join(self.app_name, 'app', 'App_Resources', 'iOS', 'Assets.xcassets',
'AppIcon.appiconset'))
folder = os.path.join(TEST_RUN_HOME, "data", "images", "resources_generate", "apetool",
"AppIcon.appiconset")
destination = os.path.join(self.app_name, 'app', 'App_Resources', 'iOS', 'Assets.xcassets', 'AppIcon.appiconset')
Folder.copy(folder, destination)
icon_path = os.path.join(self.app_name, "app", "App_Resources", "iOS", "Assets.xcassets",
"AppIcon.appiconset", "[email protected]")
output = run("tns resources generate icons \"" + icon_path + "\"" + " --path " + self.app_name)
assert "Generating icons" in output
assert "Icons generation completed" in output
assert "Invalid settings specified for the resizer." not in output
示例14: test_390_LSApplicationQueriesSchemes_merged
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import copy [as 别名]
def test_390_LSApplicationQueriesSchemes_merged(self):
# https: // github.com / NativeScript / nativescript - cli / issues / 3108
Folder.cleanup(os.path.join(self.app_name, 'app', 'App_Resources', 'iOS', 'Info.plist'))
info_c = os.path.join('data', 'issues', 'info-plist', 'app', 'Info.plist')
info_p = os.path.join(self.app_name, 'app', 'App_Resources', 'iOS')
Folder.copy(info_c, info_p)
Tns.plugin_add("nativescript-geolocation", attributes={"--path": self.app_name})
Folder.cleanup(
os.path.join(self.app_name, 'node_modules', 'nativescript-geolocation', 'platforms', 'ios', 'Info.plist'))
info_plugin_c = os.path.join('data', 'issues', 'info-plist', 'plugin', 'Info.plist')
info_plugin_p = os.path.join(self.app_name, 'node_modules', 'nativescript-geolocation', 'platforms', 'ios')
Folder.copy(info_plugin_c, info_plugin_p)
Tns.build_ios(attributes={"--path": self.app_name})
output = File.read(os.path.join(self.app_name, 'platforms', 'ios', 'TestApp', 'TestApp-Info.plist'))
assert 'itms' in output
assert "itms-apps" in output
assert "LSApplicationQueriesSchemes" in output
示例15: test_451_resources_update
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import copy [as 别名]
def test_451_resources_update(self):
target_app = os.path.join(TEST_RUN_HOME, BaseClass.app_name)
source_app = os.path.join(TEST_RUN_HOME, 'data', 'apps', 'test-app-js-41')
Folder.cleanup(target_app)
Folder.copy(source_app, target_app)
output = Tns.run_tns_command("resources update", attributes={"--path": self.app_name})
assert "Successfully updated your project's application resources '/Android' directory structure" in output
assert "The previous version of your Android application resources has been renamed to '/Android-Pre-v4'" in output
assert File.exists(self.app_name + "/app/App_Resources/Android-Pre-v4/app.gradle")
assert File.exists(self.app_name + "/app/App_Resources/Android/app.gradle")
assert File.exists(self.app_name + "/app/App_Resources/Android/src/main/AndroidManifest.xml")
assert File.exists(self.app_name + "/app/App_Resources/Android/src/main/assets")
assert File.exists(self.app_name + "/app/App_Resources/Android/src/main/java")
assert File.exists(self.app_name + "/app/App_Resources/Android/src/main/res/values")
Tns.build_android(attributes={"--path": self.app_name})