def test_examples(self): """Test deploying all examples.""" for example_name in self.conf.sections(): os.chdir(TESTS_DIR) app_name = example_name + create_example.APP_NAME_SUFFIX package_name = "%s.%s" % (create_example.DOMAIN, app_name) project_dir = os.path.join(TESTS_DIR, app_name) test_utils.remove_directories_if_exist([project_dir]) self.assertFalse(os.path.exists(project_dir)) if is_device_rooted(): test_utils.stop_app(package_name) self.assertFalse(test_utils.is_app_running(package_name)) create_example.create_example([example_name]) self.assertTrue(os.path.exists(project_dir)) complete_deploy.complete_deploy() time.sleep(8) self.assertTrue(test_utils.is_app_running(package_name)) if is_device_rooted(): test_utils.stop_app(package_name) test_utils.remove_directories_if_exist([project_dir])
def test_create_example_python_api(self): """Test creating example projects via python api.""" self.assertFalse(os.path.exists(EXAMPLE_PROJECT_DIR)) create_example.create_example([APP_NAME]) self.assertTrue(os.path.exists(EXAMPLE_PROJECT_DIR))
#!/usr/bin/python # Tests if using pydroid via python API by creating and deploying an app works. # This test will fail, if you installed pydroid by using the # install_pydroid_editable.py script. # Example usage: # ./test_installation.py import os from pydroid.create_example import create_example from pydroid.complete_deploy import complete_deploy from pydroid.rename import rename TEST_DIR = os.path.join(os.path.expanduser('~'), 'pydroid_test') os.chdir(TEST_DIR) create_example(["qt_components"]) os.chdir(os.path.join(TEST_DIR, 'qt_components_example')) rename(['installation_test_example', 'com.example']) os.chdir(os.path.dirname(os.getcwd())) app_dir = os.path.join(TEST_DIR, 'installation_test_example') os.chdir(app_dir) complete_deploy()