File tree Expand file tree Collapse file tree
src/practitest_firecracker Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11(ns practitest-firecracker.const )
22
3- (def ^:const fc-version " 2.1.2 " )
3+ (def ^:const fc-version " 2.1.4 " )
44
55(def ^:const testset-instances-uri " /projects/%d/instances.json" )
66(def ^:const test-uri " /projects/%d/tests/%d.json" )
Original file line number Diff line number Diff line change 44 [clojure.string :as str]
55 [clojure.xml :as xml]
66 [clojure.zip :as zip])
7- (:import (java.text NumberFormat)
8- (java.io ByteArrayInputStream)))
7+ (:import
8+ (java.io ByteArrayInputStream)
9+ (java.text NumberFormat)))
910
1011(defn round
1112 [x & {p :precision }]
5152 {:tag :testsuites :content (flatten-testsuite root)}
5253 root))
5354
55+ (defn normalize-attribute [value]
56+ (when value
57+ (str/replace value " /" " ." )))
58+
59+ (defn normalize-attributes
60+ " Sometimes `classname` and `name` contain '/', we need to replace it with '.'"
61+ [element]
62+ (if (map? element)
63+ (if-let [_attrs (:attrs element)]
64+ (-> element
65+ (update-in [:attrs :name ] normalize-attribute)
66+ (update-in [:attrs :classname ] normalize-attribute)
67+ (update :content #(map normalize-attributes %)))
68+ (update element :content #(map normalize-attributes %)))
69+ element))
70+
5471(defn zip-str [s]
5572 (zip/xml-zip
56- (preprocess-xunit
57- (xml/parse (ByteArrayInputStream. (.getBytes s " UTF-8" ))))))
73+ (normalize-attributes
74+ (preprocess-xunit
75+ (xml/parse (ByteArrayInputStream. (.getBytes s " UTF-8" )))))))
5876
5977(defn filter-tags [tag-key xml-content]
6078 (let [filter-result (filter #(= (:tag %) tag-key) xml-content)]
243261 (preprocess-xunit
244262 (xml/parse (ByteArrayInputStream. (.getBytes s " UTF-8" ))))))
245263
264+ (let [s (slurp " test-data/pb/report.xml" )]
265+ (normalize-attributes
266+ (preprocess-xunit
267+ (xml/parse (ByteArrayInputStream. (.getBytes s " UTF-8" ))))))
268+
246269 )
You can’t perform that action at this time.
0 commit comments