Example #1
0
 def setUpClass(cls):
     """Set up a new project."""
     os.chdir(TESTS_DIR)
     if is_device_rooted():
         test_utils.stop_app(PACKAGE_NAME)
     test_utils.remove_directories_if_exist([PROJECT_DIR])
     create_app.create_app([APP_NAME, DOMAIN])
Example #2
0
    def tearDown(self):

        if is_device_rooted():

            # Wait until the app was started successful
            time.sleep(6)

            self.assertTrue(test_utils.is_app_running(PACKAGE_NAME))
            test_utils.stop_app(PACKAGE_NAME)
Example #3
0
    def tearDown(self):
        self.assertTrue(os.path.exists(PROJECT_DIR))

        # Wait for termination of the app installation before checking
        time.sleep(6)
        self.assertTrue(test_utils.is_app_running(PACKAGE_NAME))
        if is_device_rooted():
            test_utils.stop_app(PACKAGE_NAME)
        os.chdir(TESTS_DIR)
        test_utils.remove_directories_if_exist([PROJECT_DIR])
Example #4
0
 def setUp(self):
     """
     Explicitly remove previous test projects, to be sure a new one is
     created.
     """
     os.chdir(TESTS_DIR)
     if is_device_rooted():
         test_utils.stop_app(PACKAGE_NAME)
         self.assertFalse(test_utils.is_app_running(PACKAGE_NAME))
     test_utils.remove_directories_if_exist([PROJECT_DIR])
     self.assertFalse(os.path.exists(PROJECT_DIR))
Example #5
0
    def setUpClass(cls):
        """Create a new test project and install and run it properly."""

        if is_device_rooted():
            os.chdir(TESTS_DIR)
            test_utils.stop_app(PACKAGE_NAME)
            hello_world.hello_world(show_log=False)

            # Wait for termination of the app installation before doing fast deploys.
            time.sleep(6)
            test_utils.stop_app(PACKAGE_NAME)
Example #6
0
    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])
Example #7
0
    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])
Example #8
0
 def tearDown(self):
     # Wait for termination of the app installation before checking
     time.sleep(6)
     self.assertTrue(test_utils.is_app_running(PACKAGE_NAME))
     if is_device_rooted():
         test_utils.stop_app(PACKAGE_NAME)
Example #9
0
 def setUp(self):
     if is_device_rooted():
         self.assertFalse(test_utils.is_app_running(PACKAGE_NAME))
Example #10
0
    def test_fast_deploy_python_api(self):
        """Test the fast deployment method via python api."""

        if is_device_rooted():
            fast_deploy.fast_deploy(show_log=False)
Example #11
0
    def test_fast_deploy_cmd_line(self):
        """Test the fast deployment method from command line."""

        if is_device_rooted():
            cmd = ["pydroid", "deploy", "fast"]
            subprocess.call(cmd)
Example #12
0
    def tearDownClass(cls):
        """Clean up the test project."""

        if is_device_rooted():
            test_utils.remove_directories_if_exist([PROJECT_DIR])