From 604d39305bd2ecba16183ce2a659f8f1a499197a Mon Sep 17 00:00:00 2001 From: Kei YAMAZAKI Date: Sun, 29 Dec 2013 01:45:38 +0900 Subject: Fix multibyte character problem Fixed problem that causes a UnicodeEncodeError when use multi-byte characters in the job.yml. Change-Id: Ie715c827a794e73fae11cdca079ea80cfb8c280d --- jenkins_jobs/builder.py | 2 +- tests/base.py | 6 ++++-- tests/builders/fixtures/maven-target-doc.xml | 2 +- tests/builders/fixtures/maven-target001.xml | 2 +- tests/builders/fixtures/trigger-builds001.xml | 2 +- tests/general/fixtures/assigned-node001.xml | 2 +- tests/general/fixtures/assigned-node002.xml | 2 +- tests/notifications/fixtures/http-endpoint001.xml | 2 +- tests/parameters/fixtures/dynamic-choice-param001.xml | 2 +- tests/properties/fixtures/batch-task.xml | 2 +- tests/properties/fixtures/throttle001.xml | 2 +- tests/publishers/fixtures/README | 2 +- tests/publishers/fixtures/archive001.xml | 2 +- tests/publishers/fixtures/blame001.xml | 2 +- tests/publishers/fixtures/build001.xml | 2 +- tests/publishers/fixtures/cloverphp001.xml | 2 +- tests/publishers/fixtures/cloverphp002.xml | 2 +- tests/publishers/fixtures/cloverphp003.xml | 2 +- tests/publishers/fixtures/description-setter.xml | 12 ------------ tests/publishers/fixtures/description-setter.yaml | 7 ------- tests/publishers/fixtures/description-setter001.xml | 12 ++++++++++++ tests/publishers/fixtures/description-setter001.yaml | 7 +++++++ tests/publishers/fixtures/description-setter002.xml | 12 ++++++++++++ tests/publishers/fixtures/description-setter002.yaml | 7 +++++++ tests/publishers/fixtures/emotional-jenkins.xml | 2 +- tests/publishers/fixtures/git001.xml | 2 +- tests/publishers/fixtures/github-notifier.xml | 2 +- tests/publishers/fixtures/mavendeploy001.xml | 2 +- tests/publishers/fixtures/pipeline001.xml | 2 +- tests/publishers/fixtures/pipeline002.xml | 2 +- tests/publishers/fixtures/plot001.xml | 2 +- tests/publishers/fixtures/plot002.xml | 2 +- tests/publishers/fixtures/plot003.xml | 2 +- tests/publishers/fixtures/scp001.xml | 2 +- tests/publishers/fixtures/stash001.xml | 2 +- tests/publishers/fixtures/xunit001.xml | 2 +- tests/scm/fixtures/git-shallow-clone01.xml | 2 +- tests/scm/fixtures/git-shallow-clone02.xml | 2 +- tests/scm/fixtures/git-shallow-clone03.xml | 2 +- tests/scm/fixtures/gitlab.xml | 2 +- tests/scm/fixtures/repo001.xml | 2 +- tests/triggers/fixtures/gerrit001.xml | 2 +- tests/triggers/fixtures/github-pull-request.xml | 2 +- tests/wrappers/fixtures/env-file001.xml | 2 +- 44 files changed, 79 insertions(+), 58 deletions(-) delete mode 100644 tests/publishers/fixtures/description-setter.xml delete mode 100644 tests/publishers/fixtures/description-setter.yaml create mode 100644 tests/publishers/fixtures/description-setter001.xml create mode 100644 tests/publishers/fixtures/description-setter001.yaml create mode 100644 tests/publishers/fixtures/description-setter002.xml create mode 100644 tests/publishers/fixtures/description-setter002.yaml diff --git a/jenkins_jobs/builder.py b/jenkins_jobs/builder.py index 5d7a81f9..2a89653f 100644 --- a/jenkins_jobs/builder.py +++ b/jenkins_jobs/builder.py @@ -381,7 +381,7 @@ class XmlJob(object): def output(self): out = minidom.parseString(XML.tostring(self.xml)) - out = out.toprettyxml(indent=' ') + out = out.toprettyxml(indent=' ', encoding='utf-8') return self.pretty_text_re.sub('>\g<1> + diff --git a/tests/builders/fixtures/maven-target001.xml b/tests/builders/fixtures/maven-target001.xml index dbb6490f..328eb0e8 100644 --- a/tests/builders/fixtures/maven-target001.xml +++ b/tests/builders/fixtures/maven-target001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/builders/fixtures/trigger-builds001.xml b/tests/builders/fixtures/trigger-builds001.xml index 5afabc73..f083ed86 100644 --- a/tests/builders/fixtures/trigger-builds001.xml +++ b/tests/builders/fixtures/trigger-builds001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/general/fixtures/assigned-node001.xml b/tests/general/fixtures/assigned-node001.xml index 37a87ba9..ebbf8c7c 100644 --- a/tests/general/fixtures/assigned-node001.xml +++ b/tests/general/fixtures/assigned-node001.xml @@ -1,4 +1,4 @@ - + false diff --git a/tests/general/fixtures/assigned-node002.xml b/tests/general/fixtures/assigned-node002.xml index 01aff283..1505db51 100644 --- a/tests/general/fixtures/assigned-node002.xml +++ b/tests/general/fixtures/assigned-node002.xml @@ -1,4 +1,4 @@ - + false diff --git a/tests/notifications/fixtures/http-endpoint001.xml b/tests/notifications/fixtures/http-endpoint001.xml index cc3ddc18..79ba0ef8 100644 --- a/tests/notifications/fixtures/http-endpoint001.xml +++ b/tests/notifications/fixtures/http-endpoint001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/parameters/fixtures/dynamic-choice-param001.xml b/tests/parameters/fixtures/dynamic-choice-param001.xml index 7220a733..f057e8e4 100644 --- a/tests/parameters/fixtures/dynamic-choice-param001.xml +++ b/tests/parameters/fixtures/dynamic-choice-param001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/properties/fixtures/batch-task.xml b/tests/properties/fixtures/batch-task.xml index 9866cc66..9740f8a2 100644 --- a/tests/properties/fixtures/batch-task.xml +++ b/tests/properties/fixtures/batch-task.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/properties/fixtures/throttle001.xml b/tests/properties/fixtures/throttle001.xml index de321a37..073a9f8f 100644 --- a/tests/properties/fixtures/throttle001.xml +++ b/tests/properties/fixtures/throttle001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/README b/tests/publishers/fixtures/README index dc505aba..225f630f 100644 --- a/tests/publishers/fixtures/README +++ b/tests/publishers/fixtures/README @@ -10,5 +10,5 @@ Each yaml file MUST have a corresponding xml file. Once the YAML file has been parsed, it is prettify using python minidom which also means that: -- your XML file must start with: +- your XML file must start with: - self closing elements do not contains space eg: diff --git a/tests/publishers/fixtures/archive001.xml b/tests/publishers/fixtures/archive001.xml index 73c52460..24bc4d62 100644 --- a/tests/publishers/fixtures/archive001.xml +++ b/tests/publishers/fixtures/archive001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/blame001.xml b/tests/publishers/fixtures/blame001.xml index ef2ff74d..d07c9503 100644 --- a/tests/publishers/fixtures/blame001.xml +++ b/tests/publishers/fixtures/blame001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/build001.xml b/tests/publishers/fixtures/build001.xml index 60ada7f5..fc7718b5 100644 --- a/tests/publishers/fixtures/build001.xml +++ b/tests/publishers/fixtures/build001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/cloverphp001.xml b/tests/publishers/fixtures/cloverphp001.xml index f572450d..6af0e77a 100644 --- a/tests/publishers/fixtures/cloverphp001.xml +++ b/tests/publishers/fixtures/cloverphp001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/cloverphp002.xml b/tests/publishers/fixtures/cloverphp002.xml index 5f4db9f3..33ad6610 100644 --- a/tests/publishers/fixtures/cloverphp002.xml +++ b/tests/publishers/fixtures/cloverphp002.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/cloverphp003.xml b/tests/publishers/fixtures/cloverphp003.xml index a9255397..4fc565d6 100644 --- a/tests/publishers/fixtures/cloverphp003.xml +++ b/tests/publishers/fixtures/cloverphp003.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/description-setter.xml b/tests/publishers/fixtures/description-setter.xml deleted file mode 100644 index f73d5c00..00000000 --- a/tests/publishers/fixtures/description-setter.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - .*(<a href=.*a>) - .*(<a href=.*a>) - some description - another description - true - - - diff --git a/tests/publishers/fixtures/description-setter.yaml b/tests/publishers/fixtures/description-setter.yaml deleted file mode 100644 index f1adf0fb..00000000 --- a/tests/publishers/fixtures/description-setter.yaml +++ /dev/null @@ -1,7 +0,0 @@ -publishers: - - description-setter: - regexp: ".*()" - regexp-for-failed: ".*()" - description: "some description" - description-for-failed: "another description" - set-for-matrix: true diff --git a/tests/publishers/fixtures/description-setter001.xml b/tests/publishers/fixtures/description-setter001.xml new file mode 100644 index 00000000..1cbb41fd --- /dev/null +++ b/tests/publishers/fixtures/description-setter001.xml @@ -0,0 +1,12 @@ + + + + + .*(<a href=.*a>) + .*(<a href=.*a>) + some description + another description + true + + + diff --git a/tests/publishers/fixtures/description-setter001.yaml b/tests/publishers/fixtures/description-setter001.yaml new file mode 100644 index 00000000..f1adf0fb --- /dev/null +++ b/tests/publishers/fixtures/description-setter001.yaml @@ -0,0 +1,7 @@ +publishers: + - description-setter: + regexp: ".*()" + regexp-for-failed: ".*()" + description: "some description" + description-for-failed: "another description" + set-for-matrix: true diff --git a/tests/publishers/fixtures/description-setter002.xml b/tests/publishers/fixtures/description-setter002.xml new file mode 100644 index 00000000..23f5d912 --- /dev/null +++ b/tests/publishers/fixtures/description-setter002.xml @@ -0,0 +1,12 @@ + + + + + .*(<a href=.*a>) + .*(<a href=.*a>) + こんにちは + さようなら + true + + + diff --git a/tests/publishers/fixtures/description-setter002.yaml b/tests/publishers/fixtures/description-setter002.yaml new file mode 100644 index 00000000..7e6e7018 --- /dev/null +++ b/tests/publishers/fixtures/description-setter002.yaml @@ -0,0 +1,7 @@ +publishers: + - description-setter: + regexp: ".*()" + regexp-for-failed: ".*()" + description: "こんにちは" + description-for-failed: "さようなら" + set-for-matrix: true diff --git a/tests/publishers/fixtures/emotional-jenkins.xml b/tests/publishers/fixtures/emotional-jenkins.xml index 0630e84e..c1469043 100644 --- a/tests/publishers/fixtures/emotional-jenkins.xml +++ b/tests/publishers/fixtures/emotional-jenkins.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/git001.xml b/tests/publishers/fixtures/git001.xml index 63dcdfda..866b0575 100644 --- a/tests/publishers/fixtures/git001.xml +++ b/tests/publishers/fixtures/git001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/github-notifier.xml b/tests/publishers/fixtures/github-notifier.xml index a4501b40..3f20f33b 100644 --- a/tests/publishers/fixtures/github-notifier.xml +++ b/tests/publishers/fixtures/github-notifier.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/mavendeploy001.xml b/tests/publishers/fixtures/mavendeploy001.xml index 6db0030e..327dddc0 100644 --- a/tests/publishers/fixtures/mavendeploy001.xml +++ b/tests/publishers/fixtures/mavendeploy001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/pipeline001.xml b/tests/publishers/fixtures/pipeline001.xml index cb448fbb..4b9295c4 100644 --- a/tests/publishers/fixtures/pipeline001.xml +++ b/tests/publishers/fixtures/pipeline001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/pipeline002.xml b/tests/publishers/fixtures/pipeline002.xml index 33eca2ab..a5c7dc9f 100644 --- a/tests/publishers/fixtures/pipeline002.xml +++ b/tests/publishers/fixtures/pipeline002.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/plot001.xml b/tests/publishers/fixtures/plot001.xml index 382d5b71..abd36d0a 100644 --- a/tests/publishers/fixtures/plot001.xml +++ b/tests/publishers/fixtures/plot001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/plot002.xml b/tests/publishers/fixtures/plot002.xml index c67956aa..1eeffb17 100644 --- a/tests/publishers/fixtures/plot002.xml +++ b/tests/publishers/fixtures/plot002.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/plot003.xml b/tests/publishers/fixtures/plot003.xml index d13c93bd..51c4ca94 100644 --- a/tests/publishers/fixtures/plot003.xml +++ b/tests/publishers/fixtures/plot003.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/scp001.xml b/tests/publishers/fixtures/scp001.xml index 78af6776..fafa32f6 100644 --- a/tests/publishers/fixtures/scp001.xml +++ b/tests/publishers/fixtures/scp001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/stash001.xml b/tests/publishers/fixtures/stash001.xml index 9260c641..a07da18a 100644 --- a/tests/publishers/fixtures/stash001.xml +++ b/tests/publishers/fixtures/stash001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/publishers/fixtures/xunit001.xml b/tests/publishers/fixtures/xunit001.xml index 2535b624..7d6e5b92 100644 --- a/tests/publishers/fixtures/xunit001.xml +++ b/tests/publishers/fixtures/xunit001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/scm/fixtures/git-shallow-clone01.xml b/tests/scm/fixtures/git-shallow-clone01.xml index d66862cd..dd001541 100644 --- a/tests/scm/fixtures/git-shallow-clone01.xml +++ b/tests/scm/fixtures/git-shallow-clone01.xml @@ -1,4 +1,4 @@ - + 2 diff --git a/tests/scm/fixtures/git-shallow-clone02.xml b/tests/scm/fixtures/git-shallow-clone02.xml index c1735f21..57fe8d7a 100644 --- a/tests/scm/fixtures/git-shallow-clone02.xml +++ b/tests/scm/fixtures/git-shallow-clone02.xml @@ -1,4 +1,4 @@ - + 2 diff --git a/tests/scm/fixtures/git-shallow-clone03.xml b/tests/scm/fixtures/git-shallow-clone03.xml index c1735f21..57fe8d7a 100644 --- a/tests/scm/fixtures/git-shallow-clone03.xml +++ b/tests/scm/fixtures/git-shallow-clone03.xml @@ -1,4 +1,4 @@ - + 2 diff --git a/tests/scm/fixtures/gitlab.xml b/tests/scm/fixtures/gitlab.xml index 4623bf9e..be772a9d 100644 --- a/tests/scm/fixtures/gitlab.xml +++ b/tests/scm/fixtures/gitlab.xml @@ -1,4 +1,4 @@ - + 2 diff --git a/tests/scm/fixtures/repo001.xml b/tests/scm/fixtures/repo001.xml index bed34c01..94be6b5c 100644 --- a/tests/scm/fixtures/repo001.xml +++ b/tests/scm/fixtures/repo001.xml @@ -1,4 +1,4 @@ - + https://example.com/project/ diff --git a/tests/triggers/fixtures/gerrit001.xml b/tests/triggers/fixtures/gerrit001.xml index 53fadaae..ebde0064 100644 --- a/tests/triggers/fixtures/gerrit001.xml +++ b/tests/triggers/fixtures/gerrit001.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/triggers/fixtures/github-pull-request.xml b/tests/triggers/fixtures/github-pull-request.xml index 63f0ef8c..e4e19b0d 100644 --- a/tests/triggers/fixtures/github-pull-request.xml +++ b/tests/triggers/fixtures/github-pull-request.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/wrappers/fixtures/env-file001.xml b/tests/wrappers/fixtures/env-file001.xml index d6cb26a5..0fc51598 100644 --- a/tests/wrappers/fixtures/env-file001.xml +++ b/tests/wrappers/fixtures/env-file001.xml @@ -1,4 +1,4 @@ - + -- cgit