def _run_test(self, dep_pkg_path): self.context.initialize(dep_pkg_path) # find GA released tags for package and run test using that code base dep_pkg_name, version, _, _ = parse_setup(dep_pkg_path) release_tag = get_release_tag(dep_pkg_name, self.context.is_latest_depend_test) if not release_tag: logging.error( "Release tag is not available. Skipping package {} from test". format(dep_pkg_name)) return test_branch_name = "{0}_tests".format(release_tag) try: git_checkout_branch(test_branch_name, dep_pkg_path) except: # If git checkout failed for "tests" branch then checkout branch with release tag logging.info( "Failed to checkout branch {}. Checking out release tagged git repo" .format(test_branch_name)) git_checkout_tag(release_tag, dep_pkg_path) try: # install packages required to run tests run_check_call([ self.context.venv.python_executable, "-m", "pip", "install", "-r", test_tools_req_file, ], dep_pkg_path) # Install pre-built whl for current package. install_package_from_whl( self.whl_path, self.context.temp_path, self.context.venv.python_executable, ) # install dependent package from source self._install_packages(dep_pkg_path, self.context.package_name) # try install of pre-built whl for current package again. if unnecessary, pip does nothing. # we do this to ensure that the correct development version is installed. on non-dev builds # this step will just skip through. install_package_from_whl( self.whl_path, self.context.temp_path, self.context.venv.python_executable, ) self._execute_test(dep_pkg_path) finally: self.context.deinitialize(dep_pkg_path)
def _run_test(self, dep_pkg_path): self.context.initialize(dep_pkg_path) # find GA released tags for package and run test using that code base dep_pkg_name, version, _, _ = parse_setup(dep_pkg_path) release_tag = get_release_tag(dep_pkg_name, self.context.is_latest_depend_test) if not release_tag: logging.error( "Release tag is not available. Skipping package {} from test". format(dep_pkg_name)) return test_branch_name = "{0}_tests".format(release_tag) try: git_checkout_branch(test_branch_name, dep_pkg_path) except: # If git checkout failed for "tests" branch then checkout branch with release tag logging.info( "Failed to checkout branch {}. Checking out release tagged git repo" .format(test_branch_name)) git_checkout_tag(release_tag, dep_pkg_path) try: # install packages required to run tests run_check_call([ self.context.venv.python_executable, "-m", "pip", "install", "-r", test_tools_req_file, ], dep_pkg_path) # Install pre-built whl for current package install_package_from_whl( self.whl_path, self.context.temp_path, self.context.venv.python_executable, ) # install package to be tested and run pytest self._execute_test(dep_pkg_path) finally: self.context.deinitialize(dep_pkg_path)