Module gcip.addons.python.jobs.test
Classes
class EvaluateGitTagPep440Conformity (*, jobName: dataclasses.InitVar[str] = 'tag-pep440-conformity', jobStage: dataclasses.InitVar[str] = 'test')
-
Checks if the current pipelines
$CI_COMMIT_TAG
validates to a valid Python package version according to https://www.python.org/dev/peps/pep-0440This job already contains a rule to only run when a
$CI_COMMIT_TAG
is present (rules.only_tags()
).Runs
pytest
and installs project requirements before (scripts.pip_install_requirements()
)- Requires a
requirements.txt
in your project folder containing at leastpytest
This subclass of
Job
will configure following defaults for the superclass:- name: tag-pep440-conformity
- stage: test
- image: PredefinedImages.GCIP
- rules: on_tagsg
Expand source code
@dataclass(kw_only=True) class EvaluateGitTagPep440Conformity(Job): """ Checks if the current pipelines `$CI_COMMIT_TAG` validates to a valid Python package version according to https://www.python.org/dev/peps/pep-0440 This job already contains a rule to only run when a `$CI_COMMIT_TAG` is present (`rules.only_tags()`). Runs `pytest` and installs project requirements before (`scripts.pip_install_requirements()`) * Requires a `requirements.txt` in your project folder containing at least `pytest` This subclass of `Job` will configure following defaults for the superclass: * name: tag-pep440-conformity * stage: test * image: PredefinedImages.GCIP * rules: on_tagsg """ jobName: InitVar[str] = "tag-pep440-conformity" jobStage: InitVar[str] = "test" def __post_init__(self, jobName: str, jobStage: str) -> None: super().__init__(script="", name=jobName, stage=jobStage) self.set_image(PredefinedImages.GCIP) self.append_rules(rules.on_tags()) def render(self) -> Dict[str, Any]: self._scripts = ["python3 -m gcip.tools.evaluate_git_tag_pep440_conformity"] return super().render()
Ancestors
Class variables
var jobName : dataclasses.InitVar[str]
var jobStage : dataclasses.InitVar[str]
Inherited members
Job
:add_dependencies
add_needs
add_tags
add_variables
allow_failure
append_rules
append_scripts
artifacts
cache
dependencies
environment
image
name
needs
prepend_rules
prepend_scripts
render
resource_group
retry
rules
scripts
set_allow_failure
set_artifacts
set_cache
set_dependencies
set_environment
set_image
set_needs
set_resource_group
set_retry
set_tags
set_timeout
set_when
stage
tags
timeout
variables
when
- Requires a
class Pytest (*, pytestCommand: str = 'pytest', pipenv_version_specifier: str = '', jobName: dataclasses.InitVar[str] = 'pytest', jobStage: dataclasses.InitVar[str] = 'test')
-
Runs
pytest
and installs project requirements before (scripts.pip_install_requirements()
)- Requires a
Pipfile.lock
orrequirements.txt
in your project folder containing at leastpytest
This subclass of
Job
will configure following defaults for the superclass:- name: pytest
- stage: test
Args
pytestCommand
:str
- This argument ist only required if you have a custom command to call pytest.
pipenv_version_specifier
- The version hint of pipenv to install if
Pipfile.lock
is found. For example '==2022.08.15'. Defaults to an empty string, which means the latest version will be installed.
Expand source code
@dataclass(kw_only=True) class Pytest(Job): """ Runs `pytest` and installs project requirements before (`scripts.pip_install_requirements()`) * Requires a `Pipfile.lock` or `requirements.txt` in your project folder containing at least `pytest` This subclass of `Job` will configure following defaults for the superclass: * name: pytest * stage: test Args: pytestCommand (str): This argument ist only required if you have a custom command to call pytest. pipenv_version_specifier: The version hint of pipenv to install if `Pipfile.lock` is found. For example '==2022.08.15'. Defaults to an empty string, which means the latest version will be installed. """ pytestCommand: str = "pytest" pipenv_version_specifier: str = "" jobName: InitVar[str] = "pytest" jobStage: InitVar[str] = "test" def __post_init__(self, jobName: str, jobStage: str) -> None: super().__init__(script="", name=jobName, stage=jobStage) def render(self) -> Dict[str, Any]: self._scripts = [ pip_install_requirements( pipenv_version_specifier=self.pipenv_version_specifier ), self.pytestCommand, ] return super().render()
Ancestors
Class variables
var jobName : dataclasses.InitVar[str]
var jobStage : dataclasses.InitVar[str]
var pipenv_version_specifier : str
var pytestCommand : str
Inherited members
Job
:add_dependencies
add_needs
add_tags
add_variables
allow_failure
append_rules
append_scripts
artifacts
cache
dependencies
environment
image
name
needs
prepend_rules
prepend_scripts
render
resource_group
retry
rules
scripts
set_allow_failure
set_artifacts
set_cache
set_dependencies
set_environment
set_image
set_needs
set_resource_group
set_retry
set_tags
set_timeout
set_when
stage
tags
timeout
variables
when
- Requires a