Commit Graph

11 Commits

Author SHA1 Message Date
Vsevolod Fedorov f4d64f9f66 Move tests to pytest
Pytest makes each scenario into individual selectable test.
To be able to run each scenario separately is very useful for development.

Change-Id: I4b1c990a1fd839ce327cd7faa27159a9b9632fed
2022-12-20 10:44:43 +03:00
Thanh Ha 4d90c187a9 Auto-generated output from python-black
Please review the following patch containing the code changes in
the repo. This patch is a transition patch and is the auto-generated
output of the python-black tool.

Change-Id: I2d2de71da8a105fb62b561899ae78441ddab4032
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
2019-09-09 19:23:24 +01:00
Darragh Bailey 0f0f681069 Output additional info when exceptions occur
Problems occurring deep in the code frequently need to be caught and
additional information included in the error output to help debug
issues.

Change-Id: I5aee523a3cf9e1cb7573fa6fc5a06dc3888be1ef
2016-12-08 15:59:12 +00:00
Darragh Bailey 64537f5125 Improve logger output for expanding templates
Output the variable inputs used that trigger an error when expanding
template names to the error logger channel in a sensible format.

Ensures that when indented variable inputs for templates result in
exceptions when expanding a template name, that the project, template
name and variables that failed to be iterated over are outputted in a
log error message along with the original set of inputs from the
project definition to make it easier for end users to find where the
error has been made in a JJB definition.

Add code to allow dumping of variables stored in OrderedDict
transparently to match the input format used in JJB definitions and
hide the implementation detail of using OrderedDict to be within the
localyaml library.

Change-Id: I660bb0ca3b109e1a861948d6a867f185047b90ae
2016-09-14 15:15:04 +01:00
Darragh Bailey 4573b3a25d Refactor base test classes inheritance for reuse
Refactor base test class inheritance to allow for BaseTest class to be
reused without needing to also import the TestCase class everywhere in
order to avoid having the common test function executed on base classes.

This makes it easier to build base testing classes and then simplifies
the subclassing of these for actual tests.

Change-Id: I89809e8082469f814f245db4a9ab7658aac8a405
2016-09-14 14:58:57 +01:00
Darragh Bailey 8805a34c0f Reorder imports to match hacking guidelines
Ensure that the imports follow the standard OpenStack hacking
guidelines.

Change-Id: Iaa4326aef118ddfd807dd006934f1d9ca80a1cfa
2015-12-23 15:23:42 -08:00
Darragh Bailey 9bfbffa559 Capture logs with FakeLogging Fixture
Capture logs to attach them on exceptions to simplify the debugging of
errors in tests when they occur.

Change-Id: I5c1b5c306aba37789a8d41eabf65e0ac628af838
2015-09-30 16:25:22 +01:00
Lukas Bednar 34ea32ba80 scms: MultiSCM is generated for scms hidden in macro
This patch fixes problem with generating MultiSCM in case that scms are
encapsulated in macro.
This patch includes simple tests to cover if-branches for this change.

Example:

- scm:
  name: xxx
  scm:
    - git: ...

- scm:
  name: yyy
  scm:
    - git: ...

- scm:
  name: xxx-and-yyy
  scm:
    - xxx
    - yyy

- job:
  name: my-job
  scm:
    - xxx-and-yyy

Change-Id: If3e7b3d19e51545a5623ee060fb7673a7a989233
Signed-off-by: Lukas Bednar <lbednar@redhat.com>
Closes-bug: #1285515
2014-05-26 17:49:04 +02:00
Darragh Bailey 07c5bd1cc3 Test creation of multiple jobs from templates
Concatenate each job XML created from the parsed yaml when using the
YamlParser class for testing. Ensures that multiple jobs created from a
single yaml file can be tested.

Remove erroneous multiple job from scm_remote_deep_bug test.

Change-Id: I2732a7303fefff1f321a1a5b7eef9144d168e39a
2014-05-10 22:21:06 +01:00
David Caro 4206928c1d Added config options to not overwrite jobs desc
When you do not specify any description for a job, right now it creates a
new one overwriting whatever you had put there manually. Now when
setting the configuration option 'keep_descriptions' to True, it will
only overwrite the description if you specified one explicitly in the
yaml.
That way you can avoid specifying any description and it will not
overwrite the ones you put there manually through the jenkins ui.

Added a couple of tests for it also, and extended the tests to allow custom
configuration by adding a *.conf file for it

Change-Id: I408f5ee06a6939a8cb8f4f2e6c6e0d060462259c
Signed-off-by: David Caro <dcaroest@redhat.com>
2014-04-09 23:29:14 +01:00
Darragh Bailey b6784fcf6d Add tests for YamlParser and patch 2.6 minidom
Test full build job XML produced by the YamlParser object which exposed
differences in how the XML was being written on python 2.6 versus newer
versions of python.

Differences were whitespace only, but made testing and validating the
xml outputted across multiple versions of python difficult.

Code now patches the python 2.6 writexml method on the Element class in
the xml.dom.minidom module, with a version of the method taken from
python 2.7.5.

Removed the now obsolete regex that was reformatting the output on
python 2.6.

Change-Id: I26c100b6adfbcb9b197bb06cd162855adaaf24c5
2014-01-26 17:02:51 +11:00