diff --git a/tests/wpt/metadata/2dcontext/imagebitmap/createImageBitmap-bounds.html.ini b/tests/wpt/metadata/2dcontext/imagebitmap/createImageBitmap-bounds.html.ini new file mode 100644 index 00000000000..423ab4a1f06 --- /dev/null +++ b/tests/wpt/metadata/2dcontext/imagebitmap/createImageBitmap-bounds.html.ini @@ -0,0 +1,4 @@ +[createImageBitmap-bounds.html] + [createImageBitmap: clipping to the bitmap] + expected: FAIL + diff --git a/tests/wpt/metadata/FileAPI/idlharness.worker.js.ini b/tests/wpt/metadata/FileAPI/idlharness.worker.js.ini index a485b006078..9fe32dcc3b7 100644 --- a/tests/wpt/metadata/FileAPI/idlharness.worker.js.ini +++ b/tests/wpt/metadata/FileAPI/idlharness.worker.js.ini @@ -1,6 +1,5 @@ [idlharness.worker.html] type: testharness - expected: ERROR [ArrayBuffer interface: existence and properties of interface object] expected: FAIL @@ -82,3 +81,6 @@ [Untitled] expected: FAIL + [idlharness] + expected: FAIL + diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 322da5eff25..51ada8ced27 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -1285,6 +1285,12 @@ {} ] ], + "console/console-timing-logging-manual.html": [ + [ + "/console/console-timing-logging-manual.html", + {} + ] + ], "core-aam/alert-manual.html": [ [ "/core-aam/alert-manual.html", @@ -11101,6 +11107,42 @@ {} ] ], + "editing/manual/delete-manual.html": [ + [ + "/editing/manual/delete-manual.html", + {} + ] + ], + "editing/manual/forwarddelete-manual.html": [ + [ + "/editing/manual/forwarddelete-manual.html", + {} + ] + ], + "editing/manual/insertlinebreak-manual.html": [ + [ + "/editing/manual/insertlinebreak-manual.html", + {} + ] + ], + "editing/manual/insertparagraph-manual.html": [ + [ + "/editing/manual/insertparagraph-manual.html", + {} + ] + ], + "editing/manual/inserttext-manual.html": [ + [ + "/editing/manual/inserttext-manual.html", + {} + ] + ], + "editing/manual/inserttext2-manual.html": [ + [ + "/editing/manual/inserttext2-manual.html", + {} + ] + ], "entries-api/errors-manual.html": [ [ "/entries-api/errors-manual.html", @@ -12031,6 +12073,18 @@ {} ] ], + "html/editing/dnd/canvas/cross-domain/001-manual.xhtml": [ + [ + "/html/editing/dnd/canvas/cross-domain/001-manual.xhtml", + {} + ] + ], + "html/editing/dnd/cross-document/002-manual.html": [ + [ + "/html/editing/dnd/cross-document/002-manual.html", + {} + ] + ], "html/editing/dnd/datastore/015-manual.html": [ [ "/html/editing/dnd/datastore/015-manual.html", @@ -12109,6 +12163,12 @@ {} ] ], + "html/editing/dnd/images/cross-domain/001-manual.xhtml": [ + [ + "/html/editing/dnd/images/cross-domain/001-manual.xhtml", + {} + ] + ], "html/editing/dnd/synthetic/005-manual.html": [ [ "/html/editing/dnd/synthetic/005-manual.html", @@ -47645,6 +47705,18 @@ {} ] ], + "css/CSS2/floats/floats-line-wrap-shifted-001.html": [ + [ + "/css/CSS2/floats/floats-line-wrap-shifted-001.html", + [ + [ + "/css/CSS2/floats/floats-line-wrap-shifted-001-ref.html", + "==" + ] + ], + {} + ] + ], "css/CSS2/floats/floats-placement-vertical-001a.xht": [ [ "/css/CSS2/floats/floats-placement-vertical-001a.xht", @@ -103369,6 +103441,18 @@ {} ] ], + "css/css-backgrounds/background-size-with-negative-value.html": [ + [ + "/css/css-backgrounds/background-size-with-negative-value.html", + [ + [ + "/css/css-backgrounds/reference/background-size-002-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-backgrounds/background-size/background-size-contain.xht": [ [ "/css/css-backgrounds/background-size/background-size-contain.xht", @@ -109393,6 +109477,18 @@ {} ] ], + "css/css-contain/contain-size-borders.html": [ + [ + "/css/css-contain/contain-size-borders.html", + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], "css/css-contain/contain-size-breaks-001.html": [ [ "/css/css-contain/contain-size-breaks-001.html", @@ -109609,6 +109705,42 @@ {} ] ], + "css/css-content/element-replacement-alt.html": [ + [ + "/css/css-content/element-replacement-alt.html", + [ + [ + "/css/css-content/element-replacement-alt-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-content/element-replacement-display-contents.html": [ + [ + "/css/css-content/element-replacement-display-contents.html", + [ + [ + "/css/css-content/resources/blank.html", + "==" + ] + ], + {} + ] + ], + "css/css-content/element-replacement-display-none.html": [ + [ + "/css/css-content/element-replacement-display-none.html", + [ + [ + "/css/css-content/resources/blank.html", + "==" + ] + ], + {} + ] + ], "css/css-content/element-replacement.html": [ [ "/css/css-content/element-replacement.html", @@ -109621,6 +109753,18 @@ {} ] ], + "css/css-content/pseudo-element-inline-box.html": [ + [ + "/css/css-content/pseudo-element-inline-box.html", + [ + [ + "/css/css-content/pseudo-element-inline-box-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-counter-styles/broken-symbols.htm": [ [ "/css/css-counter-styles/broken-symbols.htm", @@ -127269,6 +127413,18 @@ {} ] ], + "css/css-pseudo/first-letter-opacity-float-001.html": [ + [ + "/css/css-pseudo/first-letter-opacity-float-001.html", + [ + [ + "/css/css-pseudo/first-letter-opacity-float-001-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-pseudo/first-line-and-placeholder.html": [ [ "/css/css-pseudo/first-line-and-placeholder.html", @@ -130021,6 +130177,30 @@ {} ] ], + "css/css-scoping/host-specificity-002.html": [ + [ + "/css/css-scoping/host-specificity-002.html", + [ + [ + "/css/css-scoping/reference/green-box.html", + "==" + ] + ], + {} + ] + ], + "css/css-scoping/host-specificity.html": [ + [ + "/css/css-scoping/host-specificity.html", + [ + [ + "/css/css-scoping/reference/green-box.html", + "==" + ] + ], + {} + ] + ], "css/css-scoping/shadow-assign-dynamic-001.html": [ [ "/css/css-scoping/shadow-assign-dynamic-001.html", @@ -130213,6 +130393,18 @@ {} ] ], + "css/css-scoping/slotted-specificity.html": [ + [ + "/css/css-scoping/slotted-specificity.html", + [ + [ + "/css/css-scoping/reference/green-box.html", + "==" + ] + ], + {} + ] + ], "css/css-scoping/slotted-with-pseudo-element.html": [ [ "/css/css-scoping/slotted-with-pseudo-element.html", @@ -131881,6 +132073,18 @@ {} ] ], + "css/css-tables/anonymous-table-cell-margin-collapsing.html": [ + [ + "/css/css-tables/anonymous-table-cell-margin-collapsing.html", + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], "css/css-tables/anonymous-table-ws-001.html": [ [ "/css/css-tables/anonymous-table-ws-001.html", @@ -134941,6 +135145,18 @@ {} ] ], + "css/css-text/overflow-wrap/overflow-wrap-break-word-004.html": [ + [ + "/css/css-text/overflow-wrap/overflow-wrap-break-word-004.html", + [ + [ + "/css/css-text/overflow-wrap/reference/overflow-wrap-break-word-001-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-text/overflow-wrap/overflow-wrap-break-word-fit-content-001.html": [ [ "/css/css-text/overflow-wrap/overflow-wrap-break-word-fit-content-001.html", @@ -134965,6 +135181,18 @@ {} ] ], + "css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html": [ + [ + "/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html", + [ + [ + "/css/css-text/overflow-wrap/reference/overflow-wrap-min-content-size-002-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-text/overflow-wrap/word-wrap-001.html": [ [ "/css/css-text/overflow-wrap/word-wrap-001.html", @@ -136573,6 +136801,42 @@ {} ] ], + "css/css-text/white-space/break-spaces-001.html": [ + [ + "/css/css-text/white-space/break-spaces-001.html", + [ + [ + "/css/css-text/white-space/reference/pre-wrap-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-text/white-space/break-spaces-002.html": [ + [ + "/css/css-text/white-space/break-spaces-002.html", + [ + [ + "/css/css-text/white-space/reference/pre-wrap-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-text/white-space/break-spaces-003.html": [ + [ + "/css/css-text/white-space/break-spaces-003.html", + [ + [ + "/css/css-text/white-space/reference/pre-wrap-001-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-text/white-space/pre-wrap-001.html": [ [ "/css/css-text/white-space/pre-wrap-001.html", @@ -136657,42 +136921,6 @@ {} ] ], - "css/css-text/white-space/pre-wrap-008.html": [ - [ - "/css/css-text/white-space/pre-wrap-008.html", - [ - [ - "/css/css-text/white-space/reference/pre-wrap-001-ref.html", - "==" - ] - ], - {} - ] - ], - "css/css-text/white-space/pre-wrap-009.html": [ - [ - "/css/css-text/white-space/pre-wrap-009.html", - [ - [ - "/css/css-text/white-space/reference/pre-wrap-001-ref.html", - "==" - ] - ], - {} - ] - ], - "css/css-text/white-space/pre-wrap-010.html": [ - [ - "/css/css-text/white-space/pre-wrap-010.html", - [ - [ - "/css/css-text/white-space/reference/pre-wrap-001-ref.html", - "==" - ] - ], - {} - ] - ], "css/css-text/white-space/pre-wrap-011.html": [ [ "/css/css-text/white-space/pre-wrap-011.html", @@ -136741,6 +136969,42 @@ {} ] ], + "css/css-text/white-space/textarea-break-spaces-001.html": [ + [ + "/css/css-text/white-space/textarea-break-spaces-001.html", + [ + [ + "/css/css-text/white-space/reference/textarea-pre-wrap-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-text/white-space/textarea-break-spaces-002.html": [ + [ + "/css/css-text/white-space/textarea-break-spaces-002.html", + [ + [ + "/css/css-text/white-space/reference/textarea-pre-wrap-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-text/white-space/textarea-break-spaces-003.html": [ + [ + "/css/css-text/white-space/textarea-break-spaces-003.html", + [ + [ + "/css/css-text/white-space/reference/textarea-pre-wrap-001-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-text/white-space/textarea-pre-wrap-001.html": [ [ "/css/css-text/white-space/textarea-pre-wrap-001.html", @@ -136825,42 +137089,6 @@ {} ] ], - "css/css-text/white-space/textarea-pre-wrap-008.html": [ - [ - "/css/css-text/white-space/textarea-pre-wrap-008.html", - [ - [ - "/css/css-text/white-space/reference/textarea-pre-wrap-001-ref.html", - "==" - ] - ], - {} - ] - ], - "css/css-text/white-space/textarea-pre-wrap-009.html": [ - [ - "/css/css-text/white-space/textarea-pre-wrap-009.html", - [ - [ - "/css/css-text/white-space/reference/textarea-pre-wrap-001-ref.html", - "==" - ] - ], - {} - ] - ], - "css/css-text/white-space/textarea-pre-wrap-010.html": [ - [ - "/css/css-text/white-space/textarea-pre-wrap-010.html", - [ - [ - "/css/css-text/white-space/reference/textarea-pre-wrap-001-ref.html", - "==" - ] - ], - {} - ] - ], "css/css-text/white-space/textarea-pre-wrap-011.html": [ [ "/css/css-text/white-space/textarea-pre-wrap-011.html", @@ -137053,6 +137281,30 @@ {} ] ], + "css/css-text/word-break/word-break-break-all-010.html": [ + [ + "/css/css-text/word-break/word-break-break-all-010.html", + [ + [ + "/css/css-text/word-break/reference/word-break-break-all-010-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-text/word-break/word-break-break-all-011.html": [ + [ + "/css/css-text/word-break/word-break-break-all-011.html", + [ + [ + "/css/css-text/word-break/reference/word-break-break-all-010-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-text/word-break/word-break-keep-all-000.html": [ [ "/css/css-text/word-break/word-break-keep-all-000.html", @@ -151421,6 +151673,18 @@ {} ] ], + "css/css-will-change/will-change-will-change-1.html": [ + [ + "/css/css-will-change/will-change-will-change-1.html", + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], "css/css-writing-modes/abs-pos-non-replaced-icb-vlr-003.xht": [ [ "/css/css-writing-modes/abs-pos-non-replaced-icb-vlr-003.xht", @@ -166345,6 +166609,102 @@ {} ] ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-block-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-block-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-block-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-button-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-button-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-button-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-flex-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-flex-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-flex-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-block-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-block-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-block-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-flex-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-flex-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-flex-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-003.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-003.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-003-ref.html", + "==" + ] + ], + {} + ] + ], "css/vendor-imports/mozilla/mozilla-central-reftests/counter-styles-3/dependent-builtin.html": [ [ "/css/vendor-imports/mozilla/mozilla-central-reftests/counter-styles-3/dependent-builtin.html", @@ -167845,6 +168205,42 @@ {} ] ], + "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-003.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-003.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-003-ref.html", + "==" + ] + ], + {} + ] + ], "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-definite-sizes-001.html": [ [ "/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-definite-sizes-001.html", @@ -182161,6 +182557,42 @@ {} ] ], + "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-1.html": [ + [ + "/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-1.html", + [ + [ + "/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-ref.html", + "==" + ] + ], + {} + ] + ], + "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-2.html": [ + [ + "/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-2.html", + [ + [ + "/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-ref.html", + "==" + ] + ], + {} + ] + ], + "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-type-change-from-image-1.html": [ + [ + "/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-type-change-from-image-1.html", + [ + [ + "/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-type-change-from-image-1-ref.html", + "==" + ] + ], + {} + ] + ], "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/object_border_perc.xhtml": [ [ "/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/object_border_perc.xhtml", @@ -184061,6 +184493,18 @@ {} ] ], + "svg/extensibility/foreignObject/foreign-object-margin-collapsing.html": [ + [ + "/svg/extensibility/foreignObject/foreign-object-margin-collapsing.html", + [ + [ + "/svg/extensibility/foreignObject/foreign-object-size-ref.html", + "==" + ] + ], + {} + ] + ], "svg/extensibility/foreignObject/foreign-object-paints-before-rect.html": [ [ "/svg/extensibility/foreignObject/foreign-object-paints-before-rect.html", @@ -184229,6 +184673,42 @@ {} ] ], + "svg/painting/currentColor-override-pserver-fallback.svg": [ + [ + "/svg/painting/currentColor-override-pserver-fallback.svg", + [ + [ + "/svg/painting/currentColor-override-pserver-fallback-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/painting/currentColor-override-pserver-fill.svg": [ + [ + "/svg/painting/currentColor-override-pserver-fill.svg", + [ + [ + "/svg/painting/currentColor-override-pserver-fill-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/painting/currentColor-override-pserver-stroke.svg": [ + [ + "/svg/painting/currentColor-override-pserver-stroke.svg", + [ + [ + "/svg/painting/currentColor-override-pserver-stroke-ref.svg", + "==" + ] + ], + {} + ] + ], "svg/painting/reftests/paint-context-001.svg": [ [ "/svg/painting/reftests/paint-context-001.svg", @@ -184385,6 +184865,114 @@ {} ] ], + "svg/rendering/order/z-index.svg": [ + [ + "/svg/rendering/order/z-index.svg", + [ + [ + "/svg/rendering/order/z-index-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/shapes/ellipse-01.svg": [ + [ + "/svg/shapes/ellipse-01.svg", + [ + [ + "/svg/shapes/ellipse-01-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/shapes/ellipse-02.svg": [ + [ + "/svg/shapes/ellipse-02.svg", + [ + [ + "/svg/shapes/ellipse-02-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/shapes/ellipse-03.svg": [ + [ + "/svg/shapes/ellipse-03.svg", + [ + [ + "/svg/shapes/ellipse-03-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/shapes/ellipse-04.svg": [ + [ + "/svg/shapes/ellipse-04.svg", + [ + [ + "/svg/shapes/ellipse-04-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/shapes/ellipse-05.svg": [ + [ + "/svg/shapes/ellipse-05.svg", + [ + [ + "/svg/shapes/ellipse-02-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/shapes/ellipse-06.svg": [ + [ + "/svg/shapes/ellipse-06.svg", + [ + [ + "/svg/shapes/ellipse-03-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/shapes/ellipse-07.svg": [ + [ + "/svg/shapes/ellipse-07.svg", + [ + [ + "/svg/shapes/ellipse-07-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/shapes/ellipse-08.svg": [ + [ + "/svg/shapes/ellipse-08.svg", + [ + [ + "/svg/shapes/ellipse-07-ref.svg", + "==" + ] + ], + {} + ] + ], "svg/shapes/line-dasharray.svg": [ [ "/svg/shapes/line-dasharray.svg", @@ -184445,6 +185033,102 @@ {} ] ], + "svg/shapes/reftests/pathlength-001.svg": [ + [ + "/svg/shapes/reftests/pathlength-001.svg", + [ + [ + "/svg/shapes/reftests/pathlength-001-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/shapes/reftests/pathlength-002.svg": [ + [ + "/svg/shapes/reftests/pathlength-002.svg", + [ + [ + "/svg/shapes/reftests/pathlength-002-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/shapes/reftests/pathlength-003.svg": [ + [ + "/svg/shapes/reftests/pathlength-003.svg", + [ + [ + "/svg/shapes/reftests/pathlength-003-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/styling/render/transform-box.svg": [ + [ + "/svg/styling/render/transform-box.svg", + [ + [ + "/svg/styling/render/transform-box-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/styling/render/transform-origin.svg": [ + [ + "/svg/styling/render/transform-origin.svg", + [ + [ + "/svg/styling/render/transform-origin-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/styling/render/transform.svg": [ + [ + "/svg/styling/render/transform.svg", + [ + [ + "/svg/styling/render/transform-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/text/reftests/textpath-shape-001.svg": [ + [ + "/svg/text/reftests/textpath-shape-001.svg", + [ + [ + "/svg/text/reftests/textpath-side-001-ref.svg", + "==" + ] + ], + {} + ] + ], + "svg/text/reftests/textpath-side-001.svg": [ + [ + "/svg/text/reftests/textpath-side-001.svg", + [ + [ + "/svg/text/reftests/textpath-side-001-ref.svg", + "==" + ] + ], + {} + ] + ], "webvtt/rendering/cues-with-video/processing-model/2_cues_overlapping_completely_move_up.html": [ [ "/webvtt/rendering/cues-with-video/processing-model/2_cues_overlapping_completely_move_up.html", @@ -188757,16 +189441,6 @@ {} ] ], - "2dcontext/best-practices/.gitkeep": [ - [ - {} - ] - ], - "2dcontext/building-paths/.gitkeep": [ - [ - {} - ] - ], "2dcontext/building-paths/canvas_complexshapes_arcto_001-ref.htm": [ [ {} @@ -188782,11 +189456,6 @@ {} ] ], - "2dcontext/compositing/.gitkeep": [ - [ - {} - ] - ], "2dcontext/compositing/2d.composite.canvas.copy.png": [ [ {} @@ -189112,46 +189781,16 @@ {} ] ], - "2dcontext/conformance-requirements/.gitkeep": [ - [ - {} - ] - ], "2dcontext/conformance-requirements/2d.coordinatespace.png": [ [ {} ] ], - "2dcontext/drawing-images-to-the-canvas/.gitkeep": [ - [ - {} - ] - ], - "2dcontext/drawing-model/.gitkeep": [ - [ - {} - ] - ], - "2dcontext/drawing-paths-to-the-canvas/.gitkeep": [ - [ - {} - ] - ], - "2dcontext/drawing-rectangles-to-the-canvas/.gitkeep": [ - [ - {} - ] - ], "2dcontext/drawing-rectangles-to-the-canvas/clear-100x50.png": [ [ {} ] ], - "2dcontext/drawing-text-to-the-canvas/.gitkeep": [ - [ - {} - ] - ], "2dcontext/drawing-text-to-the-canvas/2d.text.draw.fill.basic.png": [ [ {} @@ -189172,21 +189811,6 @@ {} ] ], - "2dcontext/drawingstyle-objects/.gitkeep": [ - [ - {} - ] - ], - "2dcontext/examples/.gitkeep": [ - [ - {} - ] - ], - "2dcontext/fill-and-stroke-styles/.gitkeep": [ - [ - {} - ] - ], "2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-1.png": [ [ {} @@ -189607,11 +190231,6 @@ {} ] ], - "2dcontext/hit-regions/.gitkeep": [ - [ - {} - ] - ], "2dcontext/imagebitmap/common.sub.js": [ [ {} @@ -189622,11 +190241,6 @@ {} ] ], - "2dcontext/line-styles/.gitkeep": [ - [ - {} - ] - ], "2dcontext/line-styles/canvas_linestyles_linecap_001-ref.htm": [ [ {} @@ -189637,11 +190251,6 @@ {} ] ], - "2dcontext/path-objects/.gitkeep": [ - [ - {} - ] - ], "2dcontext/path-objects/2d.path.fill.overlap.png": [ [ {} @@ -189652,21 +190261,11 @@ {} ] ], - "2dcontext/pixel-manipulation/.gitkeep": [ - [ - {} - ] - ], "2dcontext/pixel-manipulation/2d.imageData.put.alpha.png": [ [ {} ] ], - "2dcontext/shadows/.gitkeep": [ - [ - {} - ] - ], "2dcontext/shadows/2d.shadow.alpha.2.png": [ [ {} @@ -189722,21 +190321,11 @@ {} ] ], - "2dcontext/text-styles/.gitkeep": [ - [ - {} - ] - ], "2dcontext/text-styles/canvas_text_font_001-ref.htm": [ [ {} ] ], - "2dcontext/the-canvas-state/.gitkeep": [ - [ - {} - ] - ], "2dcontext/the-canvas-state/canvas_state_restore_001-ref.htm": [ [ {} @@ -189807,11 +190396,6 @@ {} ] ], - "2dcontext/transformations/.gitkeep": [ - [ - {} - ] - ], "2dcontext/transformations/canvas_transformations_reset_001-ref.html": [ [ {} @@ -193297,6 +193881,11 @@ {} ] ], + "appmanifest/META.yml": [ + [ + {} + ] + ], "async-local-storage/META.yml": [ [ {} @@ -193312,6 +193901,16 @@ {} ] ], + "background-fetch/get-ids.https.js": [ + [ + {} + ] + ], + "background-fetch/resources/feature-name.txt": [ + [ + {} + ] + ], "background-fetch/resources/sw.js": [ [ {} @@ -193587,7 +194186,7 @@ {} ] ], - "client-hints/accept_ch.sub.https.html.headers": [ + "client-hints/accept_ch.tentative.sub.https.html.headers": [ [ {} ] @@ -193632,6 +194231,11 @@ {} ] ], + "client-hints/resources/http_equiv_accept_ch_lifetime.html": [ + [ + {} + ] + ], "clipboard-apis/META.yml": [ [ {} @@ -216957,6 +217561,11 @@ {} ] ], + "cookie-store/serviceworker_cookieStore_subscriptions_eventhandler_attribute.js": [ + [ + {} + ] + ], "cookie-store/serviceworker_cookieStore_subscriptions_mismatch.js": [ [ {} @@ -224727,6 +225336,11 @@ {} ] ], + "css/CSS2/floats/floats-line-wrap-shifted-001-ref.html": [ + [ + {} + ] + ], "css/CSS2/floats/floats-placement-vertical-001-ref.xht": [ [ {} @@ -240917,6 +241531,11 @@ {} ] ], + "css/css-box/META.yml": [ + [ + {} + ] + ], "css/css-box/parsing/resources/parsing-testcommon.js": [ [ {} @@ -240947,6 +241566,11 @@ {} ] ], + "css/css-cascade/parsing/support/parsing-testcommon.js": [ + [ + {} + ] + ], "css/css-cascade/reference/ref-filled-green-100px-square.xht": [ [ {} @@ -241012,6 +241636,11 @@ {} ] ], + "css/css-color/parsing/resources/parsing-testcommon.js": [ + [ + {} + ] + ], "css/css-color/rebeccapurple-ref.html": [ [ {} @@ -241432,11 +242061,26 @@ {} ] ], + "css/css-content/element-replacement-alt-ref.html": [ + [ + {} + ] + ], "css/css-content/element-replacement-ref.html": [ [ {} ] ], + "css/css-content/pseudo-element-inline-box-ref.html": [ + [ + {} + ] + ], + "css/css-content/resources/blank.html": [ + [ + {} + ] + ], "css/css-content/resources/rect.svg": [ [ {} @@ -253852,6 +254496,11 @@ {} ] ], + "css/css-pseudo/first-letter-opacity-float-001-ref.html": [ + [ + {} + ] + ], "css/css-pseudo/first-line-and-placeholder-ref.html": [ [ {} @@ -257282,6 +257931,11 @@ {} ] ], + "css/css-text/overflow-wrap/reference/overflow-wrap-min-content-size-002-ref.html": [ + [ + {} + ] + ], "css/css-text/support/1x1-green.png": [ [ {} @@ -258137,6 +258791,11 @@ {} ] ], + "css/css-text/word-break/reference/word-break-break-all-010-ref.html": [ + [ + {} + ] + ], "css/css-text/word-break/reference/word-break-break-all-ref-000.html": [ [ {} @@ -261702,6 +262361,11 @@ {} ] ], + "css/css-will-change/META.yml": [ + [ + {} + ] + ], "css/css-writing-modes/META.yml": [ [ {} @@ -268432,6 +269096,46 @@ {} ] ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-block-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-button-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-flex-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-block-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-flex-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-003-ref.html": [ + [ + {} + ] + ], "css/vendor-imports/mozilla/mozilla-central-reftests/contain/reftest.list": [ [ {} @@ -269112,6 +269816,21 @@ {} ] ], + "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-003-ref.html": [ + [ + {} + ] + ], "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-definite-sizes-001-ref.html": [ [ {} @@ -273027,36 +273746,6 @@ {} ] ], - "editing/manual/delete.manual.html": [ - [ - {} - ] - ], - "editing/manual/forwarddelete.manual.html": [ - [ - {} - ] - ], - "editing/manual/insertlinebreak.manual.html": [ - [ - {} - ] - ], - "editing/manual/insertparagraph.manual.html": [ - [ - {} - ] - ], - "editing/manual/inserttext.manual.html": [ - [ - {} - ] - ], - "editing/manual/inserttext2.manual.html": [ - [ - {} - ] - ], "encoding/META.yml": [ [ {} @@ -276252,61 +276941,6 @@ {} ] ], - "html-imports/META.yml": [ - [ - {} - ] - ], - "html-imports/document/resources/body-only.html": [ - [ - {} - ] - ], - "html-imports/document/resources/test-in-import.html": [ - [ - {} - ] - ], - "html-imports/fetching/resources/async.html": [ - [ - {} - ] - ], - "html-imports/fetching/resources/dynamic.html": [ - [ - {} - ] - ], - "html-imports/fetching/resources/hello.html": [ - [ - {} - ] - ], - "html-imports/fetching/resources/parent-of-hello.html": [ - [ - {} - ] - ], - "html-imports/html-link-element/resources/body-only-0.html": [ - [ - {} - ] - ], - "html-imports/html-link-element/resources/body-only-1.html": [ - [ - {} - ] - ], - "html-imports/html-link-element/resources/body-only-2.html": [ - [ - {} - ] - ], - "html-imports/html-link-element/resources/hello.css": [ - [ - {} - ] - ], "html-longdesc/META.yml": [ [ {} @@ -276372,26 +277006,6 @@ {} ] ], - "html/browsers/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/browsing-the-web/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/browsing-the-web/aborting-a-document-load/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/browsing-the-web/history-traversal/.gitkeep": [ - [ - {} - ] - ], "html/browsers/browsing-the-web/history-traversal/001-1.html": [ [ {} @@ -276492,11 +277106,6 @@ {} ] ], - "html/browsers/browsing-the-web/navigating-across-documents/.gitkeep": [ - [ - {} - ] - ], "html/browsers/browsing-the-web/navigating-across-documents/001-1.html": [ [ {} @@ -276677,56 +277286,11 @@ {} ] ], - "html/browsers/browsing-the-web/read-html/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/browsing-the-web/read-media/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/browsing-the-web/read-multipart-x-mixed-replace/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/browsing-the-web/read-plugin/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/browsing-the-web/read-text/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/browsing-the-web/read-ua-inline/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/browsing-the-web/read-xml/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/browsing-the-web/scroll-to-fragid/.gitkeep": [ - [ - {} - ] - ], "html/browsers/browsing-the-web/scroll-to-fragid/navigate-helpers.js": [ [ {} ] ], - "html/browsers/browsing-the-web/unloading-documents/.gitkeep": [ - [ - {} - ] - ], "html/browsers/browsing-the-web/unloading-documents/base.html": [ [ {} @@ -276972,16 +277536,6 @@ {} ] ], - "html/browsers/history/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/history/history-notes/.gitkeep": [ - [ - {} - ] - ], "html/browsers/history/joint-session-history/joint-session-history-child1.html": [ [ {} @@ -277007,11 +277561,6 @@ {} ] ], - "html/browsers/history/the-history-interface/.gitkeep": [ - [ - {} - ] - ], "html/browsers/history/the-history-interface/008.js": [ [ {} @@ -277197,11 +277746,6 @@ {} ] ], - "html/browsers/history/the-location-interface/.gitkeep": [ - [ - {} - ] - ], "html/browsers/history/the-location-interface/assign_after_load-1.html": [ [ {} @@ -277342,11 +277886,6 @@ {} ] ], - "html/browsers/history/the-session-history-of-browsing-contexts/.gitkeep": [ - [ - {} - ] - ], "html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-1.tentative.html": [ [ {} @@ -277367,16 +277906,6 @@ {} ] ], - "html/browsers/offline/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/offline/appcache/.gitkeep": [ - [ - {} - ] - ], "html/browsers/offline/appcache/workers/resources/appcache-dedicated-worker-not-in-cache.js": [ [ {} @@ -277407,56 +277936,16 @@ {} ] ], - "html/browsers/offline/application-cache-api/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/offline/browser-state/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/offline/changestonetworkingmodel/.gitkeep": [ - [ - {} - ] - ], "html/browsers/offline/changestonetworkingmodel/original-id.json": [ [ {} ] ], - "html/browsers/offline/disk-space/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/offline/downloading-or-updating-an-application-cache/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/offline/expiring-application-caches/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/offline/introduction-4/.gitkeep": [ - [ - {} - ] - ], "html/browsers/offline/introduction-4/contains.json": [ [ {} ] ], - "html/browsers/offline/manifests/.gitkeep": [ - [ - {} - ] - ], "html/browsers/offline/manifests/contains.json": [ [ {} @@ -277517,11 +278006,6 @@ {} ] ], - "html/browsers/offline/the-application-cache-selection-algorithm/.gitkeep": [ - [ - {} - ] - ], "html/browsers/origin/cross-origin-objects/frame-with-then.html": [ [ {} @@ -277552,11 +278036,6 @@ {} ] ], - "html/browsers/sandboxing/.gitkeep": [ - [ - {} - ] - ], "html/browsers/sandboxing/inner-iframe.html": [ [ {} @@ -277572,16 +278051,6 @@ {} ] ], - "html/browsers/the-window-object/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/the-window-object/accessing-other-browsing-contexts/.gitkeep": [ - [ - {} - ] - ], "html/browsers/the-window-object/accessing-other-browsing-contexts/test1.html": [ [ {} @@ -277597,11 +278066,6 @@ {} ] ], - "html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/.gitkeep": [ - [ - {} - ] - ], "html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/callback.js": [ [ {} @@ -277662,21 +278126,6 @@ {} ] ], - "html/browsers/the-window-object/browser-interface-elements/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/the-window-object/closing-browsing-contexts/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/the-window-object/garbage-collection-and-browsing-contexts/.gitkeep": [ - [ - {} - ] - ], "html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_1-1.html": [ [ {} @@ -277747,41 +278196,16 @@ {} ] ], - "html/browsers/the-window-object/named-access-on-the-window-object/.gitkeep": [ - [ - {} - ] - ], "html/browsers/the-window-object/named-access-on-the-window-object/test.html": [ [ {} ] ], - "html/browsers/the-window-object/security-window/.gitkeep": [ - [ - {} - ] - ], "html/browsers/the-window-object/support/noopener-target.html": [ [ {} ] ], - "html/browsers/the-window-object/the-windowproxy-object/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/windows/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/windows/auxiliary-browsing-contexts/.gitkeep": [ - [ - {} - ] - ], "html/browsers/windows/auxiliary-browsing-contexts/contains.json": [ [ {} @@ -277812,11 +278236,6 @@ {} ] ], - "html/browsers/windows/browsing-context-names/.gitkeep": [ - [ - {} - ] - ], "html/browsers/windows/browsing-context-names/resources/choose-_parent-001-iframe-1.html": [ [ {} @@ -277917,16 +278336,6 @@ {} ] ], - "html/browsers/windows/groupings-of-browsing-contexts/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/windows/nested-browsing-contexts/.gitkeep": [ - [ - {} - ] - ], "html/browsers/windows/nested-browsing-contexts/contains.json": [ [ {} @@ -278002,241 +278411,16 @@ {} ] ], - "html/browsers/windows/secondary-browsing-contexts/.gitkeep": [ - [ - {} - ] - ], - "html/browsers/windows/security-nav/.gitkeep": [ - [ - {} - ] - ], - "html/dom/.gitkeep": [ - [ - {} - ] - ], - "html/dom/META.yml": [ - [ - {} - ] - ], - "html/dom/documents/.gitkeep": [ - [ - {} - ] - ], - "html/dom/documents/dom-tree-accessors/.gitkeep": [ - [ - {} - ] - ], "html/dom/documents/dom-tree-accessors/cross-domain.js": [ [ {} ] ], - "html/dom/documents/loading-xml-documents/.gitkeep": [ - [ - {} - ] - ], - "html/dom/documents/resource-metadata-management/.gitkeep": [ - [ - {} - ] - ], "html/dom/documents/resource-metadata-management/document-lastModified.html.headers": [ [ {} ] ], - "html/dom/documents/security-document/.gitkeep": [ - [ - {} - ] - ], - "html/dom/documents/the-document-object/.gitkeep": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/.gitkeep": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/closing-the-input-stream/.gitkeep": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/.gitkeep": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/005.js": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/006.js": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/007.js": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/008-1.js": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/008.js": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/010-1.js": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/010.js": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/011-1.js": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/011.js": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/012.js": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/013.js": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/empty.html": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_005.js": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/nested-document-write-1.html": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/nested-document-write-2.html": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/nested-document-write-external.js": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/original-id.json": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-writeln/.gitkeep": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-writeln/original-id.json": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/.gitkeep": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/004-1.html": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/010-1.html": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/010-2.html": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/011-1.html": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/012-1.html": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/013-1.html": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/014-1.html": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/015-1.html": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/016-1.html": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03-frame.html": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/resources/encoding-frame.html": [ - [ - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext-subframe.txt": [ - [ - {} - ] - ], "html/dom/elements-embedded.js": [ [ {} @@ -278282,41 +278466,16 @@ {} ] ], - "html/dom/elements/.gitkeep": [ - [ - {} - ] - ], - "html/dom/elements/content-models/.gitkeep": [ - [ - {} - ] - ], "html/dom/elements/content-models/contains.json": [ [ {} ] ], - "html/dom/elements/element-definitions/.gitkeep": [ - [ - {} - ] - ], "html/dom/elements/element-definitions/contains.json": [ [ {} ] ], - "html/dom/elements/elements-in-the-dom/.gitkeep": [ - [ - {} - ] - ], - "html/dom/elements/global-attributes/.gitkeep": [ - [ - {} - ] - ], "html/dom/elements/global-attributes/.htaccess": [ [ {} @@ -278612,11 +278771,6 @@ {} ] ], - "html/dom/elements/requirements-relating-to-bidirectional-algorithm-formatting-characters/.gitkeep": [ - [ - {} - ] - ], "html/dom/elements/requirements-relating-to-bidirectional-algorithm-formatting-characters/reference/dir-isolation-001-ref.html": [ [ {} @@ -278682,11 +278836,6 @@ {} ] ], - "html/dom/elements/semantics-0/.gitkeep": [ - [ - {} - ] - ], "html/dom/elements/the-innertext-idl-attribute/META.yml": [ [ {} @@ -278702,11 +278851,6 @@ {} ] ], - "html/dom/elements/wai-aria/.gitkeep": [ - [ - {} - ] - ], "html/dom/elements/wai-aria/README.md": [ [ {} @@ -278717,11 +278861,6 @@ {} ] ], - "html/dom/interactions-with-xpath-and-xslt/.gitkeep": [ - [ - {} - ] - ], "html/dom/new-harness.js": [ [ {} @@ -278747,41 +278886,6 @@ {} ] ], - "html/editing/.gitkeep": [ - [ - {} - ] - ], - "html/editing/META.yml": [ - [ - {} - ] - ], - "html/editing/activation/.gitkeep": [ - [ - {} - ] - ], - "html/editing/assigning-keyboard-shortcuts/.gitkeep": [ - [ - {} - ] - ], - "html/editing/assigning-keyboard-shortcuts/introduction-6/.gitkeep": [ - [ - {} - ] - ], - "html/editing/assigning-keyboard-shortcuts/processing-model-4/.gitkeep": [ - [ - {} - ] - ], - "html/editing/assigning-keyboard-shortcuts/the-accesskey-attribute/.gitkeep": [ - [ - {} - ] - ], "html/editing/dnd/README": [ [ {} @@ -278867,11 +278971,6 @@ {} ] ], - "html/editing/dnd/canvas/cross-domain/001.manual.xhtml": [ - [ - {} - ] - ], "html/editing/dnd/canvas/helper-drag-me-green-box.xhtml": [ [ {} @@ -278897,11 +278996,6 @@ {} ] ], - "html/editing/dnd/cross-document/002.manual.html": [ - [ - {} - ] - ], "html/editing/dnd/cross-document/003-1.html": [ [ {} @@ -279947,11 +280041,6 @@ {} ] ], - "html/editing/dnd/images/cross-domain/001.manual.xhtml": [ - [ - {} - ] - ], "html/editing/dnd/images/helper-circle.xhtml": [ [ {} @@ -283147,96 +283236,26 @@ {} ] ], - "html/editing/editing-0/.gitkeep": [ - [ - {} - ] - ], - "html/editing/editing-0/best-practices-for-in-page-editors/.gitkeep": [ - [ - {} - ] - ], - "html/editing/editing-0/contenteditable/.gitkeep": [ - [ - {} - ] - ], - "html/editing/editing-0/editing-apis/.gitkeep": [ - [ - {} - ] - ], - "html/editing/editing-0/making-entire-documents-editable-the-designmode-idl-attribute/.gitkeep": [ - [ - {} - ] - ], "html/editing/editing-0/making-entire-documents-editable-the-designmode-idl-attribute/original-id.json": [ [ {} ] ], - "html/editing/editing-0/spelling-and-grammar-checking/.gitkeep": [ - [ - {} - ] - ], "html/editing/editing-0/spelling-and-grammar-checking/references/spelling-markers-001-ref.html": [ [ {} ] ], - "html/editing/focus/.gitkeep": [ - [ - {} - ] - ], - "html/editing/focus/document-level-focus-apis/.gitkeep": [ - [ - {} - ] - ], "html/editing/focus/document-level-focus-apis/test.html": [ [ {} ] ], - "html/editing/focus/element-level-focus-apis/.gitkeep": [ - [ - {} - ] - ], - "html/editing/focus/focus-management/.gitkeep": [ - [ - {} - ] - ], "html/editing/focus/processing-model/support/preventScroll-helper.html": [ [ {} ] ], - "html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/.gitkeep": [ - [ - {} - ] - ], - "html/editing/inert-subtrees/.gitkeep": [ - [ - {} - ] - ], - "html/editing/inert-subtrees/the-inert-attribute/.gitkeep": [ - [ - {} - ] - ], - "html/editing/the-hidden-attribute/.gitkeep": [ - [ - {} - ] - ], "html/editing/the-hidden-attribute/hidden-1-ref.html": [ [ {} @@ -283257,261 +283276,51 @@ {} ] ], - "html/iana/.gitkeep": [ - [ - {} - ] - ], - "html/iana/application-x-www-form-urlencoded/.gitkeep": [ - [ - {} - ] - ], "html/iana/application-x-www-form-urlencoded/original-id.json": [ [ {} ] ], - "html/iana/application-xhtml-xml/.gitkeep": [ - [ - {} - ] - ], "html/iana/application-xhtml-xml/original-id.json": [ [ {} ] ], - "html/iana/multipart-x-mixed-replace/.gitkeep": [ - [ - {} - ] - ], "html/iana/multipart-x-mixed-replace/original-id.json": [ [ {} ] ], - "html/iana/ping-to/.gitkeep": [ - [ - {} - ] - ], - "html/iana/text-cache-manifest/.gitkeep": [ - [ - {} - ] - ], "html/iana/text-cache-manifest/original-id.json": [ [ {} ] ], - "html/iana/text-html/.gitkeep": [ - [ - {} - ] - ], "html/iana/text-html/original-id.json": [ [ {} ] ], - "html/iana/web-scheme-prefix/.gitkeep": [ - [ - {} - ] - ], "html/iana/web-scheme-prefix/original-id.json": [ [ {} ] ], - "html/infrastructure/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/META.yml": [ - [ - {} - ] - ], - "html/infrastructure/case-sensitivity-and-string-comparison/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/common-dom-interfaces/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/common-dom-interfaces/collections/.gitkeep": [ - [ - {} - ] - ], "html/infrastructure/common-dom-interfaces/collections/contains.json": [ [ {} ] ], - "html/infrastructure/common-dom-interfaces/domstringmap/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/common-dom-interfaces/garbage-collection/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/common-dom-interfaces/reflecting-content-attributes-in-idl-attributes/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/common-dom-interfaces/safe-passing-of-structured-data/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/common-dom-interfaces/transferable-objects/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/common-microsyntaxes/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/common-microsyntaxes/boolean-attributes/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/common-microsyntaxes/colors/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/common-microsyntaxes/comma-separated-tokens/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/common-microsyntaxes/common-parser-idioms/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/common-microsyntaxes/dates-and-times/.gitkeep": [ - [ - {} - ] - ], "html/infrastructure/common-microsyntaxes/dates-and-times/contains.json": [ [ {} ] ], - "html/infrastructure/common-microsyntaxes/keywords-and-enumerated-attributes/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/common-microsyntaxes/mq/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/common-microsyntaxes/numbers/.gitkeep": [ - [ - {} - ] - ], "html/infrastructure/common-microsyntaxes/numbers/contains.json": [ [ {} ] ], - "html/infrastructure/common-microsyntaxes/space-separated-tokens/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/common-microsyntaxes/syntax-references/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/conformance-requirements/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/conformance-requirements/conformance-classes/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/conformance-requirements/dependencies/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/conformance-requirements/extensibility/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/fetching-resources/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/fetching-resources/content-type-sniffing/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/fetching-resources/cors-enabled-fetch/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/fetching-resources/cors-settings-attributes/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/fetching-resources/encrypted-http-and-related-security-concerns/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/fetching-resources/extracting-character-encodings-from-meta-elements/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/fetching-resources/processing-model/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/fetching-resources/terminology-1/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/namespaces/.gitkeep": [ - [ - {} - ] - ], "html/infrastructure/safe-passing-of-structured-data/echo.js": [ [ {} @@ -283617,76 +283426,11 @@ {} ] ], - "html/infrastructure/terminology/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/terminology/character-encodings/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/terminology/dom-trees/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/terminology/plugins/.gitkeep": [ - [ - {} - ] - ], "html/infrastructure/terminology/plugins/sample.txt": [ [ {} ] ], - "html/infrastructure/terminology/resources/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/terminology/scripting-0/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/terminology/xml/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/urls/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/urls/base-urls/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/urls/dynamic-changes-to-base-urls/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/urls/interfaces-for-url-manipulation/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/urls/parsing-urls/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/urls/resolving-urls/.gitkeep": [ - [ - {} - ] - ], "html/infrastructure/urls/resolving-urls/query-encoding/resources/blank.py": [ [ {} @@ -283722,341 +283466,46 @@ {} ] ], - "html/infrastructure/urls/terminology-0/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/urls/url-manipulation-and-creation/.gitkeep": [ - [ - {} - ] - ], - "html/infrastructure/utf-8/.gitkeep": [ - [ - {} - ] - ], "html/input/the-placeholder-attribute/multiline-ref.html": [ [ {} ] ], - "html/introduction/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/a-quick-introduction-to-html/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/a-quick-introduction-to-html/common-pitfalls-to-avoid-when-using-the-scripting-apis/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/a-quick-introduction-to-html/writing-secure-applications-with-html/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/audience/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/background/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/conformance-requirements-for-authors/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/conformance-requirements-for-authors/presentational-markup/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/conformance-requirements-for-authors/restrictions-on-content-models-and-on-attribute-values/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/conformance-requirements-for-authors/syntax-errors/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/design-notes/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/design-notes/compliance-with-other-specifications/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/design-notes/serializability-of-script-execution/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/fingerprint/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/history-0/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/html-vs-xhtml/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/scope/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/structure-of-this-specification/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/structure-of-this-specification/how-to-read-this-specification/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/structure-of-this-specification/typographic-conventions/.gitkeep": [ - [ - {} - ] - ], - "html/introduction/suggested-reading/.gitkeep": [ - [ - {} - ] - ], - "html/obsolete/.gitkeep": [ - [ - {} - ] - ], "html/obsolete/META.yml": [ [ {} ] ], - "html/obsolete/non-conforming-features/.gitkeep": [ - [ - {} - ] - ], - "html/obsolete/obsolete-but-conforming-features/.gitkeep": [ - [ - {} - ] - ], - "html/obsolete/obsolete-but-conforming-features/warnings-for-obsolete-but-conforming-features/.gitkeep": [ - [ - {} - ] - ], - "html/obsolete/requirements-for-implementations/.gitkeep": [ - [ - {} - ] - ], - "html/obsolete/requirements-for-implementations/frames/.gitkeep": [ - [ - {} - ] - ], - "html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/.gitkeep": [ - [ - {} - ] - ], "html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/original-id.json": [ [ {} ] ], - "html/obsolete/requirements-for-implementations/the-applet-element/.gitkeep": [ - [ - {} - ] - ], - "html/obsolete/requirements-for-implementations/the-marquee-element-0/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/bindings/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/bindings/introduction-9/.gitkeep": [ - [ - {} - ] - ], "html/rendering/bindings/the-button-element/button-type-menu-historical-ref.html": [ [ {} ] ], - "html/rendering/bindings/the-details-element-0/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/bindings/the-input-element-as-a-button/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/bindings/the-input-element-as-a-checkbox-and-radio-button-widgets/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/bindings/the-input-element-as-a-color-well/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/bindings/the-input-element-as-a-file-upload-control/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/bindings/the-input-element-as-a-range-control/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/bindings/the-input-element-as-a-text-entry-widget/.gitkeep": [ - [ - {} - ] - ], "html/rendering/bindings/the-input-element-as-a-text-entry-widget/unrecognized-type-should-fallback-as-text-type-ref.html": [ [ {} ] ], - "html/rendering/bindings/the-input-element-as-domain-specific-widgets/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/bindings/the-marquee-element/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/bindings/the-meter-element-0/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/bindings/the-progress-element-0/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/bindings/the-select-element-0/.gitkeep": [ - [ - {} - ] - ], "html/rendering/bindings/the-select-element-0/option-label-ref.html": [ [ {} ] ], - "html/rendering/bindings/the-textarea-element-0/.gitkeep": [ - [ - {} - ] - ], "html/rendering/bindings/the-textarea-element-0/textarea-ref.html": [ [ {} ] ], - "html/rendering/frames-and-framesets/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/interactive-media/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/interactive-media/editing-hosts/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/interactive-media/links-forms-and-navigation/.gitkeep": [ - [ - {} - ] - ], "html/rendering/interactive-media/links-forms-and-navigation/original-id.json": [ [ {} ] ], - "html/rendering/interactive-media/text-rendered-in-native-user-interfaces/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/interactive-media/the-title-attribute-0/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/introduction-8/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/non-replaced-elements/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/non-replaced-elements/bidirectional-text/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/non-replaced-elements/flow-content-0/.gitkeep": [ - [ - {} - ] - ], "html/rendering/non-replaced-elements/flow-content-0/div-align-ref.html": [ [ {} @@ -284072,21 +283521,6 @@ {} ] ], - "html/rendering/non-replaced-elements/form-controls/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/non-replaced-elements/hidden-elements/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/non-replaced-elements/lists/.gitkeep": [ - [ - {} - ] - ], "html/rendering/non-replaced-elements/lists/TODO-lists.html": [ [ {} @@ -284127,31 +283561,11 @@ {} ] ], - "html/rendering/non-replaced-elements/phrasing-content-0/.gitkeep": [ - [ - {} - ] - ], "html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-ref.html": [ [ {} ] ], - "html/rendering/non-replaced-elements/quotes/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/non-replaced-elements/sections-and-headings/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/non-replaced-elements/tables/.gitkeep": [ - [ - {} - ] - ], "html/rendering/non-replaced-elements/tables/colgroup_valign-ref.xhtml": [ [ {} @@ -284212,21 +283626,11 @@ {} ] ], - "html/rendering/non-replaced-elements/the-fieldset-element-0/.gitkeep": [ - [ - {} - ] - ], "html/rendering/non-replaced-elements/the-fieldset-element-0/ref.html": [ [ {} ] ], - "html/rendering/non-replaced-elements/the-hr-element-0/.gitkeep": [ - [ - {} - ] - ], "html/rendering/non-replaced-elements/the-hr-element-0/align-ref.html": [ [ {} @@ -284242,11 +283646,6 @@ {} ] ], - "html/rendering/non-replaced-elements/the-page/.gitkeep": [ - [ - {} - ] - ], "html/rendering/non-replaced-elements/the-page/body-margin-1-ref.html": [ [ {} @@ -284282,21 +283681,6 @@ {} ] ], - "html/rendering/print-media/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/replaced-elements/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/.gitkeep": [ - [ - {} - ] - ], "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-dim-ref.html": [ [ {} @@ -284307,12 +283691,17 @@ {} ] ], - "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/object_border-ref.xhtml": [ + "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-ref.html": [ [ {} ] ], - "html/rendering/replaced-elements/embedded-content-rendering-rules/.gitkeep": [ + "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-type-change-from-image-1-ref.html": [ + [ + {} + ] + ], + "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/object_border-ref.xhtml": [ [ {} ] @@ -284337,16 +283726,6 @@ {} ] ], - "html/rendering/replaced-elements/image-maps-0/.gitkeep": [ - [ - {} - ] - ], - "html/rendering/replaced-elements/images/.gitkeep": [ - [ - {} - ] - ], "html/rendering/replaced-elements/images/space-ref.html": [ [ {} @@ -284372,21 +283751,11 @@ {} ] ], - "html/rendering/replaced-elements/toolbars-0/.gitkeep": [ - [ - {} - ] - ], "html/rendering/replaced-elements/tools/gen-svgsizing-tests.py": [ [ {} ] ], - "html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/.gitkeep": [ - [ - {} - ] - ], "html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change-ref.html": [ [ {} @@ -284397,76 +283766,16 @@ {} ] ], - "html/rendering/unstyled-xml-documents/.gitkeep": [ - [ - {} - ] - ], "html/resources/common.js": [ [ {} ] ], - "html/semantics/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/META.yml": [ - [ - {} - ] - ], - "html/semantics/common-idioms/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/common-idioms/conversations/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/common-idioms/footnotes/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/common-idioms/rel-up/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/common-idioms/tag-clouds/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/common-idioms/the-main-part-of-the-content/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/disabled-elements/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/document-metadata/.gitkeep": [ - [ - {} - ] - ], "html/semantics/document-metadata/interactions-of-styling-and-scripting/stylesheet.py": [ [ {} ] ], - "html/semantics/document-metadata/styling/.gitkeep": [ - [ - {} - ] - ], "html/semantics/document-metadata/styling/support/alternate.css": [ [ {} @@ -284492,11 +283801,6 @@ {} ] ], - "html/semantics/document-metadata/the-base-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/document-metadata/the-base-element/example.html": [ [ {} @@ -284507,16 +283811,6 @@ {} ] ], - "html/semantics/document-metadata/the-head-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/document-metadata/the-link-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/document-metadata/the-link-element/all": [ [ {} @@ -284592,11 +283886,6 @@ {} ] ], - "html/semantics/document-metadata/the-meta-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/document-metadata/the-meta-element/contains.json": [ [ {} @@ -284657,67 +283946,12 @@ {} ] ], - "html/semantics/document-metadata/the-style-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/document-metadata/the-style-element/html_style_in_comment-ref.html": [ [ {} ] ], - "html/semantics/document-metadata/the-title-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/edits/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/edits/attributes-common-to-ins-and-del-elements/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/edits/edits-and-lists/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/edits/edits-and-paragraphs/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/edits/edits-and-tables/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/edits/the-del-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/edits/the-ins-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/embedded-content/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/embedded-content/dimension-attributes/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/embedded-content/image-maps/.gitkeep": [ + "html/semantics/embedded-content/META.yml": [ [ {} ] @@ -284732,16 +283966,6 @@ {} ] ], - "html/semantics/embedded-content/mathml/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/embedded-content/media-elements/.gitkeep": [ - [ - {} - ] - ], "html/semantics/embedded-content/media-elements/contains.json": [ [ {} @@ -285192,16 +284416,6 @@ {} ] ], - "html/semantics/embedded-content/svg/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/embedded-content/the-area-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/embedded-content/the-area-element/resources/area-download-click.html": [ [ {} @@ -285212,21 +284426,11 @@ {} ] ], - "html/semantics/embedded-content/the-audio-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/embedded-content/the-audio-element/audio_content-ref.htm": [ [ {} ] ], - "html/semantics/embedded-content/the-canvas-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/embedded-content/the-canvas-element/2d.scaled.png": [ [ {} @@ -285447,11 +284651,6 @@ {} ] ], - "html/semantics/embedded-content/the-embed-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/embedded-content/the-embed-element/embed-iframe.html": [ [ {} @@ -285467,11 +284666,6 @@ {} ] ], - "html/semantics/embedded-content/the-iframe-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/embedded-content/the-iframe-element/change_child.html": [ [ {} @@ -285732,11 +284926,6 @@ {} ] ], - "html/semantics/embedded-content/the-img-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/embedded-content/the-img-element/3.jpg": [ [ {} @@ -285812,16 +285001,6 @@ {} ] ], - "html/semantics/embedded-content/the-map-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/embedded-content/the-object-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/embedded-content/the-object-element/test0.html": [ [ {} @@ -285837,26 +285016,6 @@ {} ] ], - "html/semantics/embedded-content/the-param-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/embedded-content/the-source-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/embedded-content/the-track-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/embedded-content/the-video-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/embedded-content/the-video-element/video_content-ref.htm": [ [ {} @@ -285872,12 +285031,7 @@ {} ] ], - "html/semantics/forms/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/forms/attributes-common-to-form-controls/.gitkeep": [ + "html/semantics/forms/META.yml": [ [ {} ] @@ -285892,16 +285046,6 @@ {} ] ], - "html/semantics/forms/categories/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/forms/constraints/.gitkeep": [ - [ - {} - ] - ], "html/semantics/forms/constraints/contains.json": [ [ {} @@ -285912,21 +285056,11 @@ {} ] ], - "html/semantics/forms/form-control-infrastructure/.gitkeep": [ - [ - {} - ] - ], "html/semantics/forms/form-control-infrastructure/contains.json": [ [ {} ] ], - "html/semantics/forms/form-submission-0/.gitkeep": [ - [ - {} - ] - ], "html/semantics/forms/form-submission-0/contains.json": [ [ {} @@ -285947,61 +285081,26 @@ {} ] ], - "html/semantics/forms/introduction-1/.gitkeep": [ - [ - {} - ] - ], "html/semantics/forms/introduction-1/contains.json": [ [ {} ] ], - "html/semantics/forms/resetting-a-form/.gitkeep": [ - [ - {} - ] - ], "html/semantics/forms/resetting-a-form/reset-form-event-realm-support.html": [ [ {} ] ], - "html/semantics/forms/textfieldselection/.gitkeep": [ - [ - {} - ] - ], "html/semantics/forms/textfieldselection/original-id.json": [ [ {} ] ], - "html/semantics/forms/the-button-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/forms/the-button-element/button-activate-frame.html": [ [ {} ] ], - "html/semantics/forms/the-datalist-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/forms/the-fieldset-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/forms/the-form-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/forms/the-form-element/resources/form-no-action-with-base.html": [ [ {} @@ -286027,11 +285126,6 @@ {} ] ], - "html/semantics/forms/the-input-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/forms/the-input-element/contains.json": [ [ {} @@ -286047,56 +285141,16 @@ {} ] ], - "html/semantics/forms/the-label-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/forms/the-label-element/iframe-label-attributes.html": [ [ {} ] ], - "html/semantics/forms/the-legend-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/forms/the-meter-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/forms/the-optgroup-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/forms/the-option-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/forms/the-option-element/option-label-value.js": [ [ {} ] ], - "html/semantics/forms/the-output-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/forms/the-select-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/forms/the-textarea-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/forms/the-textarea-element/textarea-newline-bidi-ref.html": [ [ {} @@ -286107,42 +285161,7 @@ {} ] ], - "html/semantics/grouping-content/the-blockquote-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/grouping-content/the-dd-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/grouping-content/the-div-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/grouping-content/the-dl-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/grouping-content/the-dt-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/grouping-content/the-figcaption-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/grouping-content/the-figure-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/grouping-content/the-hr-element/.gitkeep": [ + "html/semantics/grouping-content/META.yml": [ [ {} ] @@ -286242,16 +285261,6 @@ {} ] ], - "html/semantics/grouping-content/the-p-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/grouping-content/the-pre-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/grouping-content/the-pre-element/grouping-pre-reftest-001-ref.html": [ [ {} @@ -286262,17 +285271,7 @@ {} ] ], - "html/semantics/grouping-content/the-ul-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/interactive-elements/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/interactive-elements/commands/.gitkeep": [ + "html/semantics/interactive-elements/META.yml": [ [ {} ] @@ -286282,11 +285281,6 @@ {} ] ], - "html/semantics/interactive-elements/the-details-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/interactive-elements/the-dialog-element/centering-iframe.sub.html": [ [ {} @@ -286302,27 +285296,12 @@ {} ] ], - "html/semantics/interactive-elements/the-menu-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/interactive-elements/the-summary-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/interfaces.js": [ [ {} ] ], - "html/semantics/links/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/links/downloading-resources/.gitkeep": [ + "html/semantics/links/META.yml": [ [ {} ] @@ -286332,21 +285311,6 @@ {} ] ], - "html/semantics/links/following-hyperlinks/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/links/introduction-3/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/links/links-created-by-a-and-area-elements/.gitkeep": [ - [ - {} - ] - ], "html/semantics/links/links-created-by-a-and-area-elements/support/noopener-popup.html": [ [ {} @@ -286362,11 +285326,6 @@ {} ] ], - "html/semantics/links/linktypes/.gitkeep": [ - [ - {} - ] - ], "html/semantics/links/linktypes/alternate-css-ref.html": [ [ {} @@ -286397,17 +285356,7 @@ {} ] ], - "html/semantics/scripting-1/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/scripting-1/the-noscript-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/scripting-1/the-script-element/.gitkeep": [ + "html/semantics/scripting-1/META.yml": [ [ {} ] @@ -287387,87 +286336,17 @@ {} ] ], - "html/semantics/sections/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/sections/headings-and-sections/.gitkeep": [ - [ - {} - ] - ], "html/semantics/sections/headings-and-sections/contains.json": [ [ {} ] ], - "html/semantics/sections/the-address-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/sections/the-article-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/sections/the-aside-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/sections/the-body-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/sections/the-footer-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/sections/the-h1-h2-h3-h4-h5-and-h6-elements/.gitkeep": [ - [ - {} - ] - ], "html/semantics/sections/the-h1-h2-h3-h4-h5-and-h6-elements/original-id.json": [ [ {} ] ], - "html/semantics/sections/the-header-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/sections/the-hgroup-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/sections/the-nav-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/sections/the-section-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/sections/usage-summary-0/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/selectors/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/selectors/case-sensitivity/.gitkeep": [ + "html/semantics/selectors/META.yml": [ [ {} ] @@ -287482,17 +286361,7 @@ {} ] ], - "html/semantics/tabular-data/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/tabular-data/attributes-common-to-td-and-th-elements/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/tabular-data/examples/.gitkeep": [ + "html/semantics/tabular-data/META.yml": [ [ {} ] @@ -287502,81 +286371,16 @@ {} ] ], - "html/semantics/tabular-data/processing-model-1/.gitkeep": [ - [ - {} - ] - ], "html/semantics/tabular-data/processing-model-1/contains.json": [ [ {} ] ], - "html/semantics/tabular-data/the-caption-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/tabular-data/the-col-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/tabular-data/the-colgroup-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/tabular-data/the-table-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/tabular-data/the-table-element/contains.json": [ [ {} ] ], - "html/semantics/tabular-data/the-tbody-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/tabular-data/the-td-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/tabular-data/the-tfoot-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/tabular-data/the-th-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/tabular-data/the-thead-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/tabular-data/the-tr-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-a-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/text-level-semantics/the-a-element/a-download-404.py": [ [ {} @@ -287592,26 +286396,11 @@ {} ] ], - "html/semantics/text-level-semantics/the-abbr-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-b-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/text-level-semantics/the-b-element/b-usage-notref.html": [ [ {} ] ], - "html/semantics/text-level-semantics/the-bdi-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/text-level-semantics/the-bdi-element/bdi-auto-dir-default-ref.html": [ [ {} @@ -287692,21 +286481,11 @@ {} ] ], - "html/semantics/text-level-semantics/the-bdo-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/text-level-semantics/the-bdo-element/bidi-001-ref.html": [ [ {} ] ], - "html/semantics/text-level-semantics/the-br-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/text-level-semantics/the-br-element/br-bidi-in-inline-ancestors-ref.html": [ [ {} @@ -287717,136 +286496,16 @@ {} ] ], - "html/semantics/text-level-semantics/the-cite-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-code-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-dfn-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-em-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-i-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-kbd-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-mark-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-q-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-rp-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-rt-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-ruby-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/text-level-semantics/the-ruby-element/ruby-usage-notref.html": [ [ {} ] ], - "html/semantics/text-level-semantics/the-s-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-samp-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-small-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-span-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-strong-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-sub-and-sup-elements/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-time-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-u-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/text-level-semantics/the-var-element/.gitkeep": [ - [ - {} - ] - ], "html/semantics/text-level-semantics/the-wbr-element/wbr-element-ref.html": [ [ {} ] ], - "html/semantics/text-level-semantics/usage-summary/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/the-root-element/.gitkeep": [ - [ - {} - ] - ], - "html/semantics/the-root-element/the-html-element/.gitkeep": [ - [ - {} - ] - ], - "html/syntax/.gitkeep": [ - [ - {} - ] - ], "html/syntax/META.yml": [ [ {} @@ -287857,11 +286516,6 @@ {} ] ], - "html/syntax/parsing-html-fragments/.gitkeep": [ - [ - {} - ] - ], "html/syntax/parsing-html-fragments/support/encodingtests-1.css": [ [ {} @@ -287927,11 +286581,6 @@ {} ] ], - "html/syntax/parsing/.gitkeep": [ - [ - {} - ] - ], "html/syntax/parsing/DOMContentLoaded-defer-support.js": [ [ {} @@ -288017,86 +286666,21 @@ {} ] ], - "html/syntax/serializing-html-fragments/.gitkeep": [ - [ - {} - ] - ], - "html/syntax/writing/.gitkeep": [ - [ - {} - ] - ], - "html/syntax/writing/cdata-sections/.gitkeep": [ - [ - {} - ] - ], - "html/syntax/writing/character-references/.gitkeep": [ - [ - {} - ] - ], - "html/syntax/writing/comments/.gitkeep": [ - [ - {} - ] - ], - "html/syntax/writing/elements-0/.gitkeep": [ - [ - {} - ] - ], "html/syntax/writing/elements-0/contains.json": [ [ {} ] ], - "html/syntax/writing/text/.gitkeep": [ - [ - {} - ] - ], "html/syntax/writing/text/contains.json": [ [ {} ] ], - "html/syntax/writing/the-doctype/.gitkeep": [ - [ - {} - ] - ], - "html/the-xhtml-syntax/.gitkeep": [ - [ - {} - ] - ], - "html/the-xhtml-syntax/parsing-xhtml-documents/.gitkeep": [ - [ - {} - ] - ], "html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-support.htm": [ [ {} ] ], - "html/the-xhtml-syntax/parsing-xhtml-fragments/.gitkeep": [ - [ - {} - ] - ], - "html/the-xhtml-syntax/serializing-xhtml-fragments/.gitkeep": [ - [ - {} - ] - ], - "html/the-xhtml-syntax/writing-xhtml-documents/.gitkeep": [ - [ - {} - ] - ], "html/tools/META.yml": [ [ {} @@ -288122,12 +286706,167 @@ {} ] ], - "html/webappapis/.gitkeep": [ + "html/user-activation/resources/child-one.html": [ [ {} ] ], - "html/webappapis/atob/.gitkeep": [ + "html/user-activation/resources/child-two.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/005.js": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/006.js": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/007.js": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/008-1.js": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/008.js": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/010-1.js": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/010.js": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/011-1.js": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/011.js": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/012.js": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/013.js": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/empty.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_005.js": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/nested-document-write-1.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/nested-document-write-2.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/nested-document-write-external.js": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/original-id.json": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-writeln/original-id.json": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/004-1.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010-1.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010-2.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/011-1.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/012-1.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/013-1.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/014-1.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/015-1.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/016-1.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-03-frame.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-async-frame.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-frame.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/encoding-frame.html": [ [ {} ] @@ -288137,17 +286876,7 @@ {} ] ], - "html/webappapis/scripting/.gitkeep": [ - [ - {} - ] - ], - "html/webappapis/scripting/enabling-and-disabling-scripting/.gitkeep": [ - [ - {} - ] - ], - "html/webappapis/scripting/event-loops/.gitkeep": [ + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext-subframe.txt": [ [ {} ] @@ -288162,11 +286891,6 @@ {} ] ], - "html/webappapis/scripting/events/.gitkeep": [ - [ - {} - ] - ], "html/webappapis/scripting/events/contains.json": [ [ {} @@ -288197,21 +286921,6 @@ {} ] ], - "html/webappapis/scripting/introduction-5/.gitkeep": [ - [ - {} - ] - ], - "html/webappapis/scripting/javascript-protocol/.gitkeep": [ - [ - {} - ] - ], - "html/webappapis/scripting/processing-model-2/.gitkeep": [ - [ - {} - ] - ], "html/webappapis/scripting/processing-model-2/contains.json": [ [ {} @@ -288282,21 +286991,6 @@ {} ] ], - "html/webappapis/system-state-and-capabilities/.gitkeep": [ - [ - {} - ] - ], - "html/webappapis/system-state-and-capabilities/the-external-interface/.gitkeep": [ - [ - {} - ] - ], - "html/webappapis/system-state-and-capabilities/the-navigator-object/.gitkeep": [ - [ - {} - ] - ], "html/webappapis/system-state-and-capabilities/the-navigator-object/contains.json": [ [ {} @@ -288312,31 +287006,6 @@ {} ] ], - "html/webappapis/timers/.gitkeep": [ - [ - {} - ] - ], - "html/webappapis/user-prompts/.gitkeep": [ - [ - {} - ] - ], - "html/webappapis/user-prompts/dialogs-implemented-using-separate-documents/.gitkeep": [ - [ - {} - ] - ], - "html/webappapis/user-prompts/printing/.gitkeep": [ - [ - {} - ] - ], - "html/webappapis/user-prompts/simple-dialogs/.gitkeep": [ - [ - {} - ] - ], "imagebitmap-renderingcontext/META.yml": [ [ {} @@ -288752,6 +287421,11 @@ {} ] ], + "interfaces/CSP.idl": [ + [ + {} + ] + ], "interfaces/DOM-Parsing.idl": [ [ {} @@ -288782,7 +287456,7 @@ {} ] ], - "interfaces/ServiceWorker.idl": [ + "interfaces/SRI.idl": [ [ {} ] @@ -288792,6 +287466,11 @@ {} ] ], + "interfaces/WebIDL.idl": [ + [ + {} + ] + ], "interfaces/accelerometer.idl": [ [ {} @@ -288802,6 +287481,16 @@ {} ] ], + "interfaces/appmanifest.idl": [ + [ + {} + ] + ], + "interfaces/audio-output.idl": [ + [ + {} + ] + ], "interfaces/background-fetch.idl": [ [ {} @@ -288852,6 +287541,11 @@ {} ] ], + "interfaces/csp-embedded-enforcement.idl": [ + [ + {} + ] + ], "interfaces/css-animations.idl": [ [ {} @@ -288952,6 +287646,16 @@ {} ] ], + "interfaces/generic-sensor.idl": [ + [ + {} + ] + ], + "interfaces/geolocation-API.idl": [ + [ + {} + ] + ], "interfaces/geolocation-sensor.idl": [ [ {} @@ -288997,6 +287701,11 @@ {} ] ], + "interfaces/longtasks.idl": [ + [ + {} + ] + ], "interfaces/magnetometer.idl": [ [ {} @@ -289017,12 +287726,7 @@ {} ] ], - "interfaces/mediacapture-main.idl": [ - [ - {} - ] - ], - "interfaces/mediacapture-record.idl": [ + "interfaces/mediacapture-streams.idl": [ [ {} ] @@ -289032,6 +287736,21 @@ {} ] ], + "interfaces/mediastream-recording.idl": [ + [ + {} + ] + ], + "interfaces/navigation-timing.idl": [ + [ + {} + ] + ], + "interfaces/netinfo.idl": [ + [ + {} + ] + ], "interfaces/orientation-event.idl": [ [ {} @@ -289042,11 +287761,21 @@ {} ] ], + "interfaces/page-visibility.idl": [ + [ + {} + ] + ], "interfaces/payment-handler.idl": [ [ {} ] ], + "interfaces/payment-method-basic-card.idl": [ + [ + {} + ] + ], "interfaces/payment-request.idl": [ [ {} @@ -289062,6 +287791,11 @@ {} ] ], + "interfaces/picture-in-picture.idl": [ + [ + {} + ] + ], "interfaces/pointerevents-extension.idl": [ [ {} @@ -289102,6 +287836,11 @@ {} ] ], + "interfaces/requestidlecallback.idl": [ + [ + {} + ] + ], "interfaces/resource-timing.idl": [ [ {} @@ -289127,12 +287866,12 @@ {} ] ], - "interfaces/sensors.idl": [ + "interfaces/server-timing.idl": [ [ {} ] ], - "interfaces/server-timing.idl": [ + "interfaces/service-workers.idl": [ [ {} ] @@ -289182,6 +287921,11 @@ {} ] ], + "interfaces/wasm-js-api.idl": [ + [ + {} + ] + ], "interfaces/web-animations.idl": [ [ {} @@ -289202,11 +287946,6 @@ {} ] ], - "interfaces/webappsec-subresource-integrity.idl": [ - [ - {} - ] - ], "interfaces/webaudio.idl": [ [ {} @@ -289222,11 +287961,6 @@ {} ] ], - "interfaces/webidl.idl": [ - [ - {} - ] - ], "interfaces/webrtc-pc.idl": [ [ {} @@ -289247,6 +287981,11 @@ {} ] ], + "interfaces/worklets.idl": [ + [ + {} + ] + ], "interfaces/xhr.idl": [ [ {} @@ -289942,6 +288681,16 @@ {} ] ], + "media/2x2-green.mp4": [ + [ + {} + ] + ], + "media/2x2-green.ogv": [ + [ + {} + ] + ], "media/A4.mp4": [ [ {} @@ -290017,6 +288766,16 @@ {} ] ], + "media/sound_0.mp3": [ + [ + {} + ] + ], + "media/sound_0.oga": [ + [ + {} + ] + ], "media/sound_5.mp3": [ [ {} @@ -291192,6 +289951,11 @@ {} ] ], + "performance-timeline/resources/worker-invalid-entries.js": [ + [ + {} + ] + ], "performance-timeline/resources/worker-with-performance-observer.js": [ [ {} @@ -295792,6 +294556,16 @@ {} ] ], + "service-workers/service-worker/resources/claim-nested-worker-fetch-iframe.html": [ + [ + {} + ] + ], + "service-workers/service-worker/resources/claim-nested-worker-fetch-parent-worker.js": [ + [ + {} + ] + ], "service-workers/service-worker/resources/claim-shared-worker-fetch-iframe.html": [ [ {} @@ -296562,6 +295336,11 @@ {} ] ], + "service-workers/service-worker/resources/nested_load_worker.js": [ + [ + {} + ] + ], "service-workers/service-worker/resources/notification_icon.py": [ [ {} @@ -297272,6 +296051,11 @@ {} ] ], + "streams/piping/then-interception.js": [ + [ + {} + ] + ], "streams/piping/transform-streams.js": [ [ {} @@ -297997,6 +296781,26 @@ {} ] ], + "svg/painting/OWNERS": [ + [ + {} + ] + ], + "svg/painting/currentColor-override-pserver-fallback-ref.svg": [ + [ + {} + ] + ], + "svg/painting/currentColor-override-pserver-fill-ref.svg": [ + [ + {} + ] + ], + "svg/painting/currentColor-override-pserver-stroke-ref.svg": [ + [ + {} + ] + ], "svg/painting/reftests/paint-context-001-ref.svg": [ [ {} @@ -298062,6 +296866,36 @@ {} ] ], + "svg/rendering/order/z-index-ref.svg": [ + [ + {} + ] + ], + "svg/shapes/ellipse-01-ref.svg": [ + [ + {} + ] + ], + "svg/shapes/ellipse-02-ref.svg": [ + [ + {} + ] + ], + "svg/shapes/ellipse-03-ref.svg": [ + [ + {} + ] + ], + "svg/shapes/ellipse-04-ref.svg": [ + [ + {} + ] + ], + "svg/shapes/ellipse-07-ref.svg": [ + [ + {} + ] + ], "svg/shapes/line-dasharray-ref.svg": [ [ {} @@ -298087,6 +296921,46 @@ {} ] ], + "svg/shapes/reftests/pathlength-001-ref.svg": [ + [ + {} + ] + ], + "svg/shapes/reftests/pathlength-002-ref.svg": [ + [ + {} + ] + ], + "svg/shapes/reftests/pathlength-003-ref.svg": [ + [ + {} + ] + ], + "svg/styling/render/transform-box-ref.svg": [ + [ + {} + ] + ], + "svg/styling/render/transform-origin-ref.svg": [ + [ + {} + ] + ], + "svg/styling/render/transform-ref.svg": [ + [ + {} + ] + ], + "svg/text/reftests/textpath-shape-001-ref.svg": [ + [ + {} + ] + ], + "svg/text/reftests/textpath-side-001-ref.svg": [ + [ + {} + ] + ], "svg/types/scripted/resources/SVGLengthList-helper.js": [ [ {} @@ -298112,7 +296986,7 @@ {} ] ], - "trusted-types/support/helper.js": [ + "trusted-types/support/helper.sub.js": [ [ {} ] @@ -298837,6 +297711,51 @@ {} ] ], + "web-locks/META.yml": [ + [ + {} + ] + ], + "web-locks/README.md": [ + [ + {} + ] + ], + "web-locks/interfaces.idl": [ + [ + {} + ] + ], + "web-locks/resources/helpers.js": [ + [ + {} + ] + ], + "web-locks/resources/iframe.html": [ + [ + {} + ] + ], + "web-locks/resources/interfaces-serviceworker.js": [ + [ + {} + ] + ], + "web-locks/resources/service-worker.js": [ + [ + {} + ] + ], + "web-locks/resources/sw-controlled-iframe.html": [ + [ + {} + ] + ], + "web-locks/resources/worker.js": [ + [ + {} + ] + ], "web-nfc/META.yml": [ [ {} @@ -299077,6 +297996,11 @@ {} ] ], + "webaudio/the-audio-api/the-audioworklet-interface/processors/param-size-processor.js": [ + [ + {} + ] + ], "webaudio/the-audio-api/the-audioworklet-interface/processors/port-processor.js": [ [ {} @@ -299247,6 +298171,11 @@ {} ] ], + "webdriver/tests/back/__init__.py": [ + [ + {} + ] + ], "webdriver/tests/close_window/__init__.py": [ [ {} @@ -299257,11 +298186,21 @@ {} ] ], + "webdriver/tests/delete_all_cookies/__init__.py": [ + [ + {} + ] + ], "webdriver/tests/delete_cookie/__init__.py": [ [ {} ] ], + "webdriver/tests/delete_session/__init__.py": [ + [ + {} + ] + ], "webdriver/tests/dismiss_alert/__init__.py": [ [ {} @@ -299292,6 +298231,11 @@ {} ] ], + "webdriver/tests/element_send_keys/conftest.py": [ + [ + {} + ] + ], "webdriver/tests/execute_async_script/__init__.py": [ [ {} @@ -299322,6 +298266,11 @@ {} ] ], + "webdriver/tests/forward/__init__.py": [ + [ + {} + ] + ], "webdriver/tests/fullscreen_window/__init__.py": [ [ {} @@ -299392,6 +298341,11 @@ {} ] ], + "webdriver/tests/navigate_to/__init__.py": [ + [ + {} + ] + ], "webdriver/tests/new_session/__init__.py": [ [ {} @@ -299417,11 +298371,21 @@ {} ] ], + "webdriver/tests/refresh/__init__.py": [ + [ + {} + ] + ], "webdriver/tests/send_alert_text/__init__.py": [ [ {} ] ], + "webdriver/tests/set_timeouts/__init__.py": [ + [ + {} + ] + ], "webdriver/tests/set_window_rect/__init__.py": [ [ {} @@ -299467,11 +298431,21 @@ {} ] ], + "webdriver/tests/switch_to_frame/__init__.py": [ + [ + {} + ] + ], "webdriver/tests/switch_to_parent_frame/__init__.py": [ [ {} ] ], + "webdriver/tests/switch_to_window/__init__.py": [ + [ + {} + ] + ], "webgl/META.yml": [ [ {} @@ -302092,6 +301066,11 @@ {} ] ], + "workers/baseurl/beta/import.py": [ + [ + {} + ] + ], "workers/baseurl/beta/importScripts.py": [ [ {} @@ -302127,16 +301106,31 @@ {} ] ], + "workers/baseurl/beta/xhr-worker.py": [ + [ + {} + ] + ], "workers/baseurl/beta/xhr.py": [ [ {} ] ], + "workers/baseurl/gamma/import.js": [ + [ + {} + ] + ], "workers/baseurl/gamma/importScripts.js": [ [ {} ] ], + "workers/baseurl/gamma/script-module.js": [ + [ + {} + ] + ], "workers/baseurl/gamma/script.js": [ [ {} @@ -302167,6 +301161,11 @@ {} ] ], + "workers/baseurl/gamma/xhr-worker.js": [ + [ + {} + ] + ], "workers/baseurl/gamma/xhr.js": [ [ {} @@ -302232,6 +301231,11 @@ {} ] ], + "workers/interfaces/WorkerGlobalScope/location/redirect.js": [ + [ + {} + ] + ], "workers/interfaces/WorkerUtils/importScripts/1": [ [ {} @@ -302317,6 +301321,11 @@ {} ] ], + "workers/modules/resources/export-on-dynamic-import-script.js.headers": [ + [ + {} + ] + ], "workers/modules/resources/export-on-load-script.js": [ [ {} @@ -302332,6 +301341,11 @@ {} ] ], + "workers/modules/resources/export-on-static-import-script.js.headers": [ + [ + {} + ] + ], "workers/modules/resources/import-meta-url-worker.js": [ [ {} @@ -302342,6 +301356,11 @@ {} ] ], + "workers/modules/resources/import-test-cases.js": [ + [ + {} + ] + ], "workers/modules/resources/nested-dynamic-import-worker.js": [ [ {} @@ -305918,6 +304937,12 @@ {} ] ], + "2dcontext/imagebitmap/createImageBitmap-bounds.html": [ + [ + "/2dcontext/imagebitmap/createImageBitmap-bounds.html", + {} + ] + ], "2dcontext/imagebitmap/createImageBitmap-drawImage.html": [ [ "/2dcontext/imagebitmap/createImageBitmap-drawImage.html", @@ -310176,19 +309201,27 @@ {} ] ], - "IndexedDB/index_sort_order.htm": [ + "IndexedDB/idlharness.any.js": [ [ - "/IndexedDB/index_sort_order.htm", - {} - ] - ], - "IndexedDB/interfaces.any.js": [ - [ - "/IndexedDB/interfaces.any.html", + "/IndexedDB/idlharness.any.html", {} ], [ - "/IndexedDB/interfaces.any.worker.html", + "/IndexedDB/idlharness.any.sharedworker.html", + {} + ], + [ + "/IndexedDB/idlharness.any.worker.html", + {} + ], + [ + "/IndexedDB/idlharness.https.any.serviceworker.html", + {} + ] + ], + "IndexedDB/index_sort_order.htm": [ + [ + "/IndexedDB/index_sort_order.htm", {} ] ], @@ -311290,15 +310323,13 @@ {} ] ], - "WebCryptoAPI/idlharness.https.html": [ + "WebCryptoAPI/idlharness.https.any.js": [ [ - "/WebCryptoAPI/idlharness.https.html", + "/WebCryptoAPI/idlharness.https.any.html", {} - ] - ], - "WebCryptoAPI/idlharness.https.worker.js": [ + ], [ - "/WebCryptoAPI/idlharness.https.worker.html", + "/WebCryptoAPI/idlharness.https.any.worker.html", {} ] ], @@ -311636,6 +310667,12 @@ {} ] ], + "ambient-light/AmbientLightSensor-iframe-access.https.html": [ + [ + "/ambient-light/AmbientLightSensor-iframe-access.https.html", + {} + ] + ], "ambient-light/AmbientLightSensor.https.html": [ [ "/ambient-light/AmbientLightSensor.https.html", @@ -311660,15 +310697,21 @@ {} ] ], + "appmanifest/idlharness.window.js": [ + [ + "/appmanifest/idlharness.window.html", + {} + ] + ], "async-local-storage/storage-smoke-test.https.tentative.html": [ [ "/async-local-storage/storage-smoke-test.https.tentative.html", {} ] ], - "audio-output/HTMLMediaElement-sinkId-idl.html": [ + "audio-output/idlharness.window.js": [ [ - "/audio-output/HTMLMediaElement-sinkId-idl.html", + "/audio-output/idlharness.window.html", {} ] ], @@ -311696,6 +310739,12 @@ {} ] ], + "background-fetch/fetch.https.window.js": [ + [ + "/background-fetch/fetch.https.window.html", + {} + ] + ], "background-fetch/interfaces.https.any.js": [ [ "/background-fetch/interfaces.https.any.html", @@ -312184,9 +311233,15 @@ {} ] ], - "bluetooth/idl/idlharness.tentative.window.js": [ + "bluetooth/idl/idl-NavigatorBluetooth.https.html": [ [ - "/bluetooth/idl/idlharness.tentative.window.html", + "/bluetooth/idl/idl-NavigatorBluetooth.https.html", + {} + ] + ], + "bluetooth/idl/idlharness.tentative.https.window.js": [ + [ + "/bluetooth/idl/idlharness.tentative.https.window.html", {} ] ], @@ -313190,30 +312245,96 @@ {} ] ], - "client-hints/accept_ch.sub.https.html": [ - [ - "/client-hints/accept_ch.sub.https.html", - {} - ] - ], "client-hints/accept_ch.tentative.https.html": [ [ "/client-hints/accept_ch.tentative.https.html", {} ] ], + "client-hints/accept_ch.tentative.sub.https.html": [ + [ + "/client-hints/accept_ch.tentative.sub.https.html", + {} + ] + ], "client-hints/accept_ch_lifetime.tentative.https.html": [ [ "/client-hints/accept_ch_lifetime.tentative.https.html", {} ] ], + "client-hints/accept_ch_lifetime_cross_origin_iframe.tentative.sub.https.html": [ + [ + "/client-hints/accept_ch_lifetime_cross_origin_iframe.tentative.sub.https.html", + {} + ] + ], + "client-hints/accept_ch_lifetime_same_origin_iframe.tentative.https.html": [ + [ + "/client-hints/accept_ch_lifetime_same_origin_iframe.tentative.https.html", + {} + ] + ], + "client-hints/accept_ch_lifetime_subresource.tentative.https.html": [ + [ + "/client-hints/accept_ch_lifetime_subresource.tentative.https.html", + {} + ] + ], "client-hints/accept_ch_malformed_header.https.html": [ [ "/client-hints/accept_ch_malformed_header.https.html", {} ] ], + "client-hints/http_equiv_accept_ch.tentative.http.html": [ + [ + "/client-hints/http_equiv_accept_ch.tentative.http.html", + {} + ] + ], + "client-hints/http_equiv_accept_ch.tentative.https.html": [ + [ + "/client-hints/http_equiv_accept_ch.tentative.https.html", + {} + ] + ], + "client-hints/http_equiv_accept_ch.tentative.sub.https.html": [ + [ + "/client-hints/http_equiv_accept_ch.tentative.sub.https.html", + {} + ] + ], + "client-hints/http_equiv_accept_ch_lifetime.tentative.https.html": [ + [ + "/client-hints/http_equiv_accept_ch_lifetime.tentative.https.html", + {} + ] + ], + "client-hints/http_equiv_accept_ch_lifetime_cross_origin_iframe.tentative.sub.https.html": [ + [ + "/client-hints/http_equiv_accept_ch_lifetime_cross_origin_iframe.tentative.sub.https.html", + {} + ] + ], + "client-hints/http_equiv_accept_ch_lifetime_same_origin_iframe.tentative.https.html": [ + [ + "/client-hints/http_equiv_accept_ch_lifetime_same_origin_iframe.tentative.https.html", + {} + ] + ], + "client-hints/http_equiv_accept_ch_lifetime_subresource.tentative.https.html": [ + [ + "/client-hints/http_equiv_accept_ch_lifetime_subresource.tentative.https.html", + {} + ] + ], + "client-hints/http_equiv_accept_ch_malformed_header.tentative.https.html": [ + [ + "/client-hints/http_equiv_accept_ch_malformed_header.tentative.https.html", + {} + ] + ], "clipboard-apis/async-interfaces.https.html": [ [ "/clipboard-apis/async-interfaces.https.html", @@ -313254,12 +312375,6 @@ {} ] ], - "compat/webkit-appearance.tentative.html": [ - [ - "/compat/webkit-appearance.tentative.html", - {} - ] - ], "compat/webkit-text-fill-color-currentColor.html": [ [ "/compat/webkit-text-fill-color-currentColor.html", @@ -313512,6 +312627,12 @@ {} ] ], + "content-security-policy/embedded-enforcement/idlharness.window.js": [ + [ + "/content-security-policy/embedded-enforcement/idlharness.window.html", + {} + ] + ], "content-security-policy/embedded-enforcement/iframe-csp-attribute.html": [ [ "/content-security-policy/embedded-enforcement/iframe-csp-attribute.html", @@ -315084,9 +314205,9 @@ {} ] ], - "content-security-policy/securitypolicyviolation/idl.html": [ + "content-security-policy/securitypolicyviolation/idlharness.window.js": [ [ - "/content-security-policy/securitypolicyviolation/idl.html", + "/content-security-policy/securitypolicyviolation/idlharness.window.html", {} ] ], @@ -315624,6 +314745,12 @@ {} ] ], + "content-security-policy/worker-src/dedicated-worker-src-child-fallback-blocked.sub.html": [ + [ + "/content-security-policy/worker-src/dedicated-worker-src-child-fallback-blocked.sub.html", + {} + ] + ], "content-security-policy/worker-src/dedicated-worker-src-child-fallback.sub.html": [ [ "/content-security-policy/worker-src/dedicated-worker-src-child-fallback.sub.html", @@ -315678,6 +314805,12 @@ {} ] ], + "content-security-policy/worker-src/service-worker-src-child-fallback-blocked.https.sub.html": [ + [ + "/content-security-policy/worker-src/service-worker-src-child-fallback-blocked.https.sub.html", + {} + ] + ], "content-security-policy/worker-src/service-worker-src-child-fallback.https.sub.html": [ [ "/content-security-policy/worker-src/service-worker-src-child-fallback.https.sub.html", @@ -315732,6 +314865,12 @@ {} ] ], + "content-security-policy/worker-src/shared-worker-src-child-fallback-blocked.sub.html": [ + [ + "/content-security-policy/worker-src/shared-worker-src-child-fallback-blocked.sub.html", + {} + ] + ], "content-security-policy/worker-src/shared-worker-src-child-fallback.sub.html": [ [ "/content-security-policy/worker-src/shared-worker-src-child-fallback.sub.html", @@ -315936,6 +315075,12 @@ {} ] ], + "cookie-store/serviceworker_cookieStore_subscriptions_eventhandler_attribute.tentative.https.html": [ + [ + "/cookie-store/serviceworker_cookieStore_subscriptions_eventhandler_attribute.tentative.https.html", + {} + ] + ], "cookie-store/serviceworker_cookieStore_subscriptions_mismatch.tentative.https.html": [ [ "/cookie-store/serviceworker_cookieStore_subscriptions_mismatch.tentative.https.html", @@ -317380,6 +316525,12 @@ {} ] ], + "css/css-break/hit-test-inline-fragmentation-with-border-radius.html": [ + [ + "/css/css-break/hit-test-inline-fragmentation-with-border-radius.html", + {} + ] + ], "css/css-cascade/all-prop-initial-xml.html": [ [ "/css/css-cascade/all-prop-initial-xml.html", @@ -317392,6 +316543,18 @@ {} ] ], + "css/css-cascade/parsing/all-invalid.html": [ + [ + "/css/css-cascade/parsing/all-invalid.html", + {} + ] + ], + "css/css-cascade/parsing/all-valid.html": [ + [ + "/css/css-cascade/parsing/all-valid.html", + {} + ] + ], "css/css-color/color-function-parsing.html": [ [ "/css/css-color/color-function-parsing.html", @@ -317418,6 +316581,30 @@ {} ] ], + "css/css-color/parsing/color-invalid.html": [ + [ + "/css/css-color/parsing/color-invalid.html", + {} + ] + ], + "css/css-color/parsing/color-valid.html": [ + [ + "/css/css-color/parsing/color-valid.html", + {} + ] + ], + "css/css-color/parsing/opacity-invalid.html": [ + [ + "/css/css-color/parsing/opacity-invalid.html", + {} + ] + ], + "css/css-color/parsing/opacity-valid.html": [ + [ + "/css/css-color/parsing/opacity-valid.html", + {} + ] + ], "css/css-color/rgb-rounding-001.html": [ [ "/css/css-color/rgb-rounding-001.html", @@ -319956,6 +319143,12 @@ {} ] ], + "css/css-overflow/orthogonal-flow-with-inline-end-margin.html": [ + [ + "/css/css-overflow/orthogonal-flow-with-inline-end-margin.html", + {} + ] + ], "css/css-overflow/overflow-shorthand-001.html": [ [ "/css/css-overflow/overflow-shorthand-001.html", @@ -320082,6 +319275,12 @@ {} ] ], + "css/css-properties-values-api/property-cascade.html": [ + [ + "/css/css-properties-values-api/property-cascade.html", + {} + ] + ], "css/css-properties-values-api/register-property-syntax-parsing.html": [ [ "/css/css-properties-values-api/register-property-syntax-parsing.html", @@ -320118,9 +319317,21 @@ {} ] ], - "css/css-properties-values-api/url-resolution.tentative.html": [ + "css/css-properties-values-api/typedom.tentative.html": [ [ - "/css/css-properties-values-api/url-resolution.tentative.html", + "/css/css-properties-values-api/typedom.tentative.html", + {} + ] + ], + "css/css-properties-values-api/unit-cycles.html": [ + [ + "/css/css-properties-values-api/unit-cycles.html", + {} + ] + ], + "css/css-properties-values-api/url-resolution.html": [ + [ + "/css/css-properties-values-api/url-resolution.html", {} ] ], @@ -322920,6 +322131,12 @@ {} ] ], + "css/css-transitions/pseudo-elements-002.html": [ + [ + "/css/css-transitions/pseudo-elements-002.html", + {} + ] + ], "css/css-transitions/transition-001.html": [ [ "/css/css-transitions/transition-001.html", @@ -325200,6 +324417,12 @@ {} ] ], + "css/css-values/line-break-ch-unit.html": [ + [ + "/css/css-values/line-break-ch-unit.html", + {} + ] + ], "css/css-values/unset-value-storage.html": [ [ "/css/css-values/unset-value-storage.html", @@ -326226,6 +325449,24 @@ {} ] ], + "css/cssom-view/table-client-props.html": [ + [ + "/css/cssom-view/table-client-props.html", + {} + ] + ], + "css/cssom-view/table-offset-props.html": [ + [ + "/css/cssom-view/table-offset-props.html", + {} + ] + ], + "css/cssom-view/table-scroll-props.html": [ + [ + "/css/cssom-view/table-scroll-props.html", + {} + ] + ], "css/cssom-view/ttwf-js-cssomview-getclientrects-length.html": [ [ "/css/cssom-view/ttwf-js-cssomview-getclientrects-length.html", @@ -327091,7 +326332,9 @@ "css/selectors/focus-visible-005.html": [ [ "/css/selectors/focus-visible-005.html", - {} + { + "testdriver": true + } ] ], "css/selectors/focus-visible-007.html": [ @@ -327102,6 +326345,24 @@ } ] ], + "css/selectors/focus-visible-008.html": [ + [ + "/css/selectors/focus-visible-008.html", + {} + ] + ], + "css/selectors/focus-visible-009.html": [ + [ + "/css/selectors/focus-visible-009.html", + {} + ] + ], + "css/selectors/focus-visible-010.html": [ + [ + "/css/selectors/focus-visible-010.html", + {} + ] + ], "css/selectors/focus-within-009.html": [ [ "/css/selectors/focus-within-009.html", @@ -330090,29 +329351,47 @@ {} ] ], - "encoding/api-basics.html": [ + "encoding/api-basics.any.js": [ [ - "/encoding/api-basics.html", + "/encoding/api-basics.any.html", + {} + ], + [ + "/encoding/api-basics.any.worker.html", {} ] ], - "encoding/api-invalid-label.html": [ + "encoding/api-invalid-label.any.js": [ [ - "/encoding/api-invalid-label.html", + "/encoding/api-invalid-label.any.html", + { + "timeout": "long" + } + ], + [ + "/encoding/api-invalid-label.any.worker.html", { "timeout": "long" } ] ], - "encoding/api-replacement-encodings.html": [ + "encoding/api-replacement-encodings.any.js": [ [ - "/encoding/api-replacement-encodings.html", + "/encoding/api-replacement-encodings.any.html", + {} + ], + [ + "/encoding/api-replacement-encodings.any.worker.html", {} ] ], - "encoding/api-surrogates-utf8.html": [ + "encoding/api-surrogates-utf8.any.js": [ [ - "/encoding/api-surrogates-utf8.html", + "/encoding/api-surrogates-utf8.any.html", + {} + ], + [ + "/encoding/api-surrogates-utf8.any.worker.html", {} ] ], @@ -330152,9 +329431,13 @@ {} ] ], - "encoding/iso-2022-jp-decoder.html": [ + "encoding/iso-2022-jp-decoder.any.js": [ [ - "/encoding/iso-2022-jp-decoder.html", + "/encoding/iso-2022-jp-decoder.any.html", + {} + ], + [ + "/encoding/iso-2022-jp-decoder.any.worker.html", {} ] ], @@ -337460,9 +336743,13 @@ } ] ], - "encoding/replacement-encodings.html": [ + "encoding/replacement-encodings.any.js": [ [ - "/encoding/replacement-encodings.html", + "/encoding/replacement-encodings.any.html", + {} + ], + [ + "/encoding/replacement-encodings.any.worker.html", {} ] ], @@ -337486,9 +336773,13 @@ } ] ], - "encoding/textdecoder-byte-order-marks.html": [ + "encoding/textdecoder-byte-order-marks.any.js": [ [ - "/encoding/textdecoder-byte-order-marks.html", + "/encoding/textdecoder-byte-order-marks.any.html", + {} + ], + [ + "/encoding/textdecoder-byte-order-marks.any.worker.html", {} ] ], @@ -337502,63 +336793,103 @@ {} ] ], - "encoding/textdecoder-fatal-single-byte.html": [ + "encoding/textdecoder-fatal-single-byte.any.js": [ [ - "/encoding/textdecoder-fatal-single-byte.html", + "/encoding/textdecoder-fatal-single-byte.any.html", + {} + ], + [ + "/encoding/textdecoder-fatal-single-byte.any.worker.html", {} ] ], - "encoding/textdecoder-fatal-streaming.html": [ + "encoding/textdecoder-fatal-streaming.any.js": [ [ - "/encoding/textdecoder-fatal-streaming.html", + "/encoding/textdecoder-fatal-streaming.any.html", + {} + ], + [ + "/encoding/textdecoder-fatal-streaming.any.worker.html", {} ] ], - "encoding/textdecoder-fatal.html": [ + "encoding/textdecoder-fatal.any.js": [ [ - "/encoding/textdecoder-fatal.html", + "/encoding/textdecoder-fatal.any.html", + {} + ], + [ + "/encoding/textdecoder-fatal.any.worker.html", {} ] ], - "encoding/textdecoder-ignorebom.html": [ + "encoding/textdecoder-ignorebom.any.js": [ [ - "/encoding/textdecoder-ignorebom.html", + "/encoding/textdecoder-ignorebom.any.html", + {} + ], + [ + "/encoding/textdecoder-ignorebom.any.worker.html", {} ] ], - "encoding/textdecoder-labels.html": [ + "encoding/textdecoder-labels.any.js": [ [ - "/encoding/textdecoder-labels.html", + "/encoding/textdecoder-labels.any.html", + {} + ], + [ + "/encoding/textdecoder-labels.any.worker.html", {} ] ], - "encoding/textdecoder-streaming.html": [ + "encoding/textdecoder-streaming.any.js": [ [ - "/encoding/textdecoder-streaming.html", + "/encoding/textdecoder-streaming.any.html", + {} + ], + [ + "/encoding/textdecoder-streaming.any.worker.html", {} ] ], - "encoding/textdecoder-utf16-surrogates.html": [ + "encoding/textdecoder-utf16-surrogates.any.js": [ [ - "/encoding/textdecoder-utf16-surrogates.html", + "/encoding/textdecoder-utf16-surrogates.any.html", + {} + ], + [ + "/encoding/textdecoder-utf16-surrogates.any.worker.html", {} ] ], - "encoding/textencoder-constructor-non-utf.html": [ + "encoding/textencoder-constructor-non-utf.any.js": [ [ - "/encoding/textencoder-constructor-non-utf.html", + "/encoding/textencoder-constructor-non-utf.any.html", + {} + ], + [ + "/encoding/textencoder-constructor-non-utf.any.worker.html", {} ] ], - "encoding/textencoder-utf16-surrogates.html": [ + "encoding/textencoder-utf16-surrogates.any.js": [ [ - "/encoding/textencoder-utf16-surrogates.html", + "/encoding/textencoder-utf16-surrogates.any.html", + {} + ], + [ + "/encoding/textencoder-utf16-surrogates.any.worker.html", {} ] ], - "encoding/unsupported-encodings.html": [ + "encoding/unsupported-encodings.any.js": [ [ - "/encoding/unsupported-encodings.html", + "/encoding/unsupported-encodings.any.html", + {} + ], + [ + "/encoding/unsupported-encodings.any.worker.html", {} ] ], @@ -338850,6 +338181,12 @@ {} ] ], + "fetch/api/abort/destroyed-context.html": [ + [ + "/fetch/api/abort/destroyed-context.html", + {} + ] + ], "fetch/api/abort/general.any.js": [ [ "/fetch/api/abort/general.any.html", @@ -338868,6 +338205,12 @@ {} ] ], + "fetch/api/abort/keepalive.html": [ + [ + "/fetch/api/abort/keepalive.html", + {} + ] + ], "fetch/api/abort/serviceworker-intercepted.https.html": [ [ "/fetch/api/abort/serviceworker-intercepted.https.html", @@ -339927,9 +339270,17 @@ "/fetch/cors-rfc1918/idlharness.tentative.any.html", {} ], + [ + "/fetch/cors-rfc1918/idlharness.tentative.any.sharedworker.html", + {} + ], [ "/fetch/cors-rfc1918/idlharness.tentative.any.worker.html", {} + ], + [ + "/fetch/cors-rfc1918/idlharness.tentative.https.any.serviceworker.html", + {} ] ], "fetch/cross-origin-resource-policy/fetch-in-iframe.html": [ @@ -340021,7 +339372,9 @@ "fetch/http-cache/304-update.html": [ [ "/fetch/http-cache/304-update.html", - {} + { + "timeout": "long" + } ] ], "fetch/http-cache/cc-request.html": [ @@ -340051,7 +339404,9 @@ "fetch/http-cache/invalidate.html": [ [ "/fetch/http-cache/invalidate.html", - {} + { + "timeout": "long" + } ] ], "fetch/http-cache/partial.html": [ @@ -340270,9 +339625,9 @@ {} ] ], - "generic-sensor/idlharness.https.html": [ + "generic-sensor/idlharness.https.window.js": [ [ - "/generic-sensor/idlharness.https.html", + "/generic-sensor/idlharness.https.window.html", {} ] ], @@ -340312,9 +339667,9 @@ {} ] ], - "geolocation-API/interfaces.html": [ + "geolocation-API/idlharness.window.js": [ [ - "/geolocation-API/interfaces.html", + "/geolocation-API/idlharness.window.html", {} ] ], @@ -340360,6 +339715,12 @@ {} ] ], + "geolocation-sensor/GeolocationSensor-iframe-access.https.html": [ + [ + "/geolocation-sensor/GeolocationSensor-iframe-access.https.html", + {} + ] + ], "geolocation-sensor/GeolocationSensor.https.html": [ [ "/geolocation-sensor/GeolocationSensor.https.html", @@ -340494,30 +339855,6 @@ {} ] ], - "html-imports/document/document-method-changes.html": [ - [ - "/html-imports/document/document-method-changes.html", - {} - ] - ], - "html-imports/fetching/already-in-import-map.html": [ - [ - "/html-imports/fetching/already-in-import-map.html", - {} - ] - ], - "html-imports/fetching/loading-attempt.html": [ - [ - "/html-imports/fetching/loading-attempt.html", - {} - ] - ], - "html-imports/html-link-element/import-attribute.html": [ - [ - "/html-imports/html-link-element/import-attribute.html", - {} - ] - ], "html-media-capture/capture_reflect.html": [ [ "/html-media-capture/capture_reflect.html", @@ -342720,636 +342057,6 @@ {} ] ], - "html/dom/dynamic-markup-insertion/closing-the-input-stream/document.close-01.xhtml": [ - [ - "/html/dom/dynamic-markup-insertion/closing-the-input-stream/document.close-01.xhtml", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/001.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/001.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/002.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/002.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/003.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/003.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/004.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/004.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/005.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/005.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/006.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/006.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/007.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/007.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/008.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/008.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/009.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/009.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/010.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/010.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/011.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/011.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/012.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/012.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/013.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/013.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/014.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/014.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/015.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/015.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/016.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/016.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/017.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/017.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/018.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/018.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/019.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/019.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/020.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/020.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/021.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/021.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/022.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/022.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/023.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/023.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/024.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/024.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/025.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/025.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/026.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/026.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/027.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/027.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/028.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/028.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/029.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/029.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/030.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/030.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/031.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/031.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/032.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/032.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/033.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/033.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/034.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/034.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/035.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/035.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/036.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/036.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/037.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/037.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/038.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/038.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/039.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/039.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/040.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/040.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/041.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/041.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/042.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/042.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/043.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/043.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/044.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/044.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/045.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/045.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/046.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/046.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/047.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/047.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/048.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/048.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/049.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/049.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/050.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/050.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/051.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/051.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/contentType.window.js": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/contentType.window.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/document.write-01.xhtml": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/document.write-01.xhtml", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/document.write-02.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/document.write-02.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_001.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/iframe_001.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_002.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/iframe_002.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_003.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/iframe_003.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_004.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/iframe_004.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_005.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/iframe_005.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_006.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/iframe_006.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_007.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/iframe_007.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_008.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/iframe_008.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_009.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/iframe_009.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_010.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/iframe_010.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/script_001.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/script_001.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/script_002.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/script_002.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/script_003.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/script_003.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/script_004.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/script_004.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/script_005.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/script_005.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/script_006.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/script_006.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/script_007.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/script_007.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/script_008.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/script_008.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/script_009.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/script_009.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/script_010.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/script_010.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/script_011.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/script_011.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/script_012.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/script_012.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/script_013.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/script_013.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-write/write-active-document.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-write/write-active-document.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-writeln/document.writeln-01.xhtml": [ - [ - "/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-01.xhtml", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-writeln/document.writeln-02.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-02.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/document-writeln/document.writeln-03.html": [ - [ - "/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-03.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/001.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/001.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/002.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/002.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/004.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/004.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/005.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/005.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/006.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/006.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/007.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/007.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/008.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/008.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/009.https.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/009.https.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/010.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/010.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/011.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/011.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/012.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/012.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/013.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/013.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/014.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/014.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/015.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/015.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/016.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/016.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-01.xhtml": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-01.xhtml", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/encoding.window.js": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/encoding.window.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.js": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext.window.js": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext.window.html", - {} - ] - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/type-argument.window.js": [ - [ - "/html/dom/dynamic-markup-insertion/opening-the-input-stream/type-argument.window.html", - {} - ] - ], "html/dom/elements/elements-in-the-dom/historical.html": [ [ "/html/dom/elements/elements-in-the-dom/historical.html", @@ -344689,9 +343396,7 @@ "html/semantics/embedded-content/media-elements/audio_loop_base.html": [ [ "/html/semantics/embedded-content/media-elements/audio_loop_base.html", - { - "timeout": "long" - } + {} ] ], "html/semantics/embedded-content/media-elements/audio_volume_check.html": [ @@ -346299,9 +345004,7 @@ "html/semantics/embedded-content/media-elements/video_loop_base.html": [ [ "/html/semantics/embedded-content/media-elements/video_loop_base.html", - { - "timeout": "long" - } + {} ] ], "html/semantics/embedded-content/media-elements/video_volume_check.html": [ @@ -347716,6 +346419,12 @@ {} ] ], + "html/semantics/embedded-content/the-object-element/object-setcustomvalidity.html": [ + [ + "/html/semantics/embedded-content/the-object-element/object-setcustomvalidity.html", + {} + ] + ], "html/semantics/embedded-content/the-object-element/usemap-casing.html": [ [ "/html/semantics/embedded-content/the-object-element/usemap-casing.html", @@ -348694,6 +347403,12 @@ {} ] ], + "html/semantics/forms/the-output-element/output-setcustomvalidity.html": [ + [ + "/html/semantics/forms/the-output-element/output-setcustomvalidity.html", + {} + ] + ], "html/semantics/forms/the-output-element/output.html": [ [ "/html/semantics/forms/the-output-element/output.html", @@ -348772,6 +347487,12 @@ {} ] ], + "html/semantics/forms/the-select-element/select-setcustomvalidity.html": [ + [ + "/html/semantics/forms/the-select-element/select-setcustomvalidity.html", + {} + ] + ], "html/semantics/forms/the-select-element/select-validity.html": [ [ "/html/semantics/forms/the-select-element/select-validity.html", @@ -348796,6 +347517,12 @@ {} ] ], + "html/semantics/forms/the-textarea-element/textarea-setcustomvalidity.html": [ + [ + "/html/semantics/forms/the-textarea-element/textarea-setcustomvalidity.html", + {} + ] + ], "html/semantics/forms/the-textarea-element/textarea-type.html": [ [ "/html/semantics/forms/the-textarea-element/textarea-type.html", @@ -352580,6 +351307,38 @@ } ] ], + "html/user-activation/activation-api-click.tentative.html": [ + [ + "/html/user-activation/activation-api-click.tentative.html", + { + "testdriver": true + } + ] + ], + "html/user-activation/activation-api-iframe-no-activate.tenative.html": [ + [ + "/html/user-activation/activation-api-iframe-no-activate.tenative.html", + { + "testdriver": true + } + ] + ], + "html/user-activation/activation-api-iframe.tenative.html": [ + [ + "/html/user-activation/activation-api-iframe.tenative.html", + { + "testdriver": true + } + ] + ], + "html/user-activation/activation-api-setTimeout.tentative.html": [ + [ + "/html/user-activation/activation-api-setTimeout.tentative.html", + { + "testdriver": true + } + ] + ], "html/webappapis/animation-frames/callback-exception.html": [ [ "/html/webappapis/animation-frames/callback-exception.html", @@ -352622,6 +351381,636 @@ {} ] ], + "html/webappapis/dynamic-markup-insertion/closing-the-input-stream/document.close-01.xhtml": [ + [ + "/html/webappapis/dynamic-markup-insertion/closing-the-input-stream/document.close-01.xhtml", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/001.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/001.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/002.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/002.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/003.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/003.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/004.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/004.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/005.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/005.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/006.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/006.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/007.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/007.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/008.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/008.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/009.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/009.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/010.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/010.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/011.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/011.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/012.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/012.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/013.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/013.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/014.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/014.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/015.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/015.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/016.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/016.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/017.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/017.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/018.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/018.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/019.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/019.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/020.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/020.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/021.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/021.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/022.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/022.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/023.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/023.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/024.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/024.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/025.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/025.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/026.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/026.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/027.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/027.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/028.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/028.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/029.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/029.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/030.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/030.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/031.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/031.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/032.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/032.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/033.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/033.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/034.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/034.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/035.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/035.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/036.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/036.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/037.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/037.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/038.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/038.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/039.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/039.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/040.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/040.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/041.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/041.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/042.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/042.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/043.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/043.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/044.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/044.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/045.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/045.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/046.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/046.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/047.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/047.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/048.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/048.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/049.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/049.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/050.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/050.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/051.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/051.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/contentType.window.js": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/contentType.window.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/document.write-01.xhtml": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/document.write-01.xhtml", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/document.write-02.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/document.write-02.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_001.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/iframe_001.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_002.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/iframe_002.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_003.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/iframe_003.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_004.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/iframe_004.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_005.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/iframe_005.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_006.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/iframe_006.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_007.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/iframe_007.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_008.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/iframe_008.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_009.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/iframe_009.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_010.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/iframe_010.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_001.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/script_001.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_002.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/script_002.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_003.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/script_003.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_004.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/script_004.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_005.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/script_005.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_006.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/script_006.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_007.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/script_007.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_008.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/script_008.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_009.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/script_009.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_010.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/script_010.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_011.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/script_011.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_012.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/script_012.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_013.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/script_013.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-write/write-active-document.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-write/write-active-document.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-writeln/document.writeln-01.xhtml": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-writeln/document.writeln-01.xhtml", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-writeln/document.writeln-02.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-writeln/document.writeln-02.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/document-writeln/document.writeln-03.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/document-writeln/document.writeln-03.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/001.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/001.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/002.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/002.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/004.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/004.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/005.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/005.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/006.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/006.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/007.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/007.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/008.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/008.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/009.https.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/009.https.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/011.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/011.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/012.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/012.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/013.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/013.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/014.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/014.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/015.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/015.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/016.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/016.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/custom-element.window.js": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/custom-element.window.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-01.xhtml": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-01.xhtml", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/encoding.window.js": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/encoding.window.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.js": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.html", + {} + ] + ], "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/origin-check-in-document-open-basic.html": [ [ "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/origin-check-in-document-open-basic.html", @@ -352634,6 +352023,18 @@ {} ] ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext.window.js": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext.window.html", + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/type-argument.window.js": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/type-argument.window.html", + {} + ] + ], "html/webappapis/scripting/event-loops/microtask_after_raf.html": [ [ "/html/webappapis/scripting/event-loops/microtask_after_raf.html", @@ -353482,6 +352883,12 @@ {} ] ], + "intersection-observer/text-target.html": [ + [ + "/intersection-observer/text-target.html", + {} + ] + ], "intersection-observer/timestamp.html": [ [ "/intersection-observer/timestamp.html", @@ -353638,12 +353045,6 @@ {} ] ], - "keyboard-map/keyboard-map-two-parallel-requests.https.html": [ - [ - "/keyboard-map/keyboard-map-two-parallel-requests.https.html", - {} - ] - ], "keyboard-map/navigator-keyboard-map-blocked-from-cross-origin-iframe.https.html": [ [ "/keyboard-map/navigator-keyboard-map-blocked-from-cross-origin-iframe.https.html", @@ -353680,6 +353081,12 @@ {} ] ], + "longtask-timing/idlharness.window.js": [ + [ + "/longtask-timing/idlharness.window.html", + {} + ] + ], "longtask-timing/longtask-attributes.html": [ [ "/longtask-timing/longtask-attributes.html", @@ -354362,9 +353769,9 @@ {} ] ], - "mediacapture-fromelement/idlharness.html": [ + "mediacapture-fromelement/idlharness.window.js": [ [ - "/mediacapture-fromelement/idlharness.html", + "/mediacapture-fromelement/idlharness.window.html", {} ] ], @@ -354380,9 +353787,9 @@ {} ] ], - "mediacapture-record/idlharness.html": [ + "mediacapture-record/idlharness.window.js": [ [ - "/mediacapture-record/idlharness.html", + "/mediacapture-record/idlharness.window.html", {} ] ], @@ -354434,18 +353841,6 @@ {} ] ], - "mediacapture-streams/MediaDevices-IDL-all.html": [ - [ - "/mediacapture-streams/MediaDevices-IDL-all.html", - {} - ] - ], - "mediacapture-streams/MediaDevices-IDL-enumerateDevices.html": [ - [ - "/mediacapture-streams/MediaDevices-IDL-enumerateDevices.html", - {} - ] - ], "mediacapture-streams/MediaDevices-enumerateDevices.https.html": [ [ "/mediacapture-streams/MediaDevices-enumerateDevices.https.html", @@ -354548,12 +353943,6 @@ {} ] ], - "mediacapture-streams/MediaStreamTrack-idl.https.html": [ - [ - "/mediacapture-streams/MediaStreamTrack-idl.https.html", - {} - ] - ], "mediacapture-streams/MediaStreamTrack-init.https.html": [ [ "/mediacapture-streams/MediaStreamTrack-init.https.html", @@ -354572,6 +353961,12 @@ {} ] ], + "mediacapture-streams/idlharness.https.window.js": [ + [ + "/mediacapture-streams/idlharness.https.window.html", + {} + ] + ], "mediasession/idlharness.html": [ [ "/mediasession/idlharness.html", @@ -356104,9 +355499,9 @@ {} ] ], - "navigation-timing/idlharness.html": [ + "navigation-timing/idlharness.window.js": [ [ - "/navigation-timing/idlharness.html", + "/navigation-timing/idlharness.window.html", {} ] ], @@ -356362,6 +355757,16 @@ {} ] ], + "netinfo/idlharness.any.js": [ + [ + "/netinfo/idlharness.any.html", + {} + ], + [ + "/netinfo/idlharness.any.worker.html", + {} + ] + ], "netinfo/netinfo-basics.html": [ [ "/netinfo/netinfo-basics.html", @@ -365872,9 +365277,9 @@ {} ] ], - "page-visibility/idlharness.html": [ + "page-visibility/idlharness.window.js": [ [ - "/page-visibility/idlharness.html", + "/page-visibility/idlharness.window.html", {} ] ], @@ -366022,6 +365427,16 @@ {} ] ], + "payment-handler/idlharness.https.any.js": [ + [ + "/payment-handler/idlharness.https.any.html", + {} + ], + [ + "/payment-handler/idlharness.https.any.worker.html", + {} + ] + ], "payment-handler/interfaces.https.any.js": [ [ "/payment-handler/interfaces.https.any.html", @@ -366074,6 +365489,12 @@ {} ] ], + "payment-method-basic-card/idlharness.window.js": [ + [ + "/payment-method-basic-card/idlharness.window.html", + {} + ] + ], "payment-method-basic-card/payment-request-canmakepayment-method.https.html": [ [ "/payment-method-basic-card/payment-request-canmakepayment-method.https.html", @@ -366182,9 +365603,9 @@ {} ] ], - "payment-request/interfaces.https.html": [ + "payment-request/idlharness.https.window.js": [ [ - "/payment-request/interfaces.https.html", + "/payment-request/idlharness.https.window.html", {} ] ], @@ -366298,6 +365719,12 @@ {} ] ], + "performance-timeline/get-invalid-entries.html": [ + [ + "/performance-timeline/get-invalid-entries.html", + {} + ] + ], "performance-timeline/idlharness.any.js": [ [ "/performance-timeline/idlharness.any.html", @@ -366458,6 +365885,12 @@ } ] ], + "picture-in-picture/idlharness.window.js": [ + [ + "/picture-in-picture/idlharness.window.html", + {} + ] + ], "picture-in-picture/leave-picture-in-picture.html": [ [ "/picture-in-picture/leave-picture-in-picture.html", @@ -366648,6 +366081,12 @@ {} ] ], + "preload/preload-strict-dynamic.html": [ + [ + "/preload/preload-strict-dynamic.html", + {} + ] + ], "preload/preload-with-type.html": [ [ "/preload/preload-with-type.html", @@ -366772,6 +366211,12 @@ {} ] ], + "proximity/ProximitySensor-iframe-access.https.html": [ + [ + "/proximity/ProximitySensor-iframe-access.https.html", + {} + ] + ], "proximity/ProximitySensor.https.html": [ [ "/proximity/ProximitySensor.https.html", @@ -375616,9 +375061,9 @@ {} ] ], - "remote-playback/idlharness.html": [ + "remote-playback/idlharness.window.js": [ [ - "/remote-playback/idlharness.html", + "/remote-playback/idlharness.window.html", {} ] ], @@ -375700,9 +375145,9 @@ {} ] ], - "requestidlecallback/idlharness.html": [ + "requestidlecallback/idlharness.window.js": [ [ - "/requestidlecallback/idlharness.html", + "/requestidlecallback/idlharness.window.html", {} ] ], @@ -375964,9 +375409,9 @@ {} ] ], - "screen-orientation/interfaces.html": [ + "screen-orientation/idlharness.window.js": [ [ - "/screen-orientation/interfaces.html", + "/screen-orientation/idlharness.window.html", {} ] ], @@ -377075,7 +376520,9 @@ "service-workers/service-worker/fetch-event.https.html": [ [ "/service-workers/service-worker/fetch-event.https.html", - {} + { + "timeout": "long" + } ] ], "service-workers/service-worker/fetch-frame-resource.https.html": [ @@ -377956,6 +377403,12 @@ {} ] ], + "shadow-dom/getElementById-dynamic-001.html": [ + [ + "/shadow-dom/getElementById-dynamic-001.html", + {} + ] + ], "shadow-dom/historical.html": [ [ "/shadow-dom/historical.html", @@ -378698,6 +378151,30 @@ {} ] ], + "streams/piping/then-interception.dedicatedworker.html": [ + [ + "/streams/piping/then-interception.dedicatedworker.html", + {} + ] + ], + "streams/piping/then-interception.html": [ + [ + "/streams/piping/then-interception.html", + {} + ] + ], + "streams/piping/then-interception.serviceworker.https.html": [ + [ + "/streams/piping/then-interception.serviceworker.https.html", + {} + ] + ], + "streams/piping/then-interception.sharedworker.html": [ + [ + "/streams/piping/then-interception.sharedworker.html", + {} + ] + ], "streams/piping/transform-streams.dedicatedworker.html": [ [ "/streams/piping/transform-streams.dedicatedworker.html", @@ -380026,6 +379503,12 @@ {} ] ], + "svg/shapes/rx-ry-not-inherited.svg": [ + [ + "/svg/shapes/rx-ry-not-inherited.svg", + {} + ] + ], "svg/struct/UnknownElement/interface.svg": [ [ "/svg/struct/UnknownElement/interface.svg", @@ -380212,6 +379695,12 @@ {} ] ], + "svg/types/scripted/SVGGraphicsElement.svg": [ + [ + "/svg/types/scripted/SVGGraphicsElement.svg", + {} + ] + ], "svg/types/scripted/SVGLength-px-with-context.html": [ [ "/svg/types/scripted/SVGLength-px-with-context.html", @@ -380284,6 +379773,42 @@ {} ] ], + "trusted-types/DOMParser-requiresTrustedTypes.tentative.html": [ + [ + "/trusted-types/DOMParser-requiresTrustedTypes.tentative.html", + {} + ] + ], + "trusted-types/DOMParser.tentative.html": [ + [ + "/trusted-types/DOMParser.tentative.html", + {} + ] + ], + "trusted-types/HTMLBaseElement-href.tentative.html": [ + [ + "/trusted-types/HTMLBaseElement-href.tentative.html", + {} + ] + ], + "trusted-types/HTMLImageElement-src.tentative.html": [ + [ + "/trusted-types/HTMLImageElement-src.tentative.html", + {} + ] + ], + "trusted-types/HTMLMediaElement-src.tentative.html": [ + [ + "/trusted-types/HTMLMediaElement-src.tentative.html", + {} + ] + ], + "trusted-types/HTMLSourceElement-src.tentative.html": [ + [ + "/trusted-types/HTMLSourceElement-src.tentative.html", + {} + ] + ], "trusted-types/TrustedHTML.tentative.html": [ [ "/trusted-types/TrustedHTML.tentative.html", @@ -380302,6 +379827,42 @@ {} ] ], + "trusted-types/block-string-assignment-to-HTMLBaseElement-href.tentative.html": [ + [ + "/trusted-types/block-string-assignment-to-HTMLBaseElement-href.tentative.html", + {} + ] + ], + "trusted-types/block-string-assignment-to-HTMLImageElement-src.tentative.html": [ + [ + "/trusted-types/block-string-assignment-to-HTMLImageElement-src.tentative.html", + {} + ] + ], + "trusted-types/block-string-assignment-to-HTMLMediaElement-src.tentative.html": [ + [ + "/trusted-types/block-string-assignment-to-HTMLMediaElement-src.tentative.html", + {} + ] + ], + "trusted-types/block-string-assignment-to-HTMLSourceElement-src.tentative.html": [ + [ + "/trusted-types/block-string-assignment-to-HTMLSourceElement-src.tentative.html", + {} + ] + ], + "trusted-types/block-string-assignment-to-createContextualFragment.tentative.html": [ + [ + "/trusted-types/block-string-assignment-to-createContextualFragment.tentative.html", + {} + ] + ], + "trusted-types/block-string-assignment-to-embed-src.tentative.html": [ + [ + "/trusted-types/block-string-assignment-to-embed-src.tentative.html", + {} + ] + ], "trusted-types/block-string-assignment-to-innerHTML.tentative.html": [ [ "/trusted-types/block-string-assignment-to-innerHTML.tentative.html", @@ -380314,12 +379875,24 @@ {} ] ], + "trusted-types/block-string-assignment-to-location-assign.tentative.html": [ + [ + "/trusted-types/block-string-assignment-to-location-assign.tentative.html", + {} + ] + ], "trusted-types/block-string-assignment-to-location-href.tentative.html": [ [ "/trusted-types/block-string-assignment-to-location-href.tentative.html", {} ] ], + "trusted-types/block-string-assignment-to-location-replace.tentative.html": [ + [ + "/trusted-types/block-string-assignment-to-location-replace.tentative.html", + {} + ] + ], "trusted-types/block-string-assignment-to-outerHTML.tentative.html": [ [ "/trusted-types/block-string-assignment-to-outerHTML.tentative.html", @@ -380332,12 +379905,24 @@ {} ] ], + "trusted-types/createContextualFragment.tentative.html": [ + [ + "/trusted-types/createContextualFragment.tentative.html", + {} + ] + ], "trusted-types/document-write.tentative.html": [ [ "/trusted-types/document-write.tentative.html", {} ] ], + "trusted-types/embed-src.tentative.html": [ + [ + "/trusted-types/embed-src.tentative.html", + {} + ] + ], "trusted-types/innerHTML.tentative.html": [ [ "/trusted-types/innerHTML.tentative.html", @@ -380350,12 +379935,24 @@ {} ] ], + "trusted-types/location-assign.tentative.html": [ + [ + "/trusted-types/location-assign.tentative.html", + {} + ] + ], "trusted-types/location-href.tentative.html": [ [ "/trusted-types/location-href.tentative.html", {} ] ], + "trusted-types/location-replace.tentative.html": [ + [ + "/trusted-types/location-replace.tentative.html", + {} + ] + ], "trusted-types/outerHTML.tentative.html": [ [ "/trusted-types/outerHTML.tentative.html", @@ -380368,6 +379965,18 @@ {} ] ], + "trusted-types/srcDoc-requiresTrustedTypes.tentative.html": [ + [ + "/trusted-types/srcDoc-requiresTrustedTypes.tentative.html", + {} + ] + ], + "trusted-types/srcDoc.tentative.html": [ + [ + "/trusted-types/srcDoc.tentative.html", + {} + ] + ], "uievents/constructors/inputevent-constructor.html": [ [ "/uievents/constructors/inputevent-constructor.html", @@ -380932,9 +380541,9 @@ {} ] ], - "wake-lock/interfaces.https.html": [ + "wake-lock/idlharness.https.window.js": [ [ - "/wake-lock/interfaces.https.html", + "/wake-lock/idlharness.https.window.html", {} ] ], @@ -381028,6 +380637,16 @@ {} ] ], + "wasm/idlharness.any.js": [ + [ + "/wasm/idlharness.any.html", + {} + ], + [ + "/wasm/idlharness.any.worker.html", + {} + ] + ], "wasm/wasm_indexeddb_test.https.html": [ [ "/wasm/wasm_indexeddb_test.https.html", @@ -381172,9 +380791,9 @@ {} ] ], - "web-animations/interfaces/Animation/idlharness.html": [ + "web-animations/interfaces/Animation/idlharness.window.js": [ [ - "/web-animations/interfaces/Animation/idlharness.html", + "/web-animations/interfaces/Animation/idlharness.window.html", {} ] ], @@ -381238,9 +380857,9 @@ {} ] ], - "web-animations/interfaces/AnimationPlaybackEvent/idlharness.html": [ + "web-animations/interfaces/AnimationPlaybackEvent/idlharness.window.js": [ [ - "/web-animations/interfaces/AnimationPlaybackEvent/idlharness.html", + "/web-animations/interfaces/AnimationPlaybackEvent/idlharness.window.html", {} ] ], @@ -381262,9 +380881,9 @@ {} ] ], - "web-animations/interfaces/DocumentTimeline/idlharness.html": [ + "web-animations/interfaces/DocumentTimeline/idlharness.window.js": [ [ - "/web-animations/interfaces/DocumentTimeline/idlharness.html", + "/web-animations/interfaces/DocumentTimeline/idlharness.window.html", {} ] ], @@ -381286,9 +380905,9 @@ {} ] ], - "web-animations/interfaces/KeyframeEffect/idlharness.html": [ + "web-animations/interfaces/KeyframeEffect/idlharness.window.js": [ [ - "/web-animations/interfaces/KeyframeEffect/idlharness.html", + "/web-animations/interfaces/KeyframeEffect/idlharness.window.html", {} ] ], @@ -381454,9 +381073,145 @@ {} ] ], - "web-nfc/idlharness.https.html": [ + "web-animations/timing-model/timelines/update-and-send-events.html": [ [ - "/web-nfc/idlharness.https.html", + "/web-animations/timing-model/timelines/update-and-send-events.html", + {} + ] + ], + "web-locks/acquire.tentative.https.html": [ + [ + "/web-locks/acquire.tentative.https.html", + {} + ] + ], + "web-locks/clientids.tentative.https.html": [ + [ + "/web-locks/clientids.tentative.https.html", + {} + ] + ], + "web-locks/frames.tentative.https.html": [ + [ + "/web-locks/frames.tentative.https.html", + {} + ] + ], + "web-locks/held.tentative.https.html": [ + [ + "/web-locks/held.tentative.https.html", + {} + ] + ], + "web-locks/ifAvailable.tentative.https.html": [ + [ + "/web-locks/ifAvailable.tentative.https.html", + {} + ] + ], + "web-locks/interfaces-serviceworker.tentative.https.html": [ + [ + "/web-locks/interfaces-serviceworker.tentative.https.html", + {} + ] + ], + "web-locks/interfaces.tentative.https.any.js": [ + [ + "/web-locks/interfaces.tentative.https.any.html", + {} + ], + [ + "/web-locks/interfaces.tentative.https.any.worker.html", + {} + ] + ], + "web-locks/lock-attributes.tentative.https.html": [ + [ + "/web-locks/lock-attributes.tentative.https.html", + {} + ] + ], + "web-locks/mode-exclusive.tentative.https.html": [ + [ + "/web-locks/mode-exclusive.tentative.https.html", + {} + ] + ], + "web-locks/mode-mixed.tentative.https.html": [ + [ + "/web-locks/mode-mixed.tentative.https.html", + {} + ] + ], + "web-locks/mode-shared.tentative.https.html": [ + [ + "/web-locks/mode-shared.tentative.https.html", + {} + ] + ], + "web-locks/non-secure-context.tentative.html": [ + [ + "/web-locks/non-secure-context.tentative.html", + {} + ] + ], + "web-locks/opaque-origin.tentative.https.html": [ + [ + "/web-locks/opaque-origin.tentative.https.html", + {} + ] + ], + "web-locks/query-empty.tentative.https.html": [ + [ + "/web-locks/query-empty.tentative.https.html", + {} + ] + ], + "web-locks/query-order.tentative.https.html": [ + [ + "/web-locks/query-order.tentative.https.html", + {} + ] + ], + "web-locks/query.tentative.https.html": [ + [ + "/web-locks/query.tentative.https.html", + {} + ] + ], + "web-locks/resource-names.tentative.https.html": [ + [ + "/web-locks/resource-names.tentative.https.html", + {} + ] + ], + "web-locks/secure-context.tentative.https.html": [ + [ + "/web-locks/secure-context.tentative.https.html", + {} + ] + ], + "web-locks/signal.tentative.https.html": [ + [ + "/web-locks/signal.tentative.https.html", + {} + ] + ], + "web-locks/steal.tentative.https.html": [ + [ + "/web-locks/steal.tentative.https.html", + {} + ] + ], + "web-locks/workers.tentative.https.html": [ + [ + "/web-locks/workers.tentative.https.html", + {} + ] + ], + "web-nfc/idlharness.https.window.js": [ + [ + "/web-nfc/idlharness.https.window.html", {} ] ], @@ -381924,6 +381679,12 @@ {} ] ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam-size.https.html": [ + [ + "/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam-size.https.html", + {} + ] + ], "webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https.html": [ [ "/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https.html", @@ -382590,13 +382351,13 @@ {} ] ], - "webauthn/interfaces.https.any.js": [ + "webauthn/idlharness.https.any.js": [ [ - "/webauthn/interfaces.https.any.html", + "/webauthn/idlharness.https.any.html", {} ], [ - "/webauthn/interfaces.https.any.worker.html", + "/webauthn/idlharness.https.any.worker.html", {} ] ], @@ -382936,6 +382697,72 @@ {} ] ], + "webmessaging/with-options/broken-origin.tentative.html": [ + [ + "/webmessaging/with-options/broken-origin.tentative.html", + {} + ] + ], + "webmessaging/with-options/host-specific-origin.tentative.html": [ + [ + "/webmessaging/with-options/host-specific-origin.tentative.html", + {} + ] + ], + "webmessaging/with-options/invalid-args.tentative.html": [ + [ + "/webmessaging/with-options/invalid-args.tentative.html", + {} + ] + ], + "webmessaging/with-options/message-channel-transferable.tentative.html": [ + [ + "/webmessaging/with-options/message-channel-transferable.tentative.html", + {} + ] + ], + "webmessaging/with-options/no-target-origin.tentative.html": [ + [ + "/webmessaging/with-options/no-target-origin.tentative.html", + {} + ] + ], + "webmessaging/with-options/null-arg-two.tentative.html": [ + [ + "/webmessaging/with-options/null-arg-two.tentative.html", + {} + ] + ], + "webmessaging/with-options/one-arg.tentative.html": [ + [ + "/webmessaging/with-options/one-arg.tentative.html", + {} + ] + ], + "webmessaging/with-options/slash-origin.tentative.html": [ + [ + "/webmessaging/with-options/slash-origin.tentative.html", + {} + ] + ], + "webmessaging/with-options/two-arg.tentative.html": [ + [ + "/webmessaging/with-options/two-arg.tentative.html", + {} + ] + ], + "webmessaging/with-options/undefined-transferable.tentative.html": [ + [ + "/webmessaging/with-options/undefined-transferable.tentative.html", + {} + ] + ], + "webmessaging/with-options/unknown-parameter.tentative.html": [ + [ + "/webmessaging/with-options/unknown-parameter.tentative.html", + {} + ] + ], "webmessaging/with-ports/001.html": [ [ "/webmessaging/with-ports/001.html", @@ -383652,9 +383479,9 @@ {} ] ], - "webrtc/RTCRtpSender-replaceTrack.html": [ + "webrtc/RTCRtpSender-replaceTrack.https.html": [ [ - "/webrtc/RTCRtpSender-replaceTrack.html", + "/webrtc/RTCRtpSender-replaceTrack.https.html", {} ] ], @@ -387006,27 +386833,51 @@ {} ] ], - "workers/baseurl/alpha/importScripts.html": [ + "workers/baseurl/alpha/import-in-moduleworker.html": [ [ - "/workers/baseurl/alpha/importScripts.html", + "/workers/baseurl/alpha/import-in-moduleworker.html", {} ] ], - "workers/baseurl/alpha/sharedworker.html": [ + "workers/baseurl/alpha/importScripts-in-sharedworker.html": [ [ - "/workers/baseurl/alpha/sharedworker.html", + "/workers/baseurl/alpha/importScripts-in-sharedworker.html", {} ] ], - "workers/baseurl/alpha/worker.html": [ + "workers/baseurl/alpha/importScripts-in-worker.html": [ [ - "/workers/baseurl/alpha/worker.html", + "/workers/baseurl/alpha/importScripts-in-worker.html", {} ] ], - "workers/baseurl/alpha/xhr.html": [ + "workers/baseurl/alpha/sharedworker-in-worker.html": [ [ - "/workers/baseurl/alpha/xhr.html", + "/workers/baseurl/alpha/sharedworker-in-worker.html", + {} + ] + ], + "workers/baseurl/alpha/worker-in-worker.html": [ + [ + "/workers/baseurl/alpha/worker-in-worker.html", + {} + ] + ], + "workers/baseurl/alpha/xhr-in-moduleworker.html": [ + [ + "/workers/baseurl/alpha/xhr-in-moduleworker.html", + {} + ] + ], + "workers/baseurl/alpha/xhr-in-sharedworker.html": [ + [ + "/workers/baseurl/alpha/xhr-in-sharedworker.html", + {} + ] + ], + "workers/baseurl/alpha/xhr-in-worker.html": [ + [ + "/workers/baseurl/alpha/xhr-in-worker.html", {} ] ], @@ -387366,6 +387217,18 @@ {} ] ], + "workers/interfaces/WorkerGlobalScope/location/redirect-module.html": [ + [ + "/workers/interfaces/WorkerGlobalScope/location/redirect-module.html", + {} + ] + ], + "workers/interfaces/WorkerGlobalScope/location/redirect-sharedworker.html": [ + [ + "/workers/interfaces/WorkerGlobalScope/location/redirect-sharedworker.html", + {} + ] + ], "workers/interfaces/WorkerGlobalScope/location/redirect.html": [ [ "/workers/interfaces/WorkerGlobalScope/location/redirect.html", @@ -387564,12 +387427,32 @@ {} ] ], + "workers/modules/dedicated-worker-import-blob-url.any.js": [ + [ + "/workers/modules/dedicated-worker-import-blob-url.any.html", + {} + ], + [ + "/workers/modules/dedicated-worker-import-blob-url.any.worker.html", + {} + ] + ], "workers/modules/dedicated-worker-import-csp.html": [ [ "/workers/modules/dedicated-worker-import-csp.html", {} ] ], + "workers/modules/dedicated-worker-import-data-url.any.js": [ + [ + "/workers/modules/dedicated-worker-import-data-url.any.html", + {} + ], + [ + "/workers/modules/dedicated-worker-import-data-url.any.worker.html", + {} + ] + ], "workers/modules/dedicated-worker-import-failure.html": [ [ "/workers/modules/dedicated-worker-import-failure.html", @@ -387946,6 +387829,12 @@ {} ] ], + "worklets/idlharness.worker.js": [ + [ + "/worklets/idlharness.worker.html", + {} + ] + ], "worklets/layout-worklet-credentials.https.html": [ [ "/worklets/layout-worklet-credentials.https.html", @@ -388884,6 +388773,12 @@ {} ] ], + "xhr/open-url-redirected-sharedworker-origin.htm": [ + [ + "/xhr/open-url-redirected-sharedworker-origin.htm", + {} + ] + ], "xhr/open-url-redirected-worker-origin.htm": [ [ "/xhr/open-url-redirected-worker-origin.htm", @@ -407970,12 +407865,6 @@ {} ] ], - "css/css-images/img-orient-012.xht": [ - [ - "/css/css-images/img-orient-012.xht", - {} - ] - ], "css/css-lists/list-style-type-armenian-002.xht": [ [ "/css/css-lists/list-style-type-armenian-002.xht", @@ -408848,6 +408737,12 @@ {} ] ], + "webdriver/tests/actions/control_click.py": [ + [ + "/webdriver/tests/actions/control_click.py", + {} + ] + ], "webdriver/tests/actions/key.py": [ [ "/webdriver/tests/actions/key.py", @@ -408912,6 +408807,12 @@ {} ] ], + "webdriver/tests/back/back.py": [ + [ + "/webdriver/tests/back/back.py", + {} + ] + ], "webdriver/tests/close_window/close.py": [ [ "/webdriver/tests/close_window/close.py", @@ -408926,6 +408827,12 @@ } ] ], + "webdriver/tests/delete_all_cookies/delete.py": [ + [ + "/webdriver/tests/delete_all_cookies/delete.py", + {} + ] + ], "webdriver/tests/delete_cookie/delete.py": [ [ "/webdriver/tests/delete_cookie/delete.py", @@ -408938,6 +408845,12 @@ {} ] ], + "webdriver/tests/delete_session/delete.py": [ + [ + "/webdriver/tests/delete_session/delete.py", + {} + ] + ], "webdriver/tests/dismiss_alert/dismiss.py": [ [ "/webdriver/tests/dismiss_alert/dismiss.py", @@ -408958,6 +408871,12 @@ {} ] ], + "webdriver/tests/element_click/click.py": [ + [ + "/webdriver/tests/element_click/click.py", + {} + ] + ], "webdriver/tests/element_click/file_upload.py": [ [ "/webdriver/tests/element_click/file_upload.py", @@ -409000,6 +408919,18 @@ {} ] ], + "webdriver/tests/element_send_keys/events.py": [ + [ + "/webdriver/tests/element_send_keys/events.py", + {} + ] + ], + "webdriver/tests/element_send_keys/file_upload.py": [ + [ + "/webdriver/tests/element_send_keys/file_upload.py", + {} + ] + ], "webdriver/tests/element_send_keys/form_controls.py": [ [ "/webdriver/tests/element_send_keys/form_controls.py", @@ -409018,6 +408949,18 @@ {} ] ], + "webdriver/tests/element_send_keys/send_keys.py": [ + [ + "/webdriver/tests/element_send_keys/send_keys.py", + {} + ] + ], + "webdriver/tests/element_send_keys/user_prompts.py": [ + [ + "/webdriver/tests/element_send_keys/user_prompts.py", + {} + ] + ], "webdriver/tests/execute_async_script/collections.py": [ [ "/webdriver/tests/execute_async_script/collections.py", @@ -409027,7 +408970,9 @@ "webdriver/tests/execute_async_script/user_prompts.py": [ [ "/webdriver/tests/execute_async_script/user_prompts.py", - {} + { + "timeout": "long" + } ] ], "webdriver/tests/execute_script/collections.py": [ @@ -409051,7 +408996,9 @@ "webdriver/tests/execute_script/user_prompts.py": [ [ "/webdriver/tests/execute_script/user_prompts.py", - {} + { + "timeout": "long" + } ] ], "webdriver/tests/find_element/find.py": [ @@ -409078,6 +409025,12 @@ {} ] ], + "webdriver/tests/forward/forward.py": [ + [ + "/webdriver/tests/forward/forward.py", + {} + ] + ], "webdriver/tests/fullscreen_window/fullscreen.py": [ [ "/webdriver/tests/fullscreen_window/fullscreen.py", @@ -409222,6 +409175,12 @@ {} ] ], + "webdriver/tests/navigate_to/navigate.py": [ + [ + "/webdriver/tests/navigate_to/navigate.py", + {} + ] + ], "webdriver/tests/new_session/create_alwaysMatch.py": [ [ "/webdriver/tests/new_session/create_alwaysMatch.py", @@ -409249,9 +409208,7 @@ "webdriver/tests/new_session/invalid_capabilities.py": [ [ "/webdriver/tests/new_session/invalid_capabilities.py", - { - "timeout": "long" - } + {} ] ], "webdriver/tests/new_session/merge.py": [ @@ -409276,12 +409233,24 @@ {} ] ], + "webdriver/tests/refresh/refresh.py": [ + [ + "/webdriver/tests/refresh/refresh.py", + {} + ] + ], "webdriver/tests/send_alert_text/send.py": [ [ "/webdriver/tests/send_alert_text/send.py", {} ] ], + "webdriver/tests/set_timeouts/set.py": [ + [ + "/webdriver/tests/set_timeouts/set.py", + {} + ] + ], "webdriver/tests/set_window_rect/set.py": [ [ "/webdriver/tests/set_window_rect/set.py", @@ -409302,11 +409271,23 @@ {} ] ], + "webdriver/tests/switch_to_frame/switch.py": [ + [ + "/webdriver/tests/switch_to_frame/switch.py", + {} + ] + ], "webdriver/tests/switch_to_parent_frame/switch.py": [ [ "/webdriver/tests/switch_to_parent_frame/switch.py", {} ] + ], + "webdriver/tests/switch_to_window/switch.py": [ + [ + "/webdriver/tests/switch_to_window/switch.py", + {} + ] ] } }, @@ -409360,7 +409341,7 @@ "support" ], "./lint.whitelist": [ - "1fd41d38b2af42fffea5bc09c0348feb0f078e85", + "a10b26945c0ef0105e7e183cfb4d1df05ea5af15", "support" ], "./serve.py": [ @@ -409412,15 +409393,7 @@ "support" ], "2dcontext/META.yml": [ - "4350cfdc3ece39bf73aafa6e425cad279fef5097", - "support" - ], - "2dcontext/best-practices/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "2dcontext/building-paths/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "d0eb07cdc705df472cb61ecd1856ffbc6e207969", "support" ], "2dcontext/building-paths/canvas_complexshapes_arcto_001-ref.htm": [ @@ -409443,10 +409416,6 @@ "6b549fa40955b0232d58c857ee9506a255009838", "support" ], - "2dcontext/compositing/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "2dcontext/compositing/2d.composite.canvas.copy.html": [ "9ad464e17e36026a958f448949439a71204b7c77", "testharness" @@ -410083,10 +410052,6 @@ "138f74dab028aa13c1d0fdc5cd1b54c7e94ac901", "reftest" ], - "2dcontext/conformance-requirements/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "2dcontext/conformance-requirements/2d.coordinatespace-manual.html": [ "1ff038c68dc9623bc613d84a6bb06cfc0ed8e6c9", "manual" @@ -410107,10 +410072,6 @@ "63d998f1a4997ffedffd97b6f11ce3b8fd650666", "testharness" ], - "2dcontext/drawing-images-to-the-canvas/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "2dcontext/drawing-images-to-the-canvas/2d.drawImage.3arg.html": [ "1a1c591bf36c879cf81d6e2bea9e77a7bf2cc561", "testharness" @@ -410267,14 +410228,6 @@ "d86bbcbac918dc468c484e46cc03e6125122d1ef", "testharness" ], - "2dcontext/drawing-model/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "2dcontext/drawing-paths-to-the-canvas/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "2dcontext/drawing-paths-to-the-canvas/canvas_complexshapes_ispointInpath_001.htm": [ "1154b14a36ad59dfd9f091b28bec58e840287a88", "testharness" @@ -410303,10 +410256,6 @@ "3882a35911d495e6353c199b5169383672ac4a93", "testharness" ], - "2dcontext/drawing-rectangles-to-the-canvas/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "2dcontext/drawing-rectangles-to-the-canvas/2d.clearRect.basic.html": [ "c1a92963198618147550b88c94c8544ce3fc605f", "testharness" @@ -410439,10 +410388,6 @@ "6b549fa40955b0232d58c857ee9506a255009838", "support" ], - "2dcontext/drawing-text-to-the-canvas/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "2dcontext/drawing-text-to-the-canvas/2d.text.draw.align.center.html": [ "5f9fbb439700bfce1e1a3705f804e996e6dc76ec", "testharness" @@ -410571,18 +410516,6 @@ "0a5658c6bc67b04635de7a37a0aa84b3bacbf459", "testharness" ], - "2dcontext/drawingstyle-objects/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "2dcontext/examples/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "2dcontext/fill-and-stroke-styles/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "2dcontext/fill-and-stroke-styles/2d.fillStyle.default.html": [ "b184b1a55d3584cc034d9ccb1673376258315a53", "testharness" @@ -411839,10 +411772,6 @@ "de18139c6fb9e1ef54ca8fd35a9f47ee213172a5", "support" ], - "2dcontext/hit-regions/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "2dcontext/hit-regions/addHitRegions-NotSupportedError-01.html": [ "fd587fe4fa1bbaeffc57f692699069e416c72941", "testharness" @@ -411859,6 +411788,10 @@ "5da74cfd37ef072aa5b50c9a5fb658754984216b", "support" ], + "2dcontext/imagebitmap/createImageBitmap-bounds.html": [ + "cf1d9de3474c61c5827094cead43313883bc2408", + "testharness" + ], "2dcontext/imagebitmap/createImageBitmap-drawImage.html": [ "adef50e6043c6ecb80bdc4a6b7f9d9a599a80656", "testharness" @@ -411883,10 +411816,6 @@ "a4d7a168004e741c5b723b7a758f20822f9fd2d0", "support" ], - "2dcontext/line-styles/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "2dcontext/line-styles/2d.line.cap.butt.html": [ "646d8338cc34ef8e6aaea09c40a1f3363870c799", "testharness" @@ -412031,10 +411960,6 @@ "228b11f73f516fc21549391f56ff7c90fd491cb2", "testharness" ], - "2dcontext/path-objects/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "2dcontext/path-objects/2d.path.arc.angle.1.html": [ "9a8ba40867507b9cefd20714cb518d4d658e1efc", "testharness" @@ -412575,10 +412500,6 @@ "b0cf4217e48ef48304eb83f576f0cc2ec2c31898", "testharness" ], - "2dcontext/pixel-manipulation/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "2dcontext/pixel-manipulation/2d.imageData.create1.basic.html": [ "fcd5f3de01680511df6b800a1f2e222e60e64b07", "testharness" @@ -412839,10 +412760,6 @@ "3ed43652df13d239c8cf261a94101b82d9e97e3b", "testharness" ], - "2dcontext/shadows/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "2dcontext/shadows/2d.shadow.alpha.1.html": [ "bd4a0f3ed5cb6f2816626c5b83eb8249880b71e7", "testharness" @@ -413127,10 +413044,6 @@ "1af1210741b214cac60e2350673c31ed629a61aa", "reftest" ], - "2dcontext/text-styles/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "2dcontext/text-styles/2d.text.align.default.html": [ "b021cc5e25d6e73a1f9ae7c48eea316c24b01f82", "testharness" @@ -413235,10 +413148,6 @@ "72491fac6be4a8f1f75b87afdb42de05432c4f98", "reftest" ], - "2dcontext/the-canvas-state/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "2dcontext/the-canvas-state/2d.state.saverestore.bitmap.html": [ "f941d9bc8e2f8340734997ca05cece4e4d255278", "testharness" @@ -413391,10 +413300,6 @@ "7ae8c51177c71b7b0e2394406e88f0096853b244", "support" ], - "2dcontext/transformations/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "2dcontext/transformations/2d.transformation.order.html": [ "9487bad2690acad3a991d13846bd91702da95d81", "testharness" @@ -413508,11 +413413,11 @@ "support" ], "BackgroundSync/META.yml": [ - "d4b8d3ee30aca9e9bd4435534615172c89f9ca9c", + "a36a9e218d5f4727f5b9d8028e45fd7297bfdea6", "support" ], "BackgroundSync/interfaces.https.any.js": [ - "4b754f0550409475495768483f2075e8f54782d0", + "de3e6c1617c46a6c2c6142537ed2d0e1bcd953e2", "testharness" ], "FileAPI/BlobURL/support/file_test2.txt": [ @@ -413552,7 +413457,7 @@ "testharness" ], "FileAPI/META.yml": [ - "b0426c8fc9c1c16a24dc5d1e820db091e3d97169", + "8bea7f6b2cfd8edf4a92403af812dd181eeeb9c9", "support" ], "FileAPI/blob/Blob-constructor-endings.html": [ @@ -413640,11 +413545,11 @@ "manual" ], "FileAPI/idlharness.html": [ - "8758857fee6e2c4504368ed4d8ca5e818bf84171", + "440dcecf7e94b58ff6bc0035663d673fa3a1145f", "testharness" ], "FileAPI/idlharness.worker.js": [ - "3564b7fa9eaecdc3796ba25606159ae031942ca0", + "c3cddfbde633d69e17bc1d37eacb3656ef51a06f", "testharness" ], "FileAPI/progress-manual.html": [ @@ -413820,7 +413725,7 @@ "reftest" ], "IndexedDB/META.yml": [ - "23a59b2c2f26784d7c7238e74f70bde7eb898d1f", + "6b135c2fb2cc34be62dd3034000e386d579bac65", "support" ], "IndexedDB/README.md": [ @@ -415027,12 +414932,12 @@ "03e244d70d286d726bf0a227bc36ef1b4d8bcc72", "support" ], - "IndexedDB/index_sort_order.htm": [ - "251a828d333bdd3face9d20a2a28ddf0c0ffeb49", + "IndexedDB/idlharness.any.js": [ + "dfc95449e452ba68e938247644494eeb9ac926e0", "testharness" ], - "IndexedDB/interfaces.any.js": [ - "ae562d6b568c1005c5eef5a230b8869729719dff", + "IndexedDB/index_sort_order.htm": [ + "251a828d333bdd3face9d20a2a28ddf0c0ffeb49", "testharness" ], "IndexedDB/interleaved-cursors-common.js": [ @@ -415248,7 +415153,7 @@ "testharness" ], "WebCryptoAPI/META.yml": [ - "4b7eb6116aba38dd94914ea3ff49ff1e882ab5be", + "76cbf8402810794493c076081e6a9d3acab33574", "support" ], "WebCryptoAPI/README.md": [ @@ -415455,12 +415360,8 @@ "44475110f616c78bc04b93246f015e7a83e78fa7", "testharness" ], - "WebCryptoAPI/idlharness.https.html": [ - "a0ac6f063c49d9c14b614dee18b681968eee05ad", - "testharness" - ], - "WebCryptoAPI/idlharness.https.worker.js": [ - "2ef22c6a9f185492c5bca7e52b3a7a6b363a2e2f", + "WebCryptoAPI/idlharness.https.any.js": [ + "c96f061be232a56e65b5c82bf1ce5fef664e183b", "testharness" ], "WebCryptoAPI/import_export/ec_importKey.https.worker.js": [ @@ -415592,7 +415493,7 @@ "support" ], "WebIDL/META.yml": [ - "dc19e39d740d19a1fa5e813d6dc15d03c1fc1906", + "3bf00b705a042a6bd4d9f253cec60552b536046f", "support" ], "WebIDL/current-realm.html": [ @@ -415660,7 +415561,7 @@ "testharness" ], "WebIDL/interfaces.html": [ - "699d2feb7ed9f91ae04957131fcb23cebc19b621", + "85b0f1b5d97fd52d6ef20a5b4faf9a7cc55a9ca5", "testharness" ], "WebIDL/invalid/idl/enum.widl": [ @@ -416148,7 +416049,7 @@ "manual" ], "accelerometer/META.yml": [ - "f99b5f4f8bb9d631f1b55857512be56738801e6e", + "0b1b8f63953727301a4f44e34c2b5ebe71468b78", "support" ], "accelerometer/idlharness.https.html": [ @@ -416156,7 +416057,7 @@ "testharness" ], "accname/META.yml": [ - "521d90b87283645c22b8752fdb69031cc08cf3f7", + "f7d5179a9a285a89bf67e94235655e0a41c882f4", "support" ], "accname/description_1.0_combobox-focusable-manual.html": [ @@ -416959,6 +416860,10 @@ "9c9b554e33d34e1513dd315ecd6299f756d68b43", "support" ], + "ambient-light/AmbientLightSensor-iframe-access.https.html": [ + "5896b8ba40dca9f7beeab66a7b355e2aab3d6841", + "testharness" + ], "ambient-light/AmbientLightSensor.https.html": [ "b2811054c4835b22f3f2c9d8baa6f95921db67d8", "testharness" @@ -416972,7 +416877,7 @@ "manual" ], "ambient-light/META.yml": [ - "ac7cd201b98202bfef2c967328008cc581e9091f", + "a1f6a1ae10eeaccc4288d31a9a1c1584cfbafb22", "support" ], "ambient-light/idlharness.https.html": [ @@ -416988,7 +416893,7 @@ "support" ], "annotation-model/META.yml": [ - "d6c07a9a849f213ecb1efb5a8f3656039af0a3df", + "7c595706932662043997a5b84889c50b26e195fb", "support" ], "annotation-model/README.md": [ @@ -418164,7 +418069,7 @@ "support" ], "annotation-protocol/META.yml": [ - "1e4adc07cf5790fd51820158c69c1dd2c1a72c28", + "752b0b3ce5d17e7db6db8b67b2dfab13128e7abe", "support" ], "annotation-protocol/README.md": [ @@ -418420,7 +418325,7 @@ "manual" ], "annotation-vocab/META.yml": [ - "00a710bdf4b7a25200cef5b4192331c66e6b636c", + "51227a41dae3b2e83a7319dd95cf66067bf0c364", "support" ], "annotation-vocab/tools/.gitignore": [ @@ -418980,7 +418885,7 @@ "support" ], "apng/META.yml": [ - "ad3fb4311e96c76e3c9d3ab7be32dfc9d2708b7e", + "714075388ee3d8f4cf698f0291aebb34f62badff", "support" ], "apng/animated-png-timeout-ref.html": [ @@ -418995,22 +418900,30 @@ "32cf112fb1dcb4e7ec3c91bdf5bd6b976a1e4eac", "testharness" ], + "appmanifest/META.yml": [ + "09bd6b0357c774319313ff016e7ebdab12275764", + "support" + ], + "appmanifest/idlharness.window.js": [ + "6eb9bb3e49ba21dd5635631ad3a847ea85614697", + "testharness" + ], "async-local-storage/META.yml": [ - "9fcc91fa7224a8cb8b7322d607d5a02da459af3d", + "8f1032eff89e5e9128aad0b324e816e569850979", "support" ], "async-local-storage/storage-smoke-test.https.tentative.html": [ "1e00cf5aff9d85ca66d8b831ee4c2c3cb8259071", "testharness" ], - "audio-output/HTMLMediaElement-sinkId-idl.html": [ - "8f37d8d2fc1cb9b5ad0d85234f733f534f4f0db8", - "testharness" - ], "audio-output/META.yml": [ - "207e6b4a069dc5a13bf00656c3bbed751c43a1de", + "3a4c2722523dae5bc73f854dddb9281ab53248cc", "support" ], + "audio-output/idlharness.window.js": [ + "c528922cb15fa766be42f3d9b22d7e29caf98533", + "testharness" + ], "audio-output/setSinkId-manual.https.html": [ "6743b9f6843a1c6134ac9cc627375b0368986e55", "manual" @@ -419020,43 +418933,55 @@ "testharness" ], "background-fetch/META.yml": [ - "4d156fb28413323d5217a1d843f7e45162ca0a86", + "6edac5b7c18db3aa500dc41e50fb35bc934568bf", "support" ], "background-fetch/content-security-policy.https.window.js": [ - "1675b0665319efe5ce8423230f839b20e3b6a63b", + "c697f5804fd7f706ccc227cc93d0c4e895d7f067", "testharness" ], "background-fetch/credentials-in-url.https.window.js": [ - "6fa8d069c6f17da908078ac1a3770b2bd730426c", + "945d9713c5695072dc5b94f1671eed53d66005e1", "testharness" ], "background-fetch/dangling-markup.https.window.js": [ - "fd9efe16c485c6fa6cc4b587b492eb24bf9ccac2", + "63049632a7ddca3eac182885b516471dcb85e75b", "testharness" ], + "background-fetch/fetch.https.window.js": [ + "a62e7ea112a381f24dd2c9cdec6a012dec9e41c3", + "testharness" + ], + "background-fetch/get-ids.https.js": [ + "6177ea08e069fd1aca85fd3d772a53022b07f519", + "support" + ], "background-fetch/interfaces.https.any.js": [ - "af1d0da2759a9c1c5b993eb9ea0905601f531301", + "34a07e3b0425cb5a1b940c9581573e2b3322724f", "testharness" ], "background-fetch/mixed-content-and-allowed-schemes.https.window.js": [ - "a285388a7d275f50444079b9549797ed29b27fd3", + "5c8d022ff16664199c2c0f7c33df883653b4f254", "testharness" ], "background-fetch/port-blocking.https.window.js": [ - "6e06b6e9b9cd8713ff5a8ca405c1b54fe15c559c", + "f46ead816fe9c7f9d7c3e75357aa77a71a44ca1b", "testharness" ], + "background-fetch/resources/feature-name.txt": [ + "d93e330118c50918b3205c3ea1e9ea371937aaaf", + "support" + ], "background-fetch/resources/sw.js": [ - "9b4fbabe0209a5367186e8c5717be88f32530027", + "c7b6e87115da4051980837838900fee80df9cb27", "support" ], "background-fetch/resources/utils.js": [ - "1109faf95d0b0d09f2eb9a486638d68af55cb52c", + "1602f7a4e12d8470974c706ae3b2e90f8920f854", "support" ], "battery-status/META.yml": [ - "66cfecbe9492089a9319c323deadc9f03fd53636", + "088b2c7021bfb7a41d031e38adbdd7460943c948", "support" ], "battery-status/battery-charging-manual.https.html": [ @@ -419108,7 +419033,7 @@ "support" ], "beacon/META.yml": [ - "bde35c223aa8099d60febd82b3d24aa1c80633ab", + "aaa16147daf5a1ac3e0c32a39d6e63a7ad10cd22", "support" ], "beacon/beacon-basic-blob.html": [ @@ -419224,7 +419149,7 @@ "support" ], "bluetooth/META.yml": [ - "5f2a733d31520e93ce73531e5db5453b73979ced", + "a4c66f2f55cdf4c22bf523f71d301d390e26d31b", "support" ], "bluetooth/README.md": [ @@ -419380,11 +419305,15 @@ "testharness" ], "bluetooth/idl/idl-NavigatorBluetooth.html": [ + "4dadccd0abbf6379520951e2eb177e4efec15668", + "testharness" + ], + "bluetooth/idl/idl-NavigatorBluetooth.https.html": [ "fa121bcbea3d19898a71f7dda79708ee941e4b6c", "testharness" ], - "bluetooth/idl/idlharness.tentative.window.js": [ - "02a6bf3346f34196fab9b5788131641d44bf9b77", + "bluetooth/idl/idlharness.tentative.https.window.js": [ + "93988e964522b585a2cd555f803afe1d33ce52a8", "testharness" ], "bluetooth/requestDevice/acceptAllDevices/device-with-empty-name.https.html": [ @@ -419988,7 +419917,7 @@ "testharness" ], "budget-api/META.yml": [ - "d4b8d3ee30aca9e9bd4435534615172c89f9ca9c", + "a12d36202021ac41551017600278483c4a560c14", "support" ], "budget-api/interfaces.any.js": [ @@ -419996,7 +419925,7 @@ "testharness" ], "clear-site-data/META.yml": [ - "b8bca79a6a7924ef1799e8fd56684f293882b619", + "6a59c67f1e730767e09bac945ff830d44fea96b5", "support" ], "clear-site-data/navigation-insecure.html": [ @@ -420047,20 +419976,32 @@ "23aaa612f1b6ee417d31faec8399248c9bc7cffc", "support" ], - "client-hints/accept_ch.sub.https.html": [ - "8cfb7a9f11cbd19f2e3965c27af394fca31e1654", + "client-hints/accept_ch.tentative.https.html": [ + "812edca2d3fd438a13bcc05a6c7a722b467e000b", "testharness" ], - "client-hints/accept_ch.sub.https.html.headers": [ + "client-hints/accept_ch.tentative.sub.https.html": [ + "926500884d438811650ef7cca54f29d19ff03795", + "testharness" + ], + "client-hints/accept_ch.tentative.sub.https.html.headers": [ "23aaa612f1b6ee417d31faec8399248c9bc7cffc", "support" ], - "client-hints/accept_ch.tentative.https.html": [ - "342de3ae30d962249bc0c282aac5b6e4192badfd", + "client-hints/accept_ch_lifetime.tentative.https.html": [ + "4a0f40a61adfb2d4f5ab67244ebf98b4a66bf544", "testharness" ], - "client-hints/accept_ch_lifetime.tentative.https.html": [ - "58a6a6dafb4a6a3e8daa8742a1da137399353370", + "client-hints/accept_ch_lifetime_cross_origin_iframe.tentative.sub.https.html": [ + "c1c96cf6eac7da1368fcb41590efe3d60456692c", + "testharness" + ], + "client-hints/accept_ch_lifetime_same_origin_iframe.tentative.https.html": [ + "635b8d12d8d38f4f5be2b840e337a87cd63744ed", + "testharness" + ], + "client-hints/accept_ch_lifetime_subresource.tentative.https.html": [ + "6aeb04a3ad14e9efb9765b37a46ca73ca45cdd26", "testharness" ], "client-hints/accept_ch_malformed_header.https.html": [ @@ -420075,6 +420016,38 @@ "a69e980bffe7bd97aaaffde6bbec85df36b164c4", "support" ], + "client-hints/http_equiv_accept_ch.tentative.http.html": [ + "f4ea013432d4a0c599a7a8bc388ca9b5019e60f3", + "testharness" + ], + "client-hints/http_equiv_accept_ch.tentative.https.html": [ + "3d0aa253be8108f9b3aa6542d1eb5f8cafbb8e34", + "testharness" + ], + "client-hints/http_equiv_accept_ch.tentative.sub.https.html": [ + "f404276fd8263be9f4fc2ecfc4f1d28ce0f62f6d", + "testharness" + ], + "client-hints/http_equiv_accept_ch_lifetime.tentative.https.html": [ + "5881ee69c16a2990fd96bf201668900213f1c7d9", + "testharness" + ], + "client-hints/http_equiv_accept_ch_lifetime_cross_origin_iframe.tentative.sub.https.html": [ + "e505202f4f86587242bdd546eb2686d20ea70899", + "testharness" + ], + "client-hints/http_equiv_accept_ch_lifetime_same_origin_iframe.tentative.https.html": [ + "b1e602609e872b2e00f2086330450afae3764b17", + "testharness" + ], + "client-hints/http_equiv_accept_ch_lifetime_subresource.tentative.https.html": [ + "bcba9e32ad82008f3fa391559f9bc8fbca9805fb", + "testharness" + ], + "client-hints/http_equiv_accept_ch_malformed_header.tentative.https.html": [ + "17d80854b8a71289a1a1208984cca7021b51679a", + "testharness" + ], "client-hints/resources/accept_ch.html": [ "a0a6d53c0c859bb62d38f1ad3a4eeac0abd50823", "support" @@ -420088,19 +420061,23 @@ "support" ], "client-hints/resources/accept_ch_lifetime.html.headers": [ - "6e96c4ec282ce390e9becb2c50944031fb36f4a0", + "22488fcaec4a0a0f227b972ccc8c911e006f3286", "support" ], "client-hints/resources/do_not_expect_client_hints_headers.html": [ - "f48190cb980ceef479f6858cd6cc121d136c52a3", + "3aa67914736b2aaf826a641ac3886bd1a07c37d5", "support" ], "client-hints/resources/expect_client_hints_headers.html": [ - "88247405d94960fc58d49b0969f5c9357ee84fad", + "f3dad5b94c675e20a768bd1408efeb160f7a9344", + "support" + ], + "client-hints/resources/http_equiv_accept_ch_lifetime.html": [ + "d892780f71f921b8fe8a068d417de63ee4a85600", "support" ], "clipboard-apis/META.yml": [ - "49ed5058494d23f4521a07000b533d463805f104", + "c5c1ea0665c6cab9002611e7971934af01eabdab", "support" ], "clipboard-apis/async-interfaces.https.html": [ @@ -420336,7 +420313,7 @@ "support" ], "compat/META.yml": [ - "ccf32e8e83bc78ead9631738ee8c5272f7f95df0", + "c2b0035e9c5042a9c2d1db5e01731eb3e2c1a19c", "support" ], "compat/css-style-declaration-alias-enumeration.html": [ @@ -420355,10 +420332,6 @@ "b96341f909d00d6d1f3ee244f174dbe576bc0780", "testharness" ], - "compat/webkit-appearance.tentative.html": [ - "19f5d49ab9383759357d9b7cd73f15fe7fff2939", - "testharness" - ], "compat/webkit-background-origin-text-ref.html": [ "35b0175a64f38fb1e3723f7f634c18d7974a131f", "support" @@ -437988,7 +437961,7 @@ "support" ], "console/META.yml": [ - "170fecd7c57c2629628553e47d2e6c5581013549", + "ec28cc655d39a8559ac3952dbb346d2cddb4b54c", "support" ], "console/console-count-logging-manual.html": [ @@ -437996,7 +437969,7 @@ "manual" ], "console/console-countReset-logging-manual.html": [ - "6edce76ce23ebc0b885f171020909617409016b9", + "bdce08f6994cfaa34505ab7fee89fb3593142355", "manual" ], "console/console-is-a-namespace.any.js": [ @@ -438019,8 +437992,12 @@ "ee18f8a672534b478ca15990026638a73588fcf4", "testharness" ], + "console/console-timing-logging-manual.html": [ + "8b2d2e8d6675efacf99f49fec95c8be52f38407e", + "manual" + ], "content-security-policy/META.yml": [ - "5819f0331b11875efb46ad15e02d28f59770cc9d", + "8b13100d5ecf0c606f74c249a18bf031ba77094d", "support" ], "content-security-policy/README.css": [ @@ -438211,6 +438188,10 @@ "70aeb617f5d580917b385346ba629e035f062c32", "testharness" ], + "content-security-policy/embedded-enforcement/idlharness.window.js": [ + "e009d639fbb4ede1085c365038fb79d1e0625143", + "testharness" + ], "content-security-policy/embedded-enforcement/iframe-csp-attribute.html": [ "d5a253732352f46d33c1a58d1a3183a88daa3a75", "testharness" @@ -439804,15 +439785,15 @@ "testharness" ], "content-security-policy/securitypolicyviolation/blockeduri-eval.html": [ - "01d4ce834d175d13eb0d9c80bbe4a7be614d687f", + "26a5ce6bed6fba88412ffbd7a0aa0c04c4b9c86d", "testharness" ], "content-security-policy/securitypolicyviolation/blockeduri-inline.html": [ - "8e7326101e28ec65c6c834f7711b261917f93218", + "ff8d1c26701d15164bcb549d42937825e1f0edd0", "testharness" ], - "content-security-policy/securitypolicyviolation/idl.html": [ - "266180135d8167bc47d6c7a73798e87aa1082bee", + "content-security-policy/securitypolicyviolation/idlharness.window.js": [ + "f2a3d55d5fcaa14ee93d78b7f1bc4bc8ea5a9017", "testharness" ], "content-security-policy/securitypolicyviolation/img-src-redirect-upgrade-reporting.https.html": [ @@ -439880,7 +439861,7 @@ "support" ], "content-security-policy/securitypolicyviolation/targeting.html": [ - "36ec8dd9ef0bd1be3615913015d857aa1a7c9e97", + "37de17c9e37399f17662798d46970eafa2e946ec", "testharness" ], "content-security-policy/securitypolicyviolation/upgrade-insecure-requests-reporting.https.html": [ @@ -440072,11 +440053,11 @@ "support" ], "content-security-policy/support/checkReport.sub.js": [ - "5a67d7d16562a8925a916214bb1d0ab27f52ddf3", + "9349d682e7ebb6a7dc504d720733f6130d253855", "support" ], "content-security-policy/support/dedicated-worker-helper.js": [ - "c2ee371b1ca6b56d4579032db79470d38dc7fad9", + "f639d5dc27035efded725cf52849542a41be244a", "support" ], "content-security-policy/support/document-write-alert-fail.js": [ @@ -440188,11 +440169,11 @@ "support" ], "content-security-policy/support/service-worker-helper.js": [ - "dada4b697830bd56b771e02de8460dffcb3a494e", + "ffeb07440ac35d0b28cfb794b6644ac7c29d4906", "support" ], "content-security-policy/support/shared-worker-helper.js": [ - "7e7b17341425d222d440f2f4607ee40ff020efe6", + "432e0b740095aa98e72998a9f98ada0650ef1b08", "support" ], "content-security-policy/support/siblingPath.js": [ @@ -440379,6 +440360,10 @@ "ec579a530ae0f44e387ed400d5b923cdb8203dc7", "testharness" ], + "content-security-policy/worker-src/dedicated-worker-src-child-fallback-blocked.sub.html": [ + "fed3835538da7901920652ab97e6d0c5dba6d9b4", + "testharness" + ], "content-security-policy/worker-src/dedicated-worker-src-child-fallback.sub.html": [ "1206a6f00c5cf43da1327625fb7c97ce9f63a868", "testharness" @@ -440415,6 +440400,10 @@ "561c9a2ce0d4c1b9e148cad2ca5bad4b17517e9e", "testharness" ], + "content-security-policy/worker-src/service-worker-src-child-fallback-blocked.https.sub.html": [ + "f939b41fec58bcefd86e0e1f942d1c399592a043", + "testharness" + ], "content-security-policy/worker-src/service-worker-src-child-fallback.https.sub.html": [ "90d70a062e718daf5013f3b12662066b6edb1692", "testharness" @@ -440451,6 +440440,10 @@ "ff4d7ca289ea20fa00bca535fdcf929876a2278b", "testharness" ], + "content-security-policy/worker-src/shared-worker-src-child-fallback-blocked.sub.html": [ + "8cd3dc4fc6fee0a9508ab6911f1b86c1199b86f7", + "testharness" + ], "content-security-policy/worker-src/shared-worker-src-child-fallback.sub.html": [ "8cc98872cd4fe0ed2e411d74ba4c79684fb1b312", "testharness" @@ -440468,7 +440461,7 @@ "testharness" ], "cookie-store/META.yml": [ - "b0d8c58c78cfd2dcc8a81b83fb17afadeabfb375", + "4bbefdfc6d076fd45eaa914ba9106491c7932864", "support" ], "cookie-store/README.md": [ @@ -440476,11 +440469,11 @@ "support" ], "cookie-store/cookieListItem_attributes.tentative.https.window.js": [ - "773ad9b5ea3636497f9f90c57e5bc5a2fa63c289", + "4b90ff7956f16f2f829829cda1047c3eec48ae93", "testharness" ], "cookie-store/cookieStore_delete_arguments.tentative.https.window.js": [ - "740fccd53713d8ffdd84aa388580630025fc016c", + "1ade936aa42802c4fc1672b5ababd9eb15e2b4a9", "testharness" ], "cookie-store/cookieStore_delete_basic.tentative.https.window.js": [ @@ -440504,7 +440497,7 @@ "testharness" ], "cookie-store/cookieStore_getAll_arguments.tentative.https.window.js": [ - "ea9bc48ed9d2da2523b97d92de84c65226206211", + "8af46d4d9a1b30fa742ce674fff4a6e84325b2eb", "testharness" ], "cookie-store/cookieStore_getAll_multiple.tentative.https.window.js": [ @@ -440516,7 +440509,7 @@ "testharness" ], "cookie-store/cookieStore_get_arguments.tentative.https.window.js": [ - "ea197608e10369f700585066bb91e6846df2fe73", + "f189edac32de86822bd9f1dfaa11e1a3dd507e21", "testharness" ], "cookie-store/cookieStore_get_delete_basic.tentative.https.window.js": [ @@ -440532,7 +440525,7 @@ "testharness" ], "cookie-store/cookieStore_set_arguments.tentative.https.window.js": [ - "832b25b61626d3c9656731470ea06e0f95028958", + "d017d31481f73c3e83af7ae6560869e05026239a", "testharness" ], "cookie-store/cookieStore_special_names.tentative.https.window.js": [ @@ -440628,7 +440621,7 @@ "testharness" ], "cookie-store/serviceworker_cookieStore_subscriptions.js": [ - "7e140635e7587de1c606a0faf4a0bf8d8eb8c41e", + "7197cdc912d381a258a7b80daaa0d12e20a66fe5", "support" ], "cookie-store/serviceworker_cookieStore_subscriptions.tentative.https.html": [ @@ -440636,7 +440629,7 @@ "testharness" ], "cookie-store/serviceworker_cookieStore_subscriptions_basic.js": [ - "9b477518ee4c8cdc103d3cab11cca371b7b2f72d", + "503a93f435cf7784ff2b98dc7c3f5d1a1ba1fb14", "support" ], "cookie-store/serviceworker_cookieStore_subscriptions_basic.tentative.https.html": [ @@ -440644,15 +440637,23 @@ "testharness" ], "cookie-store/serviceworker_cookieStore_subscriptions_empty.js": [ - "fd8cf9d3dab06824cf0497c44a388c0cea7d02d6", + "a90b1e59e0708838ad84618c4acfb6291ec82bd9", "support" ], "cookie-store/serviceworker_cookieStore_subscriptions_empty.tentative.https.html": [ "3f8ec6177bc54738213fab8a1f8947d58714456d", "testharness" ], + "cookie-store/serviceworker_cookieStore_subscriptions_eventhandler_attribute.js": [ + "4cc19c733cea09c1143dba9ef017ccb59aee8ddc", + "support" + ], + "cookie-store/serviceworker_cookieStore_subscriptions_eventhandler_attribute.tentative.https.html": [ + "e0d44d998137cea66fc66d88a12b485386962b34", + "testharness" + ], "cookie-store/serviceworker_cookieStore_subscriptions_mismatch.js": [ - "fa57006fdb09070feb6c7a83553d300d725761b6", + "464447630cdf01b80e4469fb79756c9898653cc4", "support" ], "cookie-store/serviceworker_cookieStore_subscriptions_mismatch.tentative.https.html": [ @@ -441304,7 +441305,7 @@ "testharness" ], "core-aam/META.yml": [ - "521d90b87283645c22b8752fdb69031cc08cf3f7", + "11497389c130feadc4a1065ce683a3c5fc935001", "support" ], "core-aam/README.md": [ @@ -442208,7 +442209,7 @@ "testharness" ], "cors/META.yml": [ - "5c885aaa8b4118a67983fa41f0c75cfe24f2cdff", + "f86b687ad69afe4eb023eb0b1d893797cc786206", "support" ], "cors/README.md": [ @@ -442360,7 +442361,7 @@ "support" ], "credential-management/META.yml": [ - "4966e7a03e815dac333218faf57875b57b9dd535", + "ceca889f80b3d2489d2034caca54e0f88a1dc4e9", "support" ], "credential-management/credentialscontainer-create-basics.https.html": [ @@ -442404,7 +442405,7 @@ "support" ], "css/CSS1/META.yml": [ - "b792470b13ce6eb8f26d3d3f5368232a9ec4e5e6", + "604c70afbd73ef321e341ef79631eb30ea98abe4", "support" ], "css/CSS1/list-marker-inside-whitespace-001.xml": [ @@ -442436,7 +442437,7 @@ "support" ], "css/CSS2/META.yml": [ - "9d154a356898f6a8cc1aae1c889a66ea390a03e0", + "edc81e57b7bbe8886eb3bc90f3e6578f14ffbc18", "support" ], "css/CSS2/Makefile": [ @@ -460587,6 +460588,14 @@ "f9b30873ba1da1309d17f2ae6f0777656521e5b2", "reftest" ], + "css/CSS2/floats/floats-line-wrap-shifted-001-ref.html": [ + "97d01b457c2032e59de20eb768aa025607e9b046", + "support" + ], + "css/CSS2/floats/floats-line-wrap-shifted-001.html": [ + "1e5c1373145ea0f217fa4cf354eeae5883b629af", + "reftest" + ], "css/CSS2/floats/floats-placement-vertical-001-ref.xht": [ "219c3d13a6859b58907f35df0a5602ba215a0335", "support" @@ -496880,7 +496889,7 @@ "support" ], "css/WOFF2/META.yml": [ - "a1165964ec4100cb5df5280f04f94b29b096c585", + "5f30b25c77d21343bee561fdcbb96f0e963e2d7a", "support" ], "css/WOFF2/available-001.xht": [ @@ -500536,7 +500545,7 @@ "visual" ], "css/compositing/META.yml": [ - "290d99442afcff70c6f1d876dadd5de2e7e088c6", + "6942f4d32200cfb6123b84150f54ae99452d1e86", "support" ], "css/compositing/Text_with_SVG_background-ref.html": [ @@ -500992,7 +501001,7 @@ "visual" ], "css/css-align/META.yml": [ - "aa49a3ff79f12ba93b902cdd76fa0e980779a320", + "5f4611e301cc90ae25686adf5739e51506dc0668", "support" ], "css/css-align/content-distribution/parse-align-content-001.html": [ @@ -501368,7 +501377,7 @@ "testharness" ], "css/css-animations/META.yml": [ - "6133b41dd04471a6fa9266d86bd44eea46422d17", + "d16f910cbb3c8bbe2c8620780fe8f0b9ddf31904", "support" ], "css/css-animations/animation-common-ref.html": [ @@ -501684,7 +501693,7 @@ "testharness" ], "css/css-animations/idlharness.html": [ - "75e949c1edef367f29d23a1c4921fe7748c78a3f", + "591adfdded4944d996a6405e0f34ddc85855e44f", "testharness" ], "css/css-animations/pending-style-changes-001.html": [ @@ -501692,11 +501701,11 @@ "testharness" ], "css/css-animations/support/testcommon.js": [ - "3e2b733b29fca0963c95c0d069b7a518db266004", + "3e0f25eacf2de8cac7f81b26bcd171b281bde112", "support" ], "css/css-backgrounds/META.yml": [ - "6579dbf88b7cdf0a3720b569c1aec90f4315b23f", + "2cb1dd6bd1c8900aa07465b4ed05a8d18f64a147", "support" ], "css/css-backgrounds/background-331.html": [ @@ -502399,6 +502408,10 @@ "cc42f33213bd8392ed865c80cb4c7e12004a6fbb", "reftest" ], + "css/css-backgrounds/background-size-with-negative-value.html": [ + "5f90875ab5b6f8d5e28f6d22eced12668c3e337d", + "reftest" + ], "css/css-backgrounds/background-size/background-size-contain.xht": [ "2ee8298189f94c143626edbdfc18e2b3504e8efc", "reftest" @@ -504416,7 +504429,7 @@ "testharness" ], "css/css-backgrounds/parsing/background-color-valid.html": [ - "cb9f0f31a7e4bc9f4b23c7e6240e377b05b14154", + "28b2f10b322194066a3eaa8029ea61d21ee00611", "testharness" ], "css/css-backgrounds/parsing/background-image-invalid.html": [ @@ -504472,7 +504485,7 @@ "testharness" ], "css/css-backgrounds/parsing/border-color-valid.html": [ - "a8df09796083692c802b5a48bd7761f474f14ef5", + "07c3c5a177b266026ed4de667ba7740d58f377e7", "testharness" ], "css/css-backgrounds/parsing/border-image-invalid.html": [ @@ -505147,6 +505160,10 @@ "ceb5773fc9d6264d1f9210d8675b7bf48764d296", "reftest" ], + "css/css-box/META.yml": [ + "91b1411bc42ad5a8f4be53cb2605b2a212f5cd95", + "support" + ], "css/css-box/parsing/clear-invalid.html": [ "ee593f2639cdfb9a26edad7eb5de002e4d077850", "testharness" @@ -505248,15 +505265,19 @@ "testharness" ], "css/css-break/META.yml": [ - "4840f714501765d5bf6f0986fd453d5bf1ac3787", + "0aad659229987a811dbf6b4b927f5df2b86ea974", "support" ], "css/css-break/break-before-always-001.xht": [ "926ed3f96ba7b5c6dee79ea417746cbd60342579", "visual" ], + "css/css-break/hit-test-inline-fragmentation-with-border-radius.html": [ + "92092527c9f739dca5410a0baac8f48522889409", + "testharness" + ], "css/css-cascade/META.yml": [ - "d1a7ec7e6b46b861cff2ce11a7f793635a81a0c6", + "bd7d597835cd56aeb7904436c30502263c263d94", "support" ], "css/css-cascade/all-prop-001-ref.html": [ @@ -505295,6 +505316,18 @@ "139a6a94cf1ea7997fc38307e8fbaef6bbc561f0", "reftest" ], + "css/css-cascade/parsing/all-invalid.html": [ + "11f578baab6ee7e35dafef3d58ce7bc7d74f29d4", + "testharness" + ], + "css/css-cascade/parsing/all-valid.html": [ + "aa6d6c986a89ba1c39bd4a6eb856acd525c5852a", + "testharness" + ], + "css/css-cascade/parsing/support/parsing-testcommon.js": [ + "14f32b772f27a9bc75fe90e2ea1d8e4fb3649e95", + "support" + ], "css/css-cascade/reference/ref-filled-green-100px-square.xht": [ "2f6ee60666fbb65497dc8749683d66ae543bad12", "support" @@ -505316,7 +505349,7 @@ "support" ], "css/css-color/META.yml": [ - "b3d3139150b1dde80d7dafa2fcb388f8dc484d7f", + "9adfe0ea4112983d343b2c20cc91efb6aa0d67f0", "support" ], "css/css-color/blacktext-ref.html": [ @@ -505551,6 +505584,26 @@ "fad454c9b86d70e19fb89265c8e131ff381ed2a0", "reftest" ], + "css/css-color/parsing/color-invalid.html": [ + "a716957996b6441d1bba1d6d4fa636d4368f68c5", + "testharness" + ], + "css/css-color/parsing/color-valid.html": [ + "d13b776333ec9953ccfc403dfdc262ced259bd9a", + "testharness" + ], + "css/css-color/parsing/opacity-invalid.html": [ + "7ba8ffc6bbb4c27d43e9e6a11edbe52f8ca21613", + "testharness" + ], + "css/css-color/parsing/opacity-valid.html": [ + "edf3b52c29261dd0d4993f076ddd01dbe7edb805", + "testharness" + ], + "css/css-color/parsing/resources/parsing-testcommon.js": [ + "14f32b772f27a9bc75fe90e2ea1d8e4fb3649e95", + "support" + ], "css/css-color/rebeccapurple-ref.html": [ "e089e2daad5e5db7131015bf45739e64050c6b36", "support" @@ -506100,7 +506153,7 @@ "support" ], "css/css-conditional/META.yml": [ - "ae3412685f151437547efe46903023e37e898cd0", + "9a369b6d0be4fec34d13f941c6a9eb85f0ba668c", "support" ], "css/css-conditional/at-media-whitespace-optional-001.html": [ @@ -506292,7 +506345,7 @@ "testharness" ], "css/css-contain/META.yml": [ - "c127a237bb6c1fe9f0914dc41bfd8cecc3886194", + "a2fae675028a2b9f4322b678b8aec2877475f16b", "support" ], "css/css-contain/contain-layout-001.html": [ @@ -506491,6 +506544,10 @@ "8974279263fbd89e1b781ee9481c7466ce073f1e", "reftest" ], + "css/css-contain/contain-size-borders.html": [ + "9c7036290a0a1f1617f23ae0a9d81ab1795f4cd6", + "reftest" + ], "css/css-contain/contain-size-breaks-001.html": [ "3a3c80029a6c126c584a21e2ff3b25e5459c32e8", "reftest" @@ -506660,7 +506717,7 @@ "support" ], "css/css-content/META.yml": [ - "668b31991bb5fdf580227bbfaf2478b218f33cff", + "825ebcde56cd23199e9cd90af312f2837d6b2301", "support" ], "css/css-content/attr-case-insensitive-ref.html": [ @@ -506671,6 +506728,22 @@ "6b6cf2c15295940fb8831d17209635dc4e31cd78", "reftest" ], + "css/css-content/element-replacement-alt-ref.html": [ + "6c67290991bc0ca57223e65a995054bae04bca0a", + "support" + ], + "css/css-content/element-replacement-alt.html": [ + "383ba1ffc142ae6d783cc9300b296b83b4b2521f", + "reftest" + ], + "css/css-content/element-replacement-display-contents.html": [ + "980d17c7c90c1de3f703423bcf41d0f14d25f4c1", + "reftest" + ], + "css/css-content/element-replacement-display-none.html": [ + "b30f852673badcc7f9cb8a39cc4a12452d886d6f", + "reftest" + ], "css/css-content/element-replacement-ref.html": [ "f1ad3fca133b1b671e45ae1307fbe9454c40e3ec", "support" @@ -506679,12 +506752,24 @@ "f491ddf2b3062ea2f9b616c968c88b9cc95f22eb", "reftest" ], + "css/css-content/pseudo-element-inline-box-ref.html": [ + "9dac06a226bb54ce2c735bfb00aca30d204b2dfd", + "support" + ], + "css/css-content/pseudo-element-inline-box.html": [ + "af67630b8d0f14c2a3512c942c1f8b487388ee69", + "reftest" + ], + "css/css-content/resources/blank.html": [ + "d96d45f3a57b58460787fcde5fd15ccb324b123c", + "support" + ], "css/css-content/resources/rect.svg": [ "e0c37ea653aee58f962133219edc4484a734c6e0", "support" ], "css/css-counter-styles/META.yml": [ - "43982251f83f205725e033c37177bab441a2e547", + "395c00578932fef186aa1f474d3bac03bb7db40f", "support" ], "css/css-counter-styles/README": [ @@ -507328,7 +507413,7 @@ "manual" ], "css/css-display/META.yml": [ - "84f8e0511a2200ecaf108d944da30adbe87a4e9b", + "88b1ac95ffc1d689dd7bf5cfa5cc6d5fb20dc8dc", "support" ], "css/css-display/display-contents-alignment-001-ref.html": [ @@ -508672,7 +508757,7 @@ "support" ], "css/css-env/META.yml": [ - "f05175dd6526e7891c551bb034d190c937a7d555", + "a4706d2da945dcaa9ea1e0820af60427dd18cadb", "support" ], "css/css-env/at-supports.tentative.html": [ @@ -508704,7 +508789,7 @@ "testharness" ], "css/css-exclusions/META.yml": [ - "3ce5754412de34748eedf62d4c86b59326b80927", + "bb778e3ed876b588a3c20f125d3f38a4a86058e6", "support" ], "css/css-exclusions/css3-exclusions/exclusions-wrap-flow-01-ref.xht": [ @@ -508772,7 +508857,7 @@ "testharness" ], "css/css-fill-stroke/META.yml": [ - "d6432e3ad547c16ead21070cc04278b13ec49b58", + "4f95bfeeae086acfd265fca20466abb20f2151c2", "support" ], "css/css-fill-stroke/paint-order-001.tentative.html": [ @@ -508784,7 +508869,7 @@ "support" ], "css/css-filter/META.yml": [ - "4cf686b2a40c2c89e5e557d667fb3580657f9aa7", + "edddb36dd8335f59f963701dc92c66742f4bf66c", "support" ], "css/css-filter/filtered-block-is-container-ref.html": [ @@ -508816,7 +508901,7 @@ "reftest" ], "css/css-flexbox/META.yml": [ - "a1c3dbe395a6cc4b5389c862aa3993041191f51c", + "accb5c985d4d34fca422a1fd2af51d05d4d55bae", "support" ], "css/css-flexbox/abspos-autopos-htb-ltr.html": [ @@ -511944,7 +512029,7 @@ "reftest" ], "css/css-font-loading/META.yml": [ - "a566cf382313c5d808d636cfb9210aee8f387709", + "e4f58a6ee514a9aa87ec8816bf9c31b96addd393", "support" ], "css/css-font-loading/fontfacesetloadevent-constructor.html": [ @@ -511952,11 +512037,11 @@ "testharness" ], "css/css-font-loading/idlharness.https.html": [ - "00399ffcb0ff8000e79ab4aeefdb90cabdb0fd4d", + "93c01c16bf27adc0789dda15dd2e704b96715415", "testharness" ], "css/css-fonts/META.yml": [ - "e254b7f4226a0263147746fd1108db8b78360a19", + "e92c8d383bcf1417ef1a1979c44d17077f4acfc6", "support" ], "css/css-fonts/README": [ @@ -513060,7 +513145,7 @@ "visual" ], "css/css-fonts/matching/META.yml": [ - "da44cfca32a7f241c3432c6f233e55961388b791", + "99ef9620319207bf58e2fdaef88b60bcc4703cc7", "support" ], "css/css-fonts/matching/README.md": [ @@ -519184,7 +519269,7 @@ "testharness" ], "css/css-fonts/variations/META.yml": [ - "da44cfca32a7f241c3432c6f233e55961388b791", + "99ef9620319207bf58e2fdaef88b60bcc4703cc7", "support" ], "css/css-fonts/variations/at-font-face-descriptors.html": [ @@ -519436,7 +519521,7 @@ "reftest" ], "css/css-gcpm/META.yml": [ - "8e54549bd5bc2d18dd042f4bf97ceb8b4f1909b1", + "5271a5a9c1c48b7e825377b26b94d5eb93ec127b", "support" ], "css/css-gcpm/leader-001.html": [ @@ -519520,7 +519605,7 @@ "manual" ], "css/css-grid/META.yml": [ - "f6a36990cb67f80bb239d1a0edd8fc92c6794d5e", + "5bac08db91d4a350a69e473d3f2176675ca675ae", "support" ], "css/css-grid/README.md": [ @@ -521728,7 +521813,7 @@ "support" ], "css/css-images/META.yml": [ - "09a11b18fe89bb03abe08b315936fb588d957895", + "373d20b8c57242dff5289f55805e7c086df272b1", "support" ], "css/css-images/css-image-fallbacks-and-annotations-ref.html": [ @@ -521823,10 +521908,6 @@ "223fe97a140e0cfb52709f02c72d8d32c5e6ae95", "visual" ], - "css/css-images/img-orient-012.xht": [ - "6075765bed0ae20451c82a7d9802e7453ae8fcdc", - "visual" - ], "css/css-images/linear-gradient-1.html": [ "fc00201e827325dc3897b789d0e6be920eb4e38b", "reftest" @@ -521848,11 +521929,11 @@ "testharness" ], "css/css-images/parsing/image-orientation-invalid.html": [ - "d73028ae4b50467e1a04a80c9b0a33a1f195ba5b", + "4e0fc11d78b4e9aa36d558d16e6d3740ef01d6a6", "testharness" ], "css/css-images/parsing/image-orientation-valid.html": [ - "07a4e4f0d471c1482ec55c1237c39791590158e8", + "5f7c8f0abf80cb663ff4bd76cfeef5e76f5814b4", "testharness" ], "css/css-images/parsing/image-rendering-invalid.html": [ @@ -522088,7 +522169,7 @@ "reftest" ], "css/css-layout-api/META.yml": [ - "af5d7e8d082ad8c9cde86636a78f8270782dbb50", + "28e37582f2ec07a61602e2eac620c3ee08799748", "support" ], "css/css-layout-api/at-supports-rule.https.html": [ @@ -522144,11 +522225,11 @@ "reftest" ], "css/css-layout-api/box-tree-unregistered-ref.html": [ - "cd0b49234938b110561ebb5ecf793375f3e3fe06", + "d1bd2b7e19ceccaaf32b25bf0db9e91a8da601e1", "support" ], "css/css-layout-api/box-tree-unregistered.https.html": [ - "c2058c848fe71230148b2531585fbddd678e6926", + "c4cbcc57030956d15d23efe98b07c460edbbaeb2", "reftest" ], "css/css-layout-api/computed-style-layout-function.https.html": [ @@ -522520,7 +522601,7 @@ "testharness" ], "css/css-lists/META.yml": [ - "d6432e3ad547c16ead21070cc04278b13ec49b58", + "3ddf25363a61baa64374747cdfadeb9329e87f81", "support" ], "css/css-lists/counter-7-ref.html": [ @@ -522556,7 +522637,7 @@ "visual" ], "css/css-logical/META.yml": [ - "7d47d8cc4beb06c6c90900afe8f50080633d2451", + "a76d2c1f93706928ed40b73b3d3147e83900f998", "support" ], "css/css-logical/cascading-001-ref.html": [ @@ -522568,7 +522649,7 @@ "reftest" ], "css/css-logical/logical-box-border-color.html": [ - "9e3a2a3796bf840f0e3ff78e54ad0382adff5b36", + "8b0476ee42276ea327938e573cd7a62ceff595c1", "testharness" ], "css/css-logical/logical-box-border-shorthands.html": [ @@ -522576,23 +522657,23 @@ "testharness" ], "css/css-logical/logical-box-border-style.html": [ - "b4e50119630c3b3b82f8ffbd03d7e221d77735f7", + "ad9ba7a5fd26a3d4f4465785dfbdc77177ab5d23", "testharness" ], "css/css-logical/logical-box-border-width.html": [ - "22e99144abdf927b195bec6aee59a41eb5b00700", + "eced0215f89082de7f674caf3be2c0bf704d9faf", "testharness" ], "css/css-logical/logical-box-inset.html": [ - "a409ba1436ca88743278cd811bb7345560ccec23", + "b63ebeabb307cddca59a604084fb74809dbffe37", "testharness" ], "css/css-logical/logical-box-margin.html": [ - "b4812c03f505f096b97d752608defb604f683a67", + "ce777da59fbf772ac7b63928228491710ca32772", "testharness" ], "css/css-logical/logical-box-padding.html": [ - "4f14cc4e6bd3623f6a55a6694039bd172e7a2361", + "0091cd5ff0f047dcd0fa46c4db871d13bbacabdf", "testharness" ], "css/css-logical/logical-box-size.html": [ @@ -522620,11 +522701,11 @@ "testharness" ], "css/css-logical/resources/test-box-properties.js": [ - "ce6a045e4afb9992c0ac13312f8b6516162d19a7", + "2a9ed0b45186a1910d71a4d449b6c21f672e8250", "support" ], "css/css-masking/META.yml": [ - "58fb98f69344d290172f564b3f4ebd450671a10b", + "d470dae7f9e5655676efc4c97f5f916cb7f0d4d1", "support" ], "css/css-masking/clip-path-svg-content/clip-path-clip-nested-twice.svg": [ @@ -523464,7 +523545,7 @@ "reftest" ], "css/css-multicol/META.yml": [ - "dea1879def95f31ec0ea1270df505cf6e68d11a4", + "0e75924cfce6d596bc427e2afdcaf425a5d982e5", "support" ], "css/css-multicol/column-count-used-001.html": [ @@ -524636,7 +524717,7 @@ "reftest" ], "css/css-namespaces/META.yml": [ - "95da4a25f9ee85a0d3a70091c77ae80d4893c03e", + "0ae2d6e00d6b119de5d85fe82331d070e3925214", "support" ], "css/css-namespaces/README": [ @@ -524792,7 +524873,7 @@ "visual" ], "css/css-overflow/META.yml": [ - "623df2bad1f25d4f262d11f18dab0284d11e796f", + "03619881c159037f2218966db6e2e0079452525f", "support" ], "css/css-overflow/input-scrollable-region-001.html": [ @@ -524803,6 +524884,10 @@ "2fe3c96c09faaa25baa2d7e88215a2ccd47e9381", "testharness" ], + "css/css-overflow/orthogonal-flow-with-inline-end-margin.html": [ + "574370fc7ff42a7d8ad8b7c883268f6f42d4f094", + "testharness" + ], "css/css-overflow/overflow-shorthand-001.html": [ "a32d1b270f62b9d563ed397c2c4cd6e87b9405e1", "testharness" @@ -524812,7 +524897,7 @@ "support" ], "css/css-page/META.yml": [ - "db913c66e6c054ad067c3dedd9e6a99495868fa2", + "e74225fbf13b9599a94ad3f9f05d27ab7383a80c", "support" ], "css/css-page/forced-page-breaks-002.xht": [ @@ -525032,7 +525117,7 @@ "support" ], "css/css-paint-api/META.yml": [ - "a68eab54914951224056fe79422371a7f1460c95", + "87c8fd6cbff312833f7085c1b07580940df21cda", "support" ], "css/css-paint-api/background-image-alpha-ref.html": [ @@ -525360,7 +525445,7 @@ "support" ], "css/css-paint-api/registered-properties-in-custom-paint.https.html": [ - "199e7dc0b76ee3bb099cc9b560a9ed2458335011", + "4b96517f4e5abfd3398a2eabdb0bf5a93f136052", "reftest" ], "css/css-paint-api/resources/html5.png": [ @@ -525408,7 +525493,7 @@ "reftest" ], "css/css-position/META.yml": [ - "7a0bbdc7d7d670e110c174b3139fd32762226cb4", + "733d1aa167da83432f0ec56018521c6eed947592", "support" ], "css/css-position/hypothetical-box-scroll-parent-ref.html": [ @@ -525736,31 +525821,35 @@ "support" ], "css/css-properties-values-api/META.yml": [ - "01384b56d5bbbb358e42778192d6893e425ca8ea", + "f909f59cb961ca319c90f95a48ccd07b2b43d653", "support" ], + "css/css-properties-values-api/property-cascade.html": [ + "3f6f4ee5f4ab4f898b0b277c4597e3af3dd2147a", + "testharness" + ], "css/css-properties-values-api/register-property-syntax-parsing.html": [ - "b065f4840b3c1deb4a2f8a59428e102f2ae11686", + "c8f0d5c43139dced6f3b8f702310fc183e1c5d90", "testharness" ], "css/css-properties-values-api/register-property.html": [ - "df61ce5dd13847deaa9b7165dd1277c1ddefb646", + "df060d9f929b49e7fe10f54eff9402436a6394ae", "testharness" ], "css/css-properties-values-api/registered-properties-inheritance.html": [ - "bee1726786f02027c0c1564adee385e2265cb3d3", + "b6ba19fea76d9d881afe0364c27438737ed79f3b", "testharness" ], "css/css-properties-values-api/registered-property-computation.html": [ - "43bd84a7ea93849f2c08633e7246d5eb84ad84ce", + "0f0d28bebdef0a8b0a13f0686b64a52434edb38c", "testharness" ], "css/css-properties-values-api/registered-property-cssom.html": [ - "01035477e322cd4465fd53619592cc2afe11e203", + "d24cfa3deb7465c4aa394e0f3a2dee244f35bb3a", "testharness" ], "css/css-properties-values-api/registered-property-initial.html": [ - "90a089424b1c884a4ce6fe1684eed3ca03055158", + "36c9dc06b192456744c5de2180ae8c0ce50d8db2", "testharness" ], "css/css-properties-values-api/support/alt/alt.css": [ @@ -525783,20 +525872,28 @@ "bd7bbb7cfc8ca930399abcf886c3da0d446725eb", "support" ], - "css/css-properties-values-api/url-resolution.tentative.html": [ - "2f651c735028307632a6f7fb934e138e626acac7", + "css/css-properties-values-api/typedom.tentative.html": [ + "6448e1fc2feb5df849f4d7c8ec60c8b4540c8c2c", + "testharness" + ], + "css/css-properties-values-api/unit-cycles.html": [ + "7bae636b594c86d5143ad9d749e1aac5f290e3cb", + "testharness" + ], + "css/css-properties-values-api/url-resolution.html": [ + "582f4f05a8b48035c3369c8ce29252e845450cfb", "testharness" ], "css/css-properties-values-api/var-reference-registered-properties-cycles.html": [ - "bc061780caa0085fca5b003c1aed68c7b162eabd", + "d8c831026c8ca0177b0974a5d6dd5938545af78e", "testharness" ], "css/css-properties-values-api/var-reference-registered-properties.html": [ - "bdaa0efd1894244a44350f3001a2ae40c35c752b", + "4830a313175aac4cdb30b614c9d8c8a6e4714819", "testharness" ], "css/css-pseudo/META.yml": [ - "8036b3e54e2c0bb937b611a1c06017b00eb440d9", + "96438231d25a8edad39a7be4270862c587e852a7", "support" ], "css/css-pseudo/first-letter-001-ref.html": [ @@ -525831,6 +525928,14 @@ "7bc7db3195b26fb32ca3b01a5834a90af66987a8", "reftest" ], + "css/css-pseudo/first-letter-opacity-float-001-ref.html": [ + "df71597f8e4bbac13d32504c1ac38f585739b3c7", + "support" + ], + "css/css-pseudo/first-letter-opacity-float-001.html": [ + "9ba635e13bc8bc7ce0099183ab9c053539569a67", + "reftest" + ], "css/css-pseudo/first-letter-property-whitelist.html": [ "38d0844f6ef10d214b7d23af45d02c8093d9c00e", "testharness" @@ -525884,7 +525989,7 @@ "reftest" ], "css/css-regions/META.yml": [ - "3ce5754412de34748eedf62d4c86b59326b80927", + "d338a5a04038363704c7d23374575f6bf4cb343d", "support" ], "css/css-regions/animations/animations-001.html": [ @@ -527900,7 +528005,7 @@ "support" ], "css/css-rhythm/META.yml": [ - "bea52223f9cf06c6d85bfb122bc71520079b4880", + "4cd6e6b252a18ebd427d7eaa458cfe7b4a865fc8", "support" ], "css/css-rhythm/line-height-step-basic-001.html": [ @@ -527980,7 +528085,7 @@ "support" ], "css/css-round-display/META.yml": [ - "f2eb067b624b021fbc10f56cdde1045e80cc77a6", + "01eab6136f1c245732c2ea083fcb4c424cf0bc21", "support" ], "css/css-round-display/polar-anchor-center-001.html": [ @@ -528044,7 +528149,7 @@ "visual" ], "css/css-ruby/META.yml": [ - "0457125a464971f3513b5959620f61b406ea5fd2", + "5c455ed13f5d398ad9232b4890d94f873685910f", "support" ], "css/css-ruby/line-break-around-ruby-001.html": [ @@ -528056,7 +528161,7 @@ "visual" ], "css/css-scoping/META.yml": [ - "692698de3bce3f3800882deaa36f34e8b38ceec0", + "c729d7ee5dad48c6b120cb6e3fa199c8b1a5e728", "support" ], "css/css-scoping/css-scoping-shadow-assigned-node-with-before-after.html": [ @@ -528163,6 +528268,14 @@ "918bd04b95a276c6035383f2fe4dcfe4274bceeb", "reftest" ], + "css/css-scoping/host-specificity-002.html": [ + "0ac361f08fa020664457c457c8c0de308f4f1b68", + "reftest" + ], + "css/css-scoping/host-specificity.html": [ + "011fe73fba24b6046d73c64b3e99d8cd46501385", + "reftest" + ], "css/css-scoping/keyframes-001.html": [ "1b72da32df7b17edbd42429d2dc8b791b9f49eff", "testharness" @@ -528267,6 +528380,10 @@ "263bcbe53e7703a2ea0a7ffae8f9ec4fcb10c7d2", "testharness" ], + "css/css-scoping/slotted-specificity.html": [ + "db5d7abd272e8ee2270876ab8cba5d86390dec34", + "reftest" + ], "css/css-scoping/slotted-with-pseudo-element-ref.html": [ "48561a3dff973b7ad1bfa9702461e50fd4a67c2d", "support" @@ -528288,7 +528405,7 @@ "reftest" ], "css/css-scroll-anchoring/META.yml": [ - "d6432e3ad547c16ead21070cc04278b13ec49b58", + "103b979562abd7804a0ac0f907ba91714932180f", "support" ], "css/css-scroll-anchoring/README.md": [ @@ -528372,7 +528489,7 @@ "testharness" ], "css/css-scroll-snap/META.yml": [ - "d6432e3ad547c16ead21070cc04278b13ec49b58", + "f60f952f90c86964f434e4af618c3734d19e197a", "support" ], "css/css-scroll-snap/overflowing-snap-areas.html": [ @@ -528388,11 +528505,11 @@ "testharness" ], "css/css-scroll-snap/snap-at-user-scroll-end-manual.html": [ - "51f08f58135901b332ff43d15fbdc8d0a22f962c", + "4ab47c6043d258fa613325f767f5ec8004031a9e", "manual" ], "css/css-scroll-snap/snap-inline-block.html": [ - "4fc646db848f597af6f4562e7b60815e9ca4ef2b", + "4640f4d992825a077d9a040f22764cdbce0c47eb", "testharness" ], "css/css-scroll-snap/snap-to-visible-areas.html": [ @@ -528400,7 +528517,7 @@ "testharness" ], "css/css-scrollbars/META.yml": [ - "c552549e7f800ffef4603ff5400acbed868c8cb8", + "80f9e6b86a95a8cc8be6c04986040d42393157ed", "support" ], "css/css-scrollbars/support/viewport-scrollbar-body-frame.html": [ @@ -528428,7 +528545,7 @@ "reftest" ], "css/css-shadow-parts/META.yml": [ - "d6432e3ad547c16ead21070cc04278b13ec49b58", + "2c80471f0fd455359dc52dd817d14f42002d48c6", "support" ], "css/css-shadow-parts/all-hosts.html": [ @@ -528476,7 +528593,7 @@ "support" ], "css/css-shapes/META.yml": [ - "66588b7de68911b939642013b693509dbda18f3a", + "e694183b87ad2c97803b925eff33b9581c1231cf", "support" ], "css/css-shapes/basic-shape-circle-ellipse-serialization.html": [ @@ -529720,7 +529837,7 @@ "support" ], "css/css-sizing/META.yml": [ - "6f1bb85cacb718d67e908e7674769994a2685e3d", + "9ae57f52e5daa81e942f35bae3e23e45443df42f", "support" ], "css/css-sizing/intrinsic-percent-non-replaced-001-ref.html": [ @@ -529768,7 +529885,7 @@ "manual" ], "css/css-speech/META.yml": [ - "d5e16ae6761b5debcfc688ef45de27d22af4351d", + "97d94f26aff10e185e477b9b07a124ad155b982b", "support" ], "css/css-speech/age-declarations-001.html": [ @@ -529796,7 +529913,7 @@ "manual" ], "css/css-style-attr/META.yml": [ - "c96d0dbde80907ea192a1d479e0f1b857383ece4", + "1746238907d43f952587c3b8224c5bb5cbb182af", "support" ], "css/css-style-attr/reference/ref-green-on-green.xht": [ @@ -530040,7 +530157,7 @@ "support" ], "css/css-syntax/META.yml": [ - "f6bdb774775508e52b24cc66dc8452931eda5ead", + "e816df05570c3be1dbaff323c1b37c655d3930d7", "support" ], "css/css-syntax/charset/.htaccess": [ @@ -530216,9 +530333,13 @@ "testharness" ], "css/css-tables/META.yml": [ - "514ca480c367b69f4fe4b7cffe9c859a9ed5f4b3", + "b147c6a143d5b7f013002f01feb76d7979ed02d3", "support" ], + "css/css-tables/anonymous-table-cell-margin-collapsing.html": [ + "6a3d014e08ed9150a902bfc78c20182d75af1dfd", + "reftest" + ], "css/css-tables/anonymous-table-ws-001-ref.html": [ "90019ee8161096455c9266672a2a90ac203f6f23", "support" @@ -530604,7 +530725,7 @@ "reftest" ], "css/css-text-decor/META.yml": [ - "c36a6fbb941e031624e13fab334100e152fa29f8", + "9d2585949899591b99309fdf47fdd49dbf567815", "support" ], "css/css-text-decor/line-through-vertical.html": [ @@ -530936,7 +531057,7 @@ "reftest" ], "css/css-text/META.yml": [ - "95f14c4be9e39a4dbeb1e010c8b91c1fad7f2eb3", + "6330241e5de89de44fd4ccdefb87a7ae17d3bfdc", "support" ], "css/css-text/astral-bidi/adlam-anti-ref.html": [ @@ -533196,11 +533317,15 @@ "reftest" ], "css/css-text/overflow-wrap/overflow-wrap-break-word-002.html": [ - "d5bbf85271b4a46399921bcdac14bb037ce05d0e", + "a8af5c3aca52a21921ce276b9b01f02fbf0a99b6", "reftest" ], "css/css-text/overflow-wrap/overflow-wrap-break-word-003.html": [ - "f25e1224db7f54d5a816b2ec4568ffd626e7ebb1", + "63bbe4f7fb67f33217876af58c1de4d032c369f4", + "reftest" + ], + "css/css-text/overflow-wrap/overflow-wrap-break-word-004.html": [ + "ca2b98f9db6ac13da149380dab3311301d741045", "reftest" ], "css/css-text/overflow-wrap/overflow-wrap-break-word-fit-content-001.html": [ @@ -533211,6 +533336,10 @@ "5858dbb88a775bb8975f338d866b6fc837485364", "reftest" ], + "css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html": [ + "ae7abc617493b9e2c9313215a3f38b77c37d9450", + "reftest" + ], "css/css-text/overflow-wrap/reference/overflow-wrap-break-word-001-ref.html": [ "0b16a0bdb25ddd647ad96dd82e3430274667ee87", "support" @@ -533220,7 +533349,7 @@ "support" ], "css/css-text/overflow-wrap/reference/overflow-wrap-break-word-003-ref.html": [ - "65ef737bff7a7e5a2e9f744d2ea4838affc897de", + "31a41d647f523d941a13d22c528ffc625dd6931d", "support" ], "css/css-text/overflow-wrap/reference/overflow-wrap-break-word-fit-content-001.html": [ @@ -533231,6 +533360,10 @@ "f3e09183b565f71e38158cc5cd4d96ab5fbf25d4", "support" ], + "css/css-text/overflow-wrap/reference/overflow-wrap-min-content-size-002-ref.html": [ + "3686ae6a0e278a970b861c165f0f840df302db70", + "support" + ], "css/css-text/overflow-wrap/word-wrap-001.html": [ "8bafc4d48bbfee1e6c465a95b29792ba33c30346", "reftest" @@ -534527,6 +534660,18 @@ "1539d2fbc03db6d654a3263591c4c17c385aa54d", "reftest" ], + "css/css-text/white-space/break-spaces-001.html": [ + "dc35c8aec3049d666da5641faad6b27e7d80c439", + "reftest" + ], + "css/css-text/white-space/break-spaces-002.html": [ + "1e28215bfca1debae5cee9c56b32bb99d096a5ab", + "reftest" + ], + "css/css-text/white-space/break-spaces-003.html": [ + "944dc1fcb26d6328cd637b8ae497961351661705", + "reftest" + ], "css/css-text/white-space/pre-wrap-001.html": [ "9094e19f8095f3fbac84356351fd56f40ba1b6b4", "reftest" @@ -534555,18 +534700,6 @@ "548d8076eb26c8fe769d3b8b6842b338ca2abca9", "reftest" ], - "css/css-text/white-space/pre-wrap-008.html": [ - "dccae2ef481258d0abd2fee23533bf30218a9965", - "reftest" - ], - "css/css-text/white-space/pre-wrap-009.html": [ - "ca8683d5fe08d851621850deb7275bb4248be2ff", - "reftest" - ], - "css/css-text/white-space/pre-wrap-010.html": [ - "b2138b69538f57b96f3ad22a620d1b45520e24b8", - "reftest" - ], "css/css-text/white-space/pre-wrap-011.html": [ "ecaf2aeddb7d349841a40b20ee9bb18e33cad681", "reftest" @@ -534671,6 +534804,18 @@ "94f7655139fc8059856e3b92129b09a4a62509ec", "testharness" ], + "css/css-text/white-space/textarea-break-spaces-001.html": [ + "0800b7358663151cbd8135131d631dab4b5c5f86", + "reftest" + ], + "css/css-text/white-space/textarea-break-spaces-002.html": [ + "3b9dcd6ebc69e506bd281d9258105b876b7cef3a", + "reftest" + ], + "css/css-text/white-space/textarea-break-spaces-003.html": [ + "a45a5217168f36e74d211d27a06abf3226f35804", + "reftest" + ], "css/css-text/white-space/textarea-pre-wrap-001.html": [ "1ec04531f5301384fa216bfd30730b757992e0f8", "reftest" @@ -534699,18 +534844,6 @@ "ada998d0fd55efd169c051b2572e9f4c92eafb37", "reftest" ], - "css/css-text/white-space/textarea-pre-wrap-008.html": [ - "41d73d94cc5d55771ca708eb138400aa434b7956", - "reftest" - ], - "css/css-text/white-space/textarea-pre-wrap-009.html": [ - "9f59166d95e1ac65666ce7849f673fac10502b04", - "reftest" - ], - "css/css-text/white-space/textarea-pre-wrap-010.html": [ - "634d2841628b741e3307fa0786c8aac41e55ec99", - "reftest" - ], "css/css-text/white-space/textarea-pre-wrap-011.html": [ "23f824b4872c55c3c5f5784615e94769b8cc699b", "reftest" @@ -534759,6 +534892,10 @@ "5ad54c7b9197746f66fa30628b6059a369f5bd36", "support" ], + "css/css-text/word-break/reference/word-break-break-all-010-ref.html": [ + "0b16a0bdb25ddd647ad96dd82e3430274667ee87", + "support" + ], "css/css-text/word-break/reference/word-break-break-all-ref-000.html": [ "765afbeeede3d3dd8ad33b88927d6eb8e5435463", "support" @@ -534935,6 +535072,14 @@ "fd5f0cf9f57152d3c6df7c4b59c0fe70733bf9f4", "manual" ], + "css/css-text/word-break/word-break-break-all-010.html": [ + "f9eedfe8e72bcf6693f8049bfdf2e1efdf3084ef", + "reftest" + ], + "css/css-text/word-break/word-break-break-all-011.html": [ + "047e950374d902e426287900a2d03c63726420a2", + "reftest" + ], "css/css-text/word-break/word-break-keep-all-000.html": [ "219e6b0435541a834ebbee114b0dd40e15956f75", "reftest" @@ -535020,7 +535165,7 @@ "reftest" ], "css/css-timing/META.yml": [ - "f6ae1015d7f8c19c5adf20df134d4c17a327a473", + "2ca744f9973c8df716205f3bd4b9ea8595c0705f", "support" ], "css/css-timing/cubic-bezier-timing-functions-output.html": [ @@ -535060,7 +535205,7 @@ "reftest_node" ], "css/css-transforms/META.yml": [ - "45918d797bc6233df9fdb8426855b627fd4f110e", + "9958cadac298893ae45b6201648a320d9b83c360", "support" ], "css/css-transforms/animation/resources/interpolation-testcommon.js": [ @@ -540452,7 +540597,7 @@ "reftest" ], "css/css-transitions/META.yml": [ - "d9c07565e8e74eee3d8c8ba18957412b6fe49111", + "0d9ae95b6dcb297e774e22055d280470c3529d6b", "support" ], "css/css-transitions/README.md": [ @@ -540551,6 +540696,10 @@ "43108935a5bf1e23ed8a61688843c7246b77b752", "testharness" ], + "css/css-transitions/pseudo-elements-002.html": [ + "ca4a5a7fffd7c938506b2ecb935dc4aa3dfd5a60", + "testharness" + ], "css/css-transitions/reference/transition-test-ref.html": [ "f5d0b5da2bdbd69ef306aa8c0b2a27d553a74c77", "support" @@ -541052,7 +541201,7 @@ "testharness" ], "css/css-typed-om/META.yml": [ - "e01827d4ac0812491943f902372abd3e66728d11", + "1716cef488adbd3535ee62f9abfd271357ee2eba", "support" ], "css/css-typed-om/declared-styleMap-accepts-inherit.html": [ @@ -542388,7 +542537,7 @@ "testharness" ], "css/css-ui/META.yml": [ - "c31805ac6b53e374521b9f289f2215928b2d2027", + "a77d9d3af5dceba8930799efc86851ab4ad930ef", "support" ], "css/css-ui/box-sizing-001.html": [ @@ -544824,7 +544973,7 @@ "manual" ], "css/css-values/META.yml": [ - "be907782d6354fc2779c31e9653931b2d4b12aa9", + "05ca3b8ca5cd6ca305a66d552d7ffd5f3185f207", "support" ], "css/css-values/absolute-length-units-001.html": [ @@ -544999,6 +545148,10 @@ "bc74010a3b7e81f008277cad91ba8adea5382787", "reftest" ], + "css/css-values/line-break-ch-unit.html": [ + "9e71f3bbe3266b02f3b1d8ef6b3d58d31e15ff7b", + "testharness" + ], "css/css-values/reference/200-200-green.html": [ "1ac64ebcfdbff6285f24dae29e32767646145082", "support" @@ -545296,7 +545449,7 @@ "testharness" ], "css/css-variables/META.yml": [ - "b1137aa66ca4053440d89a5dc21926d0048efada", + "6ae804387421fb3d91a02e2c586f0ff8f64f3d4d", "support" ], "css/css-variables/css-vars-custom-property-case-sensitive-001.html": [ @@ -545527,8 +545680,16 @@ "ac2c476205ffb2c2f985c44cb5e4acada01b0093", "reftest" ], + "css/css-will-change/META.yml": [ + "265fcf20c9c7c5691425841d518f75885af9b562", + "support" + ], + "css/css-will-change/will-change-will-change-1.html": [ + "1c0dc565ae3579de40b524c36a59378e55c5566d", + "reftest" + ], "css/css-writing-modes/META.yml": [ - "172c4d389801cb6d933965f76f2b4c4133cff185", + "36b95a330f8e624a8cbeca3077af42896fb42c12", "support" ], "css/css-writing-modes/abs-pos-non-replaced-icb-vlr-003.xht": [ @@ -547152,7 +547313,7 @@ "support" ], "css/css-writing-modes/block-flow-direction-004.xht": [ - "66b0ad0e881ee030d1ff2e4d023fe89570c227a5", + "f36725844f5497c5e72033d8ea307bc6b1d80e97", "reftest" ], "css/css-writing-modes/block-flow-direction-025-ref.xht": [ @@ -547168,7 +547329,7 @@ "support" ], "css/css-writing-modes/block-flow-direction-htb-001.xht": [ - "28c62daca6d3d58fdcc905b02db5c660751b8583", + "af01e9c8383adc0e16664d4f1b3a1260c3d7c89b", "reftest" ], "css/css-writing-modes/block-flow-direction-slr-043.xht": [ @@ -547268,95 +547429,95 @@ "reftest" ], "css/css-writing-modes/block-flow-direction-vlr-003.xht": [ - "5dea9e46db6a1a7cfca1dbddaec5ea444e9a53a1", + "42642a5a4f79fa2644a8fbc8fabd6306908438e5", "reftest" ], "css/css-writing-modes/block-flow-direction-vlr-007.xht": [ - "c001fb295db4af06e9ccc743fe8b4603d630eb61", + "8c86d2747a036dd2933edecb611b15c6092be6ec", "reftest" ], "css/css-writing-modes/block-flow-direction-vlr-008.xht": [ - "0c9c705742c39cda3f571607d82f1244569cc214", + "7f97622d7bba144c580fee00a64baec2e5f5b457", "reftest" ], "css/css-writing-modes/block-flow-direction-vlr-010.xht": [ - "2eea469e73b2b1d5149d37bce03e33518b4f266f", + "5808322647edd5737f730489770f864e38f75355", "reftest" ], "css/css-writing-modes/block-flow-direction-vlr-014.xht": [ - "8e24fef507df335aaa413d288860a1c3de7cf689", + "3938c611d2fdf2724cfcdb8970e724e8eb79a439", "reftest" ], "css/css-writing-modes/block-flow-direction-vlr-015.xht": [ - "13670aac581dfaecf838fd221da472e4fa53a487", + "08d7013acc55c7d462b4a666f73fcf79c9f9f542", "reftest" ], "css/css-writing-modes/block-flow-direction-vlr-016.xht": [ - "752650cb1a15642c4365ab946a6a52610fe937df", + "20d40e65661774ac1f140a7433c870634767831e", "reftest" ], "css/css-writing-modes/block-flow-direction-vlr-018.xht": [ - "7f0c7cf5a54b97a1887ddfe218d244ddc9661ca9", + "2eaa3626e2f4a69142127002a4aef3a61d53b16b", "reftest" ], "css/css-writing-modes/block-flow-direction-vlr-020.xht": [ - "c03d56b8df971d271427c01d4b5a41e29fd3d756", + "1178fc793fad4ad619234a8854f84f3e3094f2e6", "reftest" ], "css/css-writing-modes/block-flow-direction-vlr-022.xht": [ - "aa6ab50f0ce6a327fd2ef9adc625f38bfa0b7f6d", + "e5852a9bc7f87031f4dae8c9ff181108f1c9abcb", "reftest" ], "css/css-writing-modes/block-flow-direction-vlr-023.xht": [ - "829dea4e46f9782bf49d95ada4f0955584214642", + "58f82986e40821439cde1461346c423b42e2429e", "reftest" ], "css/css-writing-modes/block-flow-direction-vrl-002.xht": [ - "55a206442c2df0fb43e2349d4ad6b4eca138555e", + "c857f8eb2f05605adfd26723d9fb4fc2185edc67", "reftest" ], "css/css-writing-modes/block-flow-direction-vrl-005.xht": [ - "3fb7ef304bf35ad6afa1b9247dd0379bcfa949ca", + "5eebd5ea61ea5c49d510dcd82a1793a75163f26f", "reftest" ], "css/css-writing-modes/block-flow-direction-vrl-006.xht": [ - "f9973a916464bb0100844cd656a027418b610040", + "20918e127f293b8d939e0735ec3f177a8a9a649a", "reftest" ], "css/css-writing-modes/block-flow-direction-vrl-009.xht": [ - "6ec62f4e3123f4c5df36b58bd4cc264399a9d6db", + "2011eb597c17e47e2fce60b5aac17bfa5066b357", "reftest" ], "css/css-writing-modes/block-flow-direction-vrl-011.xht": [ - "d210a659115b952357667ff1a8c5f36588b49b94", + "7a2218ec10f4be425a6c1a479c5d84c652cf7ca4", "reftest" ], "css/css-writing-modes/block-flow-direction-vrl-012.xht": [ - "6f0e1dc09645cfcb93d1db7e9c39baaf1ebb2fda", + "f01cd29abb907368ce09b183b2caee4db7b2f5ab", "reftest" ], "css/css-writing-modes/block-flow-direction-vrl-013.xht": [ - "11d6a8d9b56f9867efff2d97393fa573390aeea6", + "91e918041078784abf6c87e6ed7f33a2bf73777f", "reftest" ], "css/css-writing-modes/block-flow-direction-vrl-017.xht": [ - "406cee916584bba28f6958fbcb8d802df166a833", + "ead9ae6bfdcf32d78394f534157ab508c04cb0d2", "reftest" ], "css/css-writing-modes/block-flow-direction-vrl-019.xht": [ - "ca941f4f212574bca79b2ecbbf845a9e1a1300e5", + "eff1bc87d4f00ed6342ba32ffb935c176ee4df15", "reftest" ], "css/css-writing-modes/block-flow-direction-vrl-021.xht": [ - "8bb72a04021c167d87e5410f325be70a3bc7600b", + "19f6c84ca649aec9c11c4a86350ec8d24a7e3110", "reftest" ], "css/css-writing-modes/block-flow-direction-vrl-024.xht": [ - "70e732a6c3ed7355f1e569bb5d26ad3aca6a3795", + "6a1d8c1dea0a560392db12f63d082e2fc548fe1a", "reftest" ], "css/css-writing-modes/block-flow-direction-vrl-025.xht": [ - "cfd1af31de29fd70657c90414b74a9873e1b3752", + "9525ba870d3ecc44713753319608525ae9ed4f60", "reftest" ], "css/css-writing-modes/block-flow-direction-vrl-026-ref.xht": [ @@ -547760,11 +547921,11 @@ "reftest" ], "css/css-writing-modes/different-block-flow-dir-001.xht": [ - "82d0132930dc4dc701acf668270fe4f709bc3f36", + "2465b680cd72989ba06bfef872e149f9c00c7ef5", "reftest" ], "css/css-writing-modes/different-block-flow-dir-002.xht": [ - "f37b7b088091f4e8176497064738272dc4dc0b22", + "b004bfe8dac431f5881923f61c06b11c5872d009", "reftest" ], "css/css-writing-modes/direction-vlr-003-ref.xht": [ @@ -547796,11 +547957,11 @@ "reftest" ], "css/css-writing-modes/first-page-vlr-003.xht": [ - "7456c20a91dfd80a5901eeff41e260c6dac4942b", + "a95c7f84d0a90d91420564fc4f26b67e6bf39939", "manual" ], "css/css-writing-modes/first-page-vrl-002.xht": [ - "d649d5ff1f8a0703742f03da59884842ce27e1a1", + "53b0ca9d958d836e36a02fee82202c4449ea5278", "manual" ], "css/css-writing-modes/flexbox_align-items-stretch-writing-modes-ref.html": [ @@ -547808,7 +547969,7 @@ "support" ], "css/css-writing-modes/flexbox_align-items-stretch-writing-modes.html": [ - "21607233c9a23a074991d16d6ed9c9aca0f9ae03", + "ab67b2f3d7c04d9b5895690e58d87b7876a67337", "reftest" ], "css/css-writing-modes/float-clear-vlr-003.xht": [ @@ -548080,19 +548241,19 @@ "visual" ], "css/css-writing-modes/form-controls-vlr-004.xht": [ - "6914d51d54ecb957151ec4b28c78e36aafa39d91", + "74a61f01611e8ee94a7876f0fc25f23072f7a4d7", "visual" ], "css/css-writing-modes/form-controls-vlr-005.xht": [ - "e60cc92bf66c08e736e9de42789656bce2f051fc", + "b0e1c215ef2109b6c368c797230c598fb0f3b1c5", "visual" ], "css/css-writing-modes/form-controls-vrl-004.xht": [ - "07ce37a0f414c992b2fce54e4a99083b60211eae", + "fe1bc2ba6661cfd81522daa662fb7afba72a52bf", "visual" ], "css/css-writing-modes/form-controls-vrl-005.xht": [ - "66d70d81b3989e4c09e810fb60b338683a84eeca", + "d832533f2ebb2920825042369c41d69b80a90200", "visual" ], "css/css-writing-modes/full-width-001.html": [ @@ -548212,7 +548373,7 @@ "reftest" ], "css/css-writing-modes/inline-replaced-vlr-003.xht": [ - "9b9c4467b7f28b260b17ac4369a77a3f3a3e817d", + "f72cb8a3248bf77609a22ee3a34391523de4fd83", "reftest" ], "css/css-writing-modes/inline-replaced-vlr-005.xht": [ @@ -548224,7 +548385,7 @@ "support" ], "css/css-writing-modes/inline-replaced-vrl-002.xht": [ - "f44978eebcabf37ed58cd2348822f3d1f2e94eed", + "31b7b141bc3aec07518c8137e45cc5b26ff6be53", "reftest" ], "css/css-writing-modes/inline-replaced-vrl-004-ref.xht": [ @@ -548260,7 +548421,7 @@ "reftest" ], "css/css-writing-modes/line-box-direction-htb-001.xht": [ - "a290e316833ade62bf428b46a2898a84affc7272", + "453f463c4a6d86a8e805cc8e86dc8525bf94dab8", "reftest" ], "css/css-writing-modes/line-box-direction-slr-043.xht": [ @@ -548336,75 +548497,75 @@ "reftest" ], "css/css-writing-modes/line-box-direction-vlr-003.xht": [ - "752e434c451fc3b0bb9986e746d64d628fa42c28", + "fce65a4408f730996e2fc0123542d1f964e474a8", "reftest" ], "css/css-writing-modes/line-box-direction-vlr-007.xht": [ - "e5e880f141c5969bace944e1faa3a5d08d502f48", + "f50d16f39494e45d5e19f8519914a2b14c78b627", "reftest" ], "css/css-writing-modes/line-box-direction-vlr-008.xht": [ - "6973ed1a53be85662ee35373c6c804a4cd4a6c5b", + "f5727ca40ae082d57cb9efbd1c654d06818d2748", "reftest" ], "css/css-writing-modes/line-box-direction-vlr-010.xht": [ - "ba4512801fa678640e87d8056bfb32b24fc85ad1", + "2eb7988ae985d3af8fca7737a4fabc34da374fc5", "reftest" ], "css/css-writing-modes/line-box-direction-vlr-013.xht": [ - "5e524c292d28a1bf91ccb55773d86bb27d64c569", + "2c151c06a84c6c2ff13da6e5d1afe771812c9610", "reftest" ], "css/css-writing-modes/line-box-direction-vlr-014.xht": [ - "770e05aec411188ef3d4b219972f749c36fe61bb", + "53844bbf614e17a93f91a34fb26fa18ee317f3d1", "reftest" ], "css/css-writing-modes/line-box-direction-vlr-016.xht": [ - "63c157411aa3bc4c2d337bbc759538d185c28aa7", + "e4f5309e77d2593844541dd3167234578df34c48", "reftest" ], "css/css-writing-modes/line-box-direction-vlr-018.xht": [ - "7f208ddb5aaaa2fefabaa2cb4fd135457b21db63", + "b830252470915b490a685838e2ac1cfe812f3248", "reftest" ], "css/css-writing-modes/line-box-direction-vlr-020.xht": [ - "945936bfdff6e2875b55f01dd5ceb486e69e0b5f", + "00259ba5c73b3ae61536ecf2fd3c4c7e3f5255dd", "reftest" ], "css/css-writing-modes/line-box-direction-vrl-002.xht": [ - "b2ebf107af357829a42aa642a82455e2c6036b66", + "1358b346b6c09e4603723b9fe839cd2f4d561130", "reftest" ], "css/css-writing-modes/line-box-direction-vrl-005.xht": [ - "2ea9dba0b281414ead01c5acfb9d6fd077f7070c", + "2511bc1dd70fb0c37a30bcbb9b63fe7a1a46c374", "reftest" ], "css/css-writing-modes/line-box-direction-vrl-006.xht": [ - "5c5511f825591ae3be851db77bb67421240d18f0", + "02df1e861cf1207f870940122391cad086804215", "reftest" ], "css/css-writing-modes/line-box-direction-vrl-009.xht": [ - "f0965007e97854378823213907ca4376c88b8cee", + "bafc126591617e5569b844013b928911d42e9f84", "reftest" ], "css/css-writing-modes/line-box-direction-vrl-011.xht": [ - "f20641a146a85a1643d747841c9c84695213b40b", + "68959ef10aba7b87a2a455bbca3d8c7c2232ae48", "reftest" ], "css/css-writing-modes/line-box-direction-vrl-012.xht": [ - "92eaddce8d6556cd1d4766fed5f7d3f3e134e848", + "3c265d1f51b76ff5693fc489307fa7771f3fcc5a", "reftest" ], "css/css-writing-modes/line-box-direction-vrl-015.xht": [ - "0e8a6490f34844c1b3c8ffae8548319ebd1490fb", + "42aeec15139af295ce59de754420eb2f39dabc34", "reftest" ], "css/css-writing-modes/line-box-direction-vrl-017.xht": [ - "1f75a216320a8a09ac4f7ebe5725f71d2ce84735", + "a80fbbbf0df8db4d5e1a280fcb849bb54b94e0c2", "reftest" ], "css/css-writing-modes/line-box-direction-vrl-019.xht": [ - "4836379e962c1639e7daebfa3097dfa9d4a6c0aa", + "41f7a933fd56af25f1d5792ebd226ddea004b68e", "reftest" ], "css/css-writing-modes/line-box-height-vlr-003-ref.xht": [ @@ -548872,11 +549033,11 @@ "reftest" ], "css/css-writing-modes/page-flow-direction-002.xht": [ - "0c7a122aba02a19d18678d898cbf542308926899", + "fc754c098e80c833dcc65bd487c86852660632a5", "manual" ], "css/css-writing-modes/page-flow-direction-003.xht": [ - "6dfa1c5e24ea58513813792cfa7c7091a28c3a23", + "2b7da0ba95a5bf1ecc55ccb1bcb58deb719f3a5e", "manual" ], "css/css-writing-modes/page-flow-direction-slr-005.xht": [ @@ -549536,11 +549697,11 @@ "support" ], "css/css-writing-modes/replaced-content-image-002.xht": [ - "e3e5d876a430b49d3ddbfe44c057c880840fce1c", + "545b4a4a6ad2c9e0232cc1e8d754b12fa0ccd510", "visual" ], "css/css-writing-modes/replaced-content-image-003.xht": [ - "722a6ee09ef7417bee82100c39c674fda50a9bf2", + "ab5034f039a5c28757579dd9f42ab687aaf97578", "visual" ], "css/css-writing-modes/row-progression-slr-023.xht": [ @@ -549560,15 +549721,15 @@ "reftest" ], "css/css-writing-modes/row-progression-vlr-003.xht": [ - "de0c9334397de5b2798a90a478821eb9adbad491", + "11905b092d1fa51d14a0c8838f1f51dde1a6cbe6", "reftest" ], "css/css-writing-modes/row-progression-vlr-005.xht": [ - "56f0b8948c01323a65f0c023984597fceab5fecf", + "d326feb8a33c287f288c6e6cc47953dc43390069", "reftest" ], "css/css-writing-modes/row-progression-vlr-007.xht": [ - "a035d4d9748c8050897258d617a1e829675a31e4", + "cf4607991e228d0ca0877cc272408d21a8fc17b4", "reftest" ], "css/css-writing-modes/row-progression-vlr-009.xht": [ @@ -549576,19 +549737,19 @@ "reftest" ], "css/css-writing-modes/row-progression-vrl-002.xht": [ - "4b11e6f2d3199d4f4239b6237d34ac7406664087", + "8cfac808190e35b6b5f2c5016a71da8713946eaa", "reftest" ], "css/css-writing-modes/row-progression-vrl-004.xht": [ - "240faf15565dc5c03178996b5c2a55198a5ec4a6", + "8bd65f967ed35065e8972bf6c79e6d7319923e3e", "reftest" ], "css/css-writing-modes/row-progression-vrl-006.xht": [ - "d8f9e2fee9f0ec8e43eb532b77752f9dd54be70f", + "e56aa0af6bdb2646dea0eb572ac99d984965efdb", "reftest" ], "css/css-writing-modes/row-progression-vrl-008.xht": [ - "252c877b6b62e93b69b97a9dcc99498c5f56db65", + "d17f3101adf8dd24a79649ee9325f929fc8f135e", "reftest" ], "css/css-writing-modes/scrollbar-vertical-rl.html": [ @@ -552152,7 +552313,7 @@ "support" ], "css/css-writing-modes/writing-mode-vertical-rl-003.htm": [ - "3735deb43fa19541fd22e4080e6b85eef8b8abb3", + "ef816cc85f7fc02801caeb47f43e6b5937f9539c", "reftest" ], "css/cssom-view/CaretPosition-001.html": [ @@ -552172,7 +552333,7 @@ "testharness" ], "css/cssom-view/META.yml": [ - "1cfa985163c5b0dacf17b9fe5644a5a0a9fe21b8", + "6a0886479bb4a5674a36f46e8badc254ae680ded", "support" ], "css/cssom-view/MediaQueryList-001.html": [ @@ -552599,6 +552760,18 @@ "078e1dd6dd61d36cec239ed75d02051f61fe60a5", "support" ], + "css/cssom-view/table-client-props.html": [ + "92dd07645a8ce7ef71eec2459d8aa91085720390", + "testharness" + ], + "css/cssom-view/table-offset-props.html": [ + "c9a06fbd38d57b2d25f0922a7ce09bbd8ca871dc", + "testharness" + ], + "css/cssom-view/table-scroll-props.html": [ + "47e55907361861a931c1c12bbde64b6bef46d927", + "testharness" + ], "css/cssom-view/ttwf-js-cssomview-getclientrects-length.html": [ "7f3440e65abbe692e3c28f1f1d04671054ecc815", "testharness" @@ -552656,7 +552829,7 @@ "testharness" ], "css/cssom/META.yml": [ - "32bcb7233d09088f6a32ff45a678e90d12f75061", + "d2d7446d5b45050ec8ff27d527a7f69c273914c6", "support" ], "css/cssom/MediaList.html": [ @@ -553148,7 +553321,7 @@ "testharness" ], "css/filter-effects/META.yml": [ - "5092e906f3e0d5eb3c12f826973e85ae2175daba", + "36b76f31e884bc1420438b54f0476d87716a67ff", "support" ], "css/filter-effects/css-filters-animation-blur-ref.html": [ @@ -553424,7 +553597,7 @@ "testharness" ], "css/filter-effects/parsing/lighting-color-parsing-valid.html": [ - "6ad4604f9d1f37befbf3db7ee71860400179675f", + "cc008fbe596a964cd91d3ab5753240cfb621a8f3", "testharness" ], "css/filter-effects/parsing/resources/parsing-testcommon.js": [ @@ -553708,7 +553881,7 @@ "testharness" ], "css/geometry/META.yml": [ - "7a595b51eceb096b64c731be76c35384455845d9", + "a5f8ab9f8fcd6a209e0c124d36b47240af2023de", "support" ], "css/geometry/WebKitCSSMatrix.html": [ @@ -553748,7 +553921,7 @@ "support" ], "css/mediaqueries/META.yml": [ - "f13feed38eb7b551ba63712ac2faaf54e0a36730", + "258bf3092484aae437604a32504b10f9d5e55d4f", "support" ], "css/mediaqueries/aspect-ratio-001.html": [ @@ -553892,7 +554065,7 @@ "reftest" ], "css/motion/META.yml": [ - "25c35d5d9d7db960682b472fb8282001d7d7c385", + "434de577ced79410ce58afa025bfd768d6d39a26", "support" ], "css/motion/animation/offset-anchor-interpolation.html": [ @@ -554116,7 +554289,7 @@ "support" ], "css/selectors/META.yml": [ - "b7ec0439dc97d4e0bd3e9d1e760afcab0dde9be6", + "1e87c2c0232dcdcf8df027fab9faf3f6522412aa", "support" ], "css/selectors/Makefile": [ @@ -555448,31 +555621,43 @@ "testharness" ], "css/selectors/focus-visible-001-manual.html": [ - "ac7c1ef4bd82931d3a36f8b8b22aeafbc7b0a227", + "313aff207b5293a35cbd720455ec2223feb06559", "manual" ], "css/selectors/focus-visible-002-manual.html": [ - "7bd739f8e6bf47aa9ea264a8f898f60243279796", + "00c9ca73e61ba6e04f5a77ad9ca880fb91f1abda", "manual" ], "css/selectors/focus-visible-003-manual.html": [ - "4c187f47eb337b89c8717a3a30707da83500dbb8", + "af3d9b470393cb03cf739e6e98be88f23cde34f8", "manual" ], "css/selectors/focus-visible-004-manual.html": [ - "d657847b3df6f7da546f1034e49515f732aa971b", + "39cedf4919e7a553aa15fbcd48d79d0dc7d6a918", "manual" ], "css/selectors/focus-visible-005.html": [ - "0970640f1d7e4c78378157ae305f8f24e57b94c2", + "3c7dc48f1348531eb07dfd5ef556abdbe26c65a2", "testharness" ], "css/selectors/focus-visible-006-manual.html": [ - "e5be822a7a9dc5d9d22f6d4c90846308567ee4f6", + "dce2e1e9c56df4f568e65c331442760d1cd16153", "manual" ], "css/selectors/focus-visible-007.html": [ - "5f787f1d0245e12d12e4507d909e5c38b8096a58", + "254e8c649b9b3801df191e6dc18bf01932a00191", + "testharness" + ], + "css/selectors/focus-visible-008.html": [ + "fb51f0ceeba6fb224ad5aa27cc59d3d02bb096f3", + "testharness" + ], + "css/selectors/focus-visible-009.html": [ + "20661274b554037c42ed30fd426d7a74c914c734", + "testharness" + ], + "css/selectors/focus-visible-010.html": [ + "bfe15a4423b1600e6cd97759f4aab20004a4c258", "testharness" ], "css/selectors/focus-within-001-ref.html": [ @@ -557591,8 +557776,72 @@ "eb0fef0df552a64733d7e46a1b8752d6825f1f8b", "reftest" ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-block-001-ref.html": [ + "7fd47e0b4fee60f4f79dcc237749d2f0f08ca108", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-block-001.html": [ + "a98e6b2ac1cfa2e8a7d477df89dd5a3cc4efd737", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-button-001-ref.html": [ + "926830e320f2872694c68e648f9e7491809d43d0", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-button-001.html": [ + "f075e209ab4c2395a9bdeb0d27c1474d003d2cbe", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-flex-001-ref.html": [ + "68fa19ea1016379180e746367592f098b3b1f41f", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-flex-001.html": [ + "9777db3b2bf863c39e571de5c1baa79c506dcf1c", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-block-001-ref.html": [ + "6f03ab318c78a6c708f7a043c935d906289ebb63", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-block-001.html": [ + "2dd8d48642084f42fbd7b30112e901014e5b3692", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-flex-001-ref.html": [ + "83c91b306accb49a95e8d80c42b62d3091b4214d", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-flex-001.html": [ + "b992607b66dcb00a02ca85a6bab305548060c29e", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-001-ref.html": [ + "69a610e1ff20caf6fbb097fe1bc99335bfd169d3", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-001.html": [ + "cbf4c1e25d193ddf972f4b70677507f4cb1ea651", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-002-ref.html": [ + "50f1e17eb0dd43e196eca927798ec840bf82801c", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-002.html": [ + "f24219a61169cfb695f2b13431ba172effac56d2", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-003-ref.html": [ + "c43a8433fce7c5e7f1ef276887cd2e10cf3ad7cc", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-003.html": [ + "517690a217f285264dd9d01d59bb615bed372770", + "reftest" + ], "css/vendor-imports/mozilla/mozilla-central-reftests/contain/reftest.list": [ - "865b3c38162cfb5ef744335416302ca0960f635e", + "53ebe34c7dcec40222d6482ca1443095dff27ae3", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/counter-styles-3/dependent-builtin-ref.html": [ @@ -558807,6 +559056,30 @@ "95154acaff08d7d3f999afe1ea1979017fdcc115", "reftest" ], + "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-001-ref.html": [ + "650a715625c34c1913249f10260613f4ff45ac43", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-001.html": [ + "b2424541ae9b4179deb6d1d3ceca9b7498d59361", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-002-ref.html": [ + "9a19c2cb613772b61e2fd45d57130fc44c3a8878", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-002.html": [ + "a2cc237747696692d49cfe873eb7889416384af3", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-003-ref.html": [ + "6a18aaf830075cfa92fc21072bb93482f646b718", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-003.html": [ + "42176e397fdd13e84204d2ac22ec2490e25111c6", + "reftest" + ], "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-definite-sizes-001-ref.html": [ "bf136f86366ee98f217086d5803adbf3b5a45027", "support" @@ -559628,7 +559901,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/reftest.list": [ - "d0843c4f0db3bbd437a99ec2d9281841febfa47e", + "3e0f7e9939ebe4d6e646c33bb1d9d113945bff7e", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/support/Ahem.ttf": [ @@ -561480,11 +561753,11 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/multicol3/moz-multicol3-column-balancing-break-inside-avoid-1-ref.html": [ - "e4c519e59544140de558aff7b13b6ac3e19651c8", + "9f049514bfc1bf8dfc383396127fe3aa1dd55f92", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/multicol3/moz-multicol3-column-balancing-break-inside-avoid-1.html": [ - "4a68c1461a5ffecb87ee8f780bd37f53c9c7508b", + "a3dc2c04f3898a19bb34dad92ba64ea1ca39b0cc", "manual" ], "css/vendor-imports/mozilla/mozilla-central-reftests/multicol3/multicol-height-002.xht": [ @@ -561788,7 +562061,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-005-ref.html": [ - "f5f5e55dac9bf15f31ef5a74354a83029235044c", + "257772aeb17c65ee0d3bfc6a6cd15f4e86beaff9", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-005.html": [ @@ -561796,7 +562069,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-006-ref.html": [ - "3f9d65310a5ea106709f5df8f8a694af0bac67c4", + "0b3fda615c5bcec5a6c17d2388291c30096e83ec", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-006.html": [ @@ -561804,7 +562077,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-007-ref.html": [ - "7219df7ca289c0ae302ff7d10c16f8eb4e0c6f74", + "0efb9bc179848cac49c6e20f0428fc05bbab9557", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-007.html": [ @@ -561812,7 +562085,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-008-ref.html": [ - "7a5766b1b2436c6db176c728a702fcdbe0edef23", + "99dcdb5de94bd597312d801568a52b5280183aa0", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-008.html": [ @@ -561820,7 +562093,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-009-ref.html": [ - "393b6f4393e6386dd51bed494910e85762fd1db9", + "8ab36f28d57c4fa263d542a4248495abe9b48257", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-009.html": [ @@ -561828,7 +562101,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-010-ref.html": [ - "ecc9d23815dc060a0941610b1acc00cf9dcdd4e8", + "4108bee66768f3cbc02e22b95ee0a61bd54cb9dc", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-010.html": [ @@ -561836,7 +562109,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-011-ref.html": [ - "f262b93bca33c4bd502590c9ace487c3d4c07306", + "0623546dfbe6638fd07b12a9e74ab3840d0c55ca", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-011.html": [ @@ -561844,7 +562117,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-012-ref.html": [ - "6f5fba39f50223c8377014833963c207c4c0237d", + "0a75d9e920c204aea5c9c462541c97ee5f07a2c1", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-012.html": [ @@ -561932,7 +562205,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-048-ref.html": [ - "7983204f8201695a5ed8ca4c55f3f31ab01aa05e", + "7bd832293e95f3b3a05d2657ac38414cf76dbe5c", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-048.html": [ @@ -561940,7 +562213,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-049-ref.html": [ - "5798bbc16bee68ea8e4c683191bf0269e53dd997", + "5bb73544767e000cc1ca59a0fd12fbafe1332fbd", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-049.html": [ @@ -561948,7 +562221,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-050-ref.html": [ - "497e0d26808b8d23afc8bde7a9dfc3e679c78390", + "8cc0a53539255dcafc7260de74757f8c73c17831", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-050.html": [ @@ -561956,7 +562229,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-051-ref.html": [ - "e73f765b30f41473abd003d0f10b4b0897ff51a9", + "cfc8648f8a67beea3e3e7427beb6ee88d40852f0", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-051.html": [ @@ -561964,7 +562237,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-052-ref.html": [ - "dafc80f11db90089c6954329fe8a0ab4a755c557", + "3a446155b2e9bf8277d71fc6073b697a26199e10", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-052.html": [ @@ -561972,7 +562245,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-053-ref.html": [ - "56720f0c7629ab2ab271b708d63b554a995d62ea", + "7da5e25b7860b29e8f2ba0f2aa23b8efd60a8bc1", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-053.html": [ @@ -561980,7 +562253,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-054-ref.html": [ - "8cf4e23670d557069d07d912f0acd94389683c91", + "c1e6a67b67eccc5360da939bb5261b7295516671", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-054.html": [ @@ -561988,7 +562261,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-055-ref.html": [ - "d257a98d01e6225df871e3117273d533e0f51066", + "21e1aae9a647645b8461c43bfeca33c8ade16a2e", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-055.html": [ @@ -562140,7 +562413,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-046-ref.html": [ - "243429ea605daf4083c6a05a7bb433f586e4f969", + "0fcd0ea9a3db817ca1eaea7066cb8023d6a1d942", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-046.html": [ @@ -562148,7 +562421,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-047-ref.html": [ - "3236bcc44d6c49c04683961ac883fc23ed78bdae", + "866c645fc0b20f103d2377d2976d5a87e76635b1", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-047.html": [ @@ -562156,7 +562429,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-048-ref.html": [ - "0da2df88a75bafe076f0e4d1b832fcc55cfef88e", + "63e794fb55602d8eae641b8f02543168bfd9ba7d", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-048.html": [ @@ -562164,7 +562437,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-049-ref.html": [ - "4c0dc2985beb6257fe22e9b16c8abc28d6120d04", + "b031715b71f273d9d2ff7bbdf276e42851664dd6", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-049.html": [ @@ -562172,7 +562445,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-050-ref.html": [ - "987a2e6a17ad851b701f03345cee1964744f739e", + "f0953a770f895c8a2f4a2126883bc1a91369a267", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-050.html": [ @@ -562180,7 +562453,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-051-ref.html": [ - "1a417d04b206680ab33f866e82bc91f8ee14d67b", + "4c2f498e229fd9257f78feda1f26a58406e396b9", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-051.html": [ @@ -562212,7 +562485,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-020-ref.html": [ - "8e109e72edb9cb0d3c97677db8a98462da83054f", + "7902ba738d33bd00a1f60e0e81b44a4587a87ac7", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-020.html": [ @@ -562220,7 +562493,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-021-ref.html": [ - "7ce1d8570bf9df6e5955b78fb68a43c9dd0eb82e", + "88b521a1cc7915d64427a6f690ad194c05bbbe6f", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-021.html": [ @@ -562228,7 +562501,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-022-ref.html": [ - "190e87868a2a12e1273ee815b830c6263c7c58ff", + "68d213c75d49445218f59d144f3eb227f131d68b", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-022.html": [ @@ -562236,7 +562509,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-023-ref.html": [ - "e6e291aee79452774ba8c24c0580ad6a414f9db1", + "0f4b2b8b0999f97685a43b456bb6e8e4026f6d57", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-023.html": [ @@ -562244,7 +562517,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-024-ref.html": [ - "355a90099f40741edbd063aa0d4ca130a2f51d78", + "79b7822cf9873e41860e7ad020a57aee28edb6c3", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-024.html": [ @@ -562252,7 +562525,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-025-ref.html": [ - "9f117d01c711094225e2e64089a4243143e120c5", + "82a2bab683c0683429a705a221db6af285ab6aa8", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-025.html": [ @@ -562260,7 +562533,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-026-ref.html": [ - "9732a16b7c883a1ff029b25663f2d32251265a4f", + "a8356fc4e37c80b3957050ae7084e30d756de43d", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-026.html": [ @@ -562268,7 +562541,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-027-ref.html": [ - "80bd7bbb44294078ad9ae417bc167e71031e5494", + "6fafea8bd05da33567fc09390d39b77594a4a514", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-027.html": [ @@ -562404,7 +562677,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-020-ref.html": [ - "75405d186f20cffffe3d9ab111123166be06bc6e", + "97b0f35e11580f4e83bf08a826383a07e95b6864", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-020.html": [ @@ -562412,7 +562685,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-021-ref.html": [ - "e36adb33fb095d7a907de6045f576cd823a23587", + "779439f70d61db6b3a44a81bb57c263d4bf30e8a", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-021.html": [ @@ -562420,7 +562693,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-022-ref.html": [ - "64971cf7ed776b7d6cd951283fa95aed80b7dae4", + "4d8d34cffe717903f3fe24af6de52b155ebdf48e", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-022.html": [ @@ -562428,7 +562701,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-023-ref.html": [ - "6ffa78a826332b1397b4ec924c1c456ccf7413e6", + "5539eef9f779f352f93ead1fde30cec5e01548a0", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-023.html": [ @@ -562436,7 +562709,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-024-ref.html": [ - "7c5846eebf734415da3cefc39041a5f377997a2b", + "0a0caa791c974280fb345c55e990180c8262604f", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-024.html": [ @@ -562444,7 +562717,7 @@ "reftest" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-025-ref.html": [ - "51cf20e605aa791e3d63c4902377aa3aca987ad7", + "10338219468848d954214fc1ca27fe5c19cd671f", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-025.html": [ @@ -562468,7 +562741,7 @@ "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/sync-tests.sh": [ - "1c18dc5fdcddbbd08dbdc812f538a175e58892d7", + "100b066f9c314bf281db3dba3684abe72fd169e2", "support" ], "css/vendor-imports/mozilla/mozilla-central-reftests/text-decor-3/reftest.list": [ @@ -565092,7 +565365,7 @@ "testharness" ], "custom-elements/Document-createElement.html": [ - "095cf0b0907bcd53ba8f0b655ec1655329959a98", + "b37635c37e025ca7a37cd7475fea1d918d8929e2", "testharness" ], "custom-elements/Document-createElementNS.html": [ @@ -565104,7 +565377,7 @@ "testharness" ], "custom-elements/META.yml": [ - "c4f8236cbde2ae6726d7f675380018e3811a5e48", + "5977bb66245bc932b05dfa6eb1024cc2bf82901b", "support" ], "custom-elements/adopted-callback.html": [ @@ -565348,7 +565621,7 @@ "testharness" ], "device-memory/META.yml": [ - "a15cacc470822511c789ebb6bb1b21d3bd18b085", + "6dc490adab1b4d24a2c228c6658deb58f5a88b20", "support" ], "device-memory/device-memory.https.any.js": [ @@ -565592,7 +565865,7 @@ "support" ], "dom/META.yml": [ - "92a7c6d490702d30d6c34c3a61dc09d9d2840a69", + "671e9f86e92aafb388cfd3b5dcd7d0046277e755", "support" ], "dom/abort/event.any.js": [ @@ -566732,11 +567005,11 @@ "support" ], "dom/nodes/ParentNode-querySelector-All-xht.xht": [ - "7c245a11e39f6e7b23bd63ffe5daab6f4d9de2c3", + "e12ff58cca6152f94173b2f7c34c42206b1b434b", "testharness" ], "dom/nodes/ParentNode-querySelector-All.html": [ - "f2bc7ad3c9c348a8d06c1c1cd5cc0d759e9651f7", + "25fce631f5ea3b4e5166a67cc2c3e64b9383be7f", "testharness" ], "dom/nodes/ParentNode-querySelector-All.js": [ @@ -567208,7 +567481,7 @@ "testharness" ], "domparsing/META.yml": [ - "c45c5f3136739ebcd3b099206484077c5e179c2e", + "59fa16dfc7c0232d7a5f03be0004accc79597fbf", "support" ], "domparsing/XMLSerializer-serializeToString.html": [ @@ -567296,7 +567569,7 @@ "testharness" ], "domxpath/META.yml": [ - "e307eb75427dcc46a6613e2118a66bb854f6a164", + "4abe032da356ca26e4efe90a4815e318d487d04e", "support" ], "domxpath/document.tentative.html": [ @@ -567320,7 +567593,7 @@ "support" ], "dpub-aam/META.yml": [ - "521d90b87283645c22b8752fdb69031cc08cf3f7", + "972313fd96dfadbeb7d01319aac8dcb8838d5e9c", "support" ], "dpub-aam/README.md": [ @@ -567488,7 +567761,7 @@ "support" ], "dpub-aria/META.yml": [ - "1e4adc07cf5790fd51820158c69c1dd2c1a72c28", + "28c31867b42839d80f0fd7f825221e4d6a403258", "support" ], "dpub-aria/README.md": [ @@ -567500,7 +567773,7 @@ "manual" ], "editing/META.yml": [ - "ee0778f37e92351be3e95c9c23f23b743e71e5eb", + "e96076b9ff0b2d8ab7e44ec43e4c969a97b063cb", "support" ], "editing/README": [ @@ -567528,7 +567801,7 @@ "support" ], "editing/data/delete.js": [ - "7af419763d9e8354361a109645da610099cf97b7", + "ce38b9c3083f90783526b3fb481fa4784a19f7f6", "support" ], "editing/data/fontname.js": [ @@ -567548,7 +567821,7 @@ "support" ], "editing/data/forwarddelete.js": [ - "1836be2c6f827de512381e9556e99de6cad165d6", + "c0fc57022a1c8e8ddb1ccdbb9bd9051edb95be58", "support" ], "editing/data/hilitecolor.js": [ @@ -567675,29 +567948,29 @@ "36b4f58bba27da2cf703c3d05be9566384c46486", "support" ], - "editing/manual/delete.manual.html": [ + "editing/manual/delete-manual.html": [ "2c11496c5db12571faacaebd6bb7b1f756dbf338", - "support" + "manual" ], - "editing/manual/forwarddelete.manual.html": [ + "editing/manual/forwarddelete-manual.html": [ "4ed58171d88661ab0939d5aeb6340e2f24bdcd5d", - "support" + "manual" ], - "editing/manual/insertlinebreak.manual.html": [ + "editing/manual/insertlinebreak-manual.html": [ "c83f9b87e0a59246e779795d2f15740b54008d8f", - "support" + "manual" ], - "editing/manual/insertparagraph.manual.html": [ + "editing/manual/insertparagraph-manual.html": [ "b4555f993dccee606bff36076e6605b83f044b25", - "support" + "manual" ], - "editing/manual/inserttext.manual.html": [ + "editing/manual/inserttext-manual.html": [ "c1488f03b3319e4f1a2cfb71ebeddde6b0ca96d4", - "support" + "manual" ], - "editing/manual/inserttext2.manual.html": [ + "editing/manual/inserttext2-manual.html": [ "7a5589f41ab8405d6ed09a4b83bd0c60e2a59677", - "support" + "manual" ], "editing/other/delete.html": [ "c812df13215631719f8ff17eee4e0a854684670d", @@ -567852,23 +568125,23 @@ "testharness" ], "encoding/META.yml": [ - "cd0da6ea497c98a0cd0afd943ae731ca364a743d", + "78e7b2da8f65310a77a5f4f5c1bad0bdba1156a8", "support" ], - "encoding/api-basics.html": [ - "f941c016bd9f6117af2e28652c770613c475b064", + "encoding/api-basics.any.js": [ + "1d6388311365567f7cfef142517c1d6d6dab8a69", "testharness" ], - "encoding/api-invalid-label.html": [ - "38912a0e00f769ff9c116a5871b3691d059a4ef9", + "encoding/api-invalid-label.any.js": [ + "292df0f5ce44492e166f71a8b1b3b9312cf508fd", "testharness" ], - "encoding/api-replacement-encodings.html": [ - "ea956ff139f386abf52226d981dbb5ec0e3f2a38", + "encoding/api-replacement-encodings.any.js": [ + "81fd6d2552cf0be770143cf322a581aabe762c7e", "testharness" ], - "encoding/api-surrogates-utf8.html": [ - "e44be4c30e9c65a4b51972efab2e161f166d58a5", + "encoding/api-surrogates-utf8.any.js": [ + "3714e4020601bc5f50de7ddd7d0dfb6fd2471a28", "testharness" ], "encoding/big5-encoder.html": [ @@ -567919,8 +568192,8 @@ "d37d060ee1ab2b54cf4dccc2cb80796771324ef7", "testharness" ], - "encoding/iso-2022-jp-decoder.html": [ - "c189c2f99ee066e9419fdebef5d620edf97cd785", + "encoding/iso-2022-jp-decoder.any.js": [ + "65fcb01cb4ade9d7ba4745ab59933d3a14c675ed", "testharness" ], "encoding/iso-2022-jp-encoder.html": [ @@ -568468,7 +568741,7 @@ "testharness" ], "encoding/legacy-mb-korean/euc-kr/euckr-decode-ksc_5601.html": [ - "70d7606a3c067b5c3d1c6f718ffd797427b5e687", + "fc04f9c19c600fbd29596b6999b2f3b42492f8b6", "testharness" ], "encoding/legacy-mb-korean/euc-kr/euckr-decode-windows-949.html": [ @@ -568919,8 +569192,8 @@ "22f0299c5a8741c6585c3f56b471d6970d0bb499", "support" ], - "encoding/replacement-encodings.html": [ - "10ebae214ee7307c8087206a318ce8b5765ed8e9", + "encoding/replacement-encodings.any.js": [ + "06219fcf2f4098266bef3c5730058644b137a942", "testharness" ], "encoding/resources/decode-common.js": [ @@ -568991,52 +569264,52 @@ "60eb39cc7d5115ee50611e81bbd332228ef4e03b", "testharness" ], - "encoding/textdecoder-byte-order-marks.html": [ - "d53e5217cd1cfe73c01b1136449a6dd2a0ef0c21", + "encoding/textdecoder-byte-order-marks.any.js": [ + "317b4196f7c52a15d00d565470667b9a6b789e5e", "testharness" ], "encoding/textdecoder-copy.any.js": [ "50a59f2691a7f483b262239935d9dbcc6b918d9d", "testharness" ], - "encoding/textdecoder-fatal-single-byte.html": [ - "e34be18ce290ac5dbf8eaf27adba0d1bec001b1e", + "encoding/textdecoder-fatal-single-byte.any.js": [ + "30228b150f17c781d2eaf58e428e9b470bc286e8", "testharness" ], - "encoding/textdecoder-fatal-streaming.html": [ - "17dc6a268ec850dcb6556e0cda75a29ce610ec4a", + "encoding/textdecoder-fatal-streaming.any.js": [ + "7c278fd666b97dc21fae8d76b164c24f1031b098", "testharness" ], - "encoding/textdecoder-fatal.html": [ - "c9305f447d904cbc1931666ec419f995346afee2", + "encoding/textdecoder-fatal.any.js": [ + "92c9d56e23b58a4a5c1a4b72e039befd1cb3414f", "testharness" ], - "encoding/textdecoder-ignorebom.html": [ - "6ed76e3d1b164c16aa2a1162c39250195af42c92", + "encoding/textdecoder-ignorebom.any.js": [ + "8d38a52fa000d54d948b4a1edb657ee58848bf5b", "testharness" ], - "encoding/textdecoder-labels.html": [ - "e1eda76bf8bed9a0e8778fad772fa0504089c919", + "encoding/textdecoder-labels.any.js": [ + "e141d33d966a3573fd6f90df30bb3922c6979129", "testharness" ], - "encoding/textdecoder-streaming.html": [ - "b20e902062c9e6612920e176e2856a7081eb72ef", + "encoding/textdecoder-streaming.any.js": [ + "e33fdc5ad4a34bb93ae447e5b52377b58fc3c937", "testharness" ], - "encoding/textdecoder-utf16-surrogates.html": [ - "b38d339610e7bc19d000d545243508a6eb01725d", + "encoding/textdecoder-utf16-surrogates.any.js": [ + "6f29d469e96f67ebf4f56427e45aed187d2c7669", "testharness" ], - "encoding/textencoder-constructor-non-utf.html": [ - "9b727c86e718400dcc4bec2a4b4a974cce81a66b", + "encoding/textencoder-constructor-non-utf.any.js": [ + "5a01c63d25c2d3aacd9c5afa54f4a6b27ad7403e", "testharness" ], - "encoding/textencoder-utf16-surrogates.html": [ - "2a65ef4f2ef610cffcb121998b7397568c197afb", + "encoding/textencoder-utf16-surrogates.any.js": [ + "e286db5cac8fe7dd9da7fe1ef1a761e3195d3c7e", "testharness" ], - "encoding/unsupported-encodings.html": [ - "7fecb06dda9672e97759aaa8bc18e636b6b1480a", + "encoding/unsupported-encodings.any.js": [ + "31de34ff3955a9cf96310ccb51cfa1f376546831", "testharness" ], "encoding/utf-32.html": [ @@ -569044,7 +569317,7 @@ "testharness" ], "encrypted-media/META.yml": [ - "ae2b9098914e28815df92dcc9b578c189eb2b940", + "398eff6944c88f2f889d9156572d0802631ce09a", "support" ], "encrypted-media/README.md": [ @@ -569760,7 +570033,7 @@ "support" ], "entries-api/META.yml": [ - "d1d7677378a2fda860bfbb11d774fddc17eacf1e", + "dddb2ec171c11798b9d05dc50a66976a95c08731", "support" ], "entries-api/README.md": [ @@ -569868,7 +570141,7 @@ "support" ], "eventsource/META.yml": [ - "e71b48a10f86a1428818bfaede2832b7221532a7", + "ff92b69a150982a43972f2198ffabeb7eeb8b9a5", "support" ], "eventsource/README.md": [ @@ -570172,7 +570445,7 @@ "testharness" ], "feature-policy/META.yml": [ - "b69d338123b14b5c9c9037422823630075d79575", + "9c8175c06907922b3badeb4c7b6c1c37e5a74953", "support" ], "feature-policy/README.md": [ @@ -570492,7 +570765,7 @@ "support" ], "fetch/META.yml": [ - "5b68f3a4049c6c1082ab3a5c69fbb38603f57bff", + "b5187e708bb35ad188996293ccdd8f716439447d", "support" ], "fetch/README.md": [ @@ -570503,10 +570776,18 @@ "9465007a35059e9d72d4ab1dd8bff0d44f47c3d6", "testharness" ], + "fetch/api/abort/destroyed-context.html": [ + "5cc67576c6b355dcb16b7934f075506b1ebc970b", + "testharness" + ], "fetch/api/abort/general.any.js": [ "83da4c7859ee4d1a6a386b75c12b8a87e1347fe8", "testharness" ], + "fetch/api/abort/keepalive.html": [ + "5e830116d31e9fa793f8f564798c9b8d50ee8812", + "testharness" + ], "fetch/api/abort/serviceworker-intercepted.https.html": [ "b5169e88b2146712ee98cd2c6f7575ce3f2999a3", "testharness" @@ -571204,7 +571485,7 @@ "testharness" ], "fetch/api/response/response-cancel-stream.html": [ - "453323c2a0f9a908966df3cb53211c0b0a1fa19d", + "ad839d3e6234d16aa61338b732f765572cf8291f", "testharness" ], "fetch/api/response/response-clone.html": [ @@ -571464,7 +571745,7 @@ "testharness" ], "fetch/cors-rfc1918/idlharness.tentative.any.js": [ - "08d7db9d67437d64350503f153abfd7015a0d27e", + "ad0cbb0dc40ce8176ad6c618d7a764134739378a", "testharness" ], "fetch/cross-origin-resource-policy/fetch-in-iframe.html": [ @@ -571552,11 +571833,11 @@ "support" ], "fetch/http-cache/304-update.html": [ - "2571df43eb57ecbd29f55c2fc57b16f227001787", + "3f8fa7c0d25d6f3d1ec12ddd4e28e9c922115ed6", "testharness" ], "fetch/http-cache/README.md": [ - "b9ccc7958ae3b00cd1b9c08b1e673b49ace0ca1c", + "5d07e2fc10b7898469cd73dd0a3c91dc4d09ee88", "support" ], "fetch/http-cache/basic-auth-cache-test-ref.html": [ @@ -571568,31 +571849,31 @@ "reftest" ], "fetch/http-cache/cc-request.html": [ - "2002d341679139428e164cfe916dd39b9b664a3e", + "e6b5bb75f0b4997bbbaff068ddfc4d7a99d86455", "testharness" ], "fetch/http-cache/freshness.html": [ - "84016c3d56e01f8f6be52cf4d26a0e4e860b9147", + "a2e67ceb2e2a70ec9a05a7721435a45490438c1d", "testharness" ], "fetch/http-cache/heuristic.html": [ - "63837026eb6085fc7d6220c3dcab200b4bcd1eca", + "923e1608cb2880a5f03bd0b915aac035454a2778", "testharness" ], "fetch/http-cache/http-cache.js": [ - "a61ea6705ce517f1e8e0e522026a75f1dbbe5a0e", + "f1142531189d038d8eb0bf66e1f9c3b7784a780b", "support" ], "fetch/http-cache/invalidate.html": [ - "848a26000ed9bf4c61516201e4006b97839bee11", + "ca588057fbc10f1f9aef56c2c8284e36ac01ee4c", "testharness" ], "fetch/http-cache/partial.html": [ - "685057fe8876321a5d42bcf1e7582e6f0b745f85", + "8030a72a24325cd4b872164328829a6dad4a5f0c", "testharness" ], "fetch/http-cache/resources/http-cache.py": [ - "00b65e27915c5d16f0de04821eacc675b32e4ee7", + "7d1e5b92d4b2229051c24f5c927a22843f549705", "support" ], "fetch/http-cache/resources/securedimage.py": [ @@ -571600,11 +571881,11 @@ "support" ], "fetch/http-cache/status.html": [ - "dac72c83edb75519e8ef5c3324442def4f380349", + "c98cdde7d574189daed43241e2de8aaf118712bc", "testharness" ], "fetch/http-cache/vary.html": [ - "45f337270cfa90932c7469802655e313367ac92f", + "01571c540abef4a2cbc963c7c645739411179c02", "testharness" ], "fetch/nosniff/image.html": [ @@ -571752,7 +572033,7 @@ "support" ], "fetch/sec-metadata/script.tentative.https.sub.html": [ - "b053afa3063b5c57b5d702da12b2d899080f0430", + "7db1a28d1466d72be59cae56adf64c3428ff5df6", "testharness" ], "fetch/sec-metadata/window-open.tentative.https.sub.html": [ @@ -571772,7 +572053,7 @@ "testharness" ], "fetch/security/redirect-to-url-with-credentials.https.html": [ - "6eb9c75887afd084c12dee609dd4c4a7cf7a6a5e", + "a74c316c593a1abe293e13198c56927481382f15", "testharness" ], "fetch/security/support/embedded-credential-window.sub.html": [ @@ -572408,7 +572689,7 @@ "support" ], "fullscreen/META.yml": [ - "9c6bce2f464418a60484143a7548049a0ba14698", + "a79bdb828ebe11be255d9542b5a7d98354be7d49", "support" ], "fullscreen/api/document-exit-fullscreen-active-document.html": [ @@ -572460,7 +572741,7 @@ "testharness" ], "fullscreen/api/element-ready-check-allowed-cross-origin-manual.sub.html": [ - "f62f912aeff6cd173e6e43aa9634568e32c0104c", + "d864f87d809df9a46262eac16e315fb7baaf74c1", "manual" ], "fullscreen/api/element-ready-check-containing-iframe-manual.html": [ @@ -572596,31 +572877,31 @@ "manual" ], "fullscreen/model/move-to-iframe-manual.html": [ - "7d591d11ce4a399156ed7cae7ddbee93aa8cb883", + "f4cbfacda3fdb0e67b5eb34136b774b7d33fe415", "manual" ], "fullscreen/model/move-to-inactive-document-manual.html": [ - "e3f8160bd2457bfb2797f85aed082f865ae6ad78", + "a545e45a5c77a77d4a7247950ef9187b9008e5a7", "manual" ], "fullscreen/model/remove-child-manual.html": [ - "0b19b1bbb6040b4ca6280bba0f742680856c5b9a", + "0f60c750db56a437df5041f03d55575cc19243a6", "manual" ], "fullscreen/model/remove-first-manual.html": [ - "b694dcf40492ec67239f19152779794acde3fe4a", + "6a89dee427d3447d7713d1a28540233f3d401a85", "manual" ], "fullscreen/model/remove-last-manual.html": [ - "5c425c386688bf38a8b26ba25c43923e128db88e", + "62e4f400c279c80e3f1819420d70dc3dca66dce9", "manual" ], "fullscreen/model/remove-parent-manual.html": [ - "c0f0103c9e4491ef04b016f7bbacd8564ea5493d", + "910da6d6ba080cc797cfc0f118956f72929ad1a9", "manual" ], "fullscreen/model/remove-single-manual.html": [ - "64bf88ae3a1a3708dfe823d85f67636ae5b0d736", + "0310b7223cac79a705b9335fc15b73fd1c4b2770", "manual" ], "fullscreen/rendering/fullscreen-pseudo-class-manual.html": [ @@ -572640,7 +572921,7 @@ "support" ], "gamepad/META.yml": [ - "bb395ebb2cc44e69bbdc6a281a01115239ddf096", + "95ee3087c17a73f3eb1fd59c56d6c4ff7ecf532f", "support" ], "gamepad/events-manual.html": [ @@ -572656,7 +572937,7 @@ "manual" ], "gamepad/idlharness.html": [ - "7b886df0d36a15f77936943eadecd633d9ea46f1", + "0cb95e9fda86db8327efdd3a05c3b2a99d480255", "testharness" ], "gamepad/timestamp-manual.html": [ @@ -572664,7 +572945,7 @@ "manual" ], "generic-sensor/META.yml": [ - "5de173230a2e4904d93951cb5da07c2140768f2c", + "b746a0c86e7b818c3681bc06c02fab58cc9f9e58", "support" ], "generic-sensor/README.md": [ @@ -572680,15 +572961,15 @@ "support" ], "generic-sensor/generic-sensor-iframe-tests.sub.js": [ - "5da31d59d88db106abe5d22646c1426241ff404d", + "a2c114dbaf9c82e755647f6431d76053e8fac1cf", "support" ], "generic-sensor/generic-sensor-tests.js": [ - "b950811d99ac923c300a45967889a57ec8bf2204", + "5179cfb6bf7d65930900602e490c479297aa6979", "support" ], - "generic-sensor/idlharness.https.html": [ - "02c734b907075c8abb7504fc7e2b93730ac80a0c", + "generic-sensor/idlharness.https.window.js": [ + "b3d60e51becc6520541f152d92d4cc2db47d7137", "testharness" ], "generic-sensor/resources/iframe_sensor_handler.html": [ @@ -572696,7 +572977,7 @@ "support" ], "geolocation-API/META.yml": [ - "a2dfb8c30024323213d0c98bfb255625c5bfe0fe", + "70d83403d66c6406146ec9462f4908b78ecd2a3a", "support" ], "geolocation-API/PositionOptions.https.html": [ @@ -572735,8 +573016,8 @@ "aabbc7b2d392e2bbc26c08262bae4d57348da7a2", "testharness" ], - "geolocation-API/interfaces.html": [ - "c5e300b504b6bf75818fbe79728c87b086ccce3d", + "geolocation-API/idlharness.window.js": [ + "9ac60d18abcfe72209d493d4046d86b7605f1760", "testharness" ], "geolocation-API/support.js": [ @@ -572787,6 +573068,10 @@ "1c523e7cd5741e4a515119b129b041b11cbc92cc", "support" ], + "geolocation-sensor/GeolocationSensor-iframe-access.https.html": [ + "d1e85d4c9197e35231555f82c4a3ece5f210b6f2", + "testharness" + ], "geolocation-sensor/GeolocationSensor.https.html": [ "7409dc69d96e1bc694b137c908448896576a1769", "testharness" @@ -572804,7 +573089,7 @@ "testharness" ], "geolocation-sensor/META.yml": [ - "5de8e1095bec7eb4dded143ac269e09ba4fa02c4", + "f30e3e92646c4ab20aab3b14d2418214e9e0a918", "support" ], "geolocation-sensor/idlharness.https.html": [ @@ -572812,7 +573097,7 @@ "testharness" ], "graphics-aam/META.yml": [ - "521d90b87283645c22b8752fdb69031cc08cf3f7", + "d38103192c94766770023b35bf18fdde733765f8", "support" ], "graphics-aam/graphics-document_on_html_element-manual.html": [ @@ -572888,7 +573173,7 @@ "manual" ], "gyroscope/META.yml": [ - "f99b5f4f8bb9d631f1b55857512be56738801e6e", + "45ddcab383d36c4993f487dadb339adc729f63eb", "support" ], "gyroscope/idlharness.https.html": [ @@ -572896,7 +573181,7 @@ "testharness" ], "hr-time/META.yml": [ - "088f3eb90a01853b7f6af3dab6d84871fe2f6732", + "81eeee96c0b34fd09f4360aa92624208beb94689", "support" ], "hr-time/basic.any.js": [ @@ -572935,68 +573220,8 @@ "51267d21c761c3ccaee34bc4d5e533e69d739bc5", "testharness" ], - "html-imports/META.yml": [ - "11323815db763cf9d0649abb86380139cf9c136c", - "support" - ], - "html-imports/document/document-method-changes.html": [ - "8a90989d87713f746a4a9d4d0d8c4816ba2beab3", - "testharness" - ], - "html-imports/document/resources/body-only.html": [ - "c3b2c7949a76a93f37d17ce9c73f9cbf409f71ae", - "support" - ], - "html-imports/document/resources/test-in-import.html": [ - "7a1e3187d5d622045131a4a983f269c141c6a504", - "support" - ], - "html-imports/fetching/already-in-import-map.html": [ - "ae688a3085030e42436256481111d4794102885e", - "testharness" - ], - "html-imports/fetching/loading-attempt.html": [ - "c2e55cc530dcf497e022b47aee69c81120bfdd45", - "testharness" - ], - "html-imports/fetching/resources/async.html": [ - "0c47a589bdeb3b284de1000849ec7a0387393732", - "support" - ], - "html-imports/fetching/resources/dynamic.html": [ - "dece37f1264025c6968b81252edf4ebc1f701adf", - "support" - ], - "html-imports/fetching/resources/hello.html": [ - "2c118b51566fc8dc7ecd6304e04d3b7ca5fa2244", - "support" - ], - "html-imports/fetching/resources/parent-of-hello.html": [ - "d824222626234a376b86edc75a8cd7bbf343111f", - "support" - ], - "html-imports/html-link-element/import-attribute.html": [ - "9cdfe3f3ab4dc09f3ba400921fcd2c02f5331da6", - "testharness" - ], - "html-imports/html-link-element/resources/body-only-0.html": [ - "29691598d52a661b961a3bdfaffeb410b5be37fa", - "support" - ], - "html-imports/html-link-element/resources/body-only-1.html": [ - "321d26a916eb54298c8e4f951c6a3f9b22f60524", - "support" - ], - "html-imports/html-link-element/resources/body-only-2.html": [ - "52a42561dc77affda708aff42e149880df55b4e9", - "support" - ], - "html-imports/html-link-element/resources/hello.css": [ - "fbbe647161c9b6994b36254a136e4eccd7d825e6", - "support" - ], "html-longdesc/META.yml": [ - "0a540910326292561d9e3b31288db0f63ff5c904", + "e45774c3391ef6100c6e09e94af109cb378b66d3", "support" ], "html-longdesc/README.html": [ @@ -573124,7 +573349,7 @@ "manual" ], "html-media-capture/META.yml": [ - "e500972e227401f5305900a0dac7ea4d71ff2aa4", + "5dba36766e89f647401d67bc8e035c41c36e2d8e", "support" ], "html-media-capture/capture_audio-manual.html": [ @@ -573192,29 +573417,13 @@ "support" ], "html/META.yml": [ - "785e799f0a39f170b4c095a470e2b7a283c81a97", + "d4887ec1f47379c0f0cc3dc00c596821288ba56e", "support" ], "html/README.md": [ "2912eef6630f88093ef850036e7ec812a31f06f1", "support" ], - "html/browsers/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/browsing-the-web/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/browsing-the-web/aborting-a-document-load/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/browsing-the-web/history-traversal/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/browsing-the-web/history-traversal/001-1.html": [ "9828f775639723365fcdfede618834287ec30919", "support" @@ -573387,10 +573596,6 @@ "8865745d26bee3955927f4c9d35a5174578238ce", "testharness" ], - "html/browsers/browsing-the-web/navigating-across-documents/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/browsing-the-web/navigating-across-documents/001-1.html": [ "0302d5ff320adc0eddac24f42ffdd3a2268fd1e1", "support" @@ -573667,14 +573872,6 @@ "00cb640d4ec5c878c5e3f86312126c453d497fbb", "support" ], - "html/browsers/browsing-the-web/read-html/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/browsing-the-web/read-media/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/browsing-the-web/read-media/pageload-image-in-popup.html": [ "ccf7d69d5d7fe04242eb63db86a04458cb979b87", "testharness" @@ -573687,34 +573884,10 @@ "2ae6e21db438a657afd934bb8fb8a21de5f5f2cf", "testharness" ], - "html/browsers/browsing-the-web/read-multipart-x-mixed-replace/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/browsing-the-web/read-plugin/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/browsing-the-web/read-text/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/browsing-the-web/read-text/load-text-plain.html": [ "c271fb10d4d7ce4c72399e4bc06fb8d311b6ffe7", "testharness" ], - "html/browsers/browsing-the-web/read-ua-inline/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/browsing-the-web/read-xml/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/browsing-the-web/scroll-to-fragid/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/browsing-the-web/scroll-to-fragid/001.html": [ "e5b02d601942664d5c30460ad1984d7721b44258", "testharness" @@ -573791,10 +573964,6 @@ "2dabab8b5505e7934c0977f1cf0975d4600981d5", "testharness" ], - "html/browsers/browsing-the-web/unloading-documents/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/browsing-the-web/unloading-documents/001.html": [ "feaa44a189a15b5b91298a330b21e39e06076ffd", "testharness" @@ -574091,14 +574260,6 @@ "8e6158718a67cef7e4912dda69d1287b2171654f", "manual" ], - "html/browsers/history/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/history/history-notes/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/history/joint-session-history/joint-session-history-child1.html": [ "3e515ed415bbe7a5bcb89aff5c5009cd6d445623", "support" @@ -574127,10 +574288,6 @@ "2ff693526c5637a11658831961c9ff0a738329de", "testharness" ], - "html/browsers/history/the-history-interface/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/history/the-history-interface/001.html": [ "5eb4991d51ef483a8ab629ad014977296da4ea68", "testharness" @@ -574487,10 +574644,6 @@ "2690350e1c90a432a5b48118074c6c747508acce", "testharness" ], - "html/browsers/history/the-location-interface/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/history/the-location-interface/allow_prototype_cycle_through_location.sub.html": [ "06f1491747305f05c0e25027ac3efddc2c719bfc", "testharness" @@ -574787,10 +574940,6 @@ "ee1592edde42064646fffd17cafcdc54215faf25", "testharness" ], - "html/browsers/history/the-session-history-of-browsing-contexts/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload.tentative.html": [ "fbb1c40a56f513dd66084f780eb650664188ec4f", "testharness" @@ -574811,14 +574960,6 @@ "e8251bdc0b5e35d274593f0534b1f70b2adbc58c", "support" ], - "html/browsers/offline/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/offline/appcache/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/offline/appcache/workers/appcache-worker.https.html": [ "d4dc559a600b1d197e7b31f960b396da3faa4e42", "testharness" @@ -574847,10 +574988,6 @@ "8681ab72485c543d1e22de75cee685478090a848", "support" ], - "html/browsers/offline/application-cache-api/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/offline/application-cache-api/api_status_checking-manual.html": [ "cbef274f2a41ff3f0299a3273d4706b5a1a83b76", "manual" @@ -574895,10 +575032,6 @@ "fd1eea1cc64dcc5d816545ac3420351d5e8cb317", "testharness" ], - "html/browsers/offline/browser-state/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/offline/browser-state/navigator_online_event-manual.https.html": [ "0128e846b64f2f06d72300aaa089d1e9c13faa7f", "manual" @@ -574907,30 +575040,10 @@ "a06d993d34908fb332aca34a3a2002a917db9ee5", "testharness" ], - "html/browsers/offline/changestonetworkingmodel/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/offline/changestonetworkingmodel/original-id.json": [ "0c23e40a33842be66544de52b3c35230132bc683", "support" ], - "html/browsers/offline/disk-space/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/offline/downloading-or-updating-an-application-cache/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/offline/expiring-application-caches/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/offline/introduction-4/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/offline/introduction-4/contains.json": [ "c63851b0649b98d8aa06fd82934ca8356ffa13f0", "support" @@ -574991,10 +575104,6 @@ "0959d9811748aa674d4863bd31a5cca2d2db0d15", "testharness" ], - "html/browsers/offline/manifests/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/offline/manifests/contains.json": [ "f844a4d122bf6a46e2ccd4725483a72f8ebb9f42", "support" @@ -575055,10 +575164,6 @@ "6a403d69ed90abeea5a4c61f6f09778224a5c184", "manual" ], - "html/browsers/offline/the-application-cache-selection-algorithm/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/origin/cross-origin-objects/cross-origin-objects-on-new-window.html": [ "604c6ee2bd78187a600dd28e03b60caf89580cfe", "testharness" @@ -575115,10 +575220,6 @@ "d33427abcc87693bce1f5610f460aad12cb99759", "support" ], - "html/browsers/sandboxing/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/sandboxing/inner-iframe.html": [ "ba143e41121916fba5522d5e1dca29d04ab5f4ce", "support" @@ -575151,10 +575252,6 @@ "b6345b32377ff05bc7e5261b2fc14e8c875b2245", "reftest" ], - "html/browsers/the-window-object/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/the-window-object/Document-defaultView.html": [ "a98684fde02881d89cd2153b6a9e31f451650faf", "testharness" @@ -575163,10 +575260,6 @@ "80f9408a3fa25694356c6bdde8c83302baaaa136", "testharness" ], - "html/browsers/the-window-object/accessing-other-browsing-contexts/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-01.html": [ "063664af0d5b7418f3fcee288f7480dffe3f4fb9", "testharness" @@ -575199,10 +575292,6 @@ "83b6ae4f697cf7a898512771329bd05c8aa69895", "testharness" ], - "html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/callback.js": [ "7bb3393de4ae9a2d71b629a60e0601dd435b8666", "support" @@ -575335,18 +575424,6 @@ "37afff594d1448656b233c347db88dafafc01f8f", "support" ], - "html/browsers/the-window-object/browser-interface-elements/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/the-window-object/closing-browsing-contexts/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/the-window-object/garbage-collection-and-browsing-contexts/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_1-1.html": [ "b1869558ff78f12b3e2b8605f90d5ac684784a80", "support" @@ -575431,10 +575508,6 @@ "75f8a65267df8d34a4ab600b88b785b887fb0ce6", "testharness" ], - "html/browsers/the-window-object/named-access-on-the-window-object/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/the-window-object/named-access-on-the-window-object/named-objects.html": [ "8738c9e53e1c71b6b15ea0c3f2f0f9b0e4522144", "testharness" @@ -575447,10 +575520,6 @@ "9c0164a39aea396281dbff9689b9ffac1e95fdac", "testharness" ], - "html/browsers/the-window-object/security-window/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/the-window-object/security-window/window-security.https.html": [ "16f41760b88216c36fbdfba95d249cf99f33b8a3", "testharness" @@ -575459,10 +575528,6 @@ "8b54eda2f83525a82588c889a0a24e2356cac670", "support" ], - "html/browsers/the-window-object/the-windowproxy-object/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-locationbar-manual.html": [ "a1569f0261127a0001592530e2f2235ad8467ff2", "manual" @@ -575535,14 +575600,6 @@ "69767dfb374182c8a45fe96d9988e7671c9a6b7a", "testharness" ], - "html/browsers/windows/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/windows/auxiliary-browsing-contexts/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/windows/auxiliary-browsing-contexts/contains.json": [ "aecd2f28b5bd6301c51d535a4b1068a10b497899", "support" @@ -575591,10 +575648,6 @@ "6b20b15de0e385b31d4de6a9677798387f238821", "support" ], - "html/browsers/windows/browsing-context-names/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/windows/browsing-context-names/choose-_blank-001.html": [ "4a1a9ff6c913291edce2339faa443b6da2e5fe74", "testharness" @@ -575743,14 +575796,6 @@ "8fe21ad8cdacd39594f6d01880689d1c94c617b2", "testharness" ], - "html/browsers/windows/groupings-of-browsing-contexts/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/windows/nested-browsing-contexts/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/windows/nested-browsing-contexts/contains.json": [ "0f2e164f656015ba43e2b3471af67a5d16fb97ea", "support" @@ -575855,14 +575900,6 @@ "3b7934e44c2b2cfbcc68a6f965a824ebef132baf", "support" ], - "html/browsers/windows/secondary-browsing-contexts/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/browsers/windows/security-nav/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/browsers/windows/targeting-cross-origin-nested-browsing-contexts.html": [ "81b59630c8973be637f2ef2f379e126ea6dca69d", "testharness" @@ -575871,22 +575908,6 @@ "bd24d62276b1426627f138f4a1bee27cd4c4517c", "manual" ], - "html/dom/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/dom/META.yml": [ - "ee0778f37e92351be3e95c9c23f23b743e71e5eb", - "support" - ], - "html/dom/documents/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/dom/documents/dom-tree-accessors/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/dom/documents/dom-tree-accessors/Document.body.html": [ "95f7f9c915b73cbce91a449cb44e8c0d255875b3", "testharness" @@ -576067,14 +576088,6 @@ "ffb7fbed3b9e0f2a73907358234136d5a62b6943", "testharness" ], - "html/dom/documents/loading-xml-documents/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/dom/documents/resource-metadata-management/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/dom/documents/resource-metadata-management/document-compatmode-01.html": [ "7cfbf9310f38562ba62696bbc7dd57a78924e4a0", "testharness" @@ -576119,574 +576132,6 @@ "2516e46d646648e1012c608ba01f55a0acb1155e", "testharness" ], - "html/dom/documents/security-document/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/dom/documents/the-document-object/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/dom/dynamic-markup-insertion/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/dom/dynamic-markup-insertion/closing-the-input-stream/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/dom/dynamic-markup-insertion/closing-the-input-stream/document.close-01.xhtml": [ - "a33055bb7c79c3802b657df70d8daa56b1703713", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/001.html": [ - "8c8aceec7a111f55f0c4102f87a9f2e9a647b723", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/002.html": [ - "eee21c06d708c51b8bcfd4601e0e1df370db445d", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/003.html": [ - "bc3be6177a1f80b82d7abc002407553f32e1730d", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/004.html": [ - "a121985df6e745c4a8e18c088e9bbd190d6cbaf3", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/005.html": [ - "c019f5e27f53398c08ec11e10b40fe64322f3933", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/005.js": [ - "dad693bf94993ee3d127f2f2bd8aeb846784f6cb", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/006.html": [ - "51297ed0ca0604a2ca4696cc9aa6d1f272063f2a", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/006.js": [ - "dad693bf94993ee3d127f2f2bd8aeb846784f6cb", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/007.html": [ - "6b5a6f6732a8fbaf60b109a6dbffe24b85f1f027", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/007.js": [ - "a9b6847ff6b22f2ee1c77e80e43d6429b07b1f35", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/008-1.js": [ - "e761f4b4e0d9ecfd1dccc2e5012c6ede0d5494f8", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/008.html": [ - "f6c7ddf6afd5ff7f74440a53d1611e985f2ab66f", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/008.js": [ - "8dc71f4f792944136b2268b6996978d2f05547f6", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/009.html": [ - "efb4e9cc8fab72987d7db4d843b1d3372341c27e", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/010-1.js": [ - "4f995d0008ae13d3e7952bd9341c2109e2b2a0da", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/010.html": [ - "af4328218d8aa6b7cb1114026088f01efa1c035c", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/010.js": [ - "daf7cdc770a5d05cdeb5ccbc8618134b613f2b98", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/011-1.js": [ - "6e4bf99110b51a69f844fa3c4cf1bf6cbfdd54f5", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/011.html": [ - "f55604bf3353a8edc3d7526831f055a5c3737df3", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/011.js": [ - "16225e651165db9a1607cbf042a2297d3488b86b", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/012.html": [ - "34cd06f8bc45466a601dea8492920bbda4dbdd5c", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/012.js": [ - "3ed9cf147bdaa1a177d863c047ce60493c10a98a", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/013.html": [ - "e02dfff2b6f98f796d63ecf1ba85e8d2c99ee605", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/013.js": [ - "c8b1c4dfe0eaed3b84d58855f41bd2b2552ea9b9", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/014.html": [ - "ab08a8015d397ba752372c6298202c46c003f6ec", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/015.html": [ - "201466fd4a1a291220dbca8fc341a56264cbbd54", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/016.html": [ - "b21df3653e4ea1cc8fdc3ceb0db36e9b9a2191f5", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/017.html": [ - "122c9609c3ca328e2c2d02483ad47b50ed8155c6", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/018.html": [ - "e28b55e191c78575142aae53a14aa9f59cd3d04d", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/019.html": [ - "b4267fa1f88679537dde437a35d95c1e0a48c2c4", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/020.html": [ - "16940003fba526f723f698e35a8c0c584604c1ca", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/021.html": [ - "f8c5ffa09b6c5828c0b39a36535be70064281339", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/022.html": [ - "c79b37206d78a6c641585ed681535a2b30493a17", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/023.html": [ - "34a9fddbb892f2410937b5627f322862241a0539", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/024.html": [ - "b6e901f124c099a87100b083d47cdb3ab621a74e", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/025.html": [ - "9e2aba6b4be1e032ddc67ccebf8cb9f4021935ab", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/026.html": [ - "4007e8d057ce5e6fe991220bc29b3966d576fc79", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/027.html": [ - "3a9492537987b7d688015e5e79a46ae2f49936f5", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/028.html": [ - "14d932aeba095e24733b1197b64897719c809ba2", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/029.html": [ - "44976fbc1fb75f99430aeef2df89e444d55751fe", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/030.html": [ - "e9a3580093caf362bcf2d59321f6917bab7b668f", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/031.html": [ - "ed70f8d3ffdc1220160df7f3b47c03526bb61697", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/032.html": [ - "5f5fe390b66d77e862c553d2a5f3a33029bc8a6f", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/033.html": [ - "e981ce9c2b4c4615e524d982f004aa7c79c4c6a2", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/034.html": [ - "22f988ee407cee6ebc001d8fae6f881a60c8668f", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/035.html": [ - "b485caf54e23e2e81085e54057c9aa151e6f14b1", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/036.html": [ - "1aed908834cb95d963261003db7cc780a47a04bf", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/037.html": [ - "cb3d413b0ffc1bb0b4e5391b34b6aa8c19407a4f", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/038.html": [ - "c6aa999d6a611f94acc4eb50d316f2f525dece10", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/039.html": [ - "7b2f7827e84cfb7589bc224c07c26c0b743fdbe7", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/040.html": [ - "9463d2fcf88d84f415a1fb5ed44ca216c08a49b6", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/041.html": [ - "95bfe438f109dbc35ada28b5e8c5cc539b892279", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/042.html": [ - "a706a05835f815c2362f3fb2e8f921ae05ae4128", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/043.html": [ - "1b7dc5cc552626fe5daaa4d409c403dfbf06d795", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/044.html": [ - "d0126ff1e0eebac313c35a1ca6bbc941cec25721", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/045.html": [ - "9c08d3ecf9d21e093997833062eb0248ff169ab1", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/046.html": [ - "7391e6e5e0528114d39ae3af5226f0b03730fb14", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/047.html": [ - "b72d2ad21a9127b9fbfae9f9732c25f614646704", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/048.html": [ - "b72d2ad21a9127b9fbfae9f9732c25f614646704", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/049.html": [ - "058198bdccaa24e77438cc78aef061903c2b80c0", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/050.html": [ - "6a0a46450d2b203592763e74998aeab5c40a0535", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/051.html": [ - "e7c9064ba73547f25e0c7f202f14d51ee4e10fd1", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/contentType.window.js": [ - "3f1218b65f930ba0a31044163fb995527c020fa8", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/document.write-01.xhtml": [ - "3b309503bf8f002712eafba1d5e7a1f3f743d7e1", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/document.write-02.html": [ - "f4c6db3136e0860d38fe21193a0012eb5e4842ef", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/empty.html": [ - "b1149d9764ff4a9a7e8698f7a56ed003796d8582", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_001.html": [ - "1c9c5a787612667df557c57cb1ec5e101a38dfab", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_002.html": [ - "28e827f8b8b0c9af9dfa46dfb505920df72345d4", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_003.html": [ - "011b66b2d7cbf4a6184bbbfeb198cfb27e181343", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_004.html": [ - "525eeb4f4805cec5341055278507fd8dfe7c3cfa", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_005.html": [ - "ab2ea0edc62e53c2a8e403797206a5d4f74ead0f", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_005.js": [ - "487a5b400bc7f145455c5267b07a7f083ec4adb0", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_006.html": [ - "6af33c96b459f56fc8c57216eb20877f252112db", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_007.html": [ - "21f2b8f36521e3e76bee968ee25febf016b5a263", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_008.html": [ - "c5a6befd4b60d826b522f5009346cc5cdd23b3da", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_009.html": [ - "e1f0e5b3149a7b3e2386d91147d0d63620135f3c", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/iframe_010.html": [ - "8d70bfbc321000ccbfae07c4a435a09d4d7948f3", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/nested-document-write-1.html": [ - "9f6c0ffee84cbf54639e6d39276e331a759336d1", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/nested-document-write-2.html": [ - "4748eb3ed5fdbbd036c50f31ab5a3e817f9291e0", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/nested-document-write-external.js": [ - "7350fb83fcec2374dad98d7ad13dd07cd78f5396", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/original-id.json": [ - "c1955e14b1222d952cab1eeff293ec3f5d3b0791", - "support" - ], - "html/dom/dynamic-markup-insertion/document-write/script_001.html": [ - "68400d60bf827e9e48cda169574f0a279c55cda7", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/script_002.html": [ - "8eb2c9faf27578fad096e4373c34739afaeab2a8", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/script_003.html": [ - "14887f0ec4302566de0fbb977d03933ad539b5b5", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/script_004.html": [ - "18b1736b952328c6de2ac9b902cada3b5beb5224", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/script_005.html": [ - "3c6a906f97417cbc93cf7bcb80255963e54e0910", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/script_006.html": [ - "581e59a4cce498d590d6199dbe5169ce964df631", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/script_007.html": [ - "cd326b87b050741ca4dd5d66a5a72522efdaf29a", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/script_008.html": [ - "0216f7d4199ca405da6f20e34ef5a4ff4b0406dd", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/script_009.html": [ - "0efdaefe472ec6621de75dde22197ee1a33cd529", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/script_010.html": [ - "0a53afd7a3de453cf398033fd4159e3e4988244d", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/script_011.html": [ - "c8d129add739cb431d1b50e693744c6bc6adc4ed", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/script_012.html": [ - "833de0abb686ed91179cd8228e09e05a61817c42", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/script_013.html": [ - "0c45797b8e51b33aa49148eff24e021b69c372d9", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-write/write-active-document.html": [ - "66d780431c740841834f0af67d20d28ac5178d9b", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-writeln/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/dom/dynamic-markup-insertion/document-writeln/document.writeln-01.xhtml": [ - "443e8d9d653feb514dfc3cb8a1b4cb204ef38820", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-writeln/document.writeln-02.html": [ - "f81725d70babcb3e5f30b191d891dba2d30ba038", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-writeln/document.writeln-03.html": [ - "5564adb6a1c14b3f08b33c1838a3c8377fccea2c", - "testharness" - ], - "html/dom/dynamic-markup-insertion/document-writeln/original-id.json": [ - "37ea841113fc00fe481bd43a635e7bb690ec6057", - "support" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/001.html": [ - "f3194a3557ea4991b93d53f729912e45de1a676d", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/002.html": [ - "6f633c653ba9fb431fe41f69687e37ac1083c320", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/004-1.html": [ - "448f6f9971f92c4b9b7b7a536be353793f6147d6", - "support" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/004.html": [ - "290990faf1c4107c80069110d28b925e65e4719c", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/005.html": [ - "6eb18f167496446c4c9d776e0f10be71c8f65a95", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/006.html": [ - "94989d1ee98fb9e739a116b103c23e8d8108ac87", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/007.html": [ - "6a409aa8cd0629dc1f71977e3994d07ccc7bbcfd", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/008.html": [ - "1c813722dd68b1a13348aa8071d99cf358ab9eca", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/009.https.html": [ - "02278f0ed00b2392afcbcacd56ddd750b7204241", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/010-1.html": [ - "bf26fa8b0d8542fb5b7f6db9c1e8bdcc8cfa8081", - "support" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/010-2.html": [ - "6b3c91516759cf79a2e15a45455f8071f517c346", - "support" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/010.html": [ - "95a5ad21f6ff58456d614f767046c5d3c2131460", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/011-1.html": [ - "5feea2d56edcfd872eeac109e2ff8e52acd6d60c", - "support" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/011.html": [ - "ca6b4c77e86496b0b6df85d8e61312786536c285", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/012-1.html": [ - "923397f1eec1ea22f8515c44113dea080d9230eb", - "support" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/012.html": [ - "cd5d66387f4057c11c5b9645cbba5e66805f52d1", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/013-1.html": [ - "32cd8db0139a5d65ce3ade4906724b3897a9e64d", - "support" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/013.html": [ - "ec55397d532ecac54cb3b04356b8034120161dbe", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/014-1.html": [ - "23c430e683be5ea67d4be1c8ab7ff8064914199b", - "support" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/014.html": [ - "fff1c433d2d010c8afa15fc702afc5b33643dad3", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/015-1.html": [ - "bfcf2e3d916c30f00f448f6c1b225be99f35c1c1", - "support" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/015.html": [ - "3c6015624e24b5928ea38a574a76c4aee7b6dd40", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/016-1.html": [ - "3320a164d93b8d39254c4609a5320e2f1bd115b2", - "support" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/016.html": [ - "ea3ff6e58680da8c3f08e7f26ebc738d82703801", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-01.xhtml": [ - "cb059c7c17320c0e63e9453d3a0486a8a94b060a", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html": [ - "1941d51b6489947d979480d097898e91b212e508", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03-frame.html": [ - "bcc6a14a9c3d116d95e72d3f057d0cd7cbffd2cb", - "support" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html": [ - "a2a5acc9dfe53c7482eeaa4be3a4819238f8e120", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/encoding.window.js": [ - "b021d6fcc38925ddf39309e21716c5be37791247", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.js": [ - "ccf357a8081b99de1d85e05196145e83b3de2ab5", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js": [ - "1e1c656e1d19c9c459faf16327e099a4c9e13872", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/resources/encoding-frame.html": [ - "1d8ae9f75fe05343c1858caad637c9f7602c9f28", - "support" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext-subframe.txt": [ - "8d06cea05d408d70c59b1dbc5df3bda374d869a4", - "support" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext.window.js": [ - "1f440ff93300a0ab715982feb067dd3162c8fce9", - "testharness" - ], - "html/dom/dynamic-markup-insertion/opening-the-input-stream/type-argument.window.js": [ - "0f0020e1d7d8050892ef146d687178cfe8eedcd2", - "testharness" - ], "html/dom/elements-embedded.js": [ "99489e3a8ac2be0d7dcfb22f7f45c30b00511358", "support" @@ -576723,30 +576168,14 @@ "04b456ecdbc8028566ab39c9d2ffb92a3b6e6d9b", "support" ], - "html/dom/elements/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/dom/elements/content-models/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/dom/elements/content-models/contains.json": [ "bb9f5c69cd24fde4af698b22ce50a4d2d69d7d26", "support" ], - "html/dom/elements/element-definitions/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/dom/elements/element-definitions/contains.json": [ "937a68e7c581a0a483252aa88f67a9704e2157f6", "support" ], - "html/dom/elements/elements-in-the-dom/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/dom/elements/elements-in-the-dom/historical.html": [ "89eb9192001cf925d0e0f66150fed0e525f731c6", "testharness" @@ -576755,10 +576184,6 @@ "7f8db53601af40a1cff15e430afc5a07f2f2f08e", "testharness" ], - "html/dom/elements/global-attributes/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/dom/elements/global-attributes/.htaccess": [ "e73309fe89c2d9f29828174322704a2e5a10ec36", "support" @@ -577339,10 +576764,6 @@ "62eca26e21572801404647be9e309d9ae3cf689f", "manual" ], - "html/dom/elements/requirements-relating-to-bidirectional-algorithm-formatting-characters/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/dom/elements/requirements-relating-to-bidirectional-algorithm-formatting-characters/dir-isolation-001a.html": [ "cb6a9e3eaf18c711ace6ba90188b14271d068a63", "reftest" @@ -577503,16 +576924,12 @@ "355953f8ebb44f79bfe3cad728bcaaa3ec04e4bb", "support" ], - "html/dom/elements/semantics-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/dom/elements/the-innertext-idl-attribute/META.yml": [ "45472ac8906e7b383d80ab0b92ecddd6b900f726", "support" ], "html/dom/elements/the-innertext-idl-attribute/getter-tests.js": [ - "42f3e48763297d3360c1074a7c2b706a6f539d37", + "0ffc6d2bf3011a376f85b45090c63de07ac023d5", "support" ], "html/dom/elements/the-innertext-idl-attribute/getter.html": [ @@ -577531,10 +576948,6 @@ "8e78f2b7641a609b692a55ad8f4979dd852b706c", "testharness" ], - "html/dom/elements/wai-aria/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/dom/elements/wai-aria/README.md": [ "efca9cc8bb51a26856e5c4e0408179758f985b7c", "support" @@ -577547,10 +576960,6 @@ "75fd4e5379337af2ebcb3cd7d62dbf3d726c4036", "testharness" ], - "html/dom/interactions-with-xpath-and-xslt/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/dom/interfaces.https.html": [ "74c5559dd2e6ac17ba954943da006fb5fb484719", "testharness" @@ -577627,18 +577036,6 @@ "4172dd8fe39cedc772a5b7afd12201e6cbf36b90", "testharness" ], - "html/editing/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/editing/META.yml": [ - "ee0778f37e92351be3e95c9c23f23b743e71e5eb", - "support" - ], - "html/editing/activation/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/editing/activation/click-manual.html": [ "b07249eacb63c9532ef93c4392363cf129a0ef6c", "manual" @@ -577647,22 +577044,6 @@ "67a574b4b6721eacfaa940d934d1907c3b2b49cd", "testharness" ], - "html/editing/assigning-keyboard-shortcuts/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/editing/assigning-keyboard-shortcuts/introduction-6/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/editing/assigning-keyboard-shortcuts/processing-model-4/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/editing/assigning-keyboard-shortcuts/the-accesskey-attribute/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/editing/dnd/README": [ "91c6fa4b51e3b9124fde7cce9b7d6e31b4e397ca", "support" @@ -577731,9 +577112,9 @@ "078e533b53ded409757e28dfaeb831267cf89b78", "support" ], - "html/editing/dnd/canvas/cross-domain/001.manual.xhtml": [ + "html/editing/dnd/canvas/cross-domain/001-manual.xhtml": [ "0244b56893aca3f8ecc753ba6fb8a39c52d109b1", - "support" + "manual" ], "html/editing/dnd/canvas/helper-drag-me-green-box.xhtml": [ "ae2bb9c800762c962da939661eac8ccf84359c8c", @@ -577755,9 +577136,9 @@ "c1127e71064fca74a252ede3790007e548eb99bc", "support" ], - "html/editing/dnd/cross-document/002.manual.html": [ - "5085fe6eabdbd399fe0b0e1e0b8ea4462da55fce", - "support" + "html/editing/dnd/cross-document/002-manual.html": [ + "ef6bfd21c919ac93ef1fc82f1aa8d7db6a483d3b", + "manual" ], "html/editing/dnd/cross-document/003-1.html": [ "c97f84e931d99e45861f487f46dbaeb599faf27d", @@ -578667,9 +578048,9 @@ "2d2e04929127b7e3608674eb81108b0d995c9611", "support" ], - "html/editing/dnd/images/cross-domain/001.manual.xhtml": [ + "html/editing/dnd/images/cross-domain/001-manual.xhtml": [ "a26b1d7e2834ded272e583b1a250e6653edfceb1", - "support" + "manual" ], "html/editing/dnd/images/helper-circle.xhtml": [ "99a7dc2d5b40e00e631b9657e51f4ce0694477a5", @@ -581495,22 +580876,10 @@ "e10baad8d9d3526780dcdad47a9fe4b60010a5dc", "manual" ], - "html/editing/editing-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/editing/editing-0/autocapitalization/autocapitalize.html": [ "95e7ddabc1f76b7a1577591c285f28b06da441c9", "testharness" ], - "html/editing/editing-0/best-practices-for-in-page-editors/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/editing/editing-0/contenteditable/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/editing/editing-0/contenteditable/contentEditable-invalidvalue.html": [ "372717e3b59b7bd22ac9ada31f04a7fdd2eeb60e", "testharness" @@ -581523,14 +580892,6 @@ "14b2b941663b0e447fa232d98f6a248d6395ccf4", "testharness" ], - "html/editing/editing-0/editing-apis/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/editing/editing-0/making-entire-documents-editable-the-designmode-idl-attribute/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/editing/editing-0/making-entire-documents-editable-the-designmode-idl-attribute/original-id.json": [ "06366498fe3a1ebcbbe4819ef65681dda91c8e31", "support" @@ -581539,10 +580900,6 @@ "9555688e7daf7913e84b16806ce96ffeb7222223", "testharness" ], - "html/editing/editing-0/spelling-and-grammar-checking/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/editing/editing-0/spelling-and-grammar-checking/references/spelling-markers-001-ref.html": [ "a21ca78b9c6a8795eb4e2fa95f30a51a553a3e52", "support" @@ -581591,18 +580948,10 @@ "228e52ef1987df94158305799dc53086e435b24b", "testharness" ], - "html/editing/focus/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/editing/focus/composed.window.js": [ "2d80aaec0d5e6a8952edf26603cb0b4c75f9ac7d", "testharness" ], - "html/editing/focus/document-level-focus-apis/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/editing/focus/document-level-focus-apis/document-level-apis.html": [ "85e7c162de8d2ec933cc2628e26938fb8aaa06ee", "testharness" @@ -581611,10 +580960,6 @@ "a40de555605563e0cfc7492970d8555bfcd8c78d", "support" ], - "html/editing/focus/element-level-focus-apis/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/editing/focus/focus-01.html": [ "c56d32acddaf11643f61e40dafc3f75ba18dbda6", "testharness" @@ -581623,10 +580968,6 @@ "c92495d043403d6b480d27f3ce8925f52ed3a856", "testharness" ], - "html/editing/focus/focus-management/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/editing/focus/focus-management/focus-event-targets-simple.html": [ "0abbf699b995b9c47307f8b4badf75598854d081", "testharness" @@ -581647,10 +580988,6 @@ "ffd270caa596ffb41d5b5f1cdca450fb20a5fded", "support" ], - "html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html": [ "ce71f8ce99dab96131be4e7850bd1aa29500f4fc", "testharness" @@ -581675,18 +581012,6 @@ "ec7110ae00a54dfa39027ada9152647570cb86bc", "testharness" ], - "html/editing/inert-subtrees/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/editing/inert-subtrees/the-inert-attribute/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/editing/the-hidden-attribute/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/editing/the-hidden-attribute/hidden-1-ref.html": [ "7d7ae1dcb8c6a2e0f3a1b2ffffed957f3b1d2a85", "support" @@ -581747,82 +581072,30 @@ "3b200a40e2b7ba13f060772e821328db1de82cd0", "support" ], - "html/iana/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/iana/application-x-www-form-urlencoded/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/iana/application-x-www-form-urlencoded/original-id.json": [ "c0ea3e2d918d032aaef218bed1bba4d4b7f6e495", "support" ], - "html/iana/application-xhtml-xml/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/iana/application-xhtml-xml/original-id.json": [ "29181aca5f94235dc181cfb21108224b69696fb3", "support" ], - "html/iana/multipart-x-mixed-replace/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/iana/multipart-x-mixed-replace/original-id.json": [ "9fc63da6eb2592b1b92e71ca04ffc26c2a2fabde", "support" ], - "html/iana/ping-to/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/iana/text-cache-manifest/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/iana/text-cache-manifest/original-id.json": [ "7727848980a7934f5a22ce88eb783255de120908", "support" ], - "html/iana/text-html/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/iana/text-html/original-id.json": [ "ef2e2a7dc7a110f9cdca9b7771ff7ee4dd554224", "support" ], - "html/iana/web-scheme-prefix/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/iana/web-scheme-prefix/original-id.json": [ "a1dc4b7090040ca7680f3cab15f3a25413d769e7", "support" ], - "html/infrastructure/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/META.yml": [ - "ee0778f37e92351be3e95c9c23f23b743e71e5eb", - "support" - ], - "html/infrastructure/case-sensitivity-and-string-comparison/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/common-dom-interfaces/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/common-dom-interfaces/collections/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/infrastructure/common-dom-interfaces/collections/contains.json": [ "de0ed7f283f4e17155cd3fc07dd5cb688d6fd8be", "support" @@ -581859,134 +581132,18 @@ "9b620307a52b7bc084982b15b9bd2289339d8997", "testharness" ], - "html/infrastructure/common-dom-interfaces/domstringmap/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/common-dom-interfaces/garbage-collection/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/common-dom-interfaces/reflecting-content-attributes-in-idl-attributes/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/common-dom-interfaces/safe-passing-of-structured-data/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/common-dom-interfaces/transferable-objects/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/common-microsyntaxes/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/common-microsyntaxes/boolean-attributes/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/common-microsyntaxes/colors/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/common-microsyntaxes/comma-separated-tokens/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/common-microsyntaxes/common-parser-idioms/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/common-microsyntaxes/dates-and-times/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/infrastructure/common-microsyntaxes/dates-and-times/contains.json": [ "65241a1d7695ccc8bfef0e18e5d2f77c0a29f93c", "support" ], - "html/infrastructure/common-microsyntaxes/keywords-and-enumerated-attributes/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/common-microsyntaxes/mq/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/common-microsyntaxes/numbers/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/infrastructure/common-microsyntaxes/numbers/contains.json": [ "ff35f8a0bf98a96185313fff07820faed99edc5e", "support" ], - "html/infrastructure/common-microsyntaxes/space-separated-tokens/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/common-microsyntaxes/syntax-references/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/conformance-requirements/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/conformance-requirements/conformance-classes/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/conformance-requirements/dependencies/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/conformance-requirements/extensibility/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/infrastructure/conformance-requirements/extensibility/foreign.html": [ "a77fb2e10ec862c2e1ecfcba32fec4cc5b9fd6eb", "testharness" ], - "html/infrastructure/fetching-resources/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/fetching-resources/content-type-sniffing/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/fetching-resources/cors-enabled-fetch/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/fetching-resources/cors-settings-attributes/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/fetching-resources/encrypted-http-and-related-security-concerns/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/fetching-resources/extracting-character-encodings-from-meta-elements/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/fetching-resources/processing-model/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/fetching-resources/terminology-1/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/namespaces/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/infrastructure/safe-passing-of-structured-data/echo.js": [ "092d33c695a185b38798d5e0ba12666a6f26e48a", "support" @@ -582147,22 +581304,6 @@ "03fd591d7d34f35db36742111f1aa81872775a65", "testharness" ], - "html/infrastructure/terminology/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/terminology/character-encodings/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/terminology/dom-trees/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/terminology/plugins/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/infrastructure/terminology/plugins/sample.txt": [ "8ab5f470b6574128a7bdbaeee94b976178af5d2e", "support" @@ -582171,48 +581312,12 @@ "d5b9668048b1c4f3599ff4ac4476e9587cefc352", "testharness" ], - "html/infrastructure/terminology/resources/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/terminology/scripting-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/terminology/xml/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/urls/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/urls/base-urls/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/urls/dynamic-changes-to-base-urls/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/infrastructure/urls/dynamic-changes-to-base-urls/dynamic-urls.sub.xhtml": [ "ed3aa629bb438b285cc30761f526e76bad8c01b8", "testharness" ], - "html/infrastructure/urls/interfaces-for-url-manipulation/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/urls/parsing-urls/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/urls/resolving-urls/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/infrastructure/urls/resolving-urls/query-encoding/attributes.sub.html": [ - "a467530a931aae564a73518487b12521c6dd6377", + "d86f78ff4108cc4775ca5414a8d2f3e0b669fa3a", "testharness" ], "html/infrastructure/urls/resolving-urls/query-encoding/location.sub.html": [ @@ -582271,10 +581376,6 @@ "1b8570b2cf1f5a136c0f4b4d1506b01e6fb6cb31", "testharness" ], - "html/infrastructure/urls/terminology-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/infrastructure/urls/terminology-0/document-base-url.html": [ "eef89bcfc8df29b79707b9fa5ea63707a839281e", "testharness" @@ -582283,14 +581384,6 @@ "399834df0104e545523749fb6758f586765251c5", "testharness" ], - "html/infrastructure/urls/url-manipulation-and-creation/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/infrastructure/utf-8/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/input/the-placeholder-attribute/multiline-cr.html": [ "687054d9b221998ff4c4071ccc0733faeeb129b7", "reftest" @@ -582307,120 +581400,8 @@ "bc7c64db1dfdb3084a7c3606005a41fd71a20a9b", "reftest" ], - "html/introduction/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/a-quick-introduction-to-html/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/a-quick-introduction-to-html/common-pitfalls-to-avoid-when-using-the-scripting-apis/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/a-quick-introduction-to-html/writing-secure-applications-with-html/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/audience/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/background/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/conformance-requirements-for-authors/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/conformance-requirements-for-authors/presentational-markup/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/conformance-requirements-for-authors/restrictions-on-content-models-and-on-attribute-values/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/conformance-requirements-for-authors/syntax-errors/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/design-notes/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/design-notes/compliance-with-other-specifications/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/design-notes/serializability-of-script-execution/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/fingerprint/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/history-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/html-vs-xhtml/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/scope/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/structure-of-this-specification/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/structure-of-this-specification/how-to-read-this-specification/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/structure-of-this-specification/typographic-conventions/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/introduction/suggested-reading/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/obsolete/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/obsolete/META.yml": [ - "ee0778f37e92351be3e95c9c23f23b743e71e5eb", - "support" - ], - "html/obsolete/non-conforming-features/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/obsolete/obsolete-but-conforming-features/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/obsolete/obsolete-but-conforming-features/warnings-for-obsolete-but-conforming-features/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/obsolete/requirements-for-implementations/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/obsolete/requirements-for-implementations/frames/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "2aff31265354432f3dfe036da4593390f0af41e7", "support" ], "html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-all.html": [ @@ -582459,14 +581440,6 @@ "80e8d621e58faf19c40fe8c9a9246d7277ea537b", "testharness" ], - "html/obsolete/requirements-for-implementations/the-applet-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/obsolete/requirements-for-implementations/the-marquee-element-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/obsolete/requirements-for-implementations/the-marquee-element-0/marquee-direction-down-manual.html": [ "0c95bf0a298c18e6ba33c3ec56558c0a3594ba65", "manual" @@ -582511,18 +581484,6 @@ "2896b41f40702a36e2e35ebdc1bc0a049c7be909", "manual" ], - "html/rendering/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/bindings/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/bindings/introduction-9/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/bindings/the-button-element/button-type-menu-historical-ref.html": [ "95f61bd62a89467229aac48744a2ccefd62e81c6", "support" @@ -582531,34 +581492,6 @@ "0e4bb72d2be50b4c08acdc23692d6187afb7c160", "reftest" ], - "html/rendering/bindings/the-details-element-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/bindings/the-input-element-as-a-button/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/bindings/the-input-element-as-a-checkbox-and-radio-button-widgets/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/bindings/the-input-element-as-a-color-well/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/bindings/the-input-element-as-a-file-upload-control/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/bindings/the-input-element-as-a-range-control/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/bindings/the-input-element-as-a-text-entry-widget/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/bindings/the-input-element-as-a-text-entry-widget/unrecognized-type-should-fallback-as-text-type-ref.html": [ "a5fa95e71b00d1ad88fdff3fc9e93b6588742eee", "support" @@ -582567,26 +581500,6 @@ "6186a83ccdba01d4c5430f4afce7ae397427f0c5", "reftest" ], - "html/rendering/bindings/the-input-element-as-domain-specific-widgets/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/bindings/the-marquee-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/bindings/the-meter-element-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/bindings/the-progress-element-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/bindings/the-select-element-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/bindings/the-select-element-0/option-label-ref.html": [ "34ac1b429801bdb44125c92f5df03fb79b15aad4", "support" @@ -582595,10 +581508,6 @@ "f8fcfb9055a678a2b6714a15957485c137296177", "reftest" ], - "html/rendering/bindings/the-textarea-element-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/bindings/the-textarea-element-0/cols-default.html": [ "8b963bce003842a81c6d52a860cc5bd49c598933", "reftest" @@ -582619,50 +581528,10 @@ "0c91f2093be9e8f9815e4907fcf98d32c66af2d4", "support" ], - "html/rendering/frames-and-framesets/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/interactive-media/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/interactive-media/editing-hosts/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/interactive-media/links-forms-and-navigation/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/interactive-media/links-forms-and-navigation/original-id.json": [ "f4ec57281d8f32a4931599edc65941ea0db78d5f", "support" ], - "html/rendering/interactive-media/text-rendered-in-native-user-interfaces/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/interactive-media/the-title-attribute-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/introduction-8/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/non-replaced-elements/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/non-replaced-elements/bidirectional-text/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/non-replaced-elements/flow-content-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/non-replaced-elements/flow-content-0/dialog-display.html": [ "3adb7bbb575c26d03909a6fa105a9c035fcac801", "testharness" @@ -582691,18 +581560,6 @@ "59a05101c1cdcb345ce992b63de40077abb2a564", "support" ], - "html/rendering/non-replaced-elements/form-controls/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/non-replaced-elements/hidden-elements/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/non-replaced-elements/lists/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/non-replaced-elements/lists/TODO-lists.html": [ "1993a0736f73b9ac2916f89de4fa34fdab90cca9", "support" @@ -582847,10 +581704,6 @@ "ffc5c58fa1fa37be7e433285de870acac12b41a5", "testharness" ], - "html/rendering/non-replaced-elements/phrasing-content-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-a.html": [ "da59b8c71eb6abbcc4423b424f19c47d7fbd10b5", "reftest" @@ -582871,18 +581724,6 @@ "0c65854ebeb20fe22798d24f427c57d3a478b480", "reftest" ], - "html/rendering/non-replaced-elements/quotes/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/non-replaced-elements/sections-and-headings/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/non-replaced-elements/tables/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/non-replaced-elements/tables/colgroup_valign-ref.xhtml": [ "58ec4d37d310270ebccf93e2fe539037cd1d95f0", "support" @@ -583003,10 +581844,6 @@ "d14590d989f2c2c65f59f0f952115038fa705087", "reftest" ], - "html/rendering/non-replaced-elements/the-fieldset-element-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/non-replaced-elements/the-fieldset-element-0/legend-block-formatting-context.html": [ "80d80d4934f0ad148458c5d5494946f5c7b126c8", "testharness" @@ -583023,10 +581860,6 @@ "ca98c73f07f62c3536f6fe1d2460fc94c575aad1", "support" ], - "html/rendering/non-replaced-elements/the-hr-element-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/non-replaced-elements/the-hr-element-0/align-ref.html": [ "eb2082192a4be6b4b4d6eafc7c3d609afb0cde49", "support" @@ -583059,10 +581892,6 @@ "e7d430fbca2872d186c679a4cad2a5d249d5e67f", "reftest" ], - "html/rendering/non-replaced-elements/the-page/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/non-replaced-elements/the-page/body-margin-1-ref.html": [ "401080bf2f8be86c3c479f8443437270746b6308", "support" @@ -583199,18 +582028,6 @@ "7a229199399e678847280e6e88e40e5b37bfdd11", "support" ], - "html/rendering/print-media/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/replaced-elements/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-dim-ref.html": [ "a383f05b889bb8272aec262b271890334460db12", "support" @@ -583227,6 +582044,26 @@ "c1cff7b05cc400195328292521ecf76840d60540", "reftest" ], + "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-1.html": [ + "0c229767f50480bc044975494ffbc5c30b9a38ec", + "reftest" + ], + "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-2.html": [ + "691b374d8852aaaa5459a125989ee25e46632224", + "reftest" + ], + "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-ref.html": [ + "7e62d0a23322cf52a49ab203bbd2ce3224cb2cc1", + "support" + ], + "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-type-change-from-image-1-ref.html": [ + "db5ba23b7ff29945bb5c7ba71a9c24567c8a5446", + "support" + ], + "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-type-change-from-image-1.html": [ + "32df51d982607e285e34199ce3f1f90ad208deb5", + "reftest" + ], "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/object_border-ref.xhtml": [ "48efda6cb8f06cc70c71c436cecf6f3e4fea6aec", "support" @@ -583239,10 +582076,6 @@ "c1a52d71881ec5326761f415cc319a467587be17", "reftest" ], - "html/rendering/replaced-elements/embedded-content-rendering-rules/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/replaced-elements/embedded-content-rendering-rules/canvas-fallback-ref.html": [ "b4f3b4b0159928ea0d7dab5d4dbf9f75676a4a07", "support" @@ -583275,14 +582108,6 @@ "5b111e4a102e7d1795a9a68daad92dda9fa707d3", "reftest" ], - "html/rendering/replaced-elements/image-maps-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/rendering/replaced-elements/images/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/replaced-elements/images/space-ref.html": [ "d5b9df319bcb762ac7dedf04fec4c08885a25101", "support" @@ -583351,18 +582176,10 @@ "99187e557e72c3a87068a73f4cdc22e9d202f7c6", "reftest" ], - "html/rendering/replaced-elements/toolbars-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/replaced-elements/tools/gen-svgsizing-tests.py": [ "c7e3954f1f5c23d74b1758b40eec0701df4a9d0f", "support" ], - "html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change-ref.html": [ "8040cdc2d5096bbb27ebed7539706574faa8515f", "support" @@ -583383,10 +582200,6 @@ "53b556c68c1c3670c20dcc2dc472d58b79d74999", "support" ], - "html/rendering/unstyled-xml-documents/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/resources/common.js": [ "0f18ee2c61b99893cfe2a3d1ff549b170a8d715d", "support" @@ -583395,50 +582208,10 @@ "121760184777008c2ddeb598278216e40b34e367", "testharness" ], - "html/semantics/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/META.yml": [ - "ee0778f37e92351be3e95c9c23f23b743e71e5eb", - "support" - ], - "html/semantics/common-idioms/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/common-idioms/conversations/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/common-idioms/footnotes/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/common-idioms/rel-up/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/common-idioms/tag-clouds/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/common-idioms/the-main-part-of-the-content/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/disabled-elements/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/disabled-elements/disabledElement.html": [ "b8d9d665da184056cba3b0443d18e423d849ce25", "testharness" ], - "html/semantics/document-metadata/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/document-metadata/interactions-of-styling-and-scripting/conditionally-block-rendering-on-link-media-attr.html": [ "e30982d8f6490bfd4b3c124b281d13a1f93e0e18", "testharness" @@ -583447,10 +582220,6 @@ "fde4968951519e82db85aa8624470f5256e16396", "support" ], - "html/semantics/document-metadata/styling/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/document-metadata/styling/LinkStyle.html": [ "9204127131c4ff7c7fc7753733c54f4a13242131", "testharness" @@ -583475,10 +582244,6 @@ "adf136354fb5d5e70f2fa016712eff8995fa4710", "support" ], - "html/semantics/document-metadata/the-base-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/document-metadata/the-base-element/base_about_blank.html": [ "6867a4d38382a9c981832c93712aa0484bf161f3", "testharness" @@ -583515,14 +582280,6 @@ "51607f9b3955894b2cec1751a60c42f1c8dd0040", "support" ], - "html/semantics/document-metadata/the-head-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/document-metadata/the-link-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/document-metadata/the-link-element/all": [ "1dcc57d4f3363562322937979cb7828b0c298daa", "support" @@ -583627,10 +582384,6 @@ "b1d3d6b603ed5c0c0e2337248e67d34762e9b26a", "support" ], - "html/semantics/document-metadata/the-meta-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/document-metadata/the-meta-element/contains.json": [ "a87934d6ec713c3349a9e0e643e2f7362fe090f7", "support" @@ -583707,10 +582460,6 @@ "104f4d98f80ac94de65ddddd8df294c9af4944a4", "testharness" ], - "html/semantics/document-metadata/the-style-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/document-metadata/the-style-element/historical.html": [ "a79507053f56789fe02f0cc6ef841c9d0e46d490", "testharness" @@ -583759,10 +582508,6 @@ "867064126601c92dce8a61d6f3e8237153a0a583", "testharness" ], - "html/semantics/document-metadata/the-title-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/document-metadata/the-title-element/title.text-01.html": [ "50c3dafd0ed0e06be1b700915340732f5ea5357e", "testharness" @@ -583779,52 +582524,16 @@ "a4695c277347cb083fe0d4993022bd00b42c5716", "testharness" ], - "html/semantics/edits/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/edits/attributes-common-to-ins-and-del-elements/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/edits/edits-and-lists/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/edits/edits-and-paragraphs/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/edits/edits-and-tables/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/edits/the-del-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/edits/the-del-element/del_effect.html": [ "c16299b0b77b35899b79957c961fa418f7753672", "testharness" ], - "html/semantics/edits/the-ins-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/edits/the-ins-element/ins_effect.html": [ "2248c2170f4928ce9870f152c03224a42d1c9b7f", "testharness" ], - "html/semantics/embedded-content/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/embedded-content/dimension-attributes/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/embedded-content/image-maps/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "html/semantics/embedded-content/META.yml": [ + "f3c8b6b5b7e60781ff320a1e5cd914dc297cf956", "support" ], "html/semantics/embedded-content/image-maps/contains.json": [ @@ -583839,20 +582548,12 @@ "81e9d89988e89b3ee4c6913a346a8ac3f2a78ab3", "testharness" ], - "html/semantics/embedded-content/mathml/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/embedded-content/media-elements/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/embedded-content/media-elements/audio_controls_present-manual.html": [ "9dacdb9cf50ff61b0b7d31cba1304bfddc2b9a58", "manual" ], "html/semantics/embedded-content/media-elements/audio_loop_base.html": [ - "0b80893f6737ac647fd0205748ce3e6be437a3c3", + "7799a9715626cc162be9a4b3d0b0d95ebf1c3bca", "testharness" ], "html/semantics/embedded-content/media-elements/audio_muted_overriding_volume-manual.html": [ @@ -585332,7 +584033,7 @@ "manual" ], "html/semantics/embedded-content/media-elements/video_loop_base.html": [ - "d84abb0277613a9f38037c7dcec197fab5e8bdd9", + "299773150c7637c7472b1366583dc33ca4ae0d1b", "testharness" ], "html/semantics/embedded-content/media-elements/video_muted_overriding_volume-manual.html": [ @@ -585367,14 +584068,6 @@ "a1657fc9e655ad0a30ced47a1412b6c34ba964b9", "support" ], - "html/semantics/embedded-content/svg/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/embedded-content/the-area-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/embedded-content/the-area-element/area-coords.html": [ "88f44bcf9beb7329b001b1c1a56b7fb0c7363f1a", "testharness" @@ -585403,10 +584096,6 @@ "d6128e676d8584222248b03ae2e868136377d799", "support" ], - "html/semantics/embedded-content/the-audio-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/embedded-content/the-audio-element/audio_001.htm": [ "608d30e852106678bacc806e9164e20661988e7b", "reftest" @@ -585423,10 +584112,6 @@ "a74faddb16266717024b3a4efa21be7f4d00a85e", "support" ], - "html/semantics/embedded-content/the-canvas-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/embedded-content/the-canvas-element/2d.canvas.readonly.html": [ "877d238083fe2547543298613244cd51f6f071f2", "testharness" @@ -586087,10 +584772,6 @@ "c8784361857ba83afbe1be4bca4ed5e654307c2f", "testharness" ], - "html/semantics/embedded-content/the-embed-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/embedded-content/the-embed-element/document-getters-return-null-for-cross-origin.html": [ "3d75c8c998b3f98f2023311826dcd1d4c21d3361", "testharness" @@ -586151,10 +584832,6 @@ "c77b4fd64e831e7dff8def0d5c0c851f2a0bc235", "testharness" ], - "html/semantics/embedded-content/the-iframe-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/embedded-content/the-iframe-element/change_child.html": [ "bb385ac7c015e09a70f482d0ad82616d3f4d149e", "support" @@ -586639,10 +585316,6 @@ "3a8148c40148df2cfcb85054975ff9ad7c718923", "support" ], - "html/semantics/embedded-content/the-img-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/embedded-content/the-img-element/3.jpg": [ "842453aa8de65e562f5925c3fac90431c186a7fa", "support" @@ -586843,14 +585516,6 @@ "4f7dde7856e4bfab43ce4d411e8bf317dc2a7c6b", "testharness" ], - "html/semantics/embedded-content/the-map-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/embedded-content/the-object-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/embedded-content/the-object-element/document-getters-return-null-for-cross-origin.html": [ "f9f22673579147c7591d5f71467d6655140702b9", "testharness" @@ -586883,6 +585548,10 @@ "a5bb885111ac7ea02241957ee7233491c2277516", "testharness" ], + "html/semantics/embedded-content/the-object-element/object-setcustomvalidity.html": [ + "66b9c49899cf1bbc8f5061f5f515ed5ba46d5655", + "testharness" + ], "html/semantics/embedded-content/the-object-element/test0.html": [ "04319dea2f1e0b00e8db1703f2072ec22f1a82ad", "support" @@ -586899,22 +585568,6 @@ "90d22cff3227bafa7e95cb0a6309e9ccaba40685", "testharness" ], - "html/semantics/embedded-content/the-param-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/embedded-content/the-source-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/embedded-content/the-track-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/embedded-content/the-video-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/embedded-content/the-video-element/video-tabindex.html": [ "9eb50aa9958ae38bd14cfd7243f79d1fd76d71ef", "testharness" @@ -586951,12 +585604,8 @@ "90165d45b8b1670f0374ba2c8185327ece678458", "reftest" ], - "html/semantics/forms/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/forms/attributes-common-to-form-controls/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "html/semantics/forms/META.yml": [ + "64a19fd949fd6235fa522d90e06539a08b339e5b", "support" ], "html/semantics/forms/attributes-common-to-form-controls/contains.json": [ @@ -587003,14 +585652,6 @@ "29403d1f358129fe21f4643a1662409848c98572", "testharness" ], - "html/semantics/forms/categories/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/forms/constraints/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/constraints/contains.json": [ "8bc5764cf5b37dbd911e5e5992a80b9b5833e518", "support" @@ -587139,10 +585780,6 @@ "bd04127c8077b016bf5496216b9d7c39133ffe37", "manual" ], - "html/semantics/forms/form-control-infrastructure/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/form-control-infrastructure/association.window.js": [ "378503a30aa005cd35e726ff252dc5e69644a04f", "testharness" @@ -587171,10 +585808,6 @@ "305a2a0d02488f0a90184ddd94894045f413b18a", "testharness" ], - "html/semantics/forms/form-submission-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/form-submission-0/constructing-form-data-set.html": [ "28ddddb0e685b6de4bb1270afdd791865d6bb787", "testharness" @@ -587227,18 +585860,10 @@ "96c0951e2b6d718c1b044f71911508cc673e37de", "testharness" ], - "html/semantics/forms/introduction-1/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/introduction-1/contains.json": [ "2226bf8e951c187c11fe8321864e0888fce04b70", "support" ], - "html/semantics/forms/resetting-a-form/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/resetting-a-form/reset-event.html": [ "2b9329c270fb73a2ab60f5e9549afdfa91a13522", "testharness" @@ -587259,10 +585884,6 @@ "73e4daacde901f0dc1babb9136f4bcebd98b0250", "testharness" ], - "html/semantics/forms/textfieldselection/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/textfieldselection/defaultSelection.html": [ "f49a2316f73094a7a0b27d810453f40ef029636b", "testharness" @@ -587315,10 +585936,6 @@ "4ca73ff5658b3512784e9e1b236c78861ca4ecc9", "testharness" ], - "html/semantics/forms/the-button-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/the-button-element/button-activate-frame.html": [ "a3dd367a8f7eb9158b1271fcf95bf98b60fe0c9b", "support" @@ -587348,7 +585965,7 @@ "testharness" ], "html/semantics/forms/the-button-element/button-setcustomvalidity.html": [ - "1db71a5bee8a77768dc54cbd1dc3ef000c2eaa6b", + "219360aaa6a24afe3632e3db54608fe14626c78d", "testharness" ], "html/semantics/forms/the-button-element/button-type.html": [ @@ -587371,18 +585988,10 @@ "65e3d4c40ee1f2386759f3abf5ade870217993f3", "testharness" ], - "html/semantics/forms/the-datalist-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/the-datalist-element/datalistoptions.html": [ "3a1cc7747218cffa1e7bd86a9c762339f9788ca9", "testharness" ], - "html/semantics/forms/the-fieldset-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/the-fieldset-element/HTMLFieldSetElement.html": [ "7d6b7eb6d9daa95a09469181e8c62c8174be5d52", "testharness" @@ -587400,7 +586009,7 @@ "testharness" ], "html/semantics/forms/the-fieldset-element/fieldset-setcustomvalidity.html": [ - "4954cc5b7e1c170a6ac3c815c8c1566be9da25d4", + "c4b8cc27c30bb1400d16b765097e7c9fac50d7db", "testharness" ], "html/semantics/forms/the-fieldset-element/fieldset-validationmessage.html": [ @@ -587415,10 +586024,6 @@ "ae6898e558da0ee8cca3cd31a5d3cfc5dc9c49a0", "testharness" ], - "html/semantics/forms/the-form-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/the-form-element/form-action-reflection-with-base-url.html": [ "e86e9b28d5f1bab91b198f59f877de0ccef32731", "testharness" @@ -587503,10 +586108,6 @@ "6edba9819119125ff562cb8ecc4555106cba1993", "support" ], - "html/semantics/forms/the-input-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/the-input-element/button.html": [ "b827cd11bb58fdffa11fb8d1fa9634ab41368602", "testharness" @@ -587592,7 +586193,7 @@ "testharness" ], "html/semantics/forms/the-input-element/input-setcustomvalidity.html": [ - "8397448c6a8fc9371303266671c0a1d17d488d5c", + "48cac09f2febd3c0101eb0003bb56a403bbeac71", "testharness" ], "html/semantics/forms/the-input-element/input-stepdown.html": [ @@ -587739,16 +586340,12 @@ "95fa0e8176311adcbb5a8d0d408d3c4c8bea100c", "testharness" ], - "html/semantics/forms/the-label-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/the-label-element/iframe-label-attributes.html": [ "3629d93c34f27a575114b15256803941c9893f6e", "support" ], "html/semantics/forms/the-label-element/label-attributes.sub.html": [ - "8977e6a8c0ddd8ef2b85a879bf7d4255af8eeecb", + "084ab750c7706f2d01b934cddcfb8f296f06bf9c", "testharness" ], "html/semantics/forms/the-label-element/labelable-elements.html": [ @@ -587759,34 +586356,18 @@ "49f17bfea3e8080fd8690b7be4bc3aa0c82e63e2", "testharness" ], - "html/semantics/forms/the-legend-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/the-legend-element/legend-form.html": [ "40ba412d801e5a06a817e32c28a53a5cbc98046c", "testharness" ], - "html/semantics/forms/the-meter-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/the-meter-element/meter.html": [ "63f4331aa44145b71888c967d4b252610cd3ebc3", "testharness" ], - "html/semantics/forms/the-optgroup-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/the-optgroup-element/optgroup-disabled-manual.html": [ "d5adddda9e4c60593b71630fe395b2da8cac4c98", "manual" ], - "html/semantics/forms/the-option-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/the-option-element/option-disabled-manual.html": [ "566d5202b873e0dddbbdf76d2a07fdb28554b709", "manual" @@ -587839,9 +586420,9 @@ "281e5b5547770f13b8b7ddfb0b6f0a85d0e5ff6c", "testharness" ], - "html/semantics/forms/the-output-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" + "html/semantics/forms/the-output-element/output-setcustomvalidity.html": [ + "2c8bb59995da6ec060ebfe0adece54da652c0246", + "testharness" ], "html/semantics/forms/the-output-element/output.html": [ "10685b8d6e5e3c7d17f4f8b702bcd9672c5c02a7", @@ -587859,10 +586440,6 @@ "4a354f5de58cd0dfcd98b4970a9cee7de8b463cf", "testharness" ], - "html/semantics/forms/the-select-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/the-select-element/common-HTMLOptionsCollection-add.html": [ "2d6949b9226f3347c4957eed623af4bd30bc2d90", "testharness" @@ -587899,6 +586476,10 @@ "81805a8f0b1f0c6dbf056d370b96472309ffe36d", "testharness" ], + "html/semantics/forms/the-select-element/select-setcustomvalidity.html": [ + "ea33791943736b4439a03eba1025765ac1279ace", + "testharness" + ], "html/semantics/forms/the-select-element/select-validity.html": [ "f1cf30c31b0bfeacbe5ef4cfe863a32ff198ad14", "testharness" @@ -587911,10 +586492,6 @@ "98b59224f658d97a782623a054e5c3c5611945a2", "testharness" ], - "html/semantics/forms/the-textarea-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/forms/the-textarea-element/cloning-steps.html": [ "b61235681689807b5d46b8aaca9ae6c7a18039f7", "testharness" @@ -587939,6 +586516,10 @@ "7b513a17599ea93eb430a81bbff8d5aa94d07c3c", "manual" ], + "html/semantics/forms/the-textarea-element/textarea-setcustomvalidity.html": [ + "5f5932aeba8a0a7da66ee006a6e604780210d57b", + "testharness" + ], "html/semantics/forms/the-textarea-element/textarea-type.html": [ "81a270bc3c9304f8b2e7dd526519f4eab7d94f45", "testharness" @@ -587963,62 +586544,34 @@ "4920affb48df0cb5e9a2c75776125ee1bf31904d", "reftest" ], - "html/semantics/grouping-content/the-blockquote-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/grouping-content/the-dd-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "html/semantics/grouping-content/META.yml": [ + "9fcc91fa7224a8cb8b7322d607d5a02da459af3d", "support" ], "html/semantics/grouping-content/the-dd-element/grouping-dd.html": [ "7bdba87df27d4bc6b97ba71a2e4bba991aa11f87", "testharness" ], - "html/semantics/grouping-content/the-div-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/grouping-content/the-div-element/grouping-div.html": [ "09088366b723410e5ddb4bf139756cc2a0c561a8", "testharness" ], - "html/semantics/grouping-content/the-dl-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/grouping-content/the-dl-element/grouping-dl.html": [ "78d8e66077ba1a6ac1b4bf6c6c93296fd931620e", "testharness" ], - "html/semantics/grouping-content/the-dt-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/grouping-content/the-dt-element/grouping-dt.html": [ "107537a4b20c4fe2030410b8481b08a01d1b5dc2", "testharness" ], - "html/semantics/grouping-content/the-figcaption-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/grouping-content/the-figcaption-element/grouping-figcaption.html": [ "6d4d79887825af1f5b830240dc00ff5bb47ddbfe", "testharness" ], - "html/semantics/grouping-content/the-figure-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/grouping-content/the-figure-element/grouping-figure.html": [ "67b958e7d3d78d0a7700d32271f3d9d66e1a46c3", "testharness" ], - "html/semantics/grouping-content/the-hr-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/grouping-content/the-hr-element/grouping-hr.html": [ "1bb031d483d052dfc4481e002371ccc74570ef07", "testharness" @@ -588211,18 +586764,10 @@ "3a6a2722d6fc1d924a43108c0e91339bb36964b4", "reftest" ], - "html/semantics/grouping-content/the-p-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/grouping-content/the-p-element/grouping-p.html": [ "021a20053c9d7921937ac4a488b562f5520004fd", "testharness" ], - "html/semantics/grouping-content/the-pre-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/grouping-content/the-pre-element/grouping-pre-reftest-001-ref.html": [ "6b46337620623ec21b002d2eb1aad905c0c401b6", "support" @@ -588243,20 +586788,12 @@ "12dc5b08fc26d816cea6d08f331d44e8ad0b7e95", "reftest" ], - "html/semantics/grouping-content/the-ul-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/grouping-content/the-ul-element/grouping-ul.html": [ "faca18d0b7c0960f3e8589d0667db5219064a876", "testharness" ], - "html/semantics/interactive-elements/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/interactive-elements/commands/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "html/semantics/interactive-elements/META.yml": [ + "2aff31265354432f3dfe036da4593390f0af41e7", "support" ], "html/semantics/interactive-elements/commands/contains.json": [ @@ -588267,10 +586804,6 @@ "6e16c7701d1e8f0fe49b01d0edf0451d7f34d60e", "testharness" ], - "html/semantics/interactive-elements/the-details-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/interactive-elements/the-details-element/details.html": [ "2095117d3b5d2a58dbfea27b5aec561a371efd83", "testharness" @@ -588347,14 +586880,6 @@ "39b274df2e4ca72a9cd691c9a3ec45fd2f1ba932", "testharness" ], - "html/semantics/interactive-elements/the-menu-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/interactive-elements/the-summary-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/interactive-elements/the-summary-element/activation-behavior.html": [ "2bc98d888e9b0d41c1b6a142abf0a1df8e712d70", "testharness" @@ -588367,22 +586892,14 @@ "a9ac58b56b1a0f69f4e47365cb0ada55f31958e3", "support" ], - "html/semantics/links/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/links/downloading-resources/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "html/semantics/links/META.yml": [ + "4cf702138706700839c944ac7cd6f354eedafd18", "support" ], "html/semantics/links/downloading-resources/contains.json": [ "6dd82b2c809879871f7d1d120237b8dd8e4948e8", "support" ], - "html/semantics/links/following-hyperlinks/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/links/following-hyperlinks/activation-behavior.window.js": [ "aebe3d5ccf39622783c358303acdd3d230bf6abf", "testharness" @@ -588391,14 +586908,6 @@ "9561aaf89b8fd9ad0ef501e6f02167930044a66a", "testharness" ], - "html/semantics/links/introduction-3/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/links/links-created-by-a-and-area-elements/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/links/links-created-by-a-and-area-elements/htmlanchorelement_attribute-getter-setter.html": [ "e1f74fb61a87226321b5a0653cfdb99d1a29bc99", "testharness" @@ -588423,10 +586932,6 @@ "363d0cc7d503f32f6cf8f43479de3b3fb8e401d8", "support" ], - "html/semantics/links/linktypes/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/links/linktypes/alternate-css-ref.html": [ "0962515838bc3815dae82af0df45f8f5bd60c283", "support" @@ -588459,16 +586964,8 @@ "be3d2ceedd65adc2a7ff496ee5980492c42a6b94", "testharness" ], - "html/semantics/scripting-1/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/scripting-1/the-noscript-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/scripting-1/the-script-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "html/semantics/scripting-1/META.yml": [ + "9fcc91fa7224a8cb8b7322d607d5a02da459af3d", "support" ], "html/semantics/scripting-1/the-script-element/async_001.htm": [ @@ -589660,7 +588157,7 @@ "support" ], "html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-url.html": [ - "3328350068373e6ad5cfd06f1180468ea4dccfb8", + "be7fd0cc365f59413abfd57287675596c8124f80", "testharness" ], "html/semantics/scripting-1/the-script-element/module/import-something-namespace.js": [ @@ -590439,72 +588936,16 @@ "c4857d6819b09edc270205c040455567948df447", "testharness" ], - "html/semantics/sections/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/sections/headings-and-sections/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/sections/headings-and-sections/contains.json": [ "3f2f9c62d7e2e3827724075376da897617188797", "support" ], - "html/semantics/sections/the-address-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/sections/the-article-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/sections/the-aside-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/sections/the-body-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/sections/the-footer-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/sections/the-h1-h2-h3-h4-h5-and-h6-elements/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/sections/the-h1-h2-h3-h4-h5-and-h6-elements/original-id.json": [ "e166e5c138a9b6caf2b36d43cad406a73f156d9b", "support" ], - "html/semantics/sections/the-header-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/sections/the-hgroup-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/sections/the-nav-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/sections/the-section-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/sections/usage-summary-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/selectors/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/selectors/case-sensitivity/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "html/semantics/selectors/META.yml": [ + "8499a8a3d363a26184aa29952d9a241428a438b8", "support" ], "html/semantics/selectors/pseudo-classes/checked-001-manual.html": [ @@ -590603,22 +589044,14 @@ "b3826ded2837b80fb77efc9a7f1a0be6192c73e1", "testharness" ], - "html/semantics/tabular-data/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/tabular-data/attributes-common-to-td-and-th-elements/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "html/semantics/tabular-data/META.yml": [ + "64a19fd949fd6235fa522d90e06539a08b339e5b", "support" ], "html/semantics/tabular-data/attributes-common-to-td-and-th-elements/cellIndex.html": [ "28103d973e7fa05dabff850ede4a638018a44dc4", "testharness" ], - "html/semantics/tabular-data/examples/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/tabular-data/historical.html": [ "d92dcdf6722077634bcabe9b52ee386a338b3606", "testharness" @@ -590627,10 +589060,6 @@ "395d8e073f4bc533b74e49f4daca4350d27b8258", "support" ], - "html/semantics/tabular-data/processing-model-1/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/tabular-data/processing-model-1/col-span-limits.html": [ "8a50d7de81bb0b1372fa6f5b8182af79207802ed", "testharness" @@ -590643,26 +589072,10 @@ "8e22913e1a3cae5de1413765e5e8de559d5178f2", "testharness" ], - "html/semantics/tabular-data/the-caption-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/tabular-data/the-caption-element/caption_001.html": [ "6d453a0e49fd4def6c17d3ab3fa7b663ca323ae3", "testharness" ], - "html/semantics/tabular-data/the-col-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/tabular-data/the-colgroup-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/tabular-data/the-table-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/tabular-data/the-table-element/caption-methods.html": [ "a9340862c368c99492ab20e1e743362dd7f0525a", "testharness" @@ -590715,10 +589128,6 @@ "2d53c9ae50320629158128aa28b5215758d6aeed", "testharness" ], - "html/semantics/tabular-data/the-tbody-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/tabular-data/the-tbody-element/deleteRow.html": [ "310567470dad0d99575e2617543e905e7061bf2f", "testharness" @@ -590731,34 +589140,14 @@ "01e29830bde3d485d8476cf96bf8561f1308e634", "testharness" ], - "html/semantics/tabular-data/the-td-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/tabular-data/the-tfoot-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/tabular-data/the-tfoot-element/rows.html": [ "48566370d83e4e682f24516f82e0916751e6614c", "testharness" ], - "html/semantics/tabular-data/the-th-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/tabular-data/the-thead-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/tabular-data/the-thead-element/rows.html": [ "733a15859ff5708bc4cc135c6ce704c49d635d2e", "testharness" ], - "html/semantics/tabular-data/the-tr-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/tabular-data/the-tr-element/cells.html": [ "8ce5552738730af167b0c3694b9156b82561b1dd", "testharness" @@ -590779,18 +589168,10 @@ "108f31a4171e31f60e375996ffdc30c5dec74418", "testharness" ], - "html/semantics/text-level-semantics/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/text-level-semantics/historical.html": [ "6bedcab42ba05adce75511465c2374ec653f1373", "testharness" ], - "html/semantics/text-level-semantics/the-a-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/text-level-semantics/the-a-element/a-download-404.py": [ "c28a2e25288ef685cbcba11493a5eab7d5ede9a5", "support" @@ -590831,14 +589212,6 @@ "187ff7074f9d52e59177a3c3dafabe2823b60257", "support" ], - "html/semantics/text-level-semantics/the-abbr-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-b-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/text-level-semantics/the-b-element/b-usage-notref.html": [ "325d5278bce87086f1a1e4a8ba5181ffd9604d9b", "support" @@ -590847,10 +589220,6 @@ "7e600b3b69a8d8afe1939262a4e83d0b22a5e3b6", "reftest" ], - "html/semantics/text-level-semantics/the-bdi-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/text-level-semantics/the-bdi-element/bdi-auto-dir-default-ref.html": [ "5895c849bb0236cbfcdc3114b0f34b8babecb976", "support" @@ -590979,10 +589348,6 @@ "c264f67ee5a5c11ed1e4d4b71a567da69f6d609c", "reftest" ], - "html/semantics/text-level-semantics/the-bdo-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/text-level-semantics/the-bdo-element/bdo-child.html": [ "cf129c53d7e71643af317e353322bc8c78f9b557", "reftest" @@ -591003,10 +589368,6 @@ "3fcc7f141c74fc7d790c05f103092fa7e8eb80fe", "reftest" ], - "html/semantics/text-level-semantics/the-br-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/text-level-semantics/the-br-element/br-bidi-in-inline-ancestors-ref.html": [ "fc71edfa9ac6d1ee7a271f7519643246e068681e", "support" @@ -591023,54 +589384,10 @@ "c8549faaf16118c4d5d39e8d0b5a135da7a3710c", "reftest" ], - "html/semantics/text-level-semantics/the-cite-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-code-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/text-level-semantics/the-data-element/data.value-001.html": [ "83e5bbaa2ccd031b656233b89b62be78895b0192", "testharness" ], - "html/semantics/text-level-semantics/the-dfn-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-em-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-i-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-kbd-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-mark-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-q-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-rp-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-rt-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-ruby-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/text-level-semantics/the-ruby-element/ruby-usage-notref.html": [ "2db31a9c9bb7a301dbb579332a7870315e4521f8", "support" @@ -591079,46 +589396,10 @@ "c20a6cff72623ce86f1139dff58faa88f42673f4", "reftest" ], - "html/semantics/text-level-semantics/the-s-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-samp-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-small-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-span-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-strong-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-sub-and-sup-elements/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-time-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/text-level-semantics/the-time-element/001.html": [ "437568c95f09bac529d5625a66f41d4c57b0eece", "testharness" ], - "html/semantics/text-level-semantics/the-u-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/text-level-semantics/the-var-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/semantics/text-level-semantics/the-wbr-element/wbr-element-ref.html": [ "36f56c25dc44a3c3ad305f4ad8f8bfc2a8e66a26", "support" @@ -591127,22 +589408,6 @@ "6b4e9d75a05f6537ea1990905dc628ce8a3a9dc2", "reftest" ], - "html/semantics/text-level-semantics/usage-summary/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/the-root-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/semantics/the-root-element/the-html-element/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/syntax/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/syntax/META.yml": [ "d95f375aec206f943615991fcc42b95341549a73", "support" @@ -591151,10 +589416,6 @@ "948b02875b01db1deb841d7362d9487a853c2563", "support" ], - "html/syntax/parsing-html-fragments/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/syntax/parsing-html-fragments/support/encodingtests-1.css": [ "450487e4b6c3c5b2ef183cf8904bcf3870d20339", "support" @@ -591251,10 +589512,6 @@ "41e260e7df49e0e4ddb1fc5df11913dbda15edd7", "support" ], - "html/syntax/parsing/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/syntax/parsing/DOMContentLoaded-defer-support.js": [ "d9b6c0bbc62f48f931e2317c414f7a31d97308a8", "support" @@ -591675,10 +589932,6 @@ "4b38fe0c7bcb088450cc13f13c805711caf91961", "testharness" ], - "html/syntax/serializing-html-fragments/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/syntax/serializing-html-fragments/initial-linefeed-pre.html": [ "9ff1b0c8c3d53fe8239dd74c74da8e434dffb117", "testharness" @@ -591695,50 +589948,14 @@ "7e9ca871a347f056132d81b4c1965f5384beabe9", "testharness" ], - "html/syntax/writing/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/syntax/writing/cdata-sections/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/syntax/writing/character-references/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/syntax/writing/comments/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/syntax/writing/elements-0/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/syntax/writing/elements-0/contains.json": [ "44843f9f5f52a68988f71f852f92a2a549b331f1", "support" ], - "html/syntax/writing/text/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/syntax/writing/text/contains.json": [ "a273351ea25b5b9574525d2ed9ef40c11d5858a5", "support" ], - "html/syntax/writing/the-doctype/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/the-xhtml-syntax/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/the-xhtml-syntax/parsing-xhtml-documents/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-1.htm": [ "3c58f1659b1e7a06fbc9068a243b8777fb00b730", "testharness" @@ -591783,18 +590000,6 @@ "f675bac0053a5e0b8dffe83cbaf48709537409d7", "support" ], - "html/the-xhtml-syntax/parsing-xhtml-fragments/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/the-xhtml-syntax/serializing-xhtml-fragments/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/the-xhtml-syntax/writing-xhtml-documents/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/tools/META.yml": [ "d95f375aec206f943615991fcc42b95341549a73", "support" @@ -591815,12 +590020,32 @@ "2bea14569ddd5c874a05d7ad72f083b2918d6e84", "support" ], + "html/user-activation/activation-api-click.tentative.html": [ + "24ce6e1a4963aef7638ce2b69c8476dcda6513ce", + "testharness" + ], + "html/user-activation/activation-api-iframe-no-activate.tenative.html": [ + "f04d5b96b044354727a8a838b49b809ff0e613e2", + "testharness" + ], + "html/user-activation/activation-api-iframe.tenative.html": [ + "3a1e3a31382debb324f5917a63c30303391aed50", + "testharness" + ], + "html/user-activation/activation-api-setTimeout.tentative.html": [ + "9cdb756da2a3651437efd2666255e1e7e26bd108", + "testharness" + ], "html/user-activation/activation-thru-contextmenu-event-manual.html": [ "6383438f2069930b8f7fe684c5a2850d138e6073", "manual" ], - "html/webappapis/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "html/user-activation/resources/child-one.html": [ + "9d00ea8b452c936983e9c334bdb9722608807555", + "support" + ], + "html/user-activation/resources/child-two.html": [ + "3789d0029711f4333e301955d4ff4b8b35a581b6", "support" ], "html/webappapis/animation-frames/callback-exception.html": [ @@ -591847,14 +590072,542 @@ "e99c08823b218a53057d5cf953eaee6b139bb0ed", "testharness" ], - "html/webappapis/atob/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/webappapis/atob/base64.html": [ "d720c251750e32d5ba6a76897439128a0eaa8479", "testharness" ], + "html/webappapis/dynamic-markup-insertion/closing-the-input-stream/document.close-01.xhtml": [ + "a33055bb7c79c3802b657df70d8daa56b1703713", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/001.html": [ + "8c8aceec7a111f55f0c4102f87a9f2e9a647b723", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/002.html": [ + "eee21c06d708c51b8bcfd4601e0e1df370db445d", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/003.html": [ + "bc3be6177a1f80b82d7abc002407553f32e1730d", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/004.html": [ + "a121985df6e745c4a8e18c088e9bbd190d6cbaf3", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/005.html": [ + "c019f5e27f53398c08ec11e10b40fe64322f3933", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/005.js": [ + "dad693bf94993ee3d127f2f2bd8aeb846784f6cb", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/006.html": [ + "51297ed0ca0604a2ca4696cc9aa6d1f272063f2a", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/006.js": [ + "dad693bf94993ee3d127f2f2bd8aeb846784f6cb", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/007.html": [ + "6b5a6f6732a8fbaf60b109a6dbffe24b85f1f027", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/007.js": [ + "a9b6847ff6b22f2ee1c77e80e43d6429b07b1f35", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/008-1.js": [ + "e761f4b4e0d9ecfd1dccc2e5012c6ede0d5494f8", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/008.html": [ + "f6c7ddf6afd5ff7f74440a53d1611e985f2ab66f", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/008.js": [ + "8dc71f4f792944136b2268b6996978d2f05547f6", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/009.html": [ + "efb4e9cc8fab72987d7db4d843b1d3372341c27e", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/010-1.js": [ + "4f995d0008ae13d3e7952bd9341c2109e2b2a0da", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/010.html": [ + "af4328218d8aa6b7cb1114026088f01efa1c035c", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/010.js": [ + "daf7cdc770a5d05cdeb5ccbc8618134b613f2b98", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/011-1.js": [ + "6e4bf99110b51a69f844fa3c4cf1bf6cbfdd54f5", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/011.html": [ + "f55604bf3353a8edc3d7526831f055a5c3737df3", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/011.js": [ + "16225e651165db9a1607cbf042a2297d3488b86b", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/012.html": [ + "34cd06f8bc45466a601dea8492920bbda4dbdd5c", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/012.js": [ + "3ed9cf147bdaa1a177d863c047ce60493c10a98a", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/013.html": [ + "e02dfff2b6f98f796d63ecf1ba85e8d2c99ee605", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/013.js": [ + "c8b1c4dfe0eaed3b84d58855f41bd2b2552ea9b9", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/014.html": [ + "ab08a8015d397ba752372c6298202c46c003f6ec", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/015.html": [ + "201466fd4a1a291220dbca8fc341a56264cbbd54", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/016.html": [ + "b21df3653e4ea1cc8fdc3ceb0db36e9b9a2191f5", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/017.html": [ + "122c9609c3ca328e2c2d02483ad47b50ed8155c6", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/018.html": [ + "e28b55e191c78575142aae53a14aa9f59cd3d04d", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/019.html": [ + "b4267fa1f88679537dde437a35d95c1e0a48c2c4", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/020.html": [ + "16940003fba526f723f698e35a8c0c584604c1ca", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/021.html": [ + "f8c5ffa09b6c5828c0b39a36535be70064281339", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/022.html": [ + "c79b37206d78a6c641585ed681535a2b30493a17", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/023.html": [ + "34a9fddbb892f2410937b5627f322862241a0539", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/024.html": [ + "b6e901f124c099a87100b083d47cdb3ab621a74e", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/025.html": [ + "9e2aba6b4be1e032ddc67ccebf8cb9f4021935ab", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/026.html": [ + "4007e8d057ce5e6fe991220bc29b3966d576fc79", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/027.html": [ + "3a9492537987b7d688015e5e79a46ae2f49936f5", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/028.html": [ + "14d932aeba095e24733b1197b64897719c809ba2", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/029.html": [ + "44976fbc1fb75f99430aeef2df89e444d55751fe", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/030.html": [ + "e9a3580093caf362bcf2d59321f6917bab7b668f", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/031.html": [ + "ed70f8d3ffdc1220160df7f3b47c03526bb61697", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/032.html": [ + "5f5fe390b66d77e862c553d2a5f3a33029bc8a6f", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/033.html": [ + "e981ce9c2b4c4615e524d982f004aa7c79c4c6a2", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/034.html": [ + "22f988ee407cee6ebc001d8fae6f881a60c8668f", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/035.html": [ + "b485caf54e23e2e81085e54057c9aa151e6f14b1", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/036.html": [ + "1aed908834cb95d963261003db7cc780a47a04bf", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/037.html": [ + "cb3d413b0ffc1bb0b4e5391b34b6aa8c19407a4f", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/038.html": [ + "c6aa999d6a611f94acc4eb50d316f2f525dece10", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/039.html": [ + "7b2f7827e84cfb7589bc224c07c26c0b743fdbe7", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/040.html": [ + "9463d2fcf88d84f415a1fb5ed44ca216c08a49b6", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/041.html": [ + "95bfe438f109dbc35ada28b5e8c5cc539b892279", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/042.html": [ + "a706a05835f815c2362f3fb2e8f921ae05ae4128", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/043.html": [ + "1b7dc5cc552626fe5daaa4d409c403dfbf06d795", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/044.html": [ + "d0126ff1e0eebac313c35a1ca6bbc941cec25721", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/045.html": [ + "9c08d3ecf9d21e093997833062eb0248ff169ab1", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/046.html": [ + "7391e6e5e0528114d39ae3af5226f0b03730fb14", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/047.html": [ + "b72d2ad21a9127b9fbfae9f9732c25f614646704", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/048.html": [ + "b72d2ad21a9127b9fbfae9f9732c25f614646704", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/049.html": [ + "058198bdccaa24e77438cc78aef061903c2b80c0", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/050.html": [ + "6a0a46450d2b203592763e74998aeab5c40a0535", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/051.html": [ + "e7c9064ba73547f25e0c7f202f14d51ee4e10fd1", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/contentType.window.js": [ + "3f1218b65f930ba0a31044163fb995527c020fa8", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/document.write-01.xhtml": [ + "3b309503bf8f002712eafba1d5e7a1f3f743d7e1", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/document.write-02.html": [ + "f4c6db3136e0860d38fe21193a0012eb5e4842ef", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/empty.html": [ + "b1149d9764ff4a9a7e8698f7a56ed003796d8582", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_001.html": [ + "1c9c5a787612667df557c57cb1ec5e101a38dfab", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_002.html": [ + "28e827f8b8b0c9af9dfa46dfb505920df72345d4", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_003.html": [ + "011b66b2d7cbf4a6184bbbfeb198cfb27e181343", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_004.html": [ + "525eeb4f4805cec5341055278507fd8dfe7c3cfa", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_005.html": [ + "ab2ea0edc62e53c2a8e403797206a5d4f74ead0f", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_005.js": [ + "487a5b400bc7f145455c5267b07a7f083ec4adb0", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_006.html": [ + "6af33c96b459f56fc8c57216eb20877f252112db", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_007.html": [ + "21f2b8f36521e3e76bee968ee25febf016b5a263", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_008.html": [ + "c5a6befd4b60d826b522f5009346cc5cdd23b3da", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_009.html": [ + "e1f0e5b3149a7b3e2386d91147d0d63620135f3c", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/iframe_010.html": [ + "8d70bfbc321000ccbfae07c4a435a09d4d7948f3", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/nested-document-write-1.html": [ + "9f6c0ffee84cbf54639e6d39276e331a759336d1", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/nested-document-write-2.html": [ + "4748eb3ed5fdbbd036c50f31ab5a3e817f9291e0", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/nested-document-write-external.js": [ + "7350fb83fcec2374dad98d7ad13dd07cd78f5396", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/original-id.json": [ + "c1955e14b1222d952cab1eeff293ec3f5d3b0791", + "support" + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_001.html": [ + "68400d60bf827e9e48cda169574f0a279c55cda7", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_002.html": [ + "8eb2c9faf27578fad096e4373c34739afaeab2a8", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_003.html": [ + "14887f0ec4302566de0fbb977d03933ad539b5b5", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_004.html": [ + "18b1736b952328c6de2ac9b902cada3b5beb5224", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_005.html": [ + "3c6a906f97417cbc93cf7bcb80255963e54e0910", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_006.html": [ + "581e59a4cce498d590d6199dbe5169ce964df631", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_007.html": [ + "cd326b87b050741ca4dd5d66a5a72522efdaf29a", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_008.html": [ + "0216f7d4199ca405da6f20e34ef5a4ff4b0406dd", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_009.html": [ + "0efdaefe472ec6621de75dde22197ee1a33cd529", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_010.html": [ + "0a53afd7a3de453cf398033fd4159e3e4988244d", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_011.html": [ + "c8d129add739cb431d1b50e693744c6bc6adc4ed", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_012.html": [ + "833de0abb686ed91179cd8228e09e05a61817c42", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/script_013.html": [ + "0c45797b8e51b33aa49148eff24e021b69c372d9", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-write/write-active-document.html": [ + "66d780431c740841834f0af67d20d28ac5178d9b", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-writeln/document.writeln-01.xhtml": [ + "443e8d9d653feb514dfc3cb8a1b4cb204ef38820", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-writeln/document.writeln-02.html": [ + "f81725d70babcb3e5f30b191d891dba2d30ba038", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-writeln/document.writeln-03.html": [ + "5564adb6a1c14b3f08b33c1838a3c8377fccea2c", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/document-writeln/original-id.json": [ + "37ea841113fc00fe481bd43a635e7bb690ec6057", + "support" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/001.html": [ + "f3194a3557ea4991b93d53f729912e45de1a676d", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/002.html": [ + "6f633c653ba9fb431fe41f69687e37ac1083c320", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/004-1.html": [ + "448f6f9971f92c4b9b7b7a536be353793f6147d6", + "support" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/004.html": [ + "290990faf1c4107c80069110d28b925e65e4719c", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/005.html": [ + "6eb18f167496446c4c9d776e0f10be71c8f65a95", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/006.html": [ + "94989d1ee98fb9e739a116b103c23e8d8108ac87", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/007.html": [ + "6a409aa8cd0629dc1f71977e3994d07ccc7bbcfd", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/008.html": [ + "1c813722dd68b1a13348aa8071d99cf358ab9eca", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/009.https.html": [ + "02278f0ed00b2392afcbcacd56ddd750b7204241", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010-1.html": [ + "bf26fa8b0d8542fb5b7f6db9c1e8bdcc8cfa8081", + "support" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010-2.html": [ + "6b3c91516759cf79a2e15a45455f8071f517c346", + "support" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010.html": [ + "95a5ad21f6ff58456d614f767046c5d3c2131460", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/011-1.html": [ + "5feea2d56edcfd872eeac109e2ff8e52acd6d60c", + "support" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/011.html": [ + "ca6b4c77e86496b0b6df85d8e61312786536c285", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/012-1.html": [ + "923397f1eec1ea22f8515c44113dea080d9230eb", + "support" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/012.html": [ + "cd5d66387f4057c11c5b9645cbba5e66805f52d1", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/013-1.html": [ + "32cd8db0139a5d65ce3ade4906724b3897a9e64d", + "support" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/013.html": [ + "ec55397d532ecac54cb3b04356b8034120161dbe", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/014-1.html": [ + "23c430e683be5ea67d4be1c8ab7ff8064914199b", + "support" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/014.html": [ + "fff1c433d2d010c8afa15fc702afc5b33643dad3", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/015-1.html": [ + "bfcf2e3d916c30f00f448f6c1b225be99f35c1c1", + "support" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/015.html": [ + "3c6015624e24b5928ea38a574a76c4aee7b6dd40", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/016-1.html": [ + "3320a164d93b8d39254c4609a5320e2f1bd115b2", + "support" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/016.html": [ + "ea3ff6e58680da8c3f08e7f26ebc738d82703801", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js": [ + "0ef6dab1d5e2364a0a75513469e339c20b14c674", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/custom-element.window.js": [ + "f6c02de00d0d8edb20f1503304561c8deb36da79", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-01.xhtml": [ + "cb059c7c17320c0e63e9453d3a0486a8a94b060a", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html": [ + "1941d51b6489947d979480d097898e91b212e508", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-03-frame.html": [ + "bcc6a14a9c3d116d95e72d3f057d0cd7cbffd2cb", + "support" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html": [ + "a2a5acc9dfe53c7482eeaa4be3a4819238f8e120", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/encoding.window.js": [ + "b021d6fcc38925ddf39309e21716c5be37791247", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.js": [ + "ccf357a8081b99de1d85e05196145e83b3de2ab5", + "testharness" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js": [ + "1e1c656e1d19c9c459faf16327e099a4c9e13872", + "testharness" + ], "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/origin-check-in-document-open-basic.html": [ "5aea157f38d3bc075959be3d1f277ea25c731a66", "testharness" @@ -591863,21 +590616,33 @@ "b4cdd98c6eb9a3946b49a6876c62c7e35501f413", "testharness" ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-async-frame.html": [ + "38be68cf85bbe4cef461963768fe1390733d67db", + "support" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-frame.html": [ + "4cb26a783d232652a580e511e439b8bfaac04dfe", + "support" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/encoding-frame.html": [ + "1d8ae9f75fe05343c1858caad637c9f7602c9f28", + "support" + ], "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/set-document-domain.html": [ "f777c3f2ce746d415814083dc932f4a25a82c34f", "support" ], - "html/webappapis/scripting/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext-subframe.txt": [ + "8d06cea05d408d70c59b1dbc5df3bda374d869a4", "support" ], - "html/webappapis/scripting/enabling-and-disabling-scripting/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext.window.js": [ + "1f440ff93300a0ab715982feb067dd3162c8fce9", + "testharness" ], - "html/webappapis/scripting/event-loops/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/type-argument.window.js": [ + "0f0020e1d7d8050892ef146d687178cfe8eedcd2", + "testharness" ], "html/webappapis/scripting/event-loops/contains.json": [ "cc10a79306b389f7c99f2346ed03dedd177fa58c", @@ -591903,10 +590668,6 @@ "3907beccfe4fddca1b2326f737bde4e87979926e", "testharness" ], - "html/webappapis/scripting/events/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/webappapis/scripting/events/body-exposed-window-event-handlers.html": [ "11dc83c2b4c817e1eed694ed199d327e15abcfa6", "testharness" @@ -592055,18 +590816,6 @@ "875ab8aa7b99cec015d82bcfe9ef4133b7adf97f", "testharness" ], - "html/webappapis/scripting/introduction-5/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/webappapis/scripting/javascript-protocol/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/webappapis/scripting/processing-model-2/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/webappapis/scripting/processing-model-2/addEventListener.html": [ "a2e5be7d9a2a50da12bd8145c34bf81e7116dbac", "testharness" @@ -592311,18 +591060,6 @@ "68f8eda2182bdcbbf5fea63a0a196e9c3893ffe8", "support" ], - "html/webappapis/system-state-and-capabilities/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/webappapis/system-state-and-capabilities/the-external-interface/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/webappapis/system-state-and-capabilities/the-navigator-object/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/webappapis/system-state-and-capabilities/the-navigator-object/contains.json": [ "2c41fa08c5296f814d286d8b459424c5c488e3e1", "support" @@ -592367,10 +591104,6 @@ "00ef4a167d7b93567416ee0de031feb76eaec937", "support" ], - "html/webappapis/timers/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "html/webappapis/timers/evil-spec-example.html": [ "49fd55dbbf64c6973a0e76284c0e3d8b7bf0ef3c", "testharness" @@ -592395,24 +591128,8 @@ "7945f54f8ab924c85f337ad5a50b02677d48e526", "testharness" ], - "html/webappapis/user-prompts/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/webappapis/user-prompts/dialogs-implemented-using-separate-documents/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/webappapis/user-prompts/printing/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], - "html/webappapis/user-prompts/simple-dialogs/.gitkeep": [ - "da39a3ee5e6b4b0d3255bfef95601890afd80709", - "support" - ], "imagebitmap-renderingcontext/META.yml": [ - "4350cfdc3ece39bf73aafa6e425cad279fef5097", + "c438df5c4df3802c55ab04a8b3c187e5c11758eb", "support" ], "imagebitmap-renderingcontext/bitmaprenderer-as-imagesource.html": [ @@ -592440,7 +591157,7 @@ "testharness" ], "images/META.yml": [ - "b7b3efbc00f4018cec688bdb3ecc02623a9a54cc", + "232033e2138a3039f27ce8714a104051e1f4ab02", "support" ], "images/anim-gr.gif": [ @@ -592908,7 +591625,7 @@ "wdspec" ], "input-device-capabilities/META.yml": [ - "9781a4d75e1dcda28688def7a44f1776a1344776", + "0c4b71c525122378f517cb32d089f948a86129ef", "support" ], "input-device-capabilities/interfaces.html": [ @@ -592916,7 +591633,7 @@ "testharness" ], "input-events/META.yml": [ - "9ffe7cef99cbebef5693d56ac5832bc85d841e79", + "6b3e749857b72650eda684b2850d5970b6088fbc", "support" ], "input-events/idlharness.html": [ @@ -592943,20 +591660,24 @@ "3f9bbca50917a8a3e27d4983fa792b6d2686552e", "support" ], + "interfaces/CSP.idl": [ + "d16c0274f51864f1fd689e3908a72391131f5921", + "support" + ], "interfaces/DOM-Parsing.idl": [ - "61b8e622931ffee1b779e798e4a381959457ef45", + "b24ce10738d8bf36b5a3ed6679b2e4b8d0fb34e5", "support" ], "interfaces/FileAPI.idl": [ - "3fb06078e603a6010c2eb0fb45715c8cbda35678", + "ac9d05f31ad82befd9da8e6023b3ab5c3823d370", "support" ], "interfaces/IndexedDB.idl": [ - "149cca0098cf37769391b4caa0650a7182ed8212", + "5d1d405a9b6fdd1ac3e849e1c12aadd056cb481b", "support" ], "interfaces/InputDeviceCapabilities.idl": [ - "75bf10b0d1bda48c56cb5cd2ac1c73eb59f744fc", + "631a62b86212b61e4919dd3db3742da62271813a", "support" ], "interfaces/META.yml": [ @@ -592967,12 +591688,16 @@ "2835174993c1648c5f8e2a4639727118d62e2d77", "support" ], - "interfaces/ServiceWorker.idl": [ - "7884feabcb4c9d0a447cccfa2359e3c45eef5455", + "interfaces/SRI.idl": [ + "42cb812276c3a1fe0f10c19856deec3b003c68bb", "support" ], "interfaces/WebCryptoAPI.idl": [ - "1fa169a6badb1c21608f1e1a68075939e913603f", + "a6c7bfdf5f98a32533ba95d76fed71dc4cc6dc38", + "support" + ], + "interfaces/WebIDL.idl": [ + "62e56d5f08d5044fc3ee79ac3549d7222f4186aa", "support" ], "interfaces/accelerometer.idl": [ @@ -592983,6 +591708,14 @@ "623852530c2645b51347c82cea8fa72c0cb22f18", "support" ], + "interfaces/appmanifest.idl": [ + "dc57a1479ca3010f6fa86ef46274a452d339d1b5", + "support" + ], + "interfaces/audio-output.idl": [ + "857874c69ea248e17b3a2a6ba23c13fe096c429c", + "support" + ], "interfaces/background-fetch.idl": [ "272d5ef66a2df3a6c3fefaf9688802ed93a9ad5f", "support" @@ -593012,7 +591745,7 @@ "support" ], "interfaces/cookie-store.idl": [ - "427e33a156cad6978e1c9c5ef5a9f906aa67a4c4", + "fe873252f8a58c66f736fbabd90d6d37a15df139", "support" ], "interfaces/cors-rfc1918.idl": [ @@ -593023,8 +591756,12 @@ "29a0bcde9ddd6629c7bf05757cea45c831fe9a6b", "support" ], + "interfaces/csp-embedded-enforcement.idl": [ + "57d276da4bf41e5f47dd903411a748c3c6ebfd79", + "support" + ], "interfaces/css-animations.idl": [ - "520ed1f6d245c75551aed3f74f988026edf3ff59", + "804917872e1fd13cb9edaee693d4e011fcd7b79e", "support" ], "interfaces/css-conditional.idl": [ @@ -593068,15 +591805,15 @@ "support" ], "interfaces/dom.idl": [ - "9621186ac979a5860d5c909b7505900a48c2c810", + "13caf62b3918fec8ad0cf436c6a855c0d457a56d", "support" ], "interfaces/encoding.idl": [ - "0dd77d1c6d854b0bdd003107c2385a224e1953f8", + "d03929c62005870ae2a5a2718374c7364ec86103", "support" ], "interfaces/encrypted-media.idl": [ - "9965e27558616e512abdfacb451a4798035cf1df", + "583804d24cd5306932ac3a9ad446d6083b44f9b2", "support" ], "interfaces/entries-api.idl": [ @@ -593100,7 +591837,15 @@ "support" ], "interfaces/gamepad.idl": [ - "f112b177a27816085e46d4949b404f2d5666881a", + "94b8ff8cea671d2755b63c75259905136ee09ae9", + "support" + ], + "interfaces/generic-sensor.idl": [ + "b926fccfdfec89604ca6c582b0826c20c4b815d3", + "support" + ], + "interfaces/geolocation-API.idl": [ + "87be830712d8d40ec01b200935a41422e72ab7c4", "support" ], "interfaces/geolocation-sensor.idl": [ @@ -593120,7 +591865,7 @@ "support" ], "interfaces/html.idl": [ - "fe86c7370a537be87884d1b9da1f7b7630c6af41", + "c9a15b7403a9517afd624c96a9ce60418afea98f", "support" ], "interfaces/image-capture.idl": [ @@ -593128,7 +591873,7 @@ "support" ], "interfaces/input-events.idl": [ - "99bcfa971e6b2628ab8ba174b772d56b23dee38b", + "5a76e3df1b2e66e36470781f407c8080f70fdddc", "support" ], "interfaces/keyboard-lock.idl": [ @@ -593139,72 +591884,96 @@ "1e9e311a4d347d9f036702d29ef0bc82fca04162", "support" ], + "interfaces/longtasks.idl": [ + "ce433568ee600f02cc5df4ba6512e58ef98af798", + "support" + ], "interfaces/magnetometer.idl": [ "5839955446fafc91d9bd63d1549d7bc2e7afe499", "support" ], "interfaces/media-capabilities.idl": [ - "17413896d6281553091cf2c369c29de42d450962", + "dad6123e39feca39ec620de51307e56823cc5408", "support" ], "interfaces/mediacapture-depth.idl": [ - "d14de04445755e1f6bc88023d3bd85b601ed5209", + "2ac0dcf83f5afb227f24c9063d738dd22e941fe9", "support" ], "interfaces/mediacapture-fromelement.idl": [ - "501b9ce0b557e52c122a2bb7f3be1a3e360da512", + "96a92fe9dc7a6bab8a17e69280d4d0ba938e5521", "support" ], - "interfaces/mediacapture-main.idl": [ - "a2a5e12acdc863828532e28574ed4904f0b0b2b8", - "support" - ], - "interfaces/mediacapture-record.idl": [ - "2af81807d578af4bfec67e58aeb17fa194bf83b4", + "interfaces/mediacapture-streams.idl": [ + "af34b0336b91f5806f6a4d662495f05713b60abd", "support" ], "interfaces/mediasession.idl": [ - "7cbe73f7f563ee45772bb466ce63e16a549548d3", + "378af7beb3cf20086cec84840286f5e2a33f850c", + "support" + ], + "interfaces/mediastream-recording.idl": [ + "ad3974d839ba5ec99365dcd0b156ba1e508198ed", + "support" + ], + "interfaces/navigation-timing.idl": [ + "c12830eb9f5f18eef60557f5a93ea68812f78193", + "support" + ], + "interfaces/netinfo.idl": [ + "357a99c1a5cb73265ee63d1ab1a0e413c6ced458", "support" ], "interfaces/orientation-event.idl": [ - "0188bd03cdd323e354e8e7c3d279c6983f701378", + "88dba12d08fe65b1474994cbc0d15a71504e6300", "support" ], "interfaces/orientation-sensor.idl": [ - "1f0698a8611726b1ba724a5d7a0961e836c7b07e", + "22846ce3ca7d7e8325915a8f1cb52d97bb8467f4", + "support" + ], + "interfaces/page-visibility.idl": [ + "6551f944a2611e10ffebb80dfa217b392bdce26a", "support" ], "interfaces/payment-handler.idl": [ - "6d9157e515e419c7a2fffc61a1f8e3b23a4550ba", + "c47c18345c06d87b7b9fe318b22d51413603f626", + "support" + ], + "interfaces/payment-method-basic-card.idl": [ + "dee137bcb0e2e32c810f6d2c81ccac4187899a1d", "support" ], "interfaces/payment-request.idl": [ - "669b8faf18cb5c12f135e991279b90a48d71ee97", + "1523f682dd32680417a5e45d9201743685549fe6", "support" ], "interfaces/performance-timeline.idl": [ - "57f26fe863d12c7672905d185e9a2c7ab9cb98a0", + "67516402261de8f219f0374d38d42fa17b0a2096", "support" ], "interfaces/permissions.idl": [ "7fec46d25cf175390524b681cdbec7b0b76c89b9", "support" ], + "interfaces/picture-in-picture.idl": [ + "4051a7f0ba28e984294ca32a5a2aef73b7f9a6bb", + "support" + ], "interfaces/pointerevents-extension.idl": [ "26055736a27852501eba7da7f0cab7c57eceb652", "support" ], "interfaces/pointerevents.idl": [ - "29ca4e05813256592af7e9804e8135aaffdcc995", + "5bf09b0822cbd8ecd479092842de1cd80b891269", "support" ], "interfaces/pointerlock.idl": [ - "6d3ff2b3f8b4015f3cb282db2cd2dbb8c2e90db5", + "356f23aba40f5d32e8952ffe594e1b120112af81", "support" ], "interfaces/presentation-api.idl": [ - "2f9d2c446e561acea02f9954f4f35f1c4dc61f2c", + "2d97afcb6d7d598f48fe0d8cef99ad4c50196452", "support" ], "interfaces/proximity.idl": [ @@ -593220,7 +591989,11 @@ "support" ], "interfaces/remote-playback.idl": [ - "9ddb3a7bfce2454a3f7d835785db912f70521449", + "0bb6f1c86022bc066ecfcafab9376e9255c3a265", + "support" + ], + "interfaces/requestidlecallback.idl": [ + "e49a6aad4ba17b797516f397096703690bcbecd9", "support" ], "interfaces/resource-timing.idl": [ @@ -593228,7 +592001,7 @@ "support" ], "interfaces/screen-orientation.idl": [ - "ace5a4ae79933cdfd7ecf5c3801e93f0636fe57b", + "c3d267a479600e83e4782e4a80126e3c4467920f", "support" ], "interfaces/scroll-animations.idl": [ @@ -593240,15 +592013,15 @@ "support" ], "interfaces/selection-api.idl": [ - "c8c9e45b541e511673dbe8ddd1321dceef2856b4", - "support" - ], - "interfaces/sensors.idl": [ - "3b2cb524838f2274463664621fddc7c927ac95af", + "10e7cdeb0e3c5e3871c81e30e89e72412d3f572f", "support" ], "interfaces/server-timing.idl": [ - "0c9862d6e00d02a0955a1eaf2ec4f237bd060ac4", + "9566d1f7ef4e11d6d6b7a87ee55c0b61d5c3a55e", + "support" + ], + "interfaces/service-workers.idl": [ + "979a3b43c2db10f5a93213f46f1abf90082da22b", "support" ], "interfaces/shape-detection-api.idl": [ @@ -593280,11 +592053,15 @@ "support" ], "interfaces/vibration.idl": [ - "d1f3f51b0c6a46958d4bb3e9cc8bbc85e8a74512", + "2cac333a4dcdb11d56a4457a31941d924911853d", "support" ], "interfaces/wake-lock.idl": [ - "7d0ee3d60a923bf454e18f9116cded1cc3a16f9b", + "62ca49757b1cc22c4e61f4910b156815ce4ec720", + "support" + ], + "interfaces/wasm-js-api.idl": [ + "e02ba8be686d6f9aee7953f85ea77d836513d6ae", "support" ], "interfaces/web-animations.idl": [ @@ -593292,19 +592069,15 @@ "support" ], "interfaces/web-bluetooth.idl": [ - "48e51b15f2338d6b3b0a8c0a013b4f1bfdf6ca1f", + "069f2becc10faf23e4ae3f4d02d7f1e3b0806106", "support" ], "interfaces/web-nfc.idl": [ - "c81f70e3dd5a703ce38211227017a56a6262cadf", + "52cc53f0e1c48de190ea03a7eee1c77317897a30", "support" ], "interfaces/web-share.idl": [ - "21b54128664c5962c29fd708ebba3d8d90987f26", - "support" - ], - "interfaces/webappsec-subresource-integrity.idl": [ - "059b8faf32b557e4303a8c119ab46fe58ca85102", + "0b36b9df90683103e8bdb3707522c83f9d5789f2", "support" ], "interfaces/webaudio.idl": [ @@ -593312,15 +592085,11 @@ "support" ], "interfaces/webauthn.idl": [ - "1ae8b428644479b352fd5b1996677fd4dcdbb84b", + "330c9c317d2cc4472ff18b1fddb2bfb56c0249a4", "support" ], "interfaces/webdriver.idl": [ - "6f6ce7d142a9b548988c9ab2a7a13f0f1793cf6a", - "support" - ], - "interfaces/webidl.idl": [ - "d466ddd18ed621e15cc416863502069ffccfa5b9", + "b5ff8a9db576c8afbe3746cd41370965c06219ee", "support" ], "interfaces/webrtc-pc.idl": [ @@ -593328,7 +592097,7 @@ "support" ], "interfaces/webusb.idl": [ - "1567268ad97c23f6709c835ba5d272c0982c0a59", + "8b6b064f5dc45751da07476ef2c05390a23a2d79", "support" ], "interfaces/webvtt.idl": [ @@ -593336,7 +592105,11 @@ "support" ], "interfaces/webxr.idl": [ - "abc92e822310850493632eb1ee7183b6e859b78a", + "cc9199634844a31a06e4d25c4095a7193d308c90", + "support" + ], + "interfaces/worklets.idl": [ + "6d501d09f9c3f685d8359ef0d2fa4141391b381c", "support" ], "interfaces/xhr.idl": [ @@ -593344,7 +592117,7 @@ "support" ], "intersection-observer/META.yml": [ - "4aa4c12bfda7b423e540375f634447909238efb7", + "5332bab4a8b76118977237cd4b72f5d0dd6aadfd", "support" ], "intersection-observer/bounding-box.html": [ @@ -593352,7 +592125,7 @@ "testharness" ], "intersection-observer/client-rect.html": [ - "acec9a4f59ebee1840950cf766a45676490eef84", + "0c4b523d40f051ca3093c499eae4edcfe0c4a3d7", "testharness" ], "intersection-observer/containing-block.html": [ @@ -593451,6 +592224,10 @@ "0d1d4ccf6c2fce47a6470dbe21a382828dcaa6c4", "testharness" ], + "intersection-observer/text-target.html": [ + "07f1c09567ffc83b7925f11a8d7f841b18a892ed", + "testharness" + ], "intersection-observer/timestamp.html": [ "0d57a6abc3c3056f921401f629ab231c458cf4cb", "testharness" @@ -593468,7 +592245,7 @@ "testharness" ], "js/META.yml": [ - "4bdad91fff78a11818c366ba370a09a5d5605202", + "2c159f88dd7cdc5dcd1b6580094240d2414d7075", "support" ], "js/behaviours/SetPrototypeOf-window.html": [ @@ -593540,7 +592317,7 @@ "testharness" ], "keyboard-lock/META.yml": [ - "97cf4097ea2dbf2d22ca2fa07deed56ea88e9383", + "94a99910be54c9c6db2a318a8a6bcbd18947541d", "support" ], "keyboard-lock/idlharness.https.html": [ @@ -593576,17 +592353,13 @@ "support" ], "keyboard-map/META.yml": [ - "e27ebee62f7c097f194392d4e4594942cf991ebe", + "abee315df71456ef5fd663747ff570cc3c6d3dfc", "support" ], "keyboard-map/idlharness.https.html": [ "3215b6729d83ca2841baf6eb33445eb07e0a7c25", "testharness" ], - "keyboard-map/keyboard-map-two-parallel-requests.https.html": [ - "44ead37a7118fb121dea19d9e381f647dbe6d6df", - "testharness" - ], "keyboard-map/navigator-keyboard-map-blocked-from-cross-origin-iframe.https.html": [ "f49b379f64d6c83ad6ee8a8b9fcb34932a96ea08", "testharness" @@ -593612,7 +592385,7 @@ "support" ], "lifecycle/META.yml": [ - "c99bd5330e9e8c1620ce3e97b9a0d7a307ee285d", + "b800aeb5d6588aefbef47d269658fb288a6a1667", "support" ], "lifecycle/freeze.html": [ @@ -593628,51 +592401,55 @@ "support" ], "longtask-timing/META.yml": [ - "b8b96baac52a4d6f1dd067f2bb3b1eee0fb2870e", + "b298d79c035a4fbf81cfc9cc703f493abb9e461a", "support" ], + "longtask-timing/idlharness.window.js": [ + "a37e1c32451afbfeb20079bea4e351372a415b1f", + "testharness" + ], "longtask-timing/longtask-attributes.html": [ - "247359327818f59871be00d22942f6ecde5281a7", + "e3cc0bea49c14221c358246b60d4669e664daeff", "testharness" ], "longtask-timing/longtask-in-childiframe-crossorigin.html": [ - "218c69b5395af1590fea4216ec71aae5434e265d", + "394b4e3311a0fb212373b99f25dc77f49b5141a8", "testharness" ], "longtask-timing/longtask-in-childiframe.html": [ - "b2d61c298ef78fe19e1dc18e01db2bbf58cd1815", + "25895063252e10e42de7f21285198eb51671e044", "testharness" ], "longtask-timing/longtask-in-externalscript.html": [ - "5d6f7a11f873c8e6477b105a8e7ae2547c5243ed", + "0c9cf5404186156119f16bd4ca5826f6703f6c1b", "testharness" ], "longtask-timing/longtask-in-parentiframe.html": [ - "4914c53c30b9670e103db4bee78b80d8d35af968", + "28d8d7267760d23e5869fa2206275df69d065b2f", "testharness" ], "longtask-timing/longtask-in-raf.html": [ - "d014ed0e7317871b8a14c9f2249a58d1df5589cb", + "8f4c904ab5af0138126ba0ae1d184034d614abbe", "testharness" ], "longtask-timing/longtask-in-sibling-iframe-crossorigin.html": [ - "4443396532adac8bc3a9012553bc7dedc328d710", + "200324a1d086040741c9e48bee07a69dc2e7e6c6", "testharness" ], "longtask-timing/longtask-in-sibling-iframe.html": [ - "e9c7f9671fba6eba939a3241bbddffb2a6c2bb13", + "a78658595305f87e8014a85edc3a8279cf2b071d", "testharness" ], "longtask-timing/longtask-tojson.html": [ - "c80d01bb7d3825dbdad09137b47ab4e5327f7fbf", + "1755e11bdb5468754077d0096eaf8b606a2136ea", "testharness" ], "longtask-timing/resources/makelongtask.js": [ - "64401c9b936a3a1bb43744d821258d43628819ca", + "e9f806fdf06f30fa3d7352534a39bd4fcd228b9c", "support" ], "longtask-timing/resources/raflongtask.js": [ - "fd669203f66e5878150acf603610f2efdca51f33", + "61789053acfcbe4453803c2dee1fd21d14eddbb8", "support" ], "longtask-timing/resources/subframe-observing-longtask.html": [ @@ -593680,19 +592457,19 @@ "support" ], "longtask-timing/resources/subframe-with-longtask.html": [ - "07726af74120e3f066e8fd8f4988616984793428", + "bda4495e3a0249c111b2beb9184da52364eccc1b", "support" ], "longtask-timing/shared-renderer/longtask-in-new-window.html": [ - "903bb60746deebd8f39ee8ea1a84b40e17884c3c", + "1f1754daaf75260d5ed706b05084e4e3edb258e5", "testharness" ], "longtask-timing/shared-renderer/resources/frame-with-longtask.html": [ - "2901b02184fb36d620782fb7fd4a565124580e81", + "616a69279d1825f87b4e8133a17afdda21c438d4", "support" ], "magnetometer/META.yml": [ - "f99b5f4f8bb9d631f1b55857512be56738801e6e", + "06aa86994dc28895551b205bfa10e28859b386e5", "support" ], "magnetometer/Magnetometer-disabled-by-feature-policy.https.html": [ @@ -593748,7 +592525,7 @@ "testharness" ], "mathml/META.yml": [ - "2f6e7241905bd35ee292edef4b43187618042e3f", + "a8ef4990d75d99a5d681b11319c1d9c131b23722", "support" ], "mathml/README.md": [ @@ -594208,7 +592985,7 @@ "support" ], "media-capabilities/META.yml": [ - "9f22edc5bc959d8e78016284f52870f96cd7807d", + "807809d70534a4905bbc3b5068428d80863a7596", "support" ], "media-capabilities/README.md": [ @@ -594224,7 +593001,7 @@ "testharness" ], "media-source/META.yml": [ - "1a29b55e2e3c17dfd94c9922363e8edbc10e6087", + "4b5454610e69a3be6e08c1019750bb9b1d96e02a", "support" ], "media-source/SourceBuffer-abort-readyState.html": [ @@ -594683,6 +593460,14 @@ "386650e2315d8803062400c64f012cfc501d12c3", "support" ], + "media/2x2-green.mp4": [ + "8fdf3da158f806c796c40c1f73c84ba5a410c9f4", + "support" + ], + "media/2x2-green.ogv": [ + "1a2092f8138c7eae5576975018d3558d19f8d54b", + "support" + ], "media/A4.mp4": [ "52f5141fed23561d43cea52df6c62e05f8874f92", "support" @@ -594743,6 +593528,14 @@ "b198f30a38e76b69f135b2bd5344124efef1d196", "support" ], + "media/sound_0.mp3": [ + "98bba14d1face8f8e9c1cd816295e452956646db", + "support" + ], + "media/sound_0.oga": [ + "6879ee38fb3352b0491f236fc420f840390c3598", + "support" + ], "media/sound_5.mp3": [ "61d1f0d6c12324489c6e96496128b135e68c5b76", "support" @@ -594780,15 +593573,15 @@ "support" ], "mediacapture-depth/META.yml": [ - "13b336e701676dce031336c06116fef63930ad45", + "f4f722c0716cd8ddd7d25ef041ce44dce33443e2", "support" ], "mediacapture-depth/idlharness.html": [ - "72bf5f2a0d73828f2b0e60046b978e0a9490e7a5", + "d45008d4af911c0a6b962f6e747916b2be28e241", "testharness" ], "mediacapture-fromelement/META.yml": [ - "40a8ff568344b2cb7809312603fd2fe82f123719", + "2c2d8f99d54bb368967eb1ad63c6b36bdb219a23", "support" ], "mediacapture-fromelement/capture.html": [ @@ -594807,16 +593600,16 @@ "9fa955b3f3a20222b140db3e706967ddb3979e25", "testharness" ], - "mediacapture-fromelement/idlharness.html": [ - "cbda24f01aad5bbcc75ce5e19df2979d3e2e9c3a", + "mediacapture-fromelement/idlharness.window.js": [ + "d3057b60199fc784460cdca3fceeee2a55d935e4", "testharness" ], "mediacapture-image/META.yml": [ - "5af8665719f06c44f51056bfd7484ee286ef2c1d", + "0e0b75556b814c4d95b6bbefa19597d7f618467d", "support" ], "mediacapture-image/idlharness.html": [ - "963b96c7cffd42051fa9586ddd9105dac71819a7", + "ad2c957734eb67577ef3e50f95984eeb999f4743", "testharness" ], "mediacapture-record/BlobEvent-constructor.html": [ @@ -594824,11 +593617,11 @@ "testharness" ], "mediacapture-record/META.yml": [ - "35f8c1f9b9d7489b1dc57b71c1a9d6a99f9129b7", + "0ddeea6f6ffbf12c5f857750f609973ffe28dcd8", "support" ], - "mediacapture-record/idlharness.html": [ - "fade50f6800c09a97104c96c0b5d80b2094455b6", + "mediacapture-record/idlharness.window.js": [ + "c8b90361e8e09385de6e56c0c1a49105a48b7dbf", "testharness" ], "mediacapture-streams/GUM-api.https.html": [ @@ -594864,17 +593657,9 @@ "testharness" ], "mediacapture-streams/META.yml": [ - "8b587d9e29b8d693197ee65efc68fb3b37411cb4", + "73f8341989174066f40a5f45f38d7840202ede6c", "support" ], - "mediacapture-streams/MediaDevices-IDL-all.html": [ - "9c67c8e7fe285c5bad2497408a830d1d20dcc103", - "testharness" - ], - "mediacapture-streams/MediaDevices-IDL-enumerateDevices.html": [ - "7d47f11a93d68c886612de8ac6847194fc02ad67", - "testharness" - ], "mediacapture-streams/MediaDevices-enumerateDevices.https.html": [ "c44f824ed1836c272125b0b5b10653cb86db2a7e", "testharness" @@ -594955,10 +593740,6 @@ "46327fba3cf783d6506634b837f8308417f954cd", "testharness" ], - "mediacapture-streams/MediaStreamTrack-idl.https.html": [ - "a52c4076cfa4e1b59f7b30725bfa7bd35b831158", - "testharness" - ], "mediacapture-streams/MediaStreamTrack-init.https.html": [ "35422d66a08311f92dc1eb02a1b964c887fc02c7", "testharness" @@ -594971,8 +593752,12 @@ "f30bde11122411931ad98ef49047bd3755047fda", "testharness" ], + "mediacapture-streams/idlharness.https.window.js": [ + "0d539ec7412e279ceb3983a7d2660e229451f158", + "testharness" + ], "mediasession/META.yml": [ - "9f22edc5bc959d8e78016284f52870f96cd7807d", + "9e6cb0592a3287fe8e8e6b04ae55cdec9c9d0dd5", "support" ], "mediasession/README.md": [ @@ -594996,7 +593781,7 @@ "testharness" ], "mimesniff/META.yml": [ - "4cf702138706700839c944ac7cd6f354eedafd18", + "764052ada102dd545f7ff5ba3d3dc2cd5adf75e6", "support" ], "mimesniff/README.md": [ @@ -595032,7 +593817,7 @@ "support" ], "mixed-content/META.yml": [ - "52a129de7ed7cfd3cb474655290348457ecf3eef", + "07008ded0360b7a092ded766edcc75fe455f0fcd", "support" ], "mixed-content/audio-tag/http-csp/cross-origin-http/top-level/keep-scheme-redirect/optionally-blockable/opt-in-blocks.https.html": [ @@ -596520,11 +595305,11 @@ "testharness" ], "navigation-timing/META.yml": [ - "c238360f8496b546e525941b994bb3022be0c7ae", + "f6d2a52da759aeb26b3b6de62e5b3592a1299aa5", "support" ], - "navigation-timing/idlharness.html": [ - "7b09fdf79c4166eaf21bcf2f92973c80b2864f32", + "navigation-timing/idlharness.window.js": [ + "ec4f468da89e8339cfb9c3261bcef577bc2fc094", "testharness" ], "navigation-timing/nav2_data_uri.html": [ @@ -596732,15 +595517,19 @@ "testharness" ], "netinfo/META.yml": [ - "36e98eee34a6d132ce3ee68458d16223f0506c16", + "05807b478a3e6b6d7284a29e01aeefafa311ccd5", "support" ], + "netinfo/idlharness.any.js": [ + "0011632bd063fb72229a3a29695883dfa977c23b", + "testharness" + ], "netinfo/netinfo-basics.html": [ "972b4048bbb74e1489329ae48759b587b9ad3800", "testharness" ], "notifications/META.yml": [ - "b338fb21f59ca696402bbcf5de64149e953bec9b", + "45eebbe3795017c4062b55fe5487dfb0933e3441", "support" ], "notifications/body-basic-manual.html": [ @@ -596836,7 +595625,7 @@ "manual" ], "offscreen-canvas/META.yml": [ - "4350cfdc3ece39bf73aafa6e425cad279fef5097", + "0451a57deb447613bf32205b278b0c14d3a1a141", "support" ], "offscreen-canvas/compositing/2d.composite.canvas.copy.html": [ @@ -603216,7 +602005,7 @@ "support" ], "orientation-event/META.yml": [ - "231bd770be9983aaec15db09156d60ab0ca37c08", + "10cf85d91e799cca9a38d838299989766df25ab2", "support" ], "orientation-event/devicemotionevent-init.html": [ @@ -603340,7 +602129,7 @@ "testharness" ], "orientation-sensor/META.yml": [ - "f99b5f4f8bb9d631f1b55857512be56738801e6e", + "b11223833f65a1c38bb226dbef951036a06e90dc", "support" ], "orientation-sensor/OrientationSensor_insecure_context.html": [ @@ -603400,11 +602189,11 @@ "support" ], "page-visibility/META.yml": [ - "088f3eb90a01853b7f6af3dab6d84871fe2f6732", + "b59824c30c1241ea505cd76974b477f2e7980e53", "support" ], - "page-visibility/idlharness.html": [ - "e3f97d7f03caf99d71e9528c6db75c13c477b4eb", + "page-visibility/idlharness.window.js": [ + "4e83e98043b2ff914f95a33d9eefc3d6e74b6505", "testharness" ], "page-visibility/iframe-unload.html": [ @@ -603472,7 +602261,7 @@ "testharness" ], "paint-timing/META.yml": [ - "f53fe7e9d7a543b8ae052955663c58a0ce8c5eae", + "6e26114586d26f7d539638d90ce14175d349ada5", "support" ], "paint-timing/basetest.html": [ @@ -603540,7 +602329,7 @@ "testharness" ], "payment-handler/META.yml": [ - "e5eba0004eae5ee09f8a16a67bee35f24af86b75", + "6bb5d9865d5638ed6cc3f2cffe24c563bd768275", "support" ], "payment-handler/app-can-make-payment.js": [ @@ -603575,6 +602364,10 @@ "7a361f57439425d5ec5c583ad363d9acf9fa7e1d", "testharness" ], + "payment-handler/idlharness.https.any.js": [ + "416308d5f1ef290fc8a8ab2343a47a89fa78d994", + "testharness" + ], "payment-handler/interfaces.https.any.js": [ "4d1e2360e69d2c2f1664e73a79c1d893c6ee10fb", "testharness" @@ -603628,19 +602421,23 @@ "support" ], "payment-method-basic-card/META.yml": [ - "6ecc88050c22279a6ff640658963fe13a6e6ec1c", + "902c8c96758814fbfa62c8c6c7b7abe5afaea990", "support" ], "payment-method-basic-card/empty-data-manual.https.html": [ "01e6ebc11174b8de17212aaf004890685bd90fae", "manual" ], + "payment-method-basic-card/idlharness.window.js": [ + "0219c2651ea2bd20d1c694f4f450646a38b8513f", + "testharness" + ], "payment-method-basic-card/payment-request-canmakepayment-method.https.html": [ "70f2de7b94ca8e22fdbfed6d39f6f1627b5bf3b0", "testharness" ], "payment-method-id/META.yml": [ - "45f0d46961f2ec79d2e86a52d30576d325665537", + "a2d81acdfa7725891c1ca104e5ee0b0d5e7d088f", "support" ], "payment-method-id/README.md": [ @@ -603648,7 +602445,7 @@ "support" ], "payment-request/META.yml": [ - "cac060187c6894bb8b26bff73dc0313f8021cd8e", + "3b9ffe68d2919dbb5323106f5ed2a3ae3ad4071e", "support" ], "payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html": [ @@ -603763,8 +602560,8 @@ "6695acdcd1647fdd37702a7f63658dcd50f25596", "testharness" ], - "payment-request/interfaces.https.html": [ - "d269e8378f2a84ba96c981536667817e0db9e2d1", + "payment-request/idlharness.https.window.js": [ + "a1481e724c7881e44db341195c8cf818189cc5ec", "testharness" ], "payment-request/onpaymentmenthodchange-attribute.https.html": [ @@ -603916,15 +602713,19 @@ "manual" ], "performance-timeline/META.yml": [ - "088f3eb90a01853b7f6af3dab6d84871fe2f6732", + "0e22d2f18953aa5277917b257195ad13c0b3f254", "support" ], "performance-timeline/case-sensitivity.any.js": [ "9c6b6edf19800a2730de2dfe601a7cd2503cf87d", "testharness" ], + "performance-timeline/get-invalid-entries.html": [ + "2f5d7a95a06aa0f566e501f2c6e1793347f7ff02", + "testharness" + ], "performance-timeline/idlharness.any.js": [ - "0a3ea0b532a1634008b776489b7409b348952d6f", + "8b359740b5da7d6fe3dc832f0ccaf4ca5e0952f5", "testharness" ], "performance-timeline/performanceentry-tojson.any.js": [ @@ -603975,6 +602776,10 @@ "f2f3c2b3cef895f514f595932b767299cd6dade0", "support" ], + "performance-timeline/resources/worker-invalid-entries.js": [ + "823c4b0983946b33ef5d675451e9b16516e4306c", + "support" + ], "performance-timeline/resources/worker-with-performance-observer.js": [ "6536127a1136f45cd59f62a9851fe61ceabe3d5b", "support" @@ -603988,7 +602793,7 @@ "testharness" ], "permissions/META.yml": [ - "b6a9ae71c3b0b86061a91320ff6d6b59447d7f62", + "db1f8934d00f3f9a18a3131c9edf44426685f8c9", "support" ], "permissions/interfaces.any.js": [ @@ -603996,7 +602801,7 @@ "testharness" ], "picture-in-picture/META.yml": [ - "bc90446f4e1c690c41dce2482d126399dbb2c210", + "ca0f2a568c63e055df52ed77fcc850ccd95b4bf6", "support" ], "picture-in-picture/disable-picture-in-picture.html": [ @@ -604011,6 +602816,10 @@ "4bcd6f2c68c4f6b9b17057d57d6cfe6101845e9d", "testharness" ], + "picture-in-picture/idlharness.window.js": [ + "a2a5c08651d42ef14d4ffd1ac0fa0c56a7a2eb37", + "testharness" + ], "picture-in-picture/leave-picture-in-picture.html": [ "9f19a0c59604198b67a687b14455be6e5aad7fa8", "testharness" @@ -604036,7 +602845,7 @@ "testharness" ], "pointerevents/META.yml": [ - "5d8cebf4f17b13d7932f8b0db069255413a2d14b", + "c61c1da745a18e4bea5b2600ccc13649e3ceae17", "support" ], "pointerevents/README.md": [ @@ -604088,7 +602897,7 @@ "testharness" ], "pointerevents/pointerevent_attributes_hoverable_pointers-manual.html": [ - "9a71336042a931e45c7aef0e031669c26ac5c36c", + "852c9d598c230405d82a96dcd92a52827764e15c", "manual" ], "pointerevents/pointerevent_attributes_nohover_pointers-manual.html": [ @@ -604396,7 +603205,7 @@ "support" ], "pointerlock/META.yml": [ - "61cadf23a7b6d46035c35a65b5ccb2bc4391008a", + "7057f9876bbab7c93e49fff9b378f8ff8c4c1500", "support" ], "pointerlock/constructor.html": [ @@ -604404,7 +603213,7 @@ "testharness" ], "pointerlock/interfaces.window.js": [ - "597ed15f67c4f94f15b28b167fe7ac0ce1b7d79c", + "0838cc19db0518e115adbe07f01b195dc8b5db6f", "testharness" ], "pointerlock/movementX_Y_basic-manual.html": [ @@ -604448,7 +603257,7 @@ "manual" ], "preload/META.yml": [ - "c21e52cd3c83d3c95c4b3c1245fe564e20fd3846", + "01c5aa46ddc36ccc6113f54999582302dd87d04c", "support" ], "preload/avoid-delaying-onload-link-preload.html": [ @@ -604531,6 +603340,10 @@ "8b22c83cb91255a74078c643d92078695bcd4cea", "testharness" ], + "preload/preload-strict-dynamic.html": [ + "3408ddceb225836de2873dbde60ed8b6b397f6c5", + "testharness" + ], "preload/preload-with-type.html": [ "5592d7d0d7495b04753d09f7e01d34358b03e22e", "testharness" @@ -604644,7 +603457,7 @@ "testharness" ], "presentation-api/META.yml": [ - "a8704d33aae182813818e42871e43cb59aa79ad6", + "93e27764cd1cc935ebadddcc0d01e9cfb75ebd33", "support" ], "presentation-api/README.md": [ @@ -604872,7 +603685,7 @@ "support" ], "priority-hints/META.yml": [ - "0fc70c84c6b92174b63b4ab7fd71e91323db0123", + "44692282447605bf39a90316e4cc40b2e9c54143", "support" ], "priority-hints/fetch-api-request.tentative.any.js": [ @@ -604892,9 +603705,13 @@ "support" ], "proximity/META.yml": [ - "7645b3f88917eec4c54b28d41ed2a8941c198975", + "231f91a2df0e4a87a04e4c3cb064ddec660a3a13", "support" ], + "proximity/ProximitySensor-iframe-access.https.html": [ + "887d7bf1696f877e4a24c53a1ef32e5b2bef24a8", + "testharness" + ], "proximity/ProximitySensor.https.html": [ "0fdcbda9b340af68a05f5e86294f311fdbb5c171", "testharness" @@ -604912,15 +603729,15 @@ "testharness" ], "push-api/META.yml": [ - "d4b8d3ee30aca9e9bd4435534615172c89f9ca9c", + "4d397edf0b610cfe0fcdf16f11f156d08f201e68", "support" ], "push-api/idlharness.https.any.js": [ - "683d97ccd02091c86052375e8f6c4b7da214e76f", + "5a8cb140eb42702490dea9c71deaf08cd291c7c4", "testharness" ], "quirks/META.yml": [ - "45472ac8906e7b383d80ab0b92ecddd6b900f726", + "0214c11aec63acf1b5ae247cff64b440ff8b4bfe", "support" ], "quirks/active-and-hover-manual.html": [ @@ -605000,7 +603817,7 @@ "support" ], "referrer-policy/META.yml": [ - "f4454894fc36bdc73ea3fde9d4b97efb5c999b2f", + "c6b8f9c146f71e5498ed5e77ae045e4a8a303c7e", "support" ], "referrer-policy/README.md": [ @@ -605052,7 +603869,7 @@ "testharness" ], "referrer-policy/generic/referrer-policy-test-case.js": [ - "62d77f2911b075bfa2de6138faffd8f5997ac7d5", + "ae4b5d29fa31dcfe9ab7ac1250ef57af9cc39812", "support" ], "referrer-policy/generic/sandboxed-iframe-with-opaque-origin.html": [ @@ -612888,7 +611705,7 @@ "testharness" ], "remote-playback/META.yml": [ - "9f22edc5bc959d8e78016284f52870f96cd7807d", + "309ed92ee166fcaf872e43ccee441b9abde7855a", "support" ], "remote-playback/README.md": [ @@ -612911,8 +611728,8 @@ "2779fd2a3bd27a011e8ba20dd6fb214978d8a54c", "testharness" ], - "remote-playback/idlharness.html": [ - "715a6950952ed08b9f1ce09b698ab85395553790", + "remote-playback/idlharness.window.js": [ + "8405e3838a635565b39a479444ad0e7cc0c82b06", "testharness" ], "remote-playback/watch-availability-initial-callback.html": [ @@ -612920,7 +611737,7 @@ "testharness" ], "requestidlecallback/META.yml": [ - "06b126c4bcdc95ba95c96f590d7218e4952631d1", + "ffff9dc9862d13c919751243591b418ac8d1eee3", "support" ], "requestidlecallback/basic.html": [ @@ -612971,8 +611788,8 @@ "30787d765fa435c1392bd852559042bf3c2e2553", "testharness" ], - "requestidlecallback/idlharness.html": [ - "99fabb2abdc8aef189bd8c972a7501223517f932", + "requestidlecallback/idlharness.window.js": [ + "2f2b29b9b5a8dad507565dddbf78b63b0cd5ee30", "testharness" ], "requestidlecallback/resources/post_name_on_load.html": [ @@ -612980,7 +611797,7 @@ "support" ], "resize-observer/META.yml": [ - "c3b3d4ce8f42154c3125278de4f12adc8cf70bd0", + "40156cdbb9d9e3f9de6c2923989f4cab19d4d7ef", "support" ], "resize-observer/eventloop.html": [ @@ -613012,7 +611829,7 @@ "testharness" ], "resource-timing/META.yml": [ - "e07d13945a56dda7d2a8fe4b5f29f264e5f59245", + "d15c34e7ef20fd6e90ab48c2abcef382cac8bb9b", "support" ], "resource-timing/SyntheticResponse.py": [ @@ -613316,11 +612133,11 @@ "support" ], "screen-orientation/META.yml": [ - "488995281897b6944f90a36fc0316da6e317a28e", + "33d7f9f9207dc190350f9f764b8766269aff87af", "support" ], - "screen-orientation/interfaces.html": [ - "d54475008731fafd00c3cae73f11eac94dba0883", + "screen-orientation/idlharness.window.js": [ + "aa0cc22de907288f4b8a175fb9e8963f4892179f", "testharness" ], "screen-orientation/lock-bad-argument.html": [ @@ -613360,7 +612177,7 @@ "support" ], "scroll-animations/META.yml": [ - "df377d2d8c7e81a85e1676b0ca9dd186837710a6", + "8fd54585850dfcf8aa9fa01ae8fd21ff440f9550", "support" ], "scroll-animations/idlharness.html": [ @@ -613368,7 +612185,7 @@ "testharness" ], "secure-contexts/META.yml": [ - "4966e7a03e815dac333218faf57875b57b9dd535", + "177c29aaa6647206bbe951d2185c01bf0eb6fde8", "support" ], "secure-contexts/basic-dedicated-worker.html": [ @@ -613456,7 +612273,7 @@ "testharness" ], "selection/META.yml": [ - "ee0778f37e92351be3e95c9c23f23b743e71e5eb", + "08b96034899f314d8b0daa4d61f9ee5e5e7a2669", "support" ], "selection/addRange-00.html": [ @@ -613624,7 +612441,7 @@ "testharness" ], "server-timing/META.yml": [ - "550f1da84f0f2b320c0d858041d28b140d5fd867", + "ce150fc9c63386bf0149a92ee8e2bf6689a7ed97", "support" ], "server-timing/cross_origin.html": [ @@ -614380,7 +613197,7 @@ "support" ], "service-workers/META.yml": [ - "36621369ec3df60e75ec6df20819713fd3ff5a23", + "9f6c8d439e06c181f574933a328039fa67c9b807", "support" ], "service-workers/cache-storage/META.yml": [ @@ -614460,7 +613277,7 @@ "support" ], "service-workers/cache-storage/script-tests/cache-storage-match.js": [ - "e3cc14ea5d0587c43a5b142fca84788383b549cb", + "946b95407abe9b6fabef438da5fc9152fa6721f0", "support" ], "service-workers/cache-storage/script-tests/cache-storage.js": [ @@ -614752,7 +613569,7 @@ "testharness" ], "service-workers/service-worker/claim-worker-fetch.https.html": [ - "2088f1d6974ad87503c950b5df665725f629e80d", + "3221144d2d91cb4f2afeac1e7b074ce2450b21ce", "testharness" ], "service-workers/service-worker/client-id.https.html": [ @@ -614948,7 +613765,7 @@ "testharness" ], "service-workers/service-worker/fetch-event.https.html": [ - "d4ff864f1d5a7896cc748cd4abe10d08c0fb08f9", + "a0930d54f542c7f89ff7fed09b2bd03ccbce2484", "testharness" ], "service-workers/service-worker/fetch-frame-resource.https.html": [ @@ -615068,7 +613885,7 @@ "testharness" ], "service-workers/service-worker/interfaces-window.https.html": [ - "10b0dbc64783f88e5d990a1fdab35d06416d6f86", + "71c0e09861863b9f36571137d2398fa8af516601", "testharness" ], "service-workers/service-worker/invalid-blobtype.https.html": [ @@ -615439,6 +614256,14 @@ "11a8883c24628b25f3faa1470da05caddd5eb094", "support" ], + "service-workers/service-worker/resources/claim-nested-worker-fetch-iframe.html": [ + "99f475be1cbb64617494777400e67a1668e2b378", + "support" + ], + "service-workers/service-worker/resources/claim-nested-worker-fetch-parent-worker.js": [ + "5351292068c9492f23bf7c94e9153735f3cee84b", + "support" + ], "service-workers/service-worker/resources/claim-shared-worker-fetch-iframe.html": [ "2f7b5ec149446b2a81044e8b50ccc644facb4e42", "support" @@ -615936,7 +614761,7 @@ "support" ], "service-workers/service-worker/resources/interfaces-worker.sub.js": [ - "1b783078b34532a0f8236a964e77eb1f5836af6a", + "694568194185de15fb912b3e4b4655ea3f65420d", "support" ], "service-workers/service-worker/resources/invalid-blobtype-iframe.https.html": [ @@ -616055,6 +614880,10 @@ "efe2c9dc9e63ee0f25a15ce1ed37f116e43e7255", "support" ], + "service-workers/service-worker/resources/nested_load_worker.js": [ + "db8490d9b2830ee4c153bfad4df74438dba28ae3", + "support" + ], "service-workers/service-worker/resources/notification_icon.py": [ "ec72a4c120ccfac3a165576f59a0e02b945343b3", "support" @@ -616440,7 +615269,7 @@ "support" ], "service-workers/service-worker/resources/worker-interception-iframe.https.html": [ - "b9fd4ea281b328c1f21573d1563c968dac52cf22", + "1b0b6d8eaf25d9c497f4b63c2c6b825f7e384672", "support" ], "service-workers/service-worker/resources/worker-interception-redirect-serviceworker.js": [ @@ -616836,7 +615665,7 @@ "testharness" ], "shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint.html": [ - "e33e48a3eb754e961f07b7850caff67eee38fe69", + "ccf013d89b7a36c24b97a86a3103314d66bd6682", "testharness" ], "shadow-dom/Element-interface-attachShadow-custom-element.html": [ @@ -616860,7 +615689,7 @@ "testharness" ], "shadow-dom/META.yml": [ - "d898efbe6e24fff413f3f6d3b9ef033dbb070a12", + "6c88a3035ad7d346c54328746c20d86b6c6752a1", "support" ], "shadow-dom/MouseEvent-prototype-offsetX-offsetY.html": [ @@ -616927,6 +615756,10 @@ "7726f8fe9056d3d5c9fb7b963c4bc6e777a8256a", "testharness" ], + "shadow-dom/getElementById-dynamic-001.html": [ + "d1c7204c43cb90eb2d07096698cd13536161f7d0", + "testharness" + ], "shadow-dom/historical.html": [ "1469992db34a25397dc3d5a5e1eb600e8afcf71b", "testharness" @@ -617076,7 +615909,7 @@ "testharness" ], "shadow-dom/untriaged/events/event-dispatch/test-003.html": [ - "94ed940ccca11f9abc37a940ba5f5fc194ea2317", + "47b84ac9527ad9e51bdba5b0c0b3ecbdba2e3696", "testharness" ], "shadow-dom/untriaged/events/event-retargeting/test-001.html": [ @@ -617284,7 +616117,7 @@ "testharness" ], "shape-detection/META.yml": [ - "35f8c1f9b9d7489b1dc57b71c1a9d6a99f9129b7", + "8a88c780f0ebff1558e04117722f355599c6819a", "support" ], "shape-detection/idlharness.any.js": [ @@ -617292,7 +616125,7 @@ "testharness" ], "speech-api/META.yml": [ - "52d79b2a35757493915c591ff306a108a5e77121", + "221a1246a6c9022bed7df24551ca3a79bb227f6a", "support" ], "speech-api/SpeechSynthesis-speak-ownership.html": [ @@ -617308,7 +616141,7 @@ "testharness" ], "storage/META.yml": [ - "dc5eeef99c98637d5021d40b9db8635fbd8ed176", + "ac35d389f5b8d49b28ec08c1fbaa9dae3b4ce112", "support" ], "storage/README.md": [ @@ -617388,7 +616221,7 @@ "testharness" ], "streams/META.yml": [ - "c7b3309178642e0cc8866004fe370af526f6d068", + "be9ba4d21436c4585bb57d08694f1df61e213efc", "support" ], "streams/README.md": [ @@ -617468,7 +616301,7 @@ "testharness" ], "streams/piping/close-propagation-forward.js": [ - "7840ff0fabf15c8c86b91fbc57a8fca105af4c91", + "37d526eb7789e298fe24a4c1e4545803b8cf1d0b", "support" ], "streams/piping/close-propagation-forward.serviceworker.https.html": [ @@ -617599,6 +616432,26 @@ "8ecb019e754fd4239cb35c27787897efc2dacccb", "testharness" ], + "streams/piping/then-interception.dedicatedworker.html": [ + "e24c52c003d867037b0a0fd021a02f6abac10e57", + "testharness" + ], + "streams/piping/then-interception.html": [ + "a4955e1a66e8ac39cebec8183e6a1295a7af4c78", + "testharness" + ], + "streams/piping/then-interception.js": [ + "536f96e405ee9c36bc9f5bf75053a6136affc1f5", + "support" + ], + "streams/piping/then-interception.serviceworker.https.html": [ + "e7a05ba2bccd31c1ff284a81c08f229d34af40bb", + "testharness" + ], + "streams/piping/then-interception.sharedworker.html": [ + "b6b6fdd9ddd4ae5f61fa26f6facd82ab1227f165", + "testharness" + ], "streams/piping/transform-streams.dedicatedworker.html": [ "bd73374617b11acfcaecbf478ad050ab8621754a", "testharness" @@ -618580,7 +617433,7 @@ "testharness" ], "subresource-integrity/META.yml": [ - "e2d0769ca30055074c39935c437c4fce7d5add90", + "7f81beea3ac94782ede40b40dbbdda3a9fa5546e", "support" ], "subresource-integrity/alternate.css": [ @@ -618724,7 +617577,7 @@ "support" ], "subresource-integrity/idlharness.window.js": [ - "c4d81b58ea18d76c95cc84e43ca5145dbc06f0a3", + "b03019b665efa5262ec9b621427cf89417babbe4", "testharness" ], "subresource-integrity/matching-digest.js": [ @@ -618768,7 +617621,7 @@ "support" ], "svg-aam/META.yml": [ - "1e4adc07cf5790fd51820158c69c1dd2c1a72c28", + "93f77459852a85554bc26cad5ea4364c20b546e5", "support" ], "svg-aam/README.md": [ @@ -618776,7 +617629,7 @@ "support" ], "svg/META.yml": [ - "556bba2e68839ace472576d6cd0cf180b3e30719", + "b92bc59168e3683a0ba4a03757e874a3a1cf4acc", "support" ], "svg/README.md": [ @@ -618791,6 +617644,10 @@ "a5fbcba1ea5ba32d55210b0a87b6ecdeafbae5fe", "testharness" ], + "svg/extensibility/foreignObject/foreign-object-margin-collapsing.html": [ + "d84bd1ca6b8e62557191b5fbf365b03969adc3bd", + "reftest" + ], "svg/extensibility/foreignObject/foreign-object-paints-before-rect-ref.html": [ "18e188a6279e64cbabdd4bb638b06d4a5b22fca8", "support" @@ -618832,7 +617689,7 @@ "testharness" ], "svg/historical.html": [ - "f18f89f68fdf1266768700235f08e7181ce0e0e1", + "18f7e83a130c87f91d6bb11c0e515c4e6302a106", "testharness" ], "svg/import/animate-dom-01-f-manual.svg": [ @@ -621147,6 +620004,34 @@ "1367de727c679521d6b7237b97b86c5516e9363c", "support" ], + "svg/painting/OWNERS": [ + "793bbbcd7b50cd21b5ba5895ab97fa8ae23522d2", + "support" + ], + "svg/painting/currentColor-override-pserver-fallback-ref.svg": [ + "ecfd31db61525a01eeb7d40e9d46d88508096fb6", + "support" + ], + "svg/painting/currentColor-override-pserver-fallback.svg": [ + "5ebc8cafe14d0cab8db3a47878c6f299ed4c0645", + "reftest" + ], + "svg/painting/currentColor-override-pserver-fill-ref.svg": [ + "6a534c27b80b2e2a28611243da3aa35662d0fb27", + "support" + ], + "svg/painting/currentColor-override-pserver-fill.svg": [ + "9fa970bd0f2e2d059094408b0f7a42d430b938f2", + "reftest" + ], + "svg/painting/currentColor-override-pserver-stroke-ref.svg": [ + "9aa1ab0d77e12ae86ad2d10c9e38d93eda9a89e5", + "support" + ], + "svg/painting/currentColor-override-pserver-stroke.svg": [ + "d8e578f5422229b37676ecdc7146488ac0865eaf", + "reftest" + ], "svg/painting/reftests/paint-context-001-ref.svg": [ "d7e12d36f0b3168c677edf95ce401b3e1e5eccbe", "support" @@ -621275,6 +620160,14 @@ "03751dba3c2dfc7b4d478879dc94878b0dffcc99", "reftest" ], + "svg/rendering/order/z-index-ref.svg": [ + "955f465ece3132da0bdd1e3b832e97db84f22b55", + "support" + ], + "svg/rendering/order/z-index.svg": [ + "953878148271362da66d8f56e60ef57e2d77b0ce", + "reftest" + ], "svg/scripted/text-attrs-dxdy-have-length.svg": [ "91cd3e09332fa52800b05346d8c183bb599d7f46", "testharness" @@ -621299,6 +620192,58 @@ "1660ebba379a218ba1ce74a655df2725d788622c", "testharness" ], + "svg/shapes/ellipse-01-ref.svg": [ + "0d8b6dd9a471759dda8d9e33904b8a936c146b3a", + "support" + ], + "svg/shapes/ellipse-01.svg": [ + "1d4ed53ac1c02fef27c83ccdefe7df95750ecd9b", + "reftest" + ], + "svg/shapes/ellipse-02-ref.svg": [ + "ed927fa98a12be61040b6f9254fa209581f104a1", + "support" + ], + "svg/shapes/ellipse-02.svg": [ + "041dbe27f4e08542f147d235244f0f98b155f5b2", + "reftest" + ], + "svg/shapes/ellipse-03-ref.svg": [ + "0bae74326f227df4bf539bf046aea4ecb269c218", + "support" + ], + "svg/shapes/ellipse-03.svg": [ + "81164201dc7116cf11d4047e5a7626159283603f", + "reftest" + ], + "svg/shapes/ellipse-04-ref.svg": [ + "f42c2e31193806301d525b89227761f8156408e1", + "support" + ], + "svg/shapes/ellipse-04.svg": [ + "a13ba9204163bc2ef59cfc91f4d1266632448f1f", + "reftest" + ], + "svg/shapes/ellipse-05.svg": [ + "0592f5ffc8b8d7a04d63c3aec59969b95a526e21", + "reftest" + ], + "svg/shapes/ellipse-06.svg": [ + "b164ebcf3b84265f5791751246c62a7e4e163786", + "reftest" + ], + "svg/shapes/ellipse-07-ref.svg": [ + "db865e15becdd56b4a6646eda4a5d34e9ae60f01", + "support" + ], + "svg/shapes/ellipse-07.svg": [ + "da30b99a5945cd508f1e285457ae5bb744b63169", + "reftest" + ], + "svg/shapes/ellipse-08.svg": [ + "c56c1ec7f6c00f2291805a62d51b21ef2be6bfdb", + "reftest" + ], "svg/shapes/line-dasharray-ref.svg": [ "1703bd2fa544c3b2a0cd9a2ff3ff329089f19e6a", "support" @@ -621347,10 +620292,62 @@ "ad79ad2f821e30c3c016bb1e156c1fafb4a4decf", "reftest" ], + "svg/shapes/reftests/pathlength-001-ref.svg": [ + "8954f35f956b656a85fd1b50cd269d9d47f3b7d5", + "support" + ], + "svg/shapes/reftests/pathlength-001.svg": [ + "c551fe3f6955f18ffb43de07012c21650db4682b", + "reftest" + ], + "svg/shapes/reftests/pathlength-002-ref.svg": [ + "11ecfc5ce09d2b65e6402abe4bc62b8fcb3f67c8", + "support" + ], + "svg/shapes/reftests/pathlength-002.svg": [ + "a8d461cd4678aa8dd55f6e2495177b554086f8b1", + "reftest" + ], + "svg/shapes/reftests/pathlength-003-ref.svg": [ + "a32320f5c4cbebd4581ccacff100c163fb85b5be", + "support" + ], + "svg/shapes/reftests/pathlength-003.svg": [ + "ec384eea23caa3c2179e7ffa833e778faa32e0e1", + "reftest" + ], + "svg/shapes/rx-ry-not-inherited.svg": [ + "47c4d5ed23e7f6a73b5f6495168df31cdd6a591d", + "testharness" + ], "svg/struct/UnknownElement/interface.svg": [ "42ecd7bc94a3379d920687c79c12e2d3c55b9e98", "testharness" ], + "svg/styling/render/transform-box-ref.svg": [ + "4e65b31b1f0003a9d8bee907cd757bdefac032de", + "support" + ], + "svg/styling/render/transform-box.svg": [ + "a2f73e5855ae6daca2699349813c9854b8c46a37", + "reftest" + ], + "svg/styling/render/transform-origin-ref.svg": [ + "1732e4b4fd4512f99d624e82322e54e1127dd7de", + "support" + ], + "svg/styling/render/transform-origin.svg": [ + "d4d41ff459758345a768424651d2a2d30a2b3734", + "reftest" + ], + "svg/styling/render/transform-ref.svg": [ + "411ce29eea1df9036e7788482750fd776c2e3c2e", + "support" + ], + "svg/styling/render/transform.svg": [ + "f0f32ff3d761cb2ea645a07234b21908776c9003", + "reftest" + ], "svg/styling/required-properties.svg": [ "b59f278e8303641d5654420c89da3d1e64995458", "testharness" @@ -621359,8 +620356,24 @@ "2976a4812636c4515cc5e2c633b17c47bee392ab", "testharness" ], + "svg/text/reftests/textpath-shape-001-ref.svg": [ + "6206cb07df0e750a9a2c2e805e3ac2334309e493", + "support" + ], + "svg/text/reftests/textpath-shape-001.svg": [ + "d84bc6f2cae25aa6cc7d7119763ff33bd056922c", + "reftest" + ], + "svg/text/reftests/textpath-side-001-ref.svg": [ + "be83a5ac4c6639870c2d1f7a4aaf2e75727cbca7", + "support" + ], + "svg/text/reftests/textpath-side-001.svg": [ + "621b7e7b6799868067acf594d0248e13747830ce", + "reftest" + ], "svg/types/elements/SVGGeometryElement-rect.svg": [ - "08237002915323f41dd5590ce4226f95ae79f285", + "118fd791a90c884cab72428d4167cebcacf91662", "testharness" ], "svg/types/scripted/SVGAnimatedAngle.html": [ @@ -621464,13 +620477,17 @@ "testharness" ], "svg/types/scripted/SVGAnimatedRect.html": [ - "dfc7ec677df247b015ef360793c7e5f0c926e45f", + "7ffbe6d2a29c0743b53c7d8cf5f1a280e1e7c857", "testharness" ], "svg/types/scripted/SVGGeometryElement.getPointAtLength-01.svg": [ "73c1c15179f02b637a68939ba08faa4f90af8e5b", "testharness" ], + "svg/types/scripted/SVGGraphicsElement.svg": [ + "03bd83a59a23558f3d3a90e9e7742cc28af42f70", + "testharness" + ], "svg/types/scripted/SVGLength-px-with-context.html": [ "a605dba2368aa00a3cd3343739c05cdbbd930205", "testharness" @@ -621504,7 +620521,7 @@ "support" ], "touch-events/META.yml": [ - "df9f5e192a452f8f15a9389eb98c78a7cf38a6ab", + "c7d6bbafd8e586303cf3e4da3938d97dae55c49a", "support" ], "touch-events/historical.html": [ @@ -621547,72 +620564,152 @@ "11c8d88f78cb3e857479000332af49484da99212", "testharness" ], + "trusted-types/DOMParser-requiresTrustedTypes.tentative.html": [ + "f9b9110f3620949c26b9ae047730b2def936a812", + "testharness" + ], + "trusted-types/DOMParser.tentative.html": [ + "95e12b63536c98404993ddf9b6b90e248f56db31", + "testharness" + ], + "trusted-types/HTMLBaseElement-href.tentative.html": [ + "bdc6593b4490bd0a1b22ef423c7fc95468acd7e5", + "testharness" + ], + "trusted-types/HTMLImageElement-src.tentative.html": [ + "1ac2d898da5cb684f642250760dce70b0e130489", + "testharness" + ], + "trusted-types/HTMLMediaElement-src.tentative.html": [ + "dc2d8beec67583a7821d445c0273be1c5754c33d", + "testharness" + ], + "trusted-types/HTMLSourceElement-src.tentative.html": [ + "bc816aea73f1d1eaf7fbd7516360430483608fee", + "testharness" + ], "trusted-types/META.yml": [ "4966e7a03e815dac333218faf57875b57b9dd535", "support" ], "trusted-types/TrustedHTML.tentative.html": [ - "1bcbd6d4d990c00449a95fd9c410c199b83b6661", + "808ec9c374b847012bc1299aecfb9d87b2e8c19c", "testharness" ], "trusted-types/TrustedScriptURL.tentative.html": [ - "2a02a26d6c55e38d51abebe59b470d6f5008440c", + "2f8d956c0179adc05fd92250fab500fcf21f6bba", "testharness" ], "trusted-types/TrustedURL.tentative.html": [ - "e6cff885204af25c0233d9c18dd3de5cb82ed51b", + "2543ae30982c5d979502278f9edcd88d03090eba", + "testharness" + ], + "trusted-types/block-string-assignment-to-HTMLBaseElement-href.tentative.html": [ + "8f09389fb792f0fb24afd34035fa9cf055c05be6", + "testharness" + ], + "trusted-types/block-string-assignment-to-HTMLImageElement-src.tentative.html": [ + "29af914e035e196635be0568d8536f037c179c28", + "testharness" + ], + "trusted-types/block-string-assignment-to-HTMLMediaElement-src.tentative.html": [ + "9bb4f5866cff0c34d4d11a274008f322fa943920", + "testharness" + ], + "trusted-types/block-string-assignment-to-HTMLSourceElement-src.tentative.html": [ + "1a403b7f4d9a0614e3fb7f41b95a0cf1e5fbb3ff", + "testharness" + ], + "trusted-types/block-string-assignment-to-createContextualFragment.tentative.html": [ + "9f2da1fdf1bf19b5bd86fb6526412655c3ccbfe6", + "testharness" + ], + "trusted-types/block-string-assignment-to-embed-src.tentative.html": [ + "1e598f550c120e3f1ae24dd36111da7d8863c7fd", "testharness" ], "trusted-types/block-string-assignment-to-innerHTML.tentative.html": [ - "cde544697dbfa750e2f5ca8a1d7499d6c85c407e", + "ddbdee0f12a482599ec5913f78a527127a2aeb16", "testharness" ], "trusted-types/block-string-assignment-to-insertAdjacentHTML.tentative.html": [ - "739b7940a27a298ca05005e9549774f9e0c0122f", + "3c43309acf17f8f2efe37113c662ef97d07aa0de", + "testharness" + ], + "trusted-types/block-string-assignment-to-location-assign.tentative.html": [ + "189e70168a06390395863dc3c9d7609c11acf0a0", "testharness" ], "trusted-types/block-string-assignment-to-location-href.tentative.html": [ - "b4da566f7eab26c9156e7976714618c74fd405b0", + "8c4f974ef05dac942dcdd811ea92fa6702ba8a40", + "testharness" + ], + "trusted-types/block-string-assignment-to-location-replace.tentative.html": [ + "e06b0b7233070f19f0d1b234d1ca8c023b98df1a", "testharness" ], "trusted-types/block-string-assignment-to-outerHTML.tentative.html": [ - "a5301e971af8a918df577a3c00cf5d4be2b1d413", + "e45a6ea12e10693fb9c77e28e76e62a0c733d3da", "testharness" ], "trusted-types/block-string-assignment-to-script-src.tentative.html": [ - "4a92a5485db5e199036f10322a89b713b9b02423", + "da38712c6e43d1e6fe5892a5339a45c4bf438c7e", + "testharness" + ], + "trusted-types/createContextualFragment.tentative.html": [ + "e98f5e7fa6feeb5000a6310377ea82041c87e27d", "testharness" ], "trusted-types/document-write.tentative.html": [ - "4eaf06e1d68d027a858ef6818aeac9b912164cbd", + "d4097e6235d0a8ddd28c9cfde4b985fb61e6ace9", + "testharness" + ], + "trusted-types/embed-src.tentative.html": [ + "402c569b64f260a4e0c4121a0eee76c59ed53737", "testharness" ], "trusted-types/innerHTML.tentative.html": [ - "d5797e778311a76860aab5ae1c1212ed6bf281b0", + "6c2492b545f0989ba74772ff8e0f3922f6ba70da", "testharness" ], "trusted-types/insertAdjacentHTML.tentative.html": [ - "67298baa3acbfd88c9d867e60fc46ff8f9e2a2ca", + "fd95e2fa76d567311b8875bb7481d6345e5423c2", + "testharness" + ], + "trusted-types/location-assign.tentative.html": [ + "685f454d8f28c650b0714d1e35baaa3cfbd0b6c8", "testharness" ], "trusted-types/location-href.tentative.html": [ - "b6b009db2b50ef1a456762256c598b907cbdce81", + "973d7da1fbcbfc5d1b75c5769ae9b53379340bba", + "testharness" + ], + "trusted-types/location-replace.tentative.html": [ + "07f2e2b7b6b4a1cbd9824bc9a3e575eeb99a3fe5", "testharness" ], "trusted-types/outerHTML.tentative.html": [ - "959d23151fe6fa7f049fac11336da8ab9d962d0a", + "ad67e6c1be0b93e47b26c54544f3989d28588ece", "testharness" ], "trusted-types/script-src.tentative.html": [ - "4a125530e91a3834077c658a9c0b550fcce8e626", + "bcebab27339a828c230ad518d1d71da3cd4cda98", "testharness" ], - "trusted-types/support/helper.js": [ - "6ea027fb1cee52a457e64f9b2b2c8294aa8a9dfc", + "trusted-types/srcDoc-requiresTrustedTypes.tentative.html": [ + "7a7be9f8ed0bf2990f434a18169533a3a9df13ca", + "testharness" + ], + "trusted-types/srcDoc.tentative.html": [ + "c13a940e03f51dacfbed5036be81356ef4fe72e5", + "testharness" + ], + "trusted-types/support/helper.sub.js": [ + "6162bad41b15d0ae0be727b5d960bb538d430fe2", "support" ], "uievents/META.yml": [ - "1ba69b5968e13bc4d89eead569c53987c3208ff9", + "a6706289064c1bbabcfab6540831084fc39fb94a", "support" ], "uievents/README.md": [ @@ -622028,7 +621125,7 @@ "support" ], "upgrade-insecure-requests/META.yml": [ - "4966e7a03e815dac333218faf57875b57b9dd535", + "6666ec24605e458c1fd9f0c3d5a2709a4ebd8375", "support" ], "upgrade-insecure-requests/iframe-redirect-upgrade.https.html": [ @@ -622148,7 +621245,7 @@ "testharness" ], "url/META.yml": [ - "4e34e50ea044e46f46889a3753d208a3d60744c5", + "5ab6af28ae99d8973c5d638ebdce7d9650bbcb3d", "support" ], "url/README.md": [ @@ -622272,7 +621369,7 @@ "testharness" ], "user-timing/META.yml": [ - "088f3eb90a01853b7f6af3dab6d84871fe2f6732", + "3dcf72948c4e542083b8a79f1bf3fe280ec3624b", "support" ], "user-timing/clearMarks.html": [ @@ -622384,7 +621481,7 @@ "testharness" ], "vibration/META.yml": [ - "f23c82b0c55a91efe872c0df9957e43bb4d50157", + "838c8ef7bdd4d8c77d4846a2ace43a05b1cfdc35", "support" ], "vibration/api-is-present.html": [ @@ -622444,7 +621541,7 @@ "manual" ], "visual-viewport/META.yml": [ - "e22e0696fbf90eff036cf968efddaf062353841e", + "0b633651cccc7e2eec7752442725c63e1fc25b13", "support" ], "visual-viewport/viewport-attribute-event-handlers-manual.html": [ @@ -622540,7 +621637,7 @@ "support" ], "wai-aria/META.yml": [ - "521d90b87283645c22b8752fdb69031cc08cf3f7", + "44f6a127f3f7740ca67ce4c3039fd19916060fa3", "support" ], "wai-aria/README.md": [ @@ -623472,11 +622569,11 @@ "manual" ], "wake-lock/META.yml": [ - "9b87cd95cb0ea86299cbb08c352fb5f239253028", + "5a1d4c7ae6e1baaf1ea8aa9e510384ebecb7cd80", "support" ], - "wake-lock/interfaces.https.html": [ - "982ddca0a248f4e8829d2495fbcbb5f90af91d8b", + "wake-lock/idlharness.https.window.js": [ + "f609226af01473b340e22d266a9879e875aeca88", "testharness" ], "wake-lock/wakelock-api.https.html": [ @@ -623544,7 +622641,7 @@ "testharness" ], "wake-lock/wakelock-type.https.html": [ - "583647213b49b7bc67cad08192db3e6abcd1de9f", + "db9c24356c4b8b3b963afcca0a2cf72ea568ec58", "testharness" ], "wake-lock/wakelockrequest-is-independent.https.html": [ @@ -623563,6 +622660,10 @@ "893d408fc56d030416a3c89ae3680dc028ecf1d7", "testharness" ], + "wasm/idlharness.any.js": [ + "bf6fb75505097207e8d109cbf04dea1ccede21a7", + "testharness" + ], "wasm/incrementer.wasm": [ "acdf9d22c042ea3b2637c14b1576b4c8ffb4e97a", "support" @@ -623620,7 +622721,7 @@ "testharness" ], "web-animations/META.yml": [ - "de7037ad7c7e358d95a3c579a5a347b149c69a0d", + "6efe6a08ffad0b001860e23b629c1da9c302b895", "support" ], "web-animations/README.md": [ @@ -623644,7 +622745,7 @@ "testharness" ], "web-animations/animation-model/animation-types/property-list.js": [ - "5a818163c3ddcb6e0901b4f0086d555e9d440e27", + "258db06b29520548369fcfa6eec104a61467b3fa", "support" ], "web-animations/animation-model/animation-types/property-types.js": [ @@ -623676,7 +622777,7 @@ "testharness" ], "web-animations/animation-model/keyframe-effects/effect-value-overlapping-keyframes.html": [ - "2b10d6fb1cb925290caf57e4cefc3c3f8161777c", + "d209b67450db1a680cfbea95894029f7116d112d", "testharness" ], "web-animations/animation-model/keyframe-effects/effect-value-transformed-distance.html": [ @@ -623715,8 +622816,8 @@ "4e3dd92351d76c5c7d09ddd1ca025520f4c8875d", "testharness" ], - "web-animations/interfaces/Animation/idlharness.html": [ - "e6fb57362e315021729a7a81b62fa383e51818e3", + "web-animations/interfaces/Animation/idlharness.window.js": [ + "8826ea229d14798457e526a93efdb328f1d80ff7", "testharness" ], "web-animations/interfaces/Animation/oncancel.html": [ @@ -623724,7 +622825,7 @@ "testharness" ], "web-animations/interfaces/Animation/onfinish.html": [ - "db82fabeaf2b646647f134634fef30f05e5ec7f8", + "29b37a8ba9e653d2db88f628dd84bd99cb8be8db", "testharness" ], "web-animations/interfaces/Animation/pause.html": [ @@ -623759,8 +622860,8 @@ "5aff03b7fa469e5ec0dc02a389eca963ae24b470", "testharness" ], - "web-animations/interfaces/AnimationPlaybackEvent/idlharness.html": [ - "d9fc177ebbc3fa0317125912e38a4bfd65f727c8", + "web-animations/interfaces/AnimationPlaybackEvent/idlharness.window.js": [ + "cb9587acecc5de91a0dd69cb8887aae2a0fed216", "testharness" ], "web-animations/interfaces/Document/getAnimations.html": [ @@ -623775,8 +622876,8 @@ "b11caf0a1766818a168a7f91b01ccd6ae9a7e4f0", "testharness" ], - "web-animations/interfaces/DocumentTimeline/idlharness.html": [ - "b811b4367df7d4f2a43955323f9ddb5b0a60da14", + "web-animations/interfaces/DocumentTimeline/idlharness.window.js": [ + "4cdf2b963dbc16f1dfaa76e661fdd14e589a969c", "testharness" ], "web-animations/interfaces/KeyframeEffect/composite.html": [ @@ -623791,8 +622892,8 @@ "0e3d893d7b8e438b279f087846df596256ccbe84", "testharness" ], - "web-animations/interfaces/KeyframeEffect/idlharness.html": [ - "c65dd7fd3c76ac1e5d6f22dbd36544f7900cd992", + "web-animations/interfaces/KeyframeEffect/idlharness.window.js": [ + "2e4d418716ea7638f73ce686983daa2ad48bc332", "testharness" ], "web-animations/interfaces/KeyframeEffect/iterationComposite.html": [ @@ -623800,7 +622901,7 @@ "testharness" ], "web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html": [ - "f68c116e1da5ae8783187af22f00758d02b7a0e9", + "f9a4df0c88a22cac31c1f3d32e86aba68db6610d", "testharness" ], "web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-002.html": [ @@ -623868,11 +622969,11 @@ "testharness" ], "web-animations/timing-model/animations/canceling-an-animation.html": [ - "c2750f33d773b01a9ed5ac4bb8c9f65f7e78265a", + "ea37c5d1dfdff51a085552c742e77730e2c697e7", "testharness" ], "web-animations/timing-model/animations/finishing-an-animation.html": [ - "afe654435332e798b3771b6ec6ca13bcca99e421", + "2800a906d3fbc0f8622a2543ea9c1020d39cd95f", "testharness" ], "web-animations/timing-model/animations/pausing-an-animation.html": [ @@ -623935,12 +623036,136 @@ "29d7fe91c355fc22f563ca17315d2ab493dc0566", "testharness" ], - "web-nfc/META.yml": [ - "99db7f9bd62c44a37a38f8ea3c438c3cd570827c", + "web-animations/timing-model/timelines/update-and-send-events.html": [ + "d3182b36255e4179db13c66d0bd0599af467370f", + "testharness" + ], + "web-locks/META.yml": [ + "d54d4f23e137a6c6ac2a40d943fafae5dea66758", "support" ], - "web-nfc/idlharness.https.html": [ - "4e939e8328c0fa1ffde6a0e5a259fc790db84551", + "web-locks/README.md": [ + "6179646ac5a3c063bee945688370c05fe9bad10c", + "support" + ], + "web-locks/acquire.tentative.https.html": [ + "7a87c4594e750a96858ca46b15eb0d0d080ca469", + "testharness" + ], + "web-locks/clientids.tentative.https.html": [ + "6d46cce5fc8e3580efa7cafb1b38d9b108ede11f", + "testharness" + ], + "web-locks/frames.tentative.https.html": [ + "9b2d5ea7b923b8a68f7f80545fe2bd21714c75e1", + "testharness" + ], + "web-locks/held.tentative.https.html": [ + "d5aaf8b45f1fe4108cd5cea1f934519b0135aed2", + "testharness" + ], + "web-locks/ifAvailable.tentative.https.html": [ + "715ce4839ae64b6f43092b293068876f82065152", + "testharness" + ], + "web-locks/interfaces-serviceworker.tentative.https.html": [ + "fcff067f34f06b75775cb9923603ac5a44959898", + "testharness" + ], + "web-locks/interfaces.idl": [ + "2ba4e7bcda484e6e534edcc313ddaa2d4b4c79f9", + "support" + ], + "web-locks/interfaces.tentative.https.any.js": [ + "679a1182e68d5f72305137415a713d233b02b267", + "testharness" + ], + "web-locks/lock-attributes.tentative.https.html": [ + "4e7221ad6cea5315ad1776213983581272aea2bb", + "testharness" + ], + "web-locks/mode-exclusive.tentative.https.html": [ + "1b7613919309911c5cfb96986fcf6c5bc7f410f9", + "testharness" + ], + "web-locks/mode-mixed.tentative.https.html": [ + "28718e993597e90f76e66a5962a697473e4a8eb4", + "testharness" + ], + "web-locks/mode-shared.tentative.https.html": [ + "5cc9ffb13c0510b60e40ce365c7a44dea65ce790", + "testharness" + ], + "web-locks/non-secure-context.tentative.html": [ + "7b909df4a82c574d2db5612b437b10678003530c", + "testharness" + ], + "web-locks/opaque-origin.tentative.https.html": [ + "ad83a2f90482c3dcdd4f42931f3c41b4e6eecbf6", + "testharness" + ], + "web-locks/query-empty.tentative.https.html": [ + "e572e58e3ebbbcb05e5a81946a209b44c756f8c4", + "testharness" + ], + "web-locks/query-order.tentative.https.html": [ + "95197e4191b4e10dd3bc59acb6844f2cd2498110", + "testharness" + ], + "web-locks/query.tentative.https.html": [ + "19810829e5c1b467b419a891e00ff95c53c3616d", + "testharness" + ], + "web-locks/resource-names.tentative.https.html": [ + "93ce02c4d591d9dc8d094e81ca1ccb3833377e4b", + "testharness" + ], + "web-locks/resources/helpers.js": [ + "518c01e993406e4690f263cae48c4aa261705696", + "support" + ], + "web-locks/resources/iframe.html": [ + "f5a0cf996c285c41409378ef3ab9651f55d76fa5", + "support" + ], + "web-locks/resources/interfaces-serviceworker.js": [ + "0b31181cdf9973e3c8dd61ba6a4f28049d6c7272", + "support" + ], + "web-locks/resources/service-worker.js": [ + "836d6369a45ba29b8cfee052d467a13c096c81b7", + "support" + ], + "web-locks/resources/sw-controlled-iframe.html": [ + "6f9b41d2749836bcb9bd059b40faedbd46163f61", + "support" + ], + "web-locks/resources/worker.js": [ + "d3e19eb55de0b05301ee962b5729cc192165e00b", + "support" + ], + "web-locks/secure-context.tentative.https.html": [ + "d9e65a214df00c4c88b08dbee760570028944027", + "testharness" + ], + "web-locks/signal.tentative.https.html": [ + "4d293a99bee9aed839a7f4a79ede34c1a4f9920e", + "testharness" + ], + "web-locks/steal.tentative.https.html": [ + "ce785398bdd4cf6aaa2b7142edb134e59bc73aa6", + "testharness" + ], + "web-locks/workers.tentative.https.html": [ + "4ec54027defe8da04f8e2083f8e97582b6127571", + "testharness" + ], + "web-nfc/META.yml": [ + "401935a7be2d65ebf8db6a8e1f44bbc40e5fc6eb", + "support" + ], + "web-nfc/idlharness.https.window.js": [ + "211e264a2a8a1e0d7e9a08e2668507a38fb60107", "testharness" ], "web-nfc/nfc_hw_disabled-manual.https.html": [ @@ -623992,7 +623217,7 @@ "support" ], "web-share/META.yml": [ - "cf22bba6c06742cc5188b945d9f435f07d982eb1", + "bb99f1213ae2dfd767b69ee42b3c55978f5ce0fd", "support" ], "web-share/idlharness.https.html": [ @@ -624080,7 +623305,7 @@ "support" ], "webaudio/META.yml": [ - "c95130e1f0226d18fcdd9dc9d5795395d6de586f", + "46a12ee1c1a9bda71e6bb8d32b40709bb8e5732e", "support" ], "webaudio/README.md": [ @@ -624092,7 +623317,7 @@ "testharness" ], "webaudio/idlharness.https.html": [ - "ce6a8abcc0eb9863b0515d6ec2f16e7b42b4151c", + "0403de985b3346240ba1d4b465a8e0838f3860bc", "testharness" ], "webaudio/js/buffer-loader.js": [ @@ -624503,6 +623728,10 @@ "d8f2e2d2f6592718f329c1727b63d69035965973", "testharness" ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam-size.https.html": [ + "1b7e4de628b4dcc88a92879564d0f3f3b4ccdc4b", + "testharness" + ], "webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https.html": [ "de9ecb9c7d9a65052a7a795b0f13c73ed31dbe7b", "testharness" @@ -624560,7 +623789,7 @@ "support" ], "webaudio/the-audio-api/the-audioworklet-interface/processors/gain-processor.js": [ - "1561b9eede1ee15126fdd9674a6d9d63194b66c2", + "84901775d53ffba155e0e7395d28ede401a72dce", "support" ], "webaudio/the-audio-api/the-audioworklet-interface/processors/input-length-processor.js": [ @@ -624575,6 +623804,10 @@ "c2f028c2be836cad2c38a71f96246f84c04323a5", "support" ], + "webaudio/the-audio-api/the-audioworklet-interface/processors/param-size-processor.js": [ + "f682a0b99eb50bc7d1dcd12226e23752f8747505", + "support" + ], "webaudio/the-audio-api/the-audioworklet-interface/processors/port-processor.js": [ "47092e4372a196e47612388602b6a3876deb653a", "support" @@ -624932,7 +624165,7 @@ "testharness" ], "webaudio/the-audio-api/the-pannernode-interface/test-pannernode-automation.html": [ - "09241a8acbc3a556ac4fb24c0ae4de8c8f70c2ed", + "4652424463931d176138a725cd4fc8420a8b5fd3", "testharness" ], "webaudio/the-audio-api/the-periodicwave-interface/.gitkeep": [ @@ -624992,7 +624225,7 @@ "testharness" ], "webauthn/META.yml": [ - "ce5762e9650362564eebb210e55d66f13c32a424", + "640abbc4a5e8449dfe6cf464537edb2ba7ad711d", "support" ], "webauthn/createcredential-badargs-attestation.https.html": [ @@ -625056,11 +624289,11 @@ "testharness" ], "webauthn/helpers.js": [ - "9ce729fb89ba1863fb14dfc4d567e6b544a5238d", + "8c7ee975d637ce8cf63c4bb870baf5f9efacccd7", "support" ], - "webauthn/interfaces.https.any.js": [ - "f143ec75c75322b368f808d7d36be5b7d4cb3c62", + "webauthn/idlharness.https.any.js": [ + "f88605935bf09559cd2324c63a1b410cdfd9ce0e", "testharness" ], "webauthn/securecontext.http.html": [ @@ -625072,7 +624305,7 @@ "testharness" ], "webdriver/META.yml": [ - "aa060ffdedcd91d77aa76e69b29bf2b77b884260", + "b8e1bddf0c5bcc2c7a09986ed9d04fd79ffab01c", "support" ], "webdriver/README.md": [ @@ -625088,7 +624321,7 @@ "support" ], "webdriver/tests/accept_alert/accept.py": [ - "840f2ba655688ac1ff7581557f7560f641b61fe8", + "528149429fbb7da35a52d4b4c0e6839f170d0fac", "wdspec" ], "webdriver/tests/actions/__init__.py": [ @@ -625099,8 +624332,12 @@ "f366a25d9d5e35a2897413a265398bc7a54f7c44", "support" ], + "webdriver/tests/actions/control_click.py": [ + "341a8fbfe64f5231a91999768de0b44bba121122", + "wdspec" + ], "webdriver/tests/actions/key.py": [ - "d589b53f0096893600e696b43ec19ca84e5ee2ab", + "0b70d98a4558427666abbe9629a6cf42d69e2597", "wdspec" ], "webdriver/tests/actions/key_shortcuts.py": [ @@ -625108,11 +624345,11 @@ "wdspec" ], "webdriver/tests/actions/modifier_click.py": [ - "f0ed71cbb6550ef496096541531f3b4fa3f4c6e2", + "5cb44f87588a75a5375b552bce713e7144fd02df", "wdspec" ], "webdriver/tests/actions/mouse.py": [ - "edad7693fcd01b418821942edb870191db64ea41", + "fb5072172d8524788147bde310d612aae5bee1b1", "wdspec" ], "webdriver/tests/actions/mouse_dblclick.py": [ @@ -625160,7 +624397,15 @@ "support" ], "webdriver/tests/add_cookie/add.py": [ - "29891e121def1917c47c70efd19b40ed5f2ea61d", + "39eb6c33a7c8f7a305cd093b795c0127816ac827", + "wdspec" + ], + "webdriver/tests/back/__init__.py": [ + "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "support" + ], + "webdriver/tests/back/back.py": [ + "0df671f059b0b9064a6a8608163b46042524f7e7", "wdspec" ], "webdriver/tests/close_window/__init__.py": [ @@ -625168,27 +624413,43 @@ "support" ], "webdriver/tests/close_window/close.py": [ - "a98fdaa5d8afe6ddca892e8857c134ba24b0e43a", + "8c22860607cb0f3d610888c9816bf2384e2c5445", "wdspec" ], "webdriver/tests/close_window/user_prompts.py": [ - "30c12199dc21e1ffca80662d2cb7ec7bd3d9ef86", + "60b5caf08830d645d94207c4adb5958d279bf02f", "wdspec" ], "webdriver/tests/conftest.py": [ - "c812269d034c9ca1b8c4f136dd5d0cea52f4d0f0", + "0621a8ea4a5c12b3f510c82457d51a81d947f9a3", "support" ], + "webdriver/tests/delete_all_cookies/__init__.py": [ + "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "support" + ], + "webdriver/tests/delete_all_cookies/delete.py": [ + "1248b2e14b6b690b996f8bf620a6a1f33514256a", + "wdspec" + ], "webdriver/tests/delete_cookie/__init__.py": [ "da39a3ee5e6b4b0d3255bfef95601890afd80709", "support" ], "webdriver/tests/delete_cookie/delete.py": [ - "1f0d6b861be1ed682fd87a402908cee186a3987c", + "e9b90bac0e666ce82b3c0006830febcef726d688", "wdspec" ], "webdriver/tests/delete_cookie/user_prompts.py": [ - "65b753bd80a06c3c20b0330f624a4d395fdb7ab2", + "d3505d929c09a36c986f4eaed01d32fb3c644f56", + "wdspec" + ], + "webdriver/tests/delete_session/__init__.py": [ + "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "support" + ], + "webdriver/tests/delete_session/delete.py": [ + "a84961c8abda433f6255a2fa137ecf2b2ac435c5", "wdspec" ], "webdriver/tests/dismiss_alert/__init__.py": [ @@ -625196,7 +624457,7 @@ "support" ], "webdriver/tests/dismiss_alert/dismiss.py": [ - "e213f1939ff5cc2fbdebb2bd8e9445e284803a60", + "33b32f41d9078f7d317aed837f1fc05f443bd034", "wdspec" ], "webdriver/tests/element_clear/__init__.py": [ @@ -625204,7 +624465,7 @@ "support" ], "webdriver/tests/element_clear/clear.py": [ - "d5a0a37d410f5a748aee5ac5be75acb837e491f8", + "aa785499dc4a68650d08c829deef8aa23d073d09", "wdspec" ], "webdriver/tests/element_click/__init__.py": [ @@ -625215,6 +624476,10 @@ "492e283b686abe0743d72e31017be149726628f9", "wdspec" ], + "webdriver/tests/element_click/click.py": [ + "5af8f42f8b31cdc010a7f9e12f4a6814dc92e9de", + "wdspec" + ], "webdriver/tests/element_click/file_upload.py": [ "2c67c39dbe809dd1565830cc66ffd9dc54d90c35", "wdspec" @@ -625251,12 +624516,24 @@ "da39a3ee5e6b4b0d3255bfef95601890afd80709", "support" ], + "webdriver/tests/element_send_keys/conftest.py": [ + "5d5de26029cb9688631cb79ed0f2856c2ac4c615", + "support" + ], "webdriver/tests/element_send_keys/content_editable.py": [ "9c071e60e1203cf31120f20874b5f38ba41dacc3", "wdspec" ], + "webdriver/tests/element_send_keys/events.py": [ + "70dff6b2816da5602325098db7a6609b82ce8415", + "wdspec" + ], + "webdriver/tests/element_send_keys/file_upload.py": [ + "75774ebda6b4a43c7c5e143b9532572bd05a6738", + "wdspec" + ], "webdriver/tests/element_send_keys/form_controls.py": [ - "ec6bdf64c7c4d2e3963e89c8410f69f738565f78", + "990dd9955f06d40c98185161bc4d991b73d86916", "wdspec" ], "webdriver/tests/element_send_keys/interactability.py": [ @@ -625267,6 +624544,14 @@ "e4a50a53a13c1ab76c6c002bbda1c103f8c32ccf", "wdspec" ], + "webdriver/tests/element_send_keys/send_keys.py": [ + "83e4292e0e587a641f73d21cb1ddadc420251a10", + "wdspec" + ], + "webdriver/tests/element_send_keys/user_prompts.py": [ + "92a8270de9036fb131f72197171237dd3e6e9538", + "wdspec" + ], "webdriver/tests/execute_async_script/__init__.py": [ "da39a3ee5e6b4b0d3255bfef95601890afd80709", "support" @@ -625276,7 +624561,7 @@ "wdspec" ], "webdriver/tests/execute_async_script/user_prompts.py": [ - "8b161d459074d7e2a3e726663cedfb1cd8636f0b", + "900c47893fa2f506fc8275338c540725b5c3f2a6", "wdspec" ], "webdriver/tests/execute_script/__init__.py": [ @@ -625288,7 +624573,7 @@ "wdspec" ], "webdriver/tests/execute_script/cyclic.py": [ - "21bae43b3a6e966b8698b7c439b29a68029adc58", + "145a8a67226f31e0c1023aa0609947486be5c319", "wdspec" ], "webdriver/tests/execute_script/json_serialize_windowproxy.py": [ @@ -625296,7 +624581,7 @@ "wdspec" ], "webdriver/tests/execute_script/user_prompts.py": [ - "0e94c156954b90eca2005f6ad9fa5a4601169fd9", + "d4f627cda9669efc7fb8197bf6adde5d65b0aa1f", "wdspec" ], "webdriver/tests/find_element/__init__.py": [ @@ -625331,6 +624616,14 @@ "2daef29773c98649b04e3d6e97380ba569ec045d", "wdspec" ], + "webdriver/tests/forward/__init__.py": [ + "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "support" + ], + "webdriver/tests/forward/forward.py": [ + "558f686e715eab83f2979c4ac772472b7eb91432", + "wdspec" + ], "webdriver/tests/fullscreen_window/__init__.py": [ "da39a3ee5e6b4b0d3255bfef95601890afd80709", "support" @@ -625340,7 +624633,7 @@ "wdspec" ], "webdriver/tests/fullscreen_window/user_prompts.py": [ - "8d6d68bb6bfa9956db5b33598ae3cf33f7022de4", + "7b8f39c4d87abf5acaf63ba55ef5ac72b2537a4b", "wdspec" ], "webdriver/tests/get_active_element/__init__.py": [ @@ -625368,7 +624661,7 @@ "wdspec" ], "webdriver/tests/get_current_url/user_prompts.py": [ - "3241e1d4dbda430b32763006d558fb53d06ffaa1", + "510a4629fcfe5cc08eb4c6f0af4f92b2d3b08452", "wdspec" ], "webdriver/tests/get_element_attribute/get.py": [ @@ -625384,7 +624677,7 @@ "wdspec" ], "webdriver/tests/get_element_property/user_prompts.py": [ - "84a1817bd815bd8c2267862eb3d5f927f2849777", + "cbf65767256f65ac9ea3df09f46fb2b39d5c01b2", "wdspec" ], "webdriver/tests/get_element_tag_name/__init__.py": [ @@ -625396,7 +624689,7 @@ "wdspec" ], "webdriver/tests/get_element_tag_name/user_prompts.py": [ - "88ee5a130fb8fb55974b431d24163bd7de8b305f", + "9e16c0b4bf7162d67564dbbe950220e63f1c23d3", "wdspec" ], "webdriver/tests/get_element_text/__init__.py": [ @@ -625432,7 +624725,7 @@ "wdspec" ], "webdriver/tests/get_title/user_prompts.py": [ - "fd24d562bd7d945de1e5f87c241f4c3717359838", + "a2510586b8019c9000f1db10a86a9be7314dfe97", "wdspec" ], "webdriver/tests/get_window_rect/__init__.py": [ @@ -625444,7 +624737,7 @@ "wdspec" ], "webdriver/tests/get_window_rect/user_prompts.py": [ - "5fd2bc48547788bd24b3b5fc38a18209d85a6747", + "4c811c269596378a9a7e174982fae83c57b0edae", "wdspec" ], "webdriver/tests/interface.html": [ @@ -625460,7 +624753,7 @@ "wdspec" ], "webdriver/tests/is_element_selected/user_prompts.py": [ - "69d7821499ee460f31ed97f3f839cf6899add8fd", + "da2f9dddbbbed25b575d8053efc6a7cbab3c560d", "wdspec" ], "webdriver/tests/maximize_window/__init__.py": [ @@ -625472,7 +624765,7 @@ "wdspec" ], "webdriver/tests/maximize_window/user_prompts.py": [ - "99afcf2148c524eabee410c5ebb89327467a5e35", + "4613d592ac350d1dafd3e8f761f4e1b417dd4394", "wdspec" ], "webdriver/tests/minimize_window/__init__.py": [ @@ -625484,7 +624777,15 @@ "wdspec" ], "webdriver/tests/minimize_window/user_prompts.py": [ - "668c775a0e60b377a5a558a2a38b8887ac2683a0", + "ddc4ce653a0b7309bb40385a13d22320f7e125c2", + "wdspec" + ], + "webdriver/tests/navigate_to/__init__.py": [ + "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "support" + ], + "webdriver/tests/navigate_to/navigate.py": [ + "6274392529489518207961ed5e6b6bb3ff081572", "wdspec" ], "webdriver/tests/new_session/__init__.py": [ @@ -625492,31 +624793,31 @@ "support" ], "webdriver/tests/new_session/conftest.py": [ - "d2df38e506cb9a3e501f03fe03e2a31af42d6f04", + "84d255cc36553dd1e539a821477302f3671a760c", "support" ], "webdriver/tests/new_session/create_alwaysMatch.py": [ - "84f8ad0908e9ec787f9db73ff66cbe193c2c9626", + "7f0524d63065aa566a85e4a13be23e20fafac1a3", "wdspec" ], "webdriver/tests/new_session/create_firstMatch.py": [ - "fbdabf1852c07db0f5df2d47954c1cd5d7285492", + "dabcb551c4887e1fcff2c592ead0ed2fc4e093a0", "wdspec" ], "webdriver/tests/new_session/default_values.py": [ - "92c26366f8fd0d37587457b9b5a630df4b19cc60", + "5098317d830e827f577662dabcb4388dff776609", "wdspec" ], "webdriver/tests/new_session/invalid_capabilities.py": [ - "fcc36e5ca46cb8a9fb9927d5f618c7e9433a0260", + "ead06abab030c160f978e54ce33d4b800fdb6fea", "wdspec" ], "webdriver/tests/new_session/merge.py": [ - "000b28631bb6d862b654f1f998852f5f1a6b2e12", + "4a17fed5d366756420f7cac29696e612f405b2a0", "wdspec" ], "webdriver/tests/new_session/response.py": [ - "5eabb99858b9c3051efb351096d7ba8dca8dbfce", + "a9021a93a0355e306a8fdbb1a820bb57562e354f", "wdspec" ], "webdriver/tests/new_session/support/__init__.py": [ @@ -625535,12 +624836,28 @@ "f5e96dee33de36e3626c3e9bbfdd0014b27c305c", "wdspec" ], + "webdriver/tests/refresh/__init__.py": [ + "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "support" + ], + "webdriver/tests/refresh/refresh.py": [ + "15f800f47dcc793325dbd920b8253648072503cd", + "wdspec" + ], "webdriver/tests/send_alert_text/__init__.py": [ "da39a3ee5e6b4b0d3255bfef95601890afd80709", "support" ], "webdriver/tests/send_alert_text/send.py": [ - "743b0285cb404d5a2aafde268f9ba7e574760bd1", + "97c85c87bad0a09ec0ac97fb978e049e1b320283", + "wdspec" + ], + "webdriver/tests/set_timeouts/__init__.py": [ + "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "support" + ], + "webdriver/tests/set_timeouts/set.py": [ + "335f9e4ae5c406a90bf6a4431fefb629496ad767", "wdspec" ], "webdriver/tests/set_window_rect/__init__.py": [ @@ -625552,7 +624869,7 @@ "wdspec" ], "webdriver/tests/set_window_rect/user_prompts.py": [ - "4ed66d05835d3ab229cb90928e0ca2a15ba08c8a", + "0ecb13dd4b57c26178f29dcfa06a1b3917e1299f", "wdspec" ], "webdriver/tests/status/__init__.py": [ @@ -625560,7 +624877,7 @@ "support" ], "webdriver/tests/status/status.py": [ - "1302349ca7d6a3dcc49e26ca0345023a5c6bbe14", + "8a5e17655c8eca835f113533e8a57a233823cd83", "wdspec" ], "webdriver/tests/support/__init__.py": [ @@ -625568,11 +624885,11 @@ "support" ], "webdriver/tests/support/asserts.py": [ - "1b839404daaca1d059cba98377edb91691ef7e82", + "6ef3c1f75dfafd0291ea0ef3f1e38b500ba91f6d", "support" ], "webdriver/tests/support/fixtures.py": [ - "126e82c42568c9ecb240e735a2b1361882ecd9ba", + "e0c7db2a275c39af511cdb74492f6ee8f31cb219", "support" ], "webdriver/tests/support/http_request.py": [ @@ -625591,12 +624908,28 @@ "511d4ba0ff21325b7503440b4111fac325139edc", "support" ], + "webdriver/tests/switch_to_frame/__init__.py": [ + "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "support" + ], + "webdriver/tests/switch_to_frame/switch.py": [ + "90ab2a8b7bff127afd758b21210baa6b16b2d458", + "wdspec" + ], "webdriver/tests/switch_to_parent_frame/__init__.py": [ "da39a3ee5e6b4b0d3255bfef95601890afd80709", "support" ], "webdriver/tests/switch_to_parent_frame/switch.py": [ - "c184952fc8a78f5edc7d573a9f8440b5eec334cc", + "df4dab8bd807672599d4b6191464ffdf5a9b7f44", + "wdspec" + ], + "webdriver/tests/switch_to_window/__init__.py": [ + "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "support" + ], + "webdriver/tests/switch_to_window/switch.py": [ + "7bb4468fdaf3afb40669e581a3b277b5194c2ee0", "wdspec" ], "webgl/META.yml": [ @@ -625660,7 +624993,7 @@ "testharness" ], "webmessaging/META.yml": [ - "2352e61ffc381eb9c2f08538a310af910f54dcd5", + "c4c7ed7cc10e63f69bdc69a46a0834e706f0e65c", "support" ], "webmessaging/MessageEvent-trusted-worker.js": [ @@ -625859,6 +625192,50 @@ "d2e6a16df949e553b1067f19cb6c57f3358a3a4b", "support" ], + "webmessaging/with-options/broken-origin.tentative.html": [ + "4cd25fa136ea0d934893baa94cbb02f9225283b4", + "testharness" + ], + "webmessaging/with-options/host-specific-origin.tentative.html": [ + "3629058f06adc6e087fdb0541290ff3b2f0bd193", + "testharness" + ], + "webmessaging/with-options/invalid-args.tentative.html": [ + "fd58b92f5031a7c853752ada170c0243de3390ce", + "testharness" + ], + "webmessaging/with-options/message-channel-transferable.tentative.html": [ + "bb6befea5b1d6ecaaccf0c91e0667e2162211e61", + "testharness" + ], + "webmessaging/with-options/no-target-origin.tentative.html": [ + "4488ff7e67cbb21a61c4bc10a86ce8db635381a3", + "testharness" + ], + "webmessaging/with-options/null-arg-two.tentative.html": [ + "e267e7d0434187d68183519e771b49fb5f7e8cf0", + "testharness" + ], + "webmessaging/with-options/one-arg.tentative.html": [ + "f6a55a9d0d178021661e52871a147e220db4a2db", + "testharness" + ], + "webmessaging/with-options/slash-origin.tentative.html": [ + "dc13f33233bcff9b45574cd82e58587bed4e8145", + "testharness" + ], + "webmessaging/with-options/two-arg.tentative.html": [ + "466c251aaa926ce739acd758d2b44104d8165501", + "testharness" + ], + "webmessaging/with-options/undefined-transferable.tentative.html": [ + "bd0c1bde34600a11350b50e3030997d908276aef", + "testharness" + ], + "webmessaging/with-options/unknown-parameter.tentative.html": [ + "0a80a8467e9bcfdd7f44f3e7f6884e64d785509c", + "testharness" + ], "webmessaging/with-ports/001.html": [ "9ef343247f34d13b8709894fc85849c203428148", "testharness" @@ -626080,7 +625457,7 @@ "testharness" ], "webrtc-stats/META.yml": [ - "fe059455b173c57e29cbcd0ce90e6e5b6c21afb3", + "82d75eadab74e4e1723396af5e85dca885c8077b", "support" ], "webrtc-stats/README.md": [ @@ -626088,7 +625465,7 @@ "support" ], "webrtc/META.yml": [ - "211af3b4837a5d879fc390270db420088b228807", + "8e81606efcc908d48a399b942fe8465b667ac0af", "support" ], "webrtc/RTCCertificate.html": [ @@ -626124,7 +625501,7 @@ "support" ], "webrtc/RTCDTMFSender-insertDTMF.https.html": [ - "068c96875c7b7a0a19cfdaa6d7af5b94a57ff71c", + "f215e71673d05719f7e293c1078b139c75a5ac9f", "testharness" ], "webrtc/RTCDTMFSender-ontonechange-long.https.html": [ @@ -626164,7 +625541,7 @@ "testharness" ], "webrtc/RTCPeerConnection-add-track-no-deadlock.https.html": [ - "d08414aefa6b0f082a0fcb7f5d05933636c012bb", + "e6c4c1e922e47bfb065d65bcf0954610162b8839", "testharness" ], "webrtc/RTCPeerConnection-addIceCandidate.html": [ @@ -626172,7 +625549,7 @@ "testharness" ], "webrtc/RTCPeerConnection-addTrack.https.html": [ - "eddb5aedbfea3636ae03c0920c4450afc8e70658", + "74096ec62288029bf7aea81008e63e43a5f40549", "testharness" ], "webrtc/RTCPeerConnection-addTransceiver.html": [ @@ -626204,7 +625581,7 @@ "testharness" ], "webrtc/RTCPeerConnection-createOffer.html": [ - "fb66c7d17d237b3a1752ce67ab7963a6f8c719d0", + "87c56be7eba40e4677c7cd0776bb74a4570ffa59", "testharness" ], "webrtc/RTCPeerConnection-generateCertificate.html": [ @@ -626220,7 +625597,7 @@ "testharness" ], "webrtc/RTCPeerConnection-getStats.https.html": [ - "f703ed5bf1fc434afd72f525e1639c7e4621e1b7", + "fbb26c647a8759d1b9da637f7167b1a805f647c4", "testharness" ], "webrtc/RTCPeerConnection-getTransceivers.html": [ @@ -626228,7 +625605,7 @@ "testharness" ], "webrtc/RTCPeerConnection-helper.js": [ - "e25c8f69e6a9c9b5c565d1375d7bb6dd210f4784", + "e92d33cfb3fdacc6a2f172ecfe3444a1ced5680e", "support" ], "webrtc/RTCPeerConnection-iceConnectionState.html": [ @@ -626256,7 +625633,7 @@ "testharness" ], "webrtc/RTCPeerConnection-removeTrack.https.html": [ - "f4251f373bce768c30c5da9253029319921f3cf0", + "cfe015c4ad648d0bd5009d0ccd9629fefdc3e5ae", "testharness" ], "webrtc/RTCPeerConnection-setDescription-transceiver.html": [ @@ -626264,35 +625641,35 @@ "testharness" ], "webrtc/RTCPeerConnection-setLocalDescription-answer.html": [ - "35f5d5f3da4914fb5f42cd77d122fb3cf88ba790", + "beefd1c58a3edcc1d11a41e6ee591955b336fb3d", "testharness" ], "webrtc/RTCPeerConnection-setLocalDescription-offer.html": [ - "ce7f1e2fc7adb243a840587a1d011b683ecfbfbd", + "73e6ce16d1d1e074e26fca0f1fd605ee1db278b7", "testharness" ], "webrtc/RTCPeerConnection-setLocalDescription-pranswer.html": [ - "acc815368303f8d79d2d8f504f675092581f6724", + "9e87d7f2083c8bf506794562e2b91bd00425b065", "testharness" ], "webrtc/RTCPeerConnection-setLocalDescription-rollback.html": [ - "45f66d3133c760a8be7e6667df089df5e890ba08", + "7e635e29823127764b00b70659d2b79859ad3883", "testharness" ], "webrtc/RTCPeerConnection-setLocalDescription.html": [ - "460de818ecbd5cb476c27a38c5f39f567060bda2", + "db2b1a474b82016f7965b61e9db30d938a39c40b", "testharness" ], "webrtc/RTCPeerConnection-setRemoteDescription-answer.html": [ - "c4a942e907e8d0506cd6a6dce4f45c59e12a12e6", + "e47a0323a00e1fbd3869f036e530b41e90b829f4", "testharness" ], "webrtc/RTCPeerConnection-setRemoteDescription-offer.html": [ - "ec31150549acbd27a3c510eefd6bc40dc0fd31eb", + "4d31d96aa419fce79587ed99b1154e8acb65a286", "testharness" ], "webrtc/RTCPeerConnection-setRemoteDescription-pranswer.html": [ - "d61781c76e6e831c9a513b9a91f709761bf425f7", + "313ac01d6d63eaeeba699d07bcd894f57989d2e7", "testharness" ], "webrtc/RTCPeerConnection-setRemoteDescription-replaceTrack.https.html": [ @@ -626300,15 +625677,15 @@ "testharness" ], "webrtc/RTCPeerConnection-setRemoteDescription-rollback.html": [ - "af10b6542e99a190bb62c8375a1896c6681a8022", + "2f7a15a6600893f786d48d300cac03f474ba7e6b", "testharness" ], "webrtc/RTCPeerConnection-setRemoteDescription-tracks.https.html": [ - "b3d025c0a50886293e340afc27081212b0bead95", + "3d1cfd0db67de255f7b1845d1be7fda6847eeb90", "testharness" ], "webrtc/RTCPeerConnection-setRemoteDescription.html": [ - "cfcda3a660de85ce376e423aa122d8bca1e36413", + "8a3e2f1e157e1ceed18ac66e57040a941b658f24", "testharness" ], "webrtc/RTCPeerConnection-track-stats.https.html": [ @@ -626324,7 +625701,7 @@ "support" ], "webrtc/RTCRtpParameters-codecs.html": [ - "56f7ca6bd03087b3858c6decde1387cd4017fd3b", + "6b7827be92ec883fe87bc2c422a7fa6bb557190b", "testharness" ], "webrtc/RTCRtpParameters-degradationPreference.html": [ @@ -626332,7 +625709,7 @@ "testharness" ], "webrtc/RTCRtpParameters-encodings.html": [ - "76d4a6dccec508ea25d8c0bc3037a25a7db3f3ac", + "27fa525156e34885a12971e722ba0efc729b8f39", "testharness" ], "webrtc/RTCRtpParameters-headerExtensions.html": [ @@ -626340,7 +625717,7 @@ "testharness" ], "webrtc/RTCRtpParameters-helper.js": [ - "fcf16b5ae297d141b48003115905aa5bf28eab32", + "10aa220467977eaceb70e2143acbf46b6876f0d6", "support" ], "webrtc/RTCRtpParameters-rtcp.html": [ @@ -626348,7 +625725,7 @@ "testharness" ], "webrtc/RTCRtpParameters-transactionId.html": [ - "acb3d37db30fb2d436cc130c4a47601aa38625c8", + "a48817af4be42460a1f44f39e63f292662228db8", "testharness" ], "webrtc/RTCRtpReceiver-getCapabilities.html": [ @@ -626364,7 +625741,7 @@ "testharness" ], "webrtc/RTCRtpReceiver-getStats.https.html": [ - "ebbca119f90320469cb311cac234c82d230f1191", + "6dbb42fd71efcfbf8f637090f0326c834326c618", "testharness" ], "webrtc/RTCRtpReceiver-getSynchronizationSources.https.html": [ @@ -626376,10 +625753,10 @@ "testharness" ], "webrtc/RTCRtpSender-getStats.https.html": [ - "7cea6806ce165a32f5f28d6df215a2af07da7bd2", + "d00d8893b7f4f0e150d3e6281eff0c2e19fd03c3", "testharness" ], - "webrtc/RTCRtpSender-replaceTrack.html": [ + "webrtc/RTCRtpSender-replaceTrack.https.html": [ "ea6ff719d0939e22fd5af2c72af009a1c9602c93", "testharness" ], @@ -626444,7 +625821,7 @@ "support" ], "webrtc/interfaces.https.html": [ - "e66dc8812ea38e216c4483dbb3c7814574c39653", + "f2a927accd2cd966bc7beca49373ce77c6f4de2f", "testharness" ], "webrtc/no-media-call.html": [ @@ -626464,7 +625841,7 @@ "testharness" ], "webrtc/simplecall.https.html": [ - "146432ca56e487a035df8ad9d5a7fa4a495b5405", + "01b15f6f42ca762c5e2949370b64575d45ec9941", "testharness" ], "webrtc/tools/.eslintrc.js": [ @@ -626560,7 +625937,7 @@ "testharness" ], "websockets/Create-on-worker-shutdown.any.js": [ - "a3770c937d8c97584cc380b21c1fb56a8db44c43", + "7d118ef3fe9fd341f6986db1c56a0d8d187533e1", "testharness" ], "websockets/Create-protocol-with-space.any.js": [ @@ -626600,7 +625977,7 @@ "testharness" ], "websockets/META.yml": [ - "417baa06a0b769e413c8c547f712db2b45b5f317", + "9cb64edb82f20194ab8ff0f327c2a6d4eb7796df", "support" ], "websockets/README.md": [ @@ -627028,15 +626405,15 @@ "support" ], "websockets/handlers/set-cookie-secure_wsh.py": [ - "30b03b63d7b12371f6283ed89f967d2ffb66e372", + "bff5eced1b722a0a2fc46a882ddc9931b9e334c6", "support" ], "websockets/handlers/set-cookie_http_wsh.py": [ - "2fe1c7ac70bcf3e2acb60153eddd23742327715a", + "bad12724cbeec925c42854047cb9061ec4ace735", "support" ], "websockets/handlers/set-cookie_wsh.py": [ - "921ada3105b0010d80784f4939a79c163bb529b8", + "081f534291fc3ce29b87e8bff1060cb098bcd779", "support" ], "websockets/handlers/simple_handshake_wsh.py": [ @@ -627048,7 +626425,7 @@ "support" ], "websockets/handlers/stash_responder_wsh.py": [ - "ccb39515d6c1076ce7645350627d1a976eb7b6f5", + "dc16c4a345cd50cba90b83588c96356aadb20a9e", "support" ], "websockets/handlers/wrong_accept_key_wsh.py": [ @@ -627444,7 +626821,7 @@ "support" ], "webstorage/META.yml": [ - "c1168699a894ee7aa832c88197b4aa0e8e641a9e", + "32a88864dfb3b9aeae321a95fba6b526096804ac", "support" ], "webstorage/README.md": [ @@ -627708,7 +627085,7 @@ "testharness" ], "webusb/META.yml": [ - "1d5ec928a52fda02907002a7869af7b9a4bfcc71", + "f99a28f3303f4a8f35cb08462982ece9056c4469", "support" ], "webusb/README.md": [ @@ -627716,7 +627093,7 @@ "support" ], "webusb/idlharness.https.any.js": [ - "250dab11ef835eb0b4f0a45071816e720042129e", + "0ee7b08945b6064a6e760fd430a0c424ec93f91d", "testharness" ], "webusb/resources/fake-devices.js": [ @@ -627820,7 +627197,7 @@ "testharness" ], "webvr/META.yml": [ - "58bfdf395aa56d3292d85f1a3b0b1545c2b19c57", + "ed6e1e542838eaeaed1e527b57ea9fcf1e0f1fce", "support" ], "webvr/idlharness.https.html": [ @@ -627860,7 +627237,7 @@ "support" ], "webvtt/META.yml": [ - "fc7d57474b2e55b806cef464d08cae701881e141", + "c4db7b7b92b6f0913a43b12bf6cafbe79207ad73", "support" ], "webvtt/README.md": [ @@ -630684,7 +630061,7 @@ "support" ], "webxr/META.yml": [ - "3605bdd015d08cdd3f8a94c9fa356b9623fa728c", + "7a416c707ab33b8e277c25f3cd6fc6a4ed88fc2e", "support" ], "webxr/interfaces.https.html": [ @@ -630704,7 +630081,7 @@ "testharness" ], "workers/META.yml": [ - "7b3a04993e5866f4a2ded4098d3196702ae03d0f", + "e10618bcfad6f80d5d983b9f4da878560b644108", "support" ], "workers/README.md": [ @@ -630899,28 +630276,48 @@ "2563eac08a75fe114f6d241085816036bee9163c", "testharness" ], - "workers/baseurl/alpha/importScripts.html": [ - "5ee50e5afe784e55c040a8b34ae8c6a4425a515b", + "workers/baseurl/alpha/import-in-moduleworker.html": [ + "c420b95da4442319e5f0500eb7eb764272cc244c", "testharness" ], - "workers/baseurl/alpha/sharedworker.html": [ + "workers/baseurl/alpha/importScripts-in-sharedworker.html": [ + "43b8351bb492823de92797e0b67cda5b966b730d", + "testharness" + ], + "workers/baseurl/alpha/importScripts-in-worker.html": [ + "d04a983b7103c339dc9da4c5c153e348d5a54f43", + "testharness" + ], + "workers/baseurl/alpha/sharedworker-in-worker.html": [ "fe1cf49ada6854c4fa2a5d3bfadf83498d71c8ee", "testharness" ], - "workers/baseurl/alpha/worker.html": [ + "workers/baseurl/alpha/worker-in-worker.html": [ "1438e3cb519500ac56e606b3907dd0a8236e27ad", "testharness" ], - "workers/baseurl/alpha/xhr.html": [ - "9f6d16f219b51fd0bf4724f6cecf32ee87df16f3", + "workers/baseurl/alpha/xhr-in-moduleworker.html": [ + "fb14f5c80acfd7f71f27e8eaa62683b390cfb800", "testharness" ], + "workers/baseurl/alpha/xhr-in-sharedworker.html": [ + "557a67471f53cdeecf060ba72ec54da42025f8cd", + "testharness" + ], + "workers/baseurl/alpha/xhr-in-worker.html": [ + "20b604ef088f473d5c8c2d5f309f95a26185ec6f", + "testharness" + ], + "workers/baseurl/beta/import.py": [ + "9811ed4318c3986374cd729a4cc1cd0d0ef2d788", + "support" + ], "workers/baseurl/beta/importScripts.py": [ "c23133bf425c4e9c080b0bfc652aff19548cc0f3", "support" ], "workers/baseurl/beta/script.js": [ - "d1a3faf6735e6d328a79005dc19accc4fad0a909", + "03e7445e613ea4da10df8b36412f7f67a6213f9b", "support" ], "workers/baseurl/beta/sharedworker.py": [ @@ -630943,16 +630340,28 @@ "76f2afa47c0cec21aef2cf55fd578f29938d882f", "support" ], + "workers/baseurl/beta/xhr-worker.py": [ + "b056416f08ead64bb668b009d5183c0856a31675", + "support" + ], "workers/baseurl/beta/xhr.py": [ "3ae9e36d3fd782b54673e3ec05fbc63dad24be90", "support" ], + "workers/baseurl/gamma/import.js": [ + "be8ad7f9fc9d5652234495c8b579b6c578aab27d", + "support" + ], "workers/baseurl/gamma/importScripts.js": [ - "b1ffe7e4cfd3907565a2e3c1753c6cd06f2cc7b9", + "87f4eb450b5ff9c60d9727ea6034e76db4e2aaf4", + "support" + ], + "workers/baseurl/gamma/script-module.js": [ + "abfcc3d23973d3aa631012c3cfa632470113a359", "support" ], "workers/baseurl/gamma/script.js": [ - "6b281fd324edb83a97aa8c1a5ebe1e1eb063514e", + "8c6b664394db0f0f74e0db43b1c74bb1420f5377", "support" ], "workers/baseurl/gamma/sharedworker.js": [ @@ -630975,6 +630384,10 @@ "b4440f0a6fe5358a263470f16725ede0f63c12b1", "support" ], + "workers/baseurl/gamma/xhr-worker.js": [ + "6ca6c17cf7d4bea3c8bdb1aaa6850069e14b6dd2", + "support" + ], "workers/baseurl/gamma/xhr.js": [ "13287daf681769f1c66503a6f24fb62f122f9e68", "support" @@ -631251,10 +630664,22 @@ "b7b5edff5d7f3bf2f57716fa6ec06ddc19f3ff24", "support" ], - "workers/interfaces/WorkerGlobalScope/location/redirect.html": [ - "71e9ae34963f31c87dea34df869fd5241bc05c3b", + "workers/interfaces/WorkerGlobalScope/location/redirect-module.html": [ + "bbf9c949da5ff566efd7d758464dbd9a0b2df49c", "testharness" ], + "workers/interfaces/WorkerGlobalScope/location/redirect-sharedworker.html": [ + "8ec49d8079509f553b43a7d4713746e5118072fd", + "testharness" + ], + "workers/interfaces/WorkerGlobalScope/location/redirect.html": [ + "092a8e2885277e9fe7fe33303b3cc168919c1cd6", + "testharness" + ], + "workers/interfaces/WorkerGlobalScope/location/redirect.js": [ + "d287f41c1d4f7df8b7beac8b371aac72a3c59b80", + "support" + ], "workers/interfaces/WorkerGlobalScope/location/returns-same-object.html": [ "d24c110f744c9aa5c8df3ecd12d1712cafdff87d", "testharness" @@ -631407,12 +630832,20 @@ "6bffa3be83d81e2faa93119e710e4fee93fb855e", "testharness" ], + "workers/modules/dedicated-worker-import-blob-url.any.js": [ + "811bccb876055daee01bc50152c425dc931c0f72", + "testharness" + ], "workers/modules/dedicated-worker-import-csp.html": [ "e889866185addcccf72828df7e75cec387cffab5", "testharness" ], + "workers/modules/dedicated-worker-import-data-url.any.js": [ + "599db2cf40a1173d66b06c1b53229a654bc4473f", + "testharness" + ], "workers/modules/dedicated-worker-import-failure.html": [ - "63b2320a3ecf6133a3525574bf5a1d185d1f3aa7", + "29932911fcc6804e8d5f77f3d8f2a8adc4cd2fed", "testharness" ], "workers/modules/dedicated-worker-import-meta.html": [ @@ -631424,7 +630857,7 @@ "testharness" ], "workers/modules/dedicated-worker-import.any.js": [ - "8a3a5bdcf6034d99cb244cc6ff36ada8f422ef37", + "b890d5e557f526ed2d6c43f8e4f413faa93e58ff", "testharness" ], "workers/modules/dedicated-worker-options-credentials.html": [ @@ -631479,6 +630912,10 @@ "dbb6eaa13def20fd310c7aaafab3d3ef9fe99859", "support" ], + "workers/modules/resources/export-on-dynamic-import-script.js.headers": [ + "90d51a5e46cc58404dd5ec1e9e4e10934a6c0707", + "support" + ], "workers/modules/resources/export-on-load-script.js": [ "fab13482dce29d3150f4eb06b1375c2610ab07f3", "support" @@ -631491,6 +630928,10 @@ "fccc8ed2855b857d435d71382ed056f94be6e69d", "support" ], + "workers/modules/resources/export-on-static-import-script.js.headers": [ + "90d51a5e46cc58404dd5ec1e9e4e10934a6c0707", + "support" + ], "workers/modules/resources/import-meta-url-worker.js": [ "83f231a886c36543721c2b0204c18b97d10968f8", "support" @@ -631499,6 +630940,10 @@ "53c6df8251db9e255ba4199c5f4828acc16b93ac", "support" ], + "workers/modules/resources/import-test-cases.js": [ + "b86e4129ec023b2d9e13664c3d8c420ce0ea6ed8", + "support" + ], "workers/modules/resources/nested-dynamic-import-worker.js": [ "a6da499a70bce69c7faa79fc9f22ad2cd41c7fd5", "support" @@ -631944,7 +631389,7 @@ "testharness" ], "worklets/META.yml": [ - "bd2edbe2d714296d47e04625dab704550ec373f6", + "d0d77a35b18600217f7dbc2b77503b0538bb5b3f", "support" ], "worklets/README.md": [ @@ -631971,6 +631416,10 @@ "395ebb855280779c248cc587141568fe0f089715", "testharness" ], + "worklets/idlharness.worker.js": [ + "4809e9619a569886580bfcdc89ce6857aef47c8a", + "testharness" + ], "worklets/layout-worklet-credentials.https.html": [ "ffab9e5cdf8e3d1c759fa484512b24b45fca9cc8", "testharness" @@ -632132,7 +631581,7 @@ "support" ], "x-frame-options/META.yml": [ - "382438af20cfed5bdd980fdd3bc39771472c5547", + "956e7abe295e8eb9198ff2a8208f95f4147edbbc", "support" ], "x-frame-options/README.md": [ @@ -632180,7 +631629,7 @@ "testharness" ], "xhr/META.yml": [ - "0168b8e25e1accc1fbc2b4b3edd353dc2b0910b8", + "407984ab3695084be748ffb7e756944f42d7081b", "support" ], "xhr/README.md": [ @@ -632747,8 +632196,12 @@ "28603b8d225367ba648bb9271dec5cb3da73d733", "testharness" ], + "xhr/open-url-redirected-sharedworker-origin.htm": [ + "3764d550cf747ace6dca3a6e4589313f96b183c2", + "testharness" + ], "xhr/open-url-redirected-worker-origin.htm": [ - "79b3d8035d2e7bc6fef2c69eb378ede3f55e6ff5", + "2d224cab0d843203885c433089d0cbb95ce2767d", "testharness" ], "xhr/open-url-worker-origin.htm": [ diff --git a/tests/wpt/metadata/WebCryptoAPI/idlharness.https.any.js.ini b/tests/wpt/metadata/WebCryptoAPI/idlharness.https.any.js.ini new file mode 100644 index 00000000000..da835fe08d1 --- /dev/null +++ b/tests/wpt/metadata/WebCryptoAPI/idlharness.https.any.js.ini @@ -0,0 +1,9 @@ +[idlharness.https.any.html] + [idlharness] + expected: FAIL + + +[idlharness.https.any.worker.html] + [idlharness] + expected: FAIL + diff --git a/tests/wpt/metadata/WebCryptoAPI/idlharness.https.html.ini b/tests/wpt/metadata/WebCryptoAPI/idlharness.https.html.ini deleted file mode 100644 index 0b9f14e7c68..00000000000 --- a/tests/wpt/metadata/WebCryptoAPI/idlharness.https.html.ini +++ /dev/null @@ -1,284 +0,0 @@ -[idlharness.https.html] - type: testharness - [Crypto interface: attribute subtle] - expected: FAIL - - [Crypto interface: crypto must inherit property "subtle" with the proper type (0)] - expected: FAIL - - [CryptoKey interface: existence and properties of interface object] - expected: FAIL - - [CryptoKey interface object length] - expected: FAIL - - [CryptoKey interface object name] - expected: FAIL - - [CryptoKey interface: existence and properties of interface prototype object] - expected: FAIL - - [CryptoKey interface: existence and properties of interface prototype object's "constructor" property] - expected: FAIL - - [CryptoKey interface: attribute type] - expected: FAIL - - [CryptoKey interface: attribute extractable] - expected: FAIL - - [CryptoKey interface: attribute algorithm] - expected: FAIL - - [CryptoKey interface: attribute usages] - expected: FAIL - - [SubtleCrypto interface: existence and properties of interface object] - expected: FAIL - - [SubtleCrypto interface object length] - expected: FAIL - - [SubtleCrypto interface object name] - expected: FAIL - - [SubtleCrypto interface: existence and properties of interface prototype object] - expected: FAIL - - [SubtleCrypto interface: existence and properties of interface prototype object's "constructor" property] - expected: FAIL - - [SubtleCrypto interface: operation encrypt(AlgorithmIdentifier,CryptoKey,BufferSource)] - expected: FAIL - - [SubtleCrypto interface: operation decrypt(AlgorithmIdentifier,CryptoKey,BufferSource)] - expected: FAIL - - [SubtleCrypto interface: operation sign(AlgorithmIdentifier,CryptoKey,BufferSource)] - expected: FAIL - - [SubtleCrypto interface: operation verify(AlgorithmIdentifier,CryptoKey,BufferSource,BufferSource)] - expected: FAIL - - [SubtleCrypto interface: operation digest(AlgorithmIdentifier,BufferSource)] - expected: FAIL - - [SubtleCrypto interface: operation generateKey(AlgorithmIdentifier,boolean,[object Object\])] - expected: FAIL - - [SubtleCrypto interface: operation deriveKey(AlgorithmIdentifier,CryptoKey,AlgorithmIdentifier,boolean,[object Object\])] - expected: FAIL - - [SubtleCrypto interface: operation deriveBits(AlgorithmIdentifier,CryptoKey,unsigned long)] - expected: FAIL - - [SubtleCrypto interface: operation importKey(KeyFormat,[object Object\],[object Object\],AlgorithmIdentifier,boolean,[object Object\])] - expected: FAIL - - [SubtleCrypto interface: operation exportKey(KeyFormat,CryptoKey)] - expected: FAIL - - [SubtleCrypto interface: operation wrapKey(KeyFormat,CryptoKey,CryptoKey,AlgorithmIdentifier)] - expected: FAIL - - [SubtleCrypto interface: operation unwrapKey(KeyFormat,BufferSource,CryptoKey,AlgorithmIdentifier,AlgorithmIdentifier,boolean,[object Object\])] - expected: FAIL - - [SubtleCrypto must be primary interface of crypto.subtle] - expected: FAIL - - [Stringification of crypto.subtle] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "encrypt" with the proper type (0)] - expected: FAIL - - [SubtleCrypto interface: calling encrypt(AlgorithmIdentifier,CryptoKey,BufferSource) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "decrypt" with the proper type (1)] - expected: FAIL - - [SubtleCrypto interface: calling decrypt(AlgorithmIdentifier,CryptoKey,BufferSource) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "sign" with the proper type (2)] - expected: FAIL - - [SubtleCrypto interface: calling sign(AlgorithmIdentifier,CryptoKey,BufferSource) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "verify" with the proper type (3)] - expected: FAIL - - [SubtleCrypto interface: calling verify(AlgorithmIdentifier,CryptoKey,BufferSource,BufferSource) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "digest" with the proper type (4)] - expected: FAIL - - [SubtleCrypto interface: calling digest(AlgorithmIdentifier,BufferSource) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "generateKey" with the proper type (5)] - expected: FAIL - - [SubtleCrypto interface: calling generateKey(AlgorithmIdentifier,boolean,[object Object\]) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "deriveKey" with the proper type (6)] - expected: FAIL - - [SubtleCrypto interface: calling deriveKey(AlgorithmIdentifier,CryptoKey,AlgorithmIdentifier,boolean,[object Object\]) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "deriveBits" with the proper type (7)] - expected: FAIL - - [SubtleCrypto interface: calling deriveBits(AlgorithmIdentifier,CryptoKey,unsigned long) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "importKey" with the proper type (8)] - expected: FAIL - - [SubtleCrypto interface: calling importKey(KeyFormat,[object Object\],[object Object\],AlgorithmIdentifier,boolean,[object Object\]) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "exportKey" with the proper type (9)] - expected: FAIL - - [SubtleCrypto interface: calling exportKey(KeyFormat,CryptoKey) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "wrapKey" with the proper type (10)] - expected: FAIL - - [SubtleCrypto interface: calling wrapKey(KeyFormat,CryptoKey,CryptoKey,AlgorithmIdentifier) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "unwrapKey" with the proper type (11)] - expected: FAIL - - [SubtleCrypto interface: calling unwrapKey(KeyFormat,BufferSource,CryptoKey,AlgorithmIdentifier,AlgorithmIdentifier,boolean,[object Object\]) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [Crypto interface: crypto must inherit property "subtle" with the proper type] - expected: FAIL - - [SubtleCrypto interface: operation encrypt(AlgorithmIdentifier, CryptoKey, BufferSource)] - expected: FAIL - - [SubtleCrypto interface: operation decrypt(AlgorithmIdentifier, CryptoKey, BufferSource)] - expected: FAIL - - [SubtleCrypto interface: operation sign(AlgorithmIdentifier, CryptoKey, BufferSource)] - expected: FAIL - - [SubtleCrypto interface: operation verify(AlgorithmIdentifier, CryptoKey, BufferSource, BufferSource)] - expected: FAIL - - [SubtleCrypto interface: operation digest(AlgorithmIdentifier, BufferSource)] - expected: FAIL - - [SubtleCrypto interface: operation generateKey(AlgorithmIdentifier, boolean, [object Object\])] - expected: FAIL - - [SubtleCrypto interface: operation deriveKey(AlgorithmIdentifier, CryptoKey, AlgorithmIdentifier, boolean, [object Object\])] - expected: FAIL - - [SubtleCrypto interface: operation deriveBits(AlgorithmIdentifier, CryptoKey, unsigned long)] - expected: FAIL - - [SubtleCrypto interface: operation importKey(KeyFormat, [object Object\],[object Object\], AlgorithmIdentifier, boolean, [object Object\])] - expected: FAIL - - [SubtleCrypto interface: operation exportKey(KeyFormat, CryptoKey)] - expected: FAIL - - [SubtleCrypto interface: operation wrapKey(KeyFormat, CryptoKey, CryptoKey, AlgorithmIdentifier)] - expected: FAIL - - [SubtleCrypto interface: operation unwrapKey(KeyFormat, BufferSource, CryptoKey, AlgorithmIdentifier, AlgorithmIdentifier, boolean, [object Object\])] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "encrypt(AlgorithmIdentifier, CryptoKey, BufferSource)" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling encrypt(AlgorithmIdentifier, CryptoKey, BufferSource) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "decrypt(AlgorithmIdentifier, CryptoKey, BufferSource)" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling decrypt(AlgorithmIdentifier, CryptoKey, BufferSource) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "sign(AlgorithmIdentifier, CryptoKey, BufferSource)" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling sign(AlgorithmIdentifier, CryptoKey, BufferSource) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "verify(AlgorithmIdentifier, CryptoKey, BufferSource, BufferSource)" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling verify(AlgorithmIdentifier, CryptoKey, BufferSource, BufferSource) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "digest(AlgorithmIdentifier, BufferSource)" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling digest(AlgorithmIdentifier, BufferSource) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "generateKey(AlgorithmIdentifier, boolean, [object Object\])" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling generateKey(AlgorithmIdentifier, boolean, [object Object\]) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "deriveKey(AlgorithmIdentifier, CryptoKey, AlgorithmIdentifier, boolean, [object Object\])" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling deriveKey(AlgorithmIdentifier, CryptoKey, AlgorithmIdentifier, boolean, [object Object\]) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "deriveBits(AlgorithmIdentifier, CryptoKey, unsigned long)" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling deriveBits(AlgorithmIdentifier, CryptoKey, unsigned long) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "importKey(KeyFormat, [object Object\],[object Object\], AlgorithmIdentifier, boolean, [object Object\])" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling importKey(KeyFormat, [object Object\],[object Object\], AlgorithmIdentifier, boolean, [object Object\]) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "exportKey(KeyFormat, CryptoKey)" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling exportKey(KeyFormat, CryptoKey) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "wrapKey(KeyFormat, CryptoKey, CryptoKey, AlgorithmIdentifier)" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling wrapKey(KeyFormat, CryptoKey, CryptoKey, AlgorithmIdentifier) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "unwrapKey(KeyFormat, BufferSource, CryptoKey, AlgorithmIdentifier, AlgorithmIdentifier, boolean, [object Object\])" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling unwrapKey(KeyFormat, BufferSource, CryptoKey, AlgorithmIdentifier, AlgorithmIdentifier, boolean, [object Object\]) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [CryptoKey interface: existence and properties of interface prototype object's @@unscopables property] - expected: FAIL - - [SubtleCrypto interface: existence and properties of interface prototype object's @@unscopables property] - expected: FAIL - - [IDL check of WebCrypto] - expected: FAIL - diff --git a/tests/wpt/metadata/WebCryptoAPI/idlharness.https.worker.js.ini b/tests/wpt/metadata/WebCryptoAPI/idlharness.https.worker.js.ini deleted file mode 100644 index 546281f1ad9..00000000000 --- a/tests/wpt/metadata/WebCryptoAPI/idlharness.https.worker.js.ini +++ /dev/null @@ -1,178 +0,0 @@ -[idlharness.https.worker.html] - [ArrayBuffer interface: existence and properties of interface object] - expected: FAIL - - [Crypto interface: attribute subtle] - expected: FAIL - - [Crypto interface: crypto must inherit property "subtle" with the proper type] - expected: FAIL - - [CryptoKey interface: existence and properties of interface object] - expected: FAIL - - [CryptoKey interface object length] - expected: FAIL - - [CryptoKey interface object name] - expected: FAIL - - [CryptoKey interface: existence and properties of interface prototype object] - expected: FAIL - - [CryptoKey interface: existence and properties of interface prototype object's "constructor" property] - expected: FAIL - - [CryptoKey interface: attribute type] - expected: FAIL - - [CryptoKey interface: attribute extractable] - expected: FAIL - - [CryptoKey interface: attribute algorithm] - expected: FAIL - - [CryptoKey interface: attribute usages] - expected: FAIL - - [SubtleCrypto interface: existence and properties of interface object] - expected: FAIL - - [SubtleCrypto interface object length] - expected: FAIL - - [SubtleCrypto interface object name] - expected: FAIL - - [SubtleCrypto interface: existence and properties of interface prototype object] - expected: FAIL - - [SubtleCrypto interface: existence and properties of interface prototype object's "constructor" property] - expected: FAIL - - [SubtleCrypto interface: operation encrypt(AlgorithmIdentifier, CryptoKey, BufferSource)] - expected: FAIL - - [SubtleCrypto interface: operation decrypt(AlgorithmIdentifier, CryptoKey, BufferSource)] - expected: FAIL - - [SubtleCrypto interface: operation sign(AlgorithmIdentifier, CryptoKey, BufferSource)] - expected: FAIL - - [SubtleCrypto interface: operation verify(AlgorithmIdentifier, CryptoKey, BufferSource, BufferSource)] - expected: FAIL - - [SubtleCrypto interface: operation digest(AlgorithmIdentifier, BufferSource)] - expected: FAIL - - [SubtleCrypto interface: operation generateKey(AlgorithmIdentifier, boolean, [object Object\])] - expected: FAIL - - [SubtleCrypto interface: operation deriveKey(AlgorithmIdentifier, CryptoKey, AlgorithmIdentifier, boolean, [object Object\])] - expected: FAIL - - [SubtleCrypto interface: operation deriveBits(AlgorithmIdentifier, CryptoKey, unsigned long)] - expected: FAIL - - [SubtleCrypto interface: operation importKey(KeyFormat, [object Object\],[object Object\], AlgorithmIdentifier, boolean, [object Object\])] - expected: FAIL - - [SubtleCrypto interface: operation exportKey(KeyFormat, CryptoKey)] - expected: FAIL - - [SubtleCrypto interface: operation wrapKey(KeyFormat, CryptoKey, CryptoKey, AlgorithmIdentifier)] - expected: FAIL - - [SubtleCrypto interface: operation unwrapKey(KeyFormat, BufferSource, CryptoKey, AlgorithmIdentifier, AlgorithmIdentifier, boolean, [object Object\])] - expected: FAIL - - [SubtleCrypto must be primary interface of crypto.subtle] - expected: FAIL - - [Stringification of crypto.subtle] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "encrypt(AlgorithmIdentifier, CryptoKey, BufferSource)" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling encrypt(AlgorithmIdentifier, CryptoKey, BufferSource) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "decrypt(AlgorithmIdentifier, CryptoKey, BufferSource)" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling decrypt(AlgorithmIdentifier, CryptoKey, BufferSource) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "sign(AlgorithmIdentifier, CryptoKey, BufferSource)" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling sign(AlgorithmIdentifier, CryptoKey, BufferSource) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "verify(AlgorithmIdentifier, CryptoKey, BufferSource, BufferSource)" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling verify(AlgorithmIdentifier, CryptoKey, BufferSource, BufferSource) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "digest(AlgorithmIdentifier, BufferSource)" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling digest(AlgorithmIdentifier, BufferSource) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "generateKey(AlgorithmIdentifier, boolean, [object Object\])" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling generateKey(AlgorithmIdentifier, boolean, [object Object\]) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "deriveKey(AlgorithmIdentifier, CryptoKey, AlgorithmIdentifier, boolean, [object Object\])" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling deriveKey(AlgorithmIdentifier, CryptoKey, AlgorithmIdentifier, boolean, [object Object\]) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "deriveBits(AlgorithmIdentifier, CryptoKey, unsigned long)" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling deriveBits(AlgorithmIdentifier, CryptoKey, unsigned long) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "importKey(KeyFormat, [object Object\],[object Object\], AlgorithmIdentifier, boolean, [object Object\])" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling importKey(KeyFormat, [object Object\],[object Object\], AlgorithmIdentifier, boolean, [object Object\]) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "exportKey(KeyFormat, CryptoKey)" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling exportKey(KeyFormat, CryptoKey) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "wrapKey(KeyFormat, CryptoKey, CryptoKey, AlgorithmIdentifier)" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling wrapKey(KeyFormat, CryptoKey, CryptoKey, AlgorithmIdentifier) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [SubtleCrypto interface: crypto.subtle must inherit property "unwrapKey(KeyFormat, BufferSource, CryptoKey, AlgorithmIdentifier, AlgorithmIdentifier, boolean, [object Object\])" with the proper type] - expected: FAIL - - [SubtleCrypto interface: calling unwrapKey(KeyFormat, BufferSource, CryptoKey, AlgorithmIdentifier, AlgorithmIdentifier, boolean, [object Object\]) on crypto.subtle with too few arguments must throw TypeError] - expected: FAIL - - [CryptoKey interface: existence and properties of interface prototype object's @@unscopables property] - expected: FAIL - - [SubtleCrypto interface: existence and properties of interface prototype object's @@unscopables property] - expected: FAIL - - [Untitled] - expected: FAIL - - [idlharness] - expected: FAIL - diff --git a/tests/wpt/metadata/css/CSS2/floats/floats-in-table-caption-001.html.ini b/tests/wpt/metadata/css/CSS2/floats/floats-in-table-caption-001.html.ini deleted file mode 100644 index 86715ffc9c2..00000000000 --- a/tests/wpt/metadata/css/CSS2/floats/floats-in-table-caption-001.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[floats-in-table-caption-001.html] - expected: FAIL diff --git a/tests/wpt/metadata/css/CSS2/floats/floats-line-wrap-shifted-001.html.ini b/tests/wpt/metadata/css/CSS2/floats/floats-line-wrap-shifted-001.html.ini new file mode 100644 index 00000000000..9c0516e3f69 --- /dev/null +++ b/tests/wpt/metadata/css/CSS2/floats/floats-line-wrap-shifted-001.html.ini @@ -0,0 +1,2 @@ +[floats-line-wrap-shifted-001.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/CSS2/visudet/line-height-204.html.ini b/tests/wpt/metadata/css/CSS2/visudet/line-height-204.html.ini new file mode 100644 index 00000000000..3d28990c283 --- /dev/null +++ b/tests/wpt/metadata/css/CSS2/visudet/line-height-204.html.ini @@ -0,0 +1,2 @@ +[line-height-204.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/css-images/parsing/image-orientation-valid.html.ini b/tests/wpt/metadata/css/css-images/parsing/image-orientation-valid.html.ini index 2258081bad5..b09df02964e 100644 --- a/tests/wpt/metadata/css/css-images/parsing/image-orientation-valid.html.ini +++ b/tests/wpt/metadata/css/css-images/parsing/image-orientation-valid.html.ini @@ -11,3 +11,6 @@ [e.style['image-orientation'\] = "-1.25turn flip" should set the property value] expected: FAIL + [e.style['image-orientation'\] = "none" should set the property value] + expected: FAIL + diff --git a/tests/wpt/metadata/css/css-text/i18n/css3-text-line-break-opclns-050.html.ini b/tests/wpt/metadata/css/css-text/i18n/css3-text-line-break-opclns-050.html.ini deleted file mode 100644 index 3e0b732a20f..00000000000 --- a/tests/wpt/metadata/css/css-text/i18n/css3-text-line-break-opclns-050.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[css3-text-line-break-opclns-050.html] - expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/i18n/css3-text-line-break-opclns-054.html.ini b/tests/wpt/metadata/css/css-text/i18n/css3-text-line-break-opclns-054.html.ini deleted file mode 100644 index 247462a9f2f..00000000000 --- a/tests/wpt/metadata/css/css-text/i18n/css3-text-line-break-opclns-054.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[css3-text-line-break-opclns-054.html] - expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/i18n/css3-text-line-break-opclns-059.html.ini b/tests/wpt/metadata/css/css-text/i18n/css3-text-line-break-opclns-059.html.ini deleted file mode 100644 index 926f5631fe8..00000000000 --- a/tests/wpt/metadata/css/css-text/i18n/css3-text-line-break-opclns-059.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[css3-text-line-break-opclns-059.html] - expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/i18n/css3-text-line-break-opclns-164.html.ini b/tests/wpt/metadata/css/css-text/i18n/css3-text-line-break-opclns-164.html.ini deleted file mode 100644 index 2853708ba60..00000000000 --- a/tests/wpt/metadata/css/css-text/i18n/css3-text-line-break-opclns-164.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[css3-text-line-break-opclns-164.html] - expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/i18n/css3-text-line-break-opclns-165.html.ini b/tests/wpt/metadata/css/css-text/i18n/css3-text-line-break-opclns-165.html.ini deleted file mode 100644 index 8bcf1b74f6e..00000000000 --- a/tests/wpt/metadata/css/css-text/i18n/css3-text-line-break-opclns-165.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[css3-text-line-break-opclns-165.html] - expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/i18n/zh/css-text-line-break-zh-in-strict.html.ini b/tests/wpt/metadata/css/css-text/i18n/zh/css-text-line-break-zh-in-strict.html.ini index f32b05ecd88..102a231a234 100644 --- a/tests/wpt/metadata/css/css-text/i18n/zh/css-text-line-break-zh-in-strict.html.ini +++ b/tests/wpt/metadata/css/css-text/i18n/zh/css-text-line-break-zh-in-strict.html.ini @@ -11,3 +11,6 @@ [FE19 PRESENTATION FORM FOR VERTICAL HORIZONTAL ELLIPSIS may NOT appear at line start if zh and strict] expected: FAIL + [22EF MIDLINE HORIZONTAL ELLIPSIS may NOT appear at line start if zh and strict] + expected: FAIL + diff --git a/tests/wpt/metadata/css/css-text/overflow-wrap/overflow-wrap-break-word-002.html.ini b/tests/wpt/metadata/css/css-text/overflow-wrap/overflow-wrap-break-word-002.html.ini new file mode 100644 index 00000000000..22790db101e --- /dev/null +++ b/tests/wpt/metadata/css/css-text/overflow-wrap/overflow-wrap-break-word-002.html.ini @@ -0,0 +1,2 @@ +[overflow-wrap-break-word-002.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/overflow-wrap/overflow-wrap-break-word-004.html.ini b/tests/wpt/metadata/css/css-text/overflow-wrap/overflow-wrap-break-word-004.html.ini new file mode 100644 index 00000000000..1df73b03f34 --- /dev/null +++ b/tests/wpt/metadata/css/css-text/overflow-wrap/overflow-wrap-break-word-004.html.ini @@ -0,0 +1,2 @@ +[overflow-wrap-break-word-004.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html.ini b/tests/wpt/metadata/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html.ini new file mode 100644 index 00000000000..3f03badedc1 --- /dev/null +++ b/tests/wpt/metadata/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html.ini @@ -0,0 +1,2 @@ +[overflow-wrap-min-content-size-002.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/white-space/break-spaces-001.html.ini b/tests/wpt/metadata/css/css-text/white-space/break-spaces-001.html.ini new file mode 100644 index 00000000000..7c6bb38b1e9 --- /dev/null +++ b/tests/wpt/metadata/css/css-text/white-space/break-spaces-001.html.ini @@ -0,0 +1,2 @@ +[break-spaces-001.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/white-space/break-spaces-003.html.ini b/tests/wpt/metadata/css/css-text/white-space/break-spaces-003.html.ini new file mode 100644 index 00000000000..a160b7288b1 --- /dev/null +++ b/tests/wpt/metadata/css/css-text/white-space/break-spaces-003.html.ini @@ -0,0 +1,2 @@ +[break-spaces-003.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/white-space/pre-wrap-008.html.ini b/tests/wpt/metadata/css/css-text/white-space/pre-wrap-008.html.ini deleted file mode 100644 index 7347535e71e..00000000000 --- a/tests/wpt/metadata/css/css-text/white-space/pre-wrap-008.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pre-wrap-008.html] - expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/white-space/pre-wrap-009.html.ini b/tests/wpt/metadata/css/css-text/white-space/pre-wrap-009.html.ini deleted file mode 100644 index 6b908f61ec1..00000000000 --- a/tests/wpt/metadata/css/css-text/white-space/pre-wrap-009.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pre-wrap-009.html] - expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/white-space/pre-wrap-010.html.ini b/tests/wpt/metadata/css/css-text/white-space/pre-wrap-010.html.ini deleted file mode 100644 index b79cd9041a0..00000000000 --- a/tests/wpt/metadata/css/css-text/white-space/pre-wrap-010.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pre-wrap-010.html] - expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/white-space/textarea-break-spaces-001.html.ini b/tests/wpt/metadata/css/css-text/white-space/textarea-break-spaces-001.html.ini new file mode 100644 index 00000000000..9b7b6e3c872 --- /dev/null +++ b/tests/wpt/metadata/css/css-text/white-space/textarea-break-spaces-001.html.ini @@ -0,0 +1,2 @@ +[textarea-break-spaces-001.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/white-space/textarea-break-spaces-002.html.ini b/tests/wpt/metadata/css/css-text/white-space/textarea-break-spaces-002.html.ini new file mode 100644 index 00000000000..fe737dcb602 --- /dev/null +++ b/tests/wpt/metadata/css/css-text/white-space/textarea-break-spaces-002.html.ini @@ -0,0 +1,2 @@ +[textarea-break-spaces-002.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/white-space/textarea-break-spaces-003.html.ini b/tests/wpt/metadata/css/css-text/white-space/textarea-break-spaces-003.html.ini new file mode 100644 index 00000000000..09ad78de407 --- /dev/null +++ b/tests/wpt/metadata/css/css-text/white-space/textarea-break-spaces-003.html.ini @@ -0,0 +1,2 @@ +[textarea-break-spaces-003.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/white-space/textarea-pre-wrap-008.html.ini b/tests/wpt/metadata/css/css-text/white-space/textarea-pre-wrap-008.html.ini deleted file mode 100644 index 18b37eae8d7..00000000000 --- a/tests/wpt/metadata/css/css-text/white-space/textarea-pre-wrap-008.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[textarea-pre-wrap-008.html] - expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/white-space/textarea-pre-wrap-009.html.ini b/tests/wpt/metadata/css/css-text/white-space/textarea-pre-wrap-009.html.ini deleted file mode 100644 index 438cdb56042..00000000000 --- a/tests/wpt/metadata/css/css-text/white-space/textarea-pre-wrap-009.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[textarea-pre-wrap-009.html] - expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/white-space/textarea-pre-wrap-010.html.ini b/tests/wpt/metadata/css/css-text/white-space/textarea-pre-wrap-010.html.ini deleted file mode 100644 index ee71a30a88c..00000000000 --- a/tests/wpt/metadata/css/css-text/white-space/textarea-pre-wrap-010.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[textarea-pre-wrap-010.html] - expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/word-break/word-break-break-all-010.html.ini b/tests/wpt/metadata/css/css-text/word-break/word-break-break-all-010.html.ini new file mode 100644 index 00000000000..e6a156581dd --- /dev/null +++ b/tests/wpt/metadata/css/css-text/word-break/word-break-break-all-010.html.ini @@ -0,0 +1,2 @@ +[word-break-break-all-010.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/css-text/word-break/word-break-break-all-011.html.ini b/tests/wpt/metadata/css/css-text/word-break/word-break-break-all-011.html.ini new file mode 100644 index 00000000000..6833da89a76 --- /dev/null +++ b/tests/wpt/metadata/css/css-text/word-break/word-break-break-all-011.html.ini @@ -0,0 +1,2 @@ +[word-break-break-all-011.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/css-transforms/css-transforms-3d-on-anonymous-block-001.html.ini b/tests/wpt/metadata/css/css-transforms/css-transforms-3d-on-anonymous-block-001.html.ini new file mode 100644 index 00000000000..bbb2e5f171e --- /dev/null +++ b/tests/wpt/metadata/css/css-transforms/css-transforms-3d-on-anonymous-block-001.html.ini @@ -0,0 +1,2 @@ +[css-transforms-3d-on-anonymous-block-001.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/css-transitions/pseudo-elements-002.html.ini b/tests/wpt/metadata/css/css-transitions/pseudo-elements-002.html.ini new file mode 100644 index 00000000000..c34f9503bb1 --- /dev/null +++ b/tests/wpt/metadata/css/css-transitions/pseudo-elements-002.html.ini @@ -0,0 +1,4 @@ +[pseudo-elements-002.html] + [Check that transitions run on a pseudo element whose ancestor changes display type.] + expected: FAIL + diff --git a/tests/wpt/metadata/css/css-values/line-break-ch-unit.html.ini b/tests/wpt/metadata/css/css-values/line-break-ch-unit.html.ini new file mode 100644 index 00000000000..8ccaa0efbe5 --- /dev/null +++ b/tests/wpt/metadata/css/css-values/line-break-ch-unit.html.ini @@ -0,0 +1,292 @@ +[line-break-ch-unit.html] + [3ch should fit] + expected: FAIL + + [4ch should fit] + expected: FAIL + + [5ch should fit] + expected: FAIL + + [6ch should fit] + expected: FAIL + + [7ch should fit] + expected: FAIL + + [8ch should fit] + expected: FAIL + + [9ch should fit] + expected: FAIL + + [10ch should fit] + expected: FAIL + + [11ch should fit] + expected: FAIL + + [12ch should fit] + expected: FAIL + + [13ch should fit] + expected: FAIL + + [14ch should fit] + expected: FAIL + + [15ch should fit] + expected: FAIL + + [16ch should fit] + expected: FAIL + + [17ch should fit] + expected: FAIL + + [18ch should fit] + expected: FAIL + + [19ch should fit] + expected: FAIL + + [20ch should fit] + expected: FAIL + + [21ch should fit] + expected: FAIL + + [22ch should fit] + expected: FAIL + + [23ch should fit] + expected: FAIL + + [24ch should fit] + expected: FAIL + + [25ch should fit] + expected: FAIL + + [26ch should fit] + expected: FAIL + + [27ch should fit] + expected: FAIL + + [28ch should fit] + expected: FAIL + + [29ch should fit] + expected: FAIL + + [30ch should fit] + expected: FAIL + + [31ch should fit] + expected: FAIL + + [32ch should fit] + expected: FAIL + + [33ch should fit] + expected: FAIL + + [34ch should fit] + expected: FAIL + + [35ch should fit] + expected: FAIL + + [36ch should fit] + expected: FAIL + + [37ch should fit] + expected: FAIL + + [38ch should fit] + expected: FAIL + + [39ch should fit] + expected: FAIL + + [40ch should fit] + expected: FAIL + + [41ch should fit] + expected: FAIL + + [42ch should fit] + expected: FAIL + + [43ch should fit] + expected: FAIL + + [44ch should fit] + expected: FAIL + + [45ch should fit] + expected: FAIL + + [46ch should fit] + expected: FAIL + + [47ch should fit] + expected: FAIL + + [48ch should fit] + expected: FAIL + + [49ch should fit] + expected: FAIL + + [50ch should fit] + expected: FAIL + + [51ch should fit] + expected: FAIL + + [52ch should fit] + expected: FAIL + + [53ch should fit] + expected: FAIL + + [54ch should fit] + expected: FAIL + + [55ch should fit] + expected: FAIL + + [56ch should fit] + expected: FAIL + + [57ch should fit] + expected: FAIL + + [58ch should fit] + expected: FAIL + + [59ch should fit] + expected: FAIL + + [60ch should fit] + expected: FAIL + + [61ch should fit] + expected: FAIL + + [62ch should fit] + expected: FAIL + + [63ch should fit] + expected: FAIL + + [64ch should fit] + expected: FAIL + + [65ch should fit] + expected: FAIL + + [66ch should fit] + expected: FAIL + + [67ch should fit] + expected: FAIL + + [68ch should fit] + expected: FAIL + + [69ch should fit] + expected: FAIL + + [70ch should fit] + expected: FAIL + + [71ch should fit] + expected: FAIL + + [72ch should fit] + expected: FAIL + + [73ch should fit] + expected: FAIL + + [74ch should fit] + expected: FAIL + + [75ch should fit] + expected: FAIL + + [76ch should fit] + expected: FAIL + + [77ch should fit] + expected: FAIL + + [78ch should fit] + expected: FAIL + + [79ch should fit] + expected: FAIL + + [80ch should fit] + expected: FAIL + + [81ch should fit] + expected: FAIL + + [82ch should fit] + expected: FAIL + + [83ch should fit] + expected: FAIL + + [84ch should fit] + expected: FAIL + + [85ch should fit] + expected: FAIL + + [86ch should fit] + expected: FAIL + + [87ch should fit] + expected: FAIL + + [88ch should fit] + expected: FAIL + + [89ch should fit] + expected: FAIL + + [90ch should fit] + expected: FAIL + + [91ch should fit] + expected: FAIL + + [92ch should fit] + expected: FAIL + + [93ch should fit] + expected: FAIL + + [94ch should fit] + expected: FAIL + + [95ch should fit] + expected: FAIL + + [96ch should fit] + expected: FAIL + + [97ch should fit] + expected: FAIL + + [98ch should fit] + expected: FAIL + + [99ch should fit] + expected: FAIL + diff --git a/tests/wpt/metadata/css/css-values/vh_not_refreshing_on_chrome.html.ini b/tests/wpt/metadata/css/css-values/vh_not_refreshing_on_chrome.html.ini new file mode 100644 index 00000000000..26435e28b09 --- /dev/null +++ b/tests/wpt/metadata/css/css-values/vh_not_refreshing_on_chrome.html.ini @@ -0,0 +1,2 @@ +[vh_not_refreshing_on_chrome.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/cssom-view/table-client-props.html.ini b/tests/wpt/metadata/css/cssom-view/table-client-props.html.ini new file mode 100644 index 00000000000..8953b6b01c0 --- /dev/null +++ b/tests/wpt/metadata/css/cssom-view/table-client-props.html.ini @@ -0,0 +1,28 @@ +[table-client-props.html] + [Basic caption] + expected: FAIL + + [Table and narrower caption] + expected: FAIL + + [Table and wider caption] + expected: FAIL + + [Table with separated border] + expected: FAIL + + [Table with collapsed border] + expected: FAIL + + [Caption with padding] + expected: FAIL + + [Caption with border] + expected: FAIL + + [Caption with margin] + expected: FAIL + + [Bottom caption] + expected: FAIL + diff --git a/tests/wpt/metadata/css/cssom-view/table-offset-props.html.ini b/tests/wpt/metadata/css/cssom-view/table-offset-props.html.ini new file mode 100644 index 00000000000..a0ff9066c66 --- /dev/null +++ b/tests/wpt/metadata/css/cssom-view/table-offset-props.html.ini @@ -0,0 +1,25 @@ +[table-offset-props.html] + [Basic caption] + expected: FAIL + + [Table and narrower caption] + expected: FAIL + + [Table and wider caption] + expected: FAIL + + [Table with collapsed border] + expected: FAIL + + [Caption with padding] + expected: FAIL + + [Caption with border] + expected: FAIL + + [Caption with margin] + expected: FAIL + + [Bottom caption] + expected: FAIL + diff --git a/tests/wpt/metadata/css/cssom-view/table-scroll-props.html.ini b/tests/wpt/metadata/css/cssom-view/table-scroll-props.html.ini new file mode 100644 index 00000000000..ff0d38272bd --- /dev/null +++ b/tests/wpt/metadata/css/cssom-view/table-scroll-props.html.ini @@ -0,0 +1,13 @@ +[table-scroll-props.html] + [Table and narrower caption] + expected: FAIL + + [Table and wider caption] + expected: FAIL + + [Table with separated border] + expected: FAIL + + [Table with collapsed border] + expected: FAIL + diff --git a/tests/wpt/metadata/css/selectors/focus-visible-008.html.ini b/tests/wpt/metadata/css/selectors/focus-visible-008.html.ini new file mode 100644 index 00000000000..745d5f69d23 --- /dev/null +++ b/tests/wpt/metadata/css/selectors/focus-visible-008.html.ini @@ -0,0 +1,4 @@ +[focus-visible-008.html] + [CSS Test (Selectors): Keyboard focus enables :focus-visible] + expected: FAIL + diff --git a/tests/wpt/metadata/css/selectors/focus-visible-009.html.ini b/tests/wpt/metadata/css/selectors/focus-visible-009.html.ini new file mode 100644 index 00000000000..58182fe4092 --- /dev/null +++ b/tests/wpt/metadata/css/selectors/focus-visible-009.html.ini @@ -0,0 +1,4 @@ +[focus-visible-009.html] + [Autofocus should match :focus-visible] + expected: FAIL + diff --git a/tests/wpt/metadata/css/selectors/focus-visible-010.html.ini b/tests/wpt/metadata/css/selectors/focus-visible-010.html.ini new file mode 100644 index 00000000000..42235598dd9 --- /dev/null +++ b/tests/wpt/metadata/css/selectors/focus-visible-010.html.ini @@ -0,0 +1,4 @@ +[focus-visible-010.html] + [Programmatic focus on page load bshould match :focus-visible] + expected: FAIL + diff --git a/tests/wpt/metadata/encoding/single-byte-decoder.html.ini b/tests/wpt/metadata/encoding/single-byte-decoder.html.ini index e72e5bd6ddf..a35cb7690ff 100644 --- a/tests/wpt/metadata/encoding/single-byte-decoder.html.ini +++ b/tests/wpt/metadata/encoding/single-byte-decoder.html.ini @@ -3,9 +3,35 @@ disabled: iframe thread issue 5247 [single-byte-decoder.html?document] - expected: CRASH + expected: TIMEOUT [single-byte-decoder.html?XMLHttpRequest] - expected: CRASH + [ISO-8859-2: iso_8859-2:1987 (XMLHttpRequest)] + expected: FAIL + + [ISO-8859-3: iso_8859-3:1988 (XMLHttpRequest)] + expected: FAIL + + [ISO-8859-4: iso_8859-4:1988 (XMLHttpRequest)] + expected: FAIL + + [ISO-8859-5: iso_8859-5:1988 (XMLHttpRequest)] + expected: FAIL + + [ISO-8859-6: iso_8859-6:1987 (XMLHttpRequest)] + expected: FAIL + + [ISO-8859-7: iso_8859-7:1987 (XMLHttpRequest)] + expected: FAIL + + [ISO-8859-8: iso_8859-8:1988 (XMLHttpRequest)] + expected: FAIL + + [windows-1252: iso_8859-1:1987 (XMLHttpRequest)] + expected: FAIL + + [windows-1254: iso_8859-9:1989 (XMLHttpRequest)] + expected: FAIL + [single-byte-decoder.html?TextDecoder] diff --git a/tests/wpt/metadata/encoding/unsupported-encodings.any.js.ini b/tests/wpt/metadata/encoding/unsupported-encodings.any.js.ini new file mode 100644 index 00000000000..9d2ceb5e183 --- /dev/null +++ b/tests/wpt/metadata/encoding/unsupported-encodings.any.js.ini @@ -0,0 +1,15 @@ +[unsupported-encodings.any.worker.html] + [UTF-32be with BOM should decode as windows-1252] + expected: FAIL + + [utf-32be with BOM should decode as windows-1252] + expected: FAIL + + +[unsupported-encodings.any.html] + [UTF-32be with BOM should decode as windows-1252] + expected: FAIL + + [utf-32be with BOM should decode as windows-1252] + expected: FAIL + diff --git a/tests/wpt/metadata/encoding/unsupported-encodings.html.ini b/tests/wpt/metadata/encoding/unsupported-encodings.html.ini deleted file mode 100644 index 9e67254c864..00000000000 --- a/tests/wpt/metadata/encoding/unsupported-encodings.html.ini +++ /dev/null @@ -1,8 +0,0 @@ -[unsupported-encodings.html] - type: testharness - [UTF-32be with BOM should decode as windows-1252] - expected: FAIL - - [utf-32be with BOM should decode as windows-1252] - expected: FAIL - diff --git a/tests/wpt/metadata/fetch/api/abort/destroyed-context.html.ini b/tests/wpt/metadata/fetch/api/abort/destroyed-context.html.ini new file mode 100644 index 00000000000..34220250b69 --- /dev/null +++ b/tests/wpt/metadata/fetch/api/abort/destroyed-context.html.ini @@ -0,0 +1,4 @@ +[destroyed-context.html] + [destroyed-context] + expected: FAIL + diff --git a/tests/wpt/metadata/fetch/api/abort/keepalive.html.ini b/tests/wpt/metadata/fetch/api/abort/keepalive.html.ini new file mode 100644 index 00000000000..6c374cbc54f --- /dev/null +++ b/tests/wpt/metadata/fetch/api/abort/keepalive.html.ini @@ -0,0 +1,4 @@ +[keepalive.html] + [keepalive] + expected: FAIL + diff --git a/tests/wpt/metadata/fetch/cors-rfc1918/idlharness.tentative.any.js.ini b/tests/wpt/metadata/fetch/cors-rfc1918/idlharness.tentative.any.js.ini index 8d1dc992f8f..8343f9650f1 100644 --- a/tests/wpt/metadata/fetch/cors-rfc1918/idlharness.tentative.any.js.ini +++ b/tests/wpt/metadata/fetch/cors-rfc1918/idlharness.tentative.any.js.ini @@ -7,3 +7,13 @@ [idlharness] expected: FAIL + +[idlharness.tentative.https.any.serviceworker.html] + [idlharness] + expected: FAIL + + +[idlharness.tentative.any.sharedworker.html] + [idlharness] + expected: FAIL + diff --git a/tests/wpt/metadata/fetch/http-cache/cc-request.html.ini b/tests/wpt/metadata/fetch/http-cache/cc-request.html.ini index cc3c925009b..40b13312a9e 100644 --- a/tests/wpt/metadata/fetch/http-cache/cc-request.html.ini +++ b/tests/wpt/metadata/fetch/http-cache/cc-request.html.ini @@ -3,3 +3,6 @@ [HTTP cache generates 504 status code when nothing is in cache and request contains Cache-Control: only-if-cached.] expected: FAIL + [HTTP cache generates 504 status code when nothing is in cache and request contains Cache-Control: only-if-cached] + expected: FAIL + diff --git a/tests/wpt/metadata/fetch/http-cache/partial.html.ini b/tests/wpt/metadata/fetch/http-cache/partial.html.ini index d3f8a45038e..faedea90fb9 100644 --- a/tests/wpt/metadata/fetch/http-cache/partial.html.ini +++ b/tests/wpt/metadata/fetch/http-cache/partial.html.ini @@ -3,3 +3,6 @@ [HTTP cache stores partial content and completes it.] expected: FAIL + [HTTP cache stores partial content and completes it] + expected: FAIL + diff --git a/tests/wpt/metadata/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward.html.ini b/tests/wpt/metadata/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward.html.ini new file mode 100644 index 00000000000..c9bc68e2044 --- /dev/null +++ b/tests/wpt/metadata/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward.html.ini @@ -0,0 +1,2 @@ +[pagehide-on-history-forward.html] + expected: OK diff --git a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/015.html.ini b/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/015.html.ini deleted file mode 100644 index 31caad97d35..00000000000 --- a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/015.html.ini +++ /dev/null @@ -1,6 +0,0 @@ -[015.html] - type: testharness - [global scope unchanged] - expected: FAIL - bug: https://github.com/whatwg/html/issues/1698 - diff --git a/tests/wpt/metadata/html/dom/elements/the-innertext-idl-attribute/getter.html.ini b/tests/wpt/metadata/html/dom/elements/the-innertext-idl-attribute/getter.html.ini index 2229107b39b..34ffc9df661 100644 --- a/tests/wpt/metadata/html/dom/elements/the-innertext-idl-attribute/getter.html.ini +++ b/tests/wpt/metadata/html/dom/elements/the-innertext-idl-attribute/getter.html.ini @@ -239,3 +239,6 @@ [ ("
abc(def)")] expected: FAIL + [Whitespace text node preserved ("
abc def")] + expected: FAIL + diff --git a/tests/wpt/metadata/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-1.html.ini b/tests/wpt/metadata/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-1.html.ini new file mode 100644 index 00000000000..bbd7cbdce76 --- /dev/null +++ b/tests/wpt/metadata/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-1.html.ini @@ -0,0 +1,2 @@ +[input-align-right-1.html] + expected: FAIL diff --git a/tests/wpt/metadata/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-2.html.ini b/tests/wpt/metadata/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-2.html.ini new file mode 100644 index 00000000000..655607918b9 --- /dev/null +++ b/tests/wpt/metadata/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-2.html.ini @@ -0,0 +1,2 @@ +[input-align-right-2.html] + expected: FAIL diff --git a/tests/wpt/metadata/html/semantics/embedded-content/image-maps/image-map-processing-model/hash-name-reference.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/image-maps/image-map-processing-model/hash-name-reference.html.ini index d0913a41225..555c68213f2 100644 --- a/tests/wpt/metadata/html/semantics/embedded-content/image-maps/image-map-processing-model/hash-name-reference.html.ini +++ b/tests/wpt/metadata/html/semantics/embedded-content/image-maps/image-map-processing-model/hash-name-reference.html.ini @@ -172,36 +172,6 @@ [XHTML img usemap="http://example.org/#garbage-before-hash-id"] expected: FAIL - [XHTML img usemap="no-hash-name"] - expected: FAIL - - [XHTML img usemap="no-hash-id"] - expected: FAIL - - [XHTML img usemap="hash-last#"] - expected: FAIL - - [XHTML img usemap=""] - expected: FAIL - - [XHTML img usemap="#"] - expected: FAIL - - [XHTML img usemap="#percent-escape-name-%41"] - expected: FAIL - - [XHTML img usemap="#percent-escape-id-%41"] - expected: FAIL - - [XHTML img usemap="#no-such-map"] - expected: FAIL - - [XHTML img usemap="#different-CASE-name"] - expected: FAIL - - [XHTML img usemap="#different-CASE-id"] - expected: FAIL - [HTML (standards) IMG usemap="no-hash-name"] expected: FAIL diff --git a/tests/wpt/metadata/html/semantics/embedded-content/the-object-element/object-setcustomvalidity.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/the-object-element/object-setcustomvalidity.html.ini new file mode 100644 index 00000000000..2a869ce5596 --- /dev/null +++ b/tests/wpt/metadata/html/semantics/embedded-content/the-object-element/object-setcustomvalidity.html.ini @@ -0,0 +1,4 @@ +[object-setcustomvalidity.html] + [object setCustomValidity is correct] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/forms/the-button-element/button-setcustomvalidity.html.ini b/tests/wpt/metadata/html/semantics/forms/the-button-element/button-setcustomvalidity.html.ini index 4752ab781b4..ae7cc5ed3ba 100644 --- a/tests/wpt/metadata/html/semantics/forms/the-button-element/button-setcustomvalidity.html.ini +++ b/tests/wpt/metadata/html/semantics/forms/the-button-element/button-setcustomvalidity.html.ini @@ -3,3 +3,6 @@ [Forms] expected: FAIL + [button setCustomValidity is correct] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/forms/the-fieldset-element/fieldset-setcustomvalidity.html.ini b/tests/wpt/metadata/html/semantics/forms/the-fieldset-element/fieldset-setcustomvalidity.html.ini index 7e82d38494b..f857f5fc4b9 100644 --- a/tests/wpt/metadata/html/semantics/forms/the-fieldset-element/fieldset-setcustomvalidity.html.ini +++ b/tests/wpt/metadata/html/semantics/forms/the-fieldset-element/fieldset-setcustomvalidity.html.ini @@ -3,3 +3,6 @@ [Forms] expected: FAIL + [fieldset setCustomValidity is correct] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/forms/the-input-element/input-setcustomvalidity.html.ini b/tests/wpt/metadata/html/semantics/forms/the-input-element/input-setcustomvalidity.html.ini index 2d9b5ec59b0..419dc3f10aa 100644 --- a/tests/wpt/metadata/html/semantics/forms/the-input-element/input-setcustomvalidity.html.ini +++ b/tests/wpt/metadata/html/semantics/forms/the-input-element/input-setcustomvalidity.html.ini @@ -3,3 +3,6 @@ [Forms] expected: FAIL + [input setCustomValidity is correct] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/forms/the-output-element/output-setcustomvalidity.html.ini b/tests/wpt/metadata/html/semantics/forms/the-output-element/output-setcustomvalidity.html.ini new file mode 100644 index 00000000000..ba7705f56f5 --- /dev/null +++ b/tests/wpt/metadata/html/semantics/forms/the-output-element/output-setcustomvalidity.html.ini @@ -0,0 +1,4 @@ +[output-setcustomvalidity.html] + [output setCustomValidity is correct] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/forms/the-select-element/select-setcustomvalidity.html.ini b/tests/wpt/metadata/html/semantics/forms/the-select-element/select-setcustomvalidity.html.ini new file mode 100644 index 00000000000..ccd0056a3ac --- /dev/null +++ b/tests/wpt/metadata/html/semantics/forms/the-select-element/select-setcustomvalidity.html.ini @@ -0,0 +1,4 @@ +[select-setcustomvalidity.html] + [select setCustomValidity is correct] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/forms/the-textarea-element/textarea-setcustomvalidity.html.ini b/tests/wpt/metadata/html/semantics/forms/the-textarea-element/textarea-setcustomvalidity.html.ini new file mode 100644 index 00000000000..9eb53a4dcd3 --- /dev/null +++ b/tests/wpt/metadata/html/semantics/forms/the-textarea-element/textarea-setcustomvalidity.html.ini @@ -0,0 +1,4 @@ +[textarea-setcustomvalidity.html] + [textarea setCustomValidity is correct] + expected: FAIL + diff --git a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/001.html.ini b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/001.html.ini similarity index 53% rename from tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/001.html.ini rename to tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/001.html.ini index ed58748d169..d93744b8906 100644 --- a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/001.html.ini +++ b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/001.html.ini @@ -1,6 +1,4 @@ [001.html] - type: testharness [Replacement of window object after document.open] expected: FAIL - bug: https://github.com/whatwg/html/issues/1698 diff --git a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/005.html.ini b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/005.html.ini similarity index 78% rename from tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/005.html.ini rename to tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/005.html.ini index 3a1820ca90d..b3bda5a2c8f 100644 --- a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/005.html.ini +++ b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/005.html.ini @@ -1,5 +1,4 @@ [005.html] - type: testharness [Cancelling timeout after document.open] expected: FAIL diff --git a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/008.html.ini b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/008.html.ini similarity index 57% rename from tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/008.html.ini rename to tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/008.html.ini index 6afc3d97df7..6729cd9091b 100644 --- a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/008.html.ini +++ b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/008.html.ini @@ -1,6 +1,4 @@ [008.html] - type: testharness [Replacement of document prototype object after document.open] expected: FAIL - bug: https://github.com/whatwg/html/issues/1698 diff --git a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/009.https.html.ini b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/009.https.html.ini similarity index 100% rename from tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/009.https.html.ini rename to tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/009.https.html.ini diff --git a/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010.html.ini b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010.html.ini new file mode 100644 index 00000000000..33164945eb6 --- /dev/null +++ b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010.html.ini @@ -0,0 +1,4 @@ +[010.html] + [Salvagability of document.opened document] + expected: FAIL + diff --git a/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/015.html.ini b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/015.html.ini new file mode 100644 index 00000000000..1036a206e92 --- /dev/null +++ b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/015.html.ini @@ -0,0 +1,4 @@ +[015.html] + [global scope unchanged] + expected: FAIL + diff --git a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/016.html.ini b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/016.html.ini similarity index 63% rename from tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/016.html.ini rename to tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/016.html.ini index 8aa68bbbc4b..595f1f9d61b 100644 --- a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/016.html.ini +++ b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/016.html.ini @@ -1,6 +1,4 @@ [016.html] - type: testharness - bug: https://github.com/whatwg/html/issues/1698 [Timeout on original window, scope] expected: FAIL diff --git a/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js.ini b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js.ini new file mode 100644 index 00000000000..61cd7b4d408 --- /dev/null +++ b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js.ini @@ -0,0 +1,8 @@ +[aborted-parser.window.html] + expected: TIMEOUT + [document.open() after parser is aborted] + expected: TIMEOUT + + [async document.open() after parser is aborted] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html.ini b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html.ini similarity index 92% rename from tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html.ini rename to tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html.ini index 6adbfd3df02..ef3a57968a1 100644 --- a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html.ini +++ b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html.ini @@ -1,5 +1,4 @@ [document.open-02.html] - type: testharness [document.open should redirect to window.open when called with three arguments] expected: FAIL diff --git a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html.ini b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html.ini similarity index 55% rename from tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html.ini rename to tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html.ini index b9aa7e44b05..bde885f21c7 100644 --- a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html.ini +++ b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html.ini @@ -1,6 +1,4 @@ [document.open-03.html] - type: testharness [document.open and singleton replacement] expected: FAIL - bug: https://github.com/whatwg/html/issues/1698 diff --git a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/encoding.window.js.ini b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/encoding.window.js.ini similarity index 100% rename from tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/encoding.window.js.ini rename to tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/encoding.window.js.ini diff --git a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.js.ini b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.js.ini similarity index 100% rename from tests/wpt/metadata/html/dom/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.js.ini rename to tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.js.ini diff --git a/tests/wpt/metadata/navigation-timing/idlharness.html.ini b/tests/wpt/metadata/navigation-timing/idlharness.html.ini deleted file mode 100644 index 75ac6a64bbb..00000000000 --- a/tests/wpt/metadata/navigation-timing/idlharness.html.ini +++ /dev/null @@ -1,356 +0,0 @@ -[idlharness.html] - type: testharness - [PerformanceTiming interface: attribute unloadEventStart] - expected: FAIL - - [PerformanceTiming interface: attribute unloadEventEnd] - expected: FAIL - - [PerformanceTiming interface: attribute redirectStart] - expected: FAIL - - [PerformanceTiming interface: attribute redirectEnd] - expected: FAIL - - [PerformanceTiming interface: attribute fetchStart] - expected: FAIL - - [PerformanceTiming interface: attribute domainLookupStart] - expected: FAIL - - [PerformanceTiming interface: attribute domainLookupEnd] - expected: FAIL - - [PerformanceTiming interface: attribute connectStart] - expected: FAIL - - [PerformanceTiming interface: attribute connectEnd] - expected: FAIL - - [PerformanceTiming interface: attribute secureConnectionStart] - expected: FAIL - - [PerformanceTiming interface: attribute requestStart] - expected: FAIL - - [PerformanceTiming interface: attribute responseStart] - expected: FAIL - - [PerformanceTiming interface: attribute responseEnd] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "unloadEventStart" with the proper type (1)] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "unloadEventEnd" with the proper type (2)] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "redirectStart" with the proper type (3)] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "redirectEnd" with the proper type (4)] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "fetchStart" with the proper type (5)] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "domainLookupStart" with the proper type (6)] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "domainLookupEnd" with the proper type (7)] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "connectStart" with the proper type (8)] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "connectEnd" with the proper type (9)] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "secureConnectionStart" with the proper type (10)] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "requestStart" with the proper type (11)] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "responseStart" with the proper type (12)] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "responseEnd" with the proper type (13)] - expected: FAIL - - [PerformanceNavigation interface: existence and properties of interface object] - expected: FAIL - - [PerformanceNavigation interface object length] - expected: FAIL - - [PerformanceNavigation interface object name] - expected: FAIL - - [PerformanceNavigation interface: existence and properties of interface prototype object] - expected: FAIL - - [PerformanceNavigation interface: existence and properties of interface prototype object's "constructor" property] - expected: FAIL - - [PerformanceNavigation interface: constant TYPE_NAVIGATE on interface object] - expected: FAIL - - [PerformanceNavigation interface: constant TYPE_NAVIGATE on interface prototype object] - expected: FAIL - - [PerformanceNavigation interface: constant TYPE_RELOAD on interface object] - expected: FAIL - - [PerformanceNavigation interface: constant TYPE_RELOAD on interface prototype object] - expected: FAIL - - [PerformanceNavigation interface: constant TYPE_BACK_FORWARD on interface object] - expected: FAIL - - [PerformanceNavigation interface: constant TYPE_BACK_FORWARD on interface prototype object] - expected: FAIL - - [PerformanceNavigation interface: constant TYPE_RESERVED on interface object] - expected: FAIL - - [PerformanceNavigation interface: constant TYPE_RESERVED on interface prototype object] - expected: FAIL - - [PerformanceNavigation interface: attribute type] - expected: FAIL - - [PerformanceNavigation interface: attribute redirectCount] - expected: FAIL - - [PerformanceNavigation must be primary interface of window.performance.navigation] - expected: FAIL - - [Stringification of window.performance.navigation] - expected: FAIL - - [PerformanceNavigation interface: window.performance.navigation must inherit property "TYPE_NAVIGATE" with the proper type (0)] - expected: FAIL - - [PerformanceNavigation interface: window.performance.navigation must inherit property "TYPE_RELOAD" with the proper type (1)] - expected: FAIL - - [PerformanceNavigation interface: window.performance.navigation must inherit property "TYPE_BACK_FORWARD" with the proper type (2)] - expected: FAIL - - [PerformanceNavigation interface: window.performance.navigation must inherit property "TYPE_RESERVED" with the proper type (3)] - expected: FAIL - - [PerformanceNavigation interface: window.performance.navigation must inherit property "type" with the proper type (4)] - expected: FAIL - - [PerformanceNavigation interface: window.performance.navigation must inherit property "redirectCount" with the proper type (5)] - expected: FAIL - - [Performance interface: existence and properties of interface object] - expected: FAIL - - [Performance interface: existence and properties of interface prototype object] - expected: FAIL - - [Performance interface: attribute navigation] - expected: FAIL - - [Performance interface: window.performance must inherit property "navigation" with the proper type (1)] - expected: FAIL - - [EventTarget interface: window.performance must inherit property "addEventListener" with the proper type (0)] - expected: FAIL - - [EventTarget interface: calling addEventListener(DOMString,EventListener,boolean) on window.performance with too few arguments must throw TypeError] - expected: FAIL - - [EventTarget interface: window.performance must inherit property "removeEventListener" with the proper type (1)] - expected: FAIL - - [EventTarget interface: calling removeEventListener(DOMString,EventListener,boolean) on window.performance with too few arguments must throw TypeError] - expected: FAIL - - [EventTarget interface: window.performance must inherit property "dispatchEvent" with the proper type (2)] - expected: FAIL - - [EventTarget interface: calling dispatchEvent(Event) on window.performance with too few arguments must throw TypeError] - expected: FAIL - - [PerformanceNavigationTiming interface: existence and properties of interface object] - expected: FAIL - - [PerformanceNavigationTiming interface object length] - expected: FAIL - - [PerformanceNavigationTiming interface object name] - expected: FAIL - - [PerformanceNavigationTiming interface: existence and properties of interface prototype object] - expected: FAIL - - [PerformanceNavigationTiming interface: existence and properties of interface prototype object's "constructor" property] - expected: FAIL - - [PerformanceNavigationTiming interface: attribute unloadEventStart] - expected: FAIL - - [PerformanceNavigationTiming interface: attribute unloadEventEnd] - expected: FAIL - - [PerformanceNavigationTiming interface: attribute domInteractive] - expected: FAIL - - [PerformanceNavigationTiming interface: attribute domContentLoadedEventStart] - expected: FAIL - - [PerformanceNavigationTiming interface: attribute domContentLoadedEventEnd] - expected: FAIL - - [PerformanceNavigationTiming interface: attribute domComplete] - expected: FAIL - - [PerformanceNavigationTiming interface: attribute loadEventStart] - expected: FAIL - - [PerformanceNavigationTiming interface: attribute loadEventEnd] - expected: FAIL - - [PerformanceNavigationTiming interface: attribute type] - expected: FAIL - - [PerformanceNavigationTiming interface: attribute redirectCount] - expected: FAIL - - [PerformanceNavigationTiming interface: operation toJSON()] - expected: FAIL - - [PerformanceNavigationTiming must be primary interface of window.performance.getEntriesByType('navigation')[0\]] - expected: FAIL - - [Stringification of window.performance.getEntriesByType('navigation')[0\]] - expected: FAIL - - [PerformanceNavigationTiming interface: window.performance.getEntriesByType('navigation')[0\] must inherit property "unloadEventStart" with the proper type] - expected: FAIL - - [PerformanceNavigationTiming interface: window.performance.getEntriesByType('navigation')[0\] must inherit property "unloadEventEnd" with the proper type] - expected: FAIL - - [PerformanceNavigationTiming interface: window.performance.getEntriesByType('navigation')[0\] must inherit property "domInteractive" with the proper type] - expected: FAIL - - [PerformanceNavigationTiming interface: window.performance.getEntriesByType('navigation')[0\] must inherit property "domContentLoadedEventStart" with the proper type] - expected: FAIL - - [PerformanceNavigationTiming interface: window.performance.getEntriesByType('navigation')[0\] must inherit property "domContentLoadedEventEnd" with the proper type] - expected: FAIL - - [PerformanceNavigationTiming interface: window.performance.getEntriesByType('navigation')[0\] must inherit property "domComplete" with the proper type] - expected: FAIL - - [PerformanceNavigationTiming interface: window.performance.getEntriesByType('navigation')[0\] must inherit property "loadEventStart" with the proper type] - expected: FAIL - - [PerformanceNavigationTiming interface: window.performance.getEntriesByType('navigation')[0\] must inherit property "loadEventEnd" with the proper type] - expected: FAIL - - [PerformanceNavigationTiming interface: window.performance.getEntriesByType('navigation')[0\] must inherit property "type" with the proper type] - expected: FAIL - - [PerformanceNavigationTiming interface: window.performance.getEntriesByType('navigation')[0\] must inherit property "redirectCount" with the proper type] - expected: FAIL - - [PerformanceNavigationTiming interface: window.performance.getEntriesByType('navigation')[0\] must inherit property "toJSON()" with the proper type] - expected: FAIL - - [Test default toJSON operation of PerformanceNavigationTiming] - expected: FAIL - - [PerformanceTiming interface: operation toJSON()] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "unloadEventStart" with the proper type] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "unloadEventEnd" with the proper type] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "redirectStart" with the proper type] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "redirectEnd" with the proper type] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "fetchStart" with the proper type] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "domainLookupStart" with the proper type] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "domainLookupEnd" with the proper type] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "connectStart" with the proper type] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "connectEnd" with the proper type] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "secureConnectionStart" with the proper type] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "requestStart" with the proper type] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "responseStart" with the proper type] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "responseEnd" with the proper type] - expected: FAIL - - [PerformanceTiming interface: window.performance.timing must inherit property "toJSON()" with the proper type] - expected: FAIL - - [Test default toJSON operation of PerformanceTiming] - expected: FAIL - - [PerformanceNavigation interface: operation toJSON()] - expected: FAIL - - [PerformanceNavigation interface: window.performance.navigation must inherit property "TYPE_NAVIGATE" with the proper type] - expected: FAIL - - [PerformanceNavigation interface: window.performance.navigation must inherit property "TYPE_RELOAD" with the proper type] - expected: FAIL - - [PerformanceNavigation interface: window.performance.navigation must inherit property "TYPE_BACK_FORWARD" with the proper type] - expected: FAIL - - [PerformanceNavigation interface: window.performance.navigation must inherit property "TYPE_RESERVED" with the proper type] - expected: FAIL - - [PerformanceNavigation interface: window.performance.navigation must inherit property "type" with the proper type] - expected: FAIL - - [PerformanceNavigation interface: window.performance.navigation must inherit property "redirectCount" with the proper type] - expected: FAIL - - [PerformanceNavigation interface: window.performance.navigation must inherit property "toJSON()" with the proper type] - expected: FAIL - - [Test default toJSON operation of PerformanceNavigation] - expected: FAIL - - [Performance interface: window.performance must inherit property "navigation" with the proper type] - expected: FAIL - - [PerformanceNavigationTiming interface: existence and properties of interface prototype object's @@unscopables property] - expected: FAIL - - [PerformanceNavigation interface: existence and properties of interface prototype object's @@unscopables property] - expected: FAIL - - [Navigation Timing IDL tests] - expected: FAIL - diff --git a/tests/wpt/metadata/navigation-timing/idlharness.window.js.ini b/tests/wpt/metadata/navigation-timing/idlharness.window.js.ini new file mode 100644 index 00000000000..e663f693ac3 --- /dev/null +++ b/tests/wpt/metadata/navigation-timing/idlharness.window.js.ini @@ -0,0 +1,4 @@ +[idlharness.window.html] + [idlharness] + expected: FAIL + diff --git a/tests/wpt/metadata/workers/baseurl/alpha/import-in-moduleworker.html.ini b/tests/wpt/metadata/workers/baseurl/alpha/import-in-moduleworker.html.ini new file mode 100644 index 00000000000..bf2a1d61bab --- /dev/null +++ b/tests/wpt/metadata/workers/baseurl/alpha/import-in-moduleworker.html.ini @@ -0,0 +1,4 @@ +[import-in-moduleworker.html] + [Base URL in module dedicated workers: import] + expected: FAIL + diff --git a/tests/wpt/metadata/workers/baseurl/alpha/importScripts-in-sharedworker.html.ini b/tests/wpt/metadata/workers/baseurl/alpha/importScripts-in-sharedworker.html.ini new file mode 100644 index 00000000000..59ab9326269 --- /dev/null +++ b/tests/wpt/metadata/workers/baseurl/alpha/importScripts-in-sharedworker.html.ini @@ -0,0 +1,4 @@ +[importScripts-in-sharedworker.html] + [Base URL in classic shared workers: importScripts] + expected: FAIL + diff --git a/tests/wpt/metadata/workers/baseurl/alpha/sharedworker-in-worker.html.ini b/tests/wpt/metadata/workers/baseurl/alpha/sharedworker-in-worker.html.ini new file mode 100644 index 00000000000..333edb3a26e --- /dev/null +++ b/tests/wpt/metadata/workers/baseurl/alpha/sharedworker-in-worker.html.ini @@ -0,0 +1,4 @@ +[sharedworker-in-worker.html] + [Base URL in workers: new SharedWorker()] + expected: FAIL + diff --git a/tests/wpt/metadata/workers/baseurl/alpha/sharedworker.html.ini b/tests/wpt/metadata/workers/baseurl/alpha/sharedworker.html.ini deleted file mode 100644 index ecb1c2c4210..00000000000 --- a/tests/wpt/metadata/workers/baseurl/alpha/sharedworker.html.ini +++ /dev/null @@ -1,6 +0,0 @@ -[sharedworker.html] - type: testharness - bug: https://github.com/servo/servo/issues/7458 - [Base URL in workers: new SharedWorker()] - expected: FAIL - diff --git a/tests/wpt/metadata/workers/baseurl/alpha/xhr-in-sharedworker.html.ini b/tests/wpt/metadata/workers/baseurl/alpha/xhr-in-sharedworker.html.ini new file mode 100644 index 00000000000..0ef8c8de1a4 --- /dev/null +++ b/tests/wpt/metadata/workers/baseurl/alpha/xhr-in-sharedworker.html.ini @@ -0,0 +1,4 @@ +[xhr-in-sharedworker.html] + [Base URL in classic shared workers: XHR] + expected: FAIL + diff --git a/tests/wpt/metadata/workers/interfaces/WorkerGlobalScope/location/redirect-sharedworker.html.ini b/tests/wpt/metadata/workers/interfaces/WorkerGlobalScope/location/redirect-sharedworker.html.ini new file mode 100644 index 00000000000..3795f347c73 --- /dev/null +++ b/tests/wpt/metadata/workers/interfaces/WorkerGlobalScope/location/redirect-sharedworker.html.ini @@ -0,0 +1,4 @@ +[redirect-sharedworker.html] + [WorkerLocation with redirects: classic shared workers] + expected: FAIL + diff --git a/tests/wpt/metadata/workers/modules/dedicated-worker-import-blob-url.any.js.ini b/tests/wpt/metadata/workers/modules/dedicated-worker-import-blob-url.any.js.ini new file mode 100644 index 00000000000..9b21746b888 --- /dev/null +++ b/tests/wpt/metadata/workers/modules/dedicated-worker-import-blob-url.any.js.ini @@ -0,0 +1,9 @@ +[dedicated-worker-import-blob-url.any.worker.html] + [dedicated-worker-import-blob-url] + expected: FAIL + + +[dedicated-worker-import-blob-url.any.html] + [dedicated-worker-import-blob-url] + expected: FAIL + diff --git a/tests/wpt/metadata/workers/modules/dedicated-worker-import-data-url.any.js.ini b/tests/wpt/metadata/workers/modules/dedicated-worker-import-data-url.any.js.ini new file mode 100644 index 00000000000..11cb687229f --- /dev/null +++ b/tests/wpt/metadata/workers/modules/dedicated-worker-import-data-url.any.js.ini @@ -0,0 +1,9 @@ +[dedicated-worker-import-data-url.any.html] + [dedicated-worker-import-data-url] + expected: FAIL + + +[dedicated-worker-import-data-url.any.worker.html] + [dedicated-worker-import-data-url] + expected: FAIL + diff --git a/tests/wpt/metadata/xhr/open-url-redirected-sharedworker-origin.htm.ini b/tests/wpt/metadata/xhr/open-url-redirected-sharedworker-origin.htm.ini new file mode 100644 index 00000000000..e9d15c79bf4 --- /dev/null +++ b/tests/wpt/metadata/xhr/open-url-redirected-sharedworker-origin.htm.ini @@ -0,0 +1,4 @@ +[open-url-redirected-sharedworker-origin.htm] + [XMLHttpRequest: redirected classic shared worker scripts, origin and referrer] + expected: FAIL + diff --git a/tests/wpt/mozilla/meta/css/iframe/hide_after_load.html.ini b/tests/wpt/mozilla/meta/css/iframe/hide_after_load.html.ini deleted file mode 100644 index 65c78fd3a4a..00000000000 --- a/tests/wpt/mozilla/meta/css/iframe/hide_after_load.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[hide_after_load.html] - expected: TIMEOUT diff --git a/tests/wpt/mozilla/meta/mozilla/http-cache-xhr.html.ini b/tests/wpt/mozilla/meta/mozilla/http-cache-xhr.html.ini new file mode 100644 index 00000000000..a2d2e2f1a0b --- /dev/null +++ b/tests/wpt/mozilla/meta/mozilla/http-cache-xhr.html.ini @@ -0,0 +1,5 @@ +[http-cache-xhr.html] + expected: TIMEOUT + [The response from an aborted XHR request should not be cached] + expected: TIMEOUT + diff --git a/tests/wpt/mozilla/meta/mozilla/http-cache.html.ini b/tests/wpt/mozilla/meta/mozilla/http-cache.html.ini index 1510dd19f98..d52addb7abc 100644 --- a/tests/wpt/mozilla/meta/mozilla/http-cache.html.ini +++ b/tests/wpt/mozilla/meta/mozilla/http-cache.html.ini @@ -1,3 +1,42 @@ [http-cache.html] type: testharness prefs: [network.http-cache.disabled:true] + [HTTP cache, when disabled, does not cache a 200 response.] + expected: FAIL + + [HTTP cache, when disabled, does not cache a 203 response.] + expected: FAIL + + [HTTP cache, when disabled, does not cache a 204 response.] + expected: FAIL + + [HTTP cache, when disabled, does not cache a 299 response.] + expected: FAIL + + [HTTP cache, when disabled, does not cache a 400 response.] + expected: FAIL + + [HTTP cache, when disabled, does not cache a 404 response.] + expected: FAIL + + [HTTP cache, when disabled, does not cache a 410 response.] + expected: FAIL + + [HTTP cache, when disabled, does not cache a 499 response.] + expected: FAIL + + [HTTP cache, when disabled, does not cache a 500 response.] + expected: FAIL + + [HTTP cache, when disabled, does not cache a 502 response.] + expected: FAIL + + [HTTP cache, when disabled, does not cache a 503 response.] + expected: FAIL + + [HTTP cache, when disabled, does not cache a 504 response.] + expected: FAIL + + [HTTP cache, when disabled, does not cache a 599 response.] + expected: FAIL + diff --git a/tests/wpt/mozilla/meta/mozilla/worklets/test_paint_worklet_timeout.html.ini b/tests/wpt/mozilla/meta/mozilla/worklets/test_paint_worklet_timeout.html.ini index b99ea5a3ee9..1a37abd0b41 100644 --- a/tests/wpt/mozilla/meta/mozilla/worklets/test_paint_worklet_timeout.html.ini +++ b/tests/wpt/mozilla/meta/mozilla/worklets/test_paint_worklet_timeout.html.ini @@ -1,3 +1,4 @@ [test_paint_worklet_timeout.html] type: testharness prefs: [dom.worklet.timeout_ms:10] + expected: FAIL diff --git a/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/ogles/GL/acos/acos_001_to_006.html.ini b/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/ogles/GL/acos/acos_001_to_006.html.ini new file mode 100644 index 00000000000..86a561af11b --- /dev/null +++ b/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/ogles/GL/acos/acos_001_to_006.html.ini @@ -0,0 +1,2 @@ +[acos_001_to_006.html] + expected: TIMEOUT diff --git a/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/ogles/GL/asin/asin_001_to_006.html.ini b/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/ogles/GL/asin/asin_001_to_006.html.ini new file mode 100644 index 00000000000..2cd9fa6c511 --- /dev/null +++ b/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/ogles/GL/asin/asin_001_to_006.html.ini @@ -0,0 +1,5 @@ +[asin_001_to_006.html] + expected: TIMEOUT + [Overall test] + expected: NOTRUN + diff --git a/tests/wpt/web-platform-tests/2dcontext/META.yml b/tests/wpt/web-platform-tests/2dcontext/META.yml index 3c0af55426e..53b11d271cc 100644 --- a/tests/wpt/web-platform-tests/2dcontext/META.yml +++ b/tests/wpt/web-platform-tests/2dcontext/META.yml @@ -1,3 +1,4 @@ +spec: https://html.spec.whatwg.org/multipage/canvas.html#2dcontext suggested_reviewers: - AmeliaBR - annevk diff --git a/tests/wpt/web-platform-tests/2dcontext/examples/.gitkeep b/tests/wpt/web-platform-tests/2dcontext/examples/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/2dcontext/fill-and-stroke-styles/.gitkeep b/tests/wpt/web-platform-tests/2dcontext/fill-and-stroke-styles/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/2dcontext/hit-regions/.gitkeep b/tests/wpt/web-platform-tests/2dcontext/hit-regions/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-bounds.html b/tests/wpt/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-bounds.html new file mode 100644 index 00000000000..544bd77b885 --- /dev/null +++ b/tests/wpt/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-bounds.html @@ -0,0 +1,44 @@ + + +createImageBitmap: clipping to the bitmap + + + + diff --git a/tests/wpt/web-platform-tests/2dcontext/line-styles/.gitkeep b/tests/wpt/web-platform-tests/2dcontext/line-styles/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/2dcontext/path-objects/.gitkeep b/tests/wpt/web-platform-tests/2dcontext/path-objects/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/2dcontext/pixel-manipulation/.gitkeep b/tests/wpt/web-platform-tests/2dcontext/pixel-manipulation/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/2dcontext/shadows/.gitkeep b/tests/wpt/web-platform-tests/2dcontext/shadows/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/2dcontext/text-styles/.gitkeep b/tests/wpt/web-platform-tests/2dcontext/text-styles/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/2dcontext/the-canvas-state/.gitkeep b/tests/wpt/web-platform-tests/2dcontext/the-canvas-state/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/2dcontext/transformations/.gitkeep b/tests/wpt/web-platform-tests/2dcontext/transformations/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/BackgroundSync/META.yml b/tests/wpt/web-platform-tests/BackgroundSync/META.yml index fe808bc6151..e5e6a2361f0 100644 --- a/tests/wpt/web-platform-tests/BackgroundSync/META.yml +++ b/tests/wpt/web-platform-tests/BackgroundSync/META.yml @@ -1,2 +1,3 @@ +spec: https://wicg.github.io/BackgroundSync/spec/ suggested_reviewers: - beverloo diff --git a/tests/wpt/web-platform-tests/BackgroundSync/interfaces.https.any.js b/tests/wpt/web-platform-tests/BackgroundSync/interfaces.https.any.js index 207a0d5d684..aa8ed77bfb3 100644 --- a/tests/wpt/web-platform-tests/BackgroundSync/interfaces.https.any.js +++ b/tests/wpt/web-platform-tests/BackgroundSync/interfaces.https.any.js @@ -6,10 +6,14 @@ // https://wicg.github.io/BackgroundSync/spec/ promise_test(async () => { - const idl = await fetch('/interfaces/BackgroundSync.idl').then(r => r.text()); - const sw = await fetch('/interfaces/ServiceWorker.idl').then(r => r.text()); - const html = await fetch('/interfaces/html.idl').then(r => r.text()); - const dom = await fetch('/interfaces/dom.idl').then(r => r.text()); + const srcs = [ + 'BackgroundSync', + 'service-workers', + 'html', + 'dom' + ]; + const [idl, sw, html, dom] = await Promise.all( + srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); const idlArray = new IdlArray(); idlArray.add_idls(idl); diff --git a/tests/wpt/web-platform-tests/FileAPI/META.yml b/tests/wpt/web-platform-tests/FileAPI/META.yml index d2f5722e5c1..506a59fec1e 100644 --- a/tests/wpt/web-platform-tests/FileAPI/META.yml +++ b/tests/wpt/web-platform-tests/FileAPI/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/FileAPI/ suggested_reviewers: - inexorabletash - zqzhang diff --git a/tests/wpt/web-platform-tests/FileAPI/idlharness.html b/tests/wpt/web-platform-tests/FileAPI/idlharness.html index da3915212a0..eb55b6550ef 100644 --- a/tests/wpt/web-platform-tests/FileAPI/idlharness.html +++ b/tests/wpt/web-platform-tests/FileAPI/idlharness.html @@ -22,28 +22,22 @@ diff --git a/tests/wpt/web-platform-tests/FileAPI/idlharness.worker.js b/tests/wpt/web-platform-tests/FileAPI/idlharness.worker.js index 4262a6dd149..e65ee01ff5b 100644 --- a/tests/wpt/web-platform-tests/FileAPI/idlharness.worker.js +++ b/tests/wpt/web-platform-tests/FileAPI/idlharness.worker.js @@ -1,25 +1,22 @@ importScripts("/resources/testharness.js"); importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js"); -promise_test(async () => { - const idl = await fetch('/interfaces/FileAPI.idl').then(r => r.text()); - const dom = await fetch('/interfaces/dom.idl').then(r => r.text()); - const html = await fetch('/interfaces/html.idl').then(r => r.text()); - const url = await fetch('/interfaces/url.idl').then(r => r.text()); +'use strict'; - const idl_array = new IdlArray(); - idl_array.add_idls(idl); - idl_array.add_dependency_idls(dom); - idl_array.add_dependency_idls(html); - idl_array.add_dependency_idls(url); - idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ArrayBuffer {};"); - idl_array.add_objects({ - Blob: ['new Blob(["TEST"])'], - File: ['new File(["myFileBits"], "myFileName")'], - FileReader: ['new FileReader()'], - FileReaderSync: ['new FileReaderSync()'] - }); +// https://w3c.github.io/FileAPI/ - idl_array.test(); -}, 'Test FileAPI IDL implementation'); +idl_test( + ['FileAPI'], + ['dom', 'html', 'url'], + idl_array => { + idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ArrayBuffer {};"); + idl_array.add_objects({ + Blob: ['new Blob(["TEST"])'], + File: ['new File(["myFileBits"], "myFileName")'], + FileReader: ['new FileReader()'], + FileReaderSync: ['new FileReaderSync()'] + }); + }, + 'Test FileAPI IDL implementation' +); done(); diff --git a/tests/wpt/web-platform-tests/IndexedDB/META.yml b/tests/wpt/web-platform-tests/IndexedDB/META.yml index 5acea9a797d..89cbe2be26d 100644 --- a/tests/wpt/web-platform-tests/IndexedDB/META.yml +++ b/tests/wpt/web-platform-tests/IndexedDB/META.yml @@ -1,8 +1,5 @@ +spec: https://w3c.github.io/IndexedDB/ suggested_reviewers: - odinho - inexorabletash - - chunywang - - dumbmatter - zqzhang - - yunxiaoxie - - zhaozihao diff --git a/tests/wpt/web-platform-tests/IndexedDB/idlharness.any.js b/tests/wpt/web-platform-tests/IndexedDB/idlharness.any.js new file mode 100644 index 00000000000..bf83066ea82 --- /dev/null +++ b/tests/wpt/web-platform-tests/IndexedDB/idlharness.any.js @@ -0,0 +1,25 @@ +// META: global=window,worker +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +idl_test( + ['IndexedDB'], + ['html', 'dom'], + idl_array => { + idl_array.add_objects({ + IDBCursor: [], + IDBCursorWithValue: [], + IDBDatabase: [], + IDBFactory: [self.indexedDB], + IDBIndex: [], + IDBKeyRange: [IDBKeyRange.only(0)], + IDBObjectStore: [], + IDBOpenDBRequest: [], + IDBRequest: [], + IDBTransaction: [], + IDBVersionChangeEvent: ['new IDBVersionChangeEvent("type")'], + DOMStringList: [], + }); + }, + 'IndexedDB interfaces' +); diff --git a/tests/wpt/web-platform-tests/IndexedDB/interfaces.any.js b/tests/wpt/web-platform-tests/IndexedDB/interfaces.any.js deleted file mode 100644 index f1b2a993e47..00000000000 --- a/tests/wpt/web-platform-tests/IndexedDB/interfaces.any.js +++ /dev/null @@ -1,31 +0,0 @@ -// META: script=/resources/WebIDLParser.js -// META: script=/resources/idlharness.js - -promise_test(async t => { - const [html, dom, indexeddb] = await Promise.all([ - '/interfaces/html.idl', - '/interfaces/dom.idl', - '/interfaces/IndexedDB.idl', - ].map(url => fetch(url).then(response => response.text()))); - - const idl_array = new IdlArray(); - idl_array.add_untested_idls(html, { only: ['WindowOrWorkerGlobalScope'] }); - idl_array.add_untested_idls(dom); - idl_array.add_idls(indexeddb); - idl_array.add_objects({ - IDBCursor: [], - IDBCursorWithValue: [], - IDBDatabase: [], - IDBFactory: [self.indexedDB], - IDBIndex: [], - IDBKeyRange: [IDBKeyRange.only(0)], - IDBObjectStore: [], - IDBOpenDBRequest: [], - IDBRequest: [], - IDBTransaction: [], - IDBVersionChangeEvent: [new IDBVersionChangeEvent('')], - DOMStringList: [], - }); - - idl_array.test(); -}, 'Test driver'); diff --git a/tests/wpt/web-platform-tests/WebCryptoAPI/META.yml b/tests/wpt/web-platform-tests/WebCryptoAPI/META.yml index 263351eea87..ec95611b3fe 100644 --- a/tests/wpt/web-platform-tests/WebCryptoAPI/META.yml +++ b/tests/wpt/web-platform-tests/WebCryptoAPI/META.yml @@ -1,4 +1,4 @@ +spec: https://w3c.github.io/webcrypto/ suggested_reviewers: - Wafflespeanut - jimsch - - engelke diff --git a/tests/wpt/web-platform-tests/WebCryptoAPI/idlharness.https.any.js b/tests/wpt/web-platform-tests/WebCryptoAPI/idlharness.https.any.js new file mode 100644 index 00000000000..20aa40edbaf --- /dev/null +++ b/tests/wpt/web-platform-tests/WebCryptoAPI/idlharness.https.any.js @@ -0,0 +1,16 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://w3c.github.io/webcrypto/Overview.html + +promise_test(async () => { + const idl = await fetch(`/interfaces/WebCryptoAPI.idl`).then(r => r.text()); + + const idl_array = new IdlArray(); + idl_array.add_idls(idl); + idl_array.add_objects({ + Crypto: ['crypto'], + SubtleCrypto: ['crypto.subtle'] + }); + idl_array.test(); +}, 'WebCryptoAPI interfaces'); diff --git a/tests/wpt/web-platform-tests/WebCryptoAPI/idlharness.https.html b/tests/wpt/web-platform-tests/WebCryptoAPI/idlharness.https.html deleted file mode 100644 index c4fd0f34092..00000000000 --- a/tests/wpt/web-platform-tests/WebCryptoAPI/idlharness.https.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - -IDL check of WebCrypto - - - - - - - - - -

Description

- -

This test verifies that the implementations of the WebCrypto API match with its WebIDL definition.

- -
- - diff --git a/tests/wpt/web-platform-tests/WebCryptoAPI/idlharness.https.worker.js b/tests/wpt/web-platform-tests/WebCryptoAPI/idlharness.https.worker.js deleted file mode 100644 index b4bbdda4b29..00000000000 --- a/tests/wpt/web-platform-tests/WebCryptoAPI/idlharness.https.worker.js +++ /dev/null @@ -1,22 +0,0 @@ -importScripts("/resources/testharness.js"); -importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js"); - -var request = new XMLHttpRequest(); -request.open("GET", "../interfaces/WebCryptoAPI.idl"); -request.send(); -request.onload = function() { - var idl_array = new IdlArray(); - var idls = request.responseText; - - idl_array.add_untested_idls("[Global] interface Window { };"); - - idl_array.add_untested_idls("interface ArrayBuffer {};"); - idl_array.add_untested_idls("interface ArrayBufferView {};"); - - idl_array.add_idls(idls); - - idl_array.add_objects({"Crypto":["crypto"], "SubtleCrypto":["crypto.subtle"]}); - - idl_array.test(); - done(); -}; diff --git a/tests/wpt/web-platform-tests/WebIDL/META.yml b/tests/wpt/web-platform-tests/WebIDL/META.yml index 033a3eb2d7c..82ae5236f0d 100644 --- a/tests/wpt/web-platform-tests/WebIDL/META.yml +++ b/tests/wpt/web-platform-tests/WebIDL/META.yml @@ -1,3 +1,4 @@ +spec: https://heycam.github.io/webidl/ suggested_reviewers: - domenic - jensl diff --git a/tests/wpt/web-platform-tests/WebIDL/interfaces.html b/tests/wpt/web-platform-tests/WebIDL/interfaces.html index c3e66952ca6..2683aae9cb6 100644 --- a/tests/wpt/web-platform-tests/WebIDL/interfaces.html +++ b/tests/wpt/web-platform-tests/WebIDL/interfaces.html @@ -22,7 +22,7 @@ function doTest(idl) { } promise_test(function() { - return fetch("/interfaces/webidl.idl").then(response => response.text()) + return fetch("/interfaces/WebIDL.idl").then(response => response.text()) .then(doTest); }, "Test driver"); diff --git a/tests/wpt/web-platform-tests/accelerometer/META.yml b/tests/wpt/web-platform-tests/accelerometer/META.yml index 2eeea5b1e99..cab7007fd2f 100644 --- a/tests/wpt/web-platform-tests/accelerometer/META.yml +++ b/tests/wpt/web-platform-tests/accelerometer/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/accelerometer/ suggested_reviewers: - zqzhang - dontcallmedom diff --git a/tests/wpt/web-platform-tests/accname/META.yml b/tests/wpt/web-platform-tests/accname/META.yml index d99ed62b8e3..356c4b2cff6 100644 --- a/tests/wpt/web-platform-tests/accname/META.yml +++ b/tests/wpt/web-platform-tests/accname/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/accname/ suggested_reviewers: - halindrome - joanmarie diff --git a/tests/wpt/web-platform-tests/ambient-light/AmbientLightSensor-iframe-access.https.html b/tests/wpt/web-platform-tests/ambient-light/AmbientLightSensor-iframe-access.https.html new file mode 100644 index 00000000000..9600843145c --- /dev/null +++ b/tests/wpt/web-platform-tests/ambient-light/AmbientLightSensor-iframe-access.https.html @@ -0,0 +1,14 @@ + + +AmbientLightSensor iframe test + + + + + + + +
+ diff --git a/tests/wpt/web-platform-tests/ambient-light/META.yml b/tests/wpt/web-platform-tests/ambient-light/META.yml index f6b3ed4471e..d35c2c53620 100644 --- a/tests/wpt/web-platform-tests/ambient-light/META.yml +++ b/tests/wpt/web-platform-tests/ambient-light/META.yml @@ -1,6 +1,6 @@ +spec: https://w3c.github.io/ambient-light/ suggested_reviewers: - zqzhang - - Volker-E - dontcallmedom - riju - alexshalamov diff --git a/tests/wpt/web-platform-tests/annotation-model/META.yml b/tests/wpt/web-platform-tests/annotation-model/META.yml index 320a8277a0e..b1ced958919 100644 --- a/tests/wpt/web-platform-tests/annotation-model/META.yml +++ b/tests/wpt/web-platform-tests/annotation-model/META.yml @@ -1,4 +1,4 @@ +spec: https://www.w3.org/TR/annotation-model/ suggested_reviewers: - halindrome - bigbluehat - - tcole3 diff --git a/tests/wpt/web-platform-tests/annotation-protocol/META.yml b/tests/wpt/web-platform-tests/annotation-protocol/META.yml index a157432430e..f953586526c 100644 --- a/tests/wpt/web-platform-tests/annotation-protocol/META.yml +++ b/tests/wpt/web-platform-tests/annotation-protocol/META.yml @@ -1,2 +1,3 @@ +spec: https://www.w3.org/TR/annotation-protocol/ suggested_reviewers: - halindrome diff --git a/tests/wpt/web-platform-tests/annotation-vocab/META.yml b/tests/wpt/web-platform-tests/annotation-vocab/META.yml index fd672daab3d..030df88318c 100644 --- a/tests/wpt/web-platform-tests/annotation-vocab/META.yml +++ b/tests/wpt/web-platform-tests/annotation-vocab/META.yml @@ -1,3 +1,4 @@ +spec: https://www.w3.org/TR/annotation-vocab/ suggested_reviewers: - halindrome - gkellogg diff --git a/tests/wpt/web-platform-tests/apng/META.yml b/tests/wpt/web-platform-tests/apng/META.yml index 89834729f75..a660c7e19eb 100644 --- a/tests/wpt/web-platform-tests/apng/META.yml +++ b/tests/wpt/web-platform-tests/apng/META.yml @@ -1,3 +1,4 @@ +spec: https://wiki.mozilla.org/APNG_Specification suggested_reviewers: - stuartparmenter - svgeesus diff --git a/tests/wpt/web-platform-tests/appmanifest/META.yml b/tests/wpt/web-platform-tests/appmanifest/META.yml new file mode 100644 index 00000000000..0b9c714df2a --- /dev/null +++ b/tests/wpt/web-platform-tests/appmanifest/META.yml @@ -0,0 +1,7 @@ +spec: https://w3c.github.io/manifest/ +suggested_reviewers: + - anssiko + - kenchris + - marcoscaceres + - mgiuca + - mounirlamouri diff --git a/tests/wpt/web-platform-tests/appmanifest/idlharness.window.js b/tests/wpt/web-platform-tests/appmanifest/idlharness.window.js new file mode 100644 index 00000000000..a877c76fa31 --- /dev/null +++ b/tests/wpt/web-platform-tests/appmanifest/idlharness.window.js @@ -0,0 +1,18 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://w3c.github.io/manifest/ + +'use strict'; + +idl_test( + ['appmanifest'], + ['html', 'dom'], + idl_array => { + idl_array.add_objects({ + Window: ['window'], + BeforeInstallPromptEvent: ['new BeforeInstallPromptEvent("type")'], + }); + }, + 'appmanifest interfaces' +); diff --git a/tests/wpt/web-platform-tests/async-local-storage/META.yml b/tests/wpt/web-platform-tests/async-local-storage/META.yml index 0f3cf596537..1bbe9e5ac60 100644 --- a/tests/wpt/web-platform-tests/async-local-storage/META.yml +++ b/tests/wpt/web-platform-tests/async-local-storage/META.yml @@ -1,2 +1,3 @@ +spec: https://domenic.github.io/async-local-storage/ suggested_reviewers: - domenic diff --git a/tests/wpt/web-platform-tests/audio-output/HTMLMediaElement-sinkId-idl.html b/tests/wpt/web-platform-tests/audio-output/HTMLMediaElement-sinkId-idl.html deleted file mode 100644 index 4260672e90e..00000000000 --- a/tests/wpt/web-platform-tests/audio-output/HTMLMediaElement-sinkId-idl.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - -IDL check of sinkId on HTMLMediaElement - - - - - -

Description

-

This test verifies the availability of sinkId/setSinkId on the HTMLMediaElement interface.

-
- - - - - - - - - - - diff --git a/tests/wpt/web-platform-tests/audio-output/META.yml b/tests/wpt/web-platform-tests/audio-output/META.yml index 21057e77321..ea6b29e42f3 100644 --- a/tests/wpt/web-platform-tests/audio-output/META.yml +++ b/tests/wpt/web-platform-tests/audio-output/META.yml @@ -1,2 +1,3 @@ +spec: https://w3c.github.io/mediacapture-output/ suggested_reviewers: - guidou diff --git a/tests/wpt/web-platform-tests/audio-output/idlharness.window.js b/tests/wpt/web-platform-tests/audio-output/idlharness.window.js new file mode 100644 index 00000000000..f10e523bcdc --- /dev/null +++ b/tests/wpt/web-platform-tests/audio-output/idlharness.window.js @@ -0,0 +1,24 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://w3c.github.io/mediacapture-output/ + +'use strict'; + +promise_test(async () => { + const srcs = ['audio-output', 'dom', 'html']; + const [idl, dom, html] = await Promise.all( + srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); + + const idl_array = new IdlArray(); + idl_array.add_idls(idl); + idl_array.add_dependency_idls(html); + idl_array.add_dependency_idls(dom); + self.audio = document.createElement('audio'); + self.video = document.createElement('video'); + idl_array.add_objects({ + HTMLAudioElement: ['audio'], + HTMLVideoElement: ['video'] + }); + idl_array.test(); +}, 'Test IDL implementation of audio-output API'); diff --git a/tests/wpt/web-platform-tests/background-fetch/META.yml b/tests/wpt/web-platform-tests/background-fetch/META.yml index 68247b4e45c..8ce9f8faa2a 100644 --- a/tests/wpt/web-platform-tests/background-fetch/META.yml +++ b/tests/wpt/web-platform-tests/background-fetch/META.yml @@ -1,3 +1,4 @@ +spec: https://wicg.github.io/background-fetch/ suggested_reviewers: - beverloo - jakearchibald diff --git a/tests/wpt/web-platform-tests/background-fetch/content-security-policy.https.window.js b/tests/wpt/web-platform-tests/background-fetch/content-security-policy.https.window.js index a6dc7c302c0..0b5b1cb5e94 100644 --- a/tests/wpt/web-platform-tests/background-fetch/content-security-policy.https.window.js +++ b/tests/wpt/web-platform-tests/background-fetch/content-security-policy.https.window.js @@ -16,5 +16,5 @@ document.head.appendChild(meta); backgroundFetchTest((t, bgFetch) => { return promise_rejects( t, new TypeError(), - bgFetch.fetch(uniqueTag(), 'https://example.com')); + bgFetch.fetch(uniqueId(), 'https://example.com')); }, 'fetch blocked by CSP should reject'); diff --git a/tests/wpt/web-platform-tests/background-fetch/credentials-in-url.https.window.js b/tests/wpt/web-platform-tests/background-fetch/credentials-in-url.https.window.js index 28b37b340b9..df9a6629bed 100644 --- a/tests/wpt/web-platform-tests/background-fetch/credentials-in-url.https.window.js +++ b/tests/wpt/web-platform-tests/background-fetch/credentials-in-url.https.window.js @@ -10,23 +10,23 @@ // https://url.spec.whatwg.org/#include-credentials backgroundFetchTest((t, bgFetch) => { - return bgFetch.fetch(uniqueTag(), 'https://example.com'); + return bgFetch.fetch(uniqueId(), 'https://example.com'); }, 'fetch without credentials in URL should register ok'); backgroundFetchTest((t, bgFetch) => { return promise_rejects( t, new TypeError(), - bgFetch.fetch(uniqueTag(), 'https://username:password@example.com')); + bgFetch.fetch(uniqueId(), 'https://username:password@example.com')); }, 'fetch with username and password in URL should reject'); backgroundFetchTest((t, bgFetch) => { return promise_rejects( t, new TypeError(), - bgFetch.fetch(uniqueTag(), 'https://username:@example.com')); + bgFetch.fetch(uniqueId(), 'https://username:@example.com')); }, 'fetch with username and empty password in URL should reject'); backgroundFetchTest((t, bgFetch) => { return promise_rejects( t, new TypeError(), - bgFetch.fetch(uniqueTag(), 'https://:password@example.com')); + bgFetch.fetch(uniqueId(), 'https://:password@example.com')); }, 'fetch with empty username and password in URL should reject'); diff --git a/tests/wpt/web-platform-tests/background-fetch/dangling-markup.https.window.js b/tests/wpt/web-platform-tests/background-fetch/dangling-markup.https.window.js index af7c395d751..764257d7d1a 100644 --- a/tests/wpt/web-platform-tests/background-fetch/dangling-markup.https.window.js +++ b/tests/wpt/web-platform-tests/background-fetch/dangling-markup.https.window.js @@ -13,5 +13,5 @@ backgroundFetchTest((t, bgFetch) => { return promise_rejects( t, new TypeError(), - bgFetch.fetch(uniqueTag(), 'https://example.com/?\n<')); + bgFetch.fetch(uniqueId(), 'https://example.com/?\n<')); }, 'fetch to URL containing \\n and < should reject'); diff --git a/tests/wpt/web-platform-tests/background-fetch/fetch.https.window.js b/tests/wpt/web-platform-tests/background-fetch/fetch.https.window.js new file mode 100644 index 00000000000..4cda0efe952 --- /dev/null +++ b/tests/wpt/web-platform-tests/background-fetch/fetch.https.window.js @@ -0,0 +1,27 @@ +// META: script=/service-workers/service-worker/resources/test-helpers.sub.js +// META: script=resources/utils.js +'use strict'; + +// Covers basic functionality provided by BackgroundFetchManager.fetch(). +// https://wicg.github.io/background-fetch/#background-fetch-manager-fetch + +backgroundFetchTest(async (test, backgroundFetch) => { + const registrationId = uniqueId(); + const registration = await backgroundFetch.fetch( + registrationId, 'resources/feature-name.txt'); + + assert_equals(registration.id, registrationId); + assert_equals(registration.uploadTotal, 0); + assert_equals(registration.uploaded, 0); + assert_equals(registration.downloadTotal, 0); + // Skip `downloaded`, as the transfer may have started already. + + const {type, results} = await getMessageFromServiceWorker(); + assert_equals('backgroundfetched', type); + assert_equals(results.length, 1); + + assert_true(results[0].url.includes('resources/feature-name.txt')); + assert_equals(results[0].status, 200); + assert_equals(results[0].text, 'Background Fetch'); + +}, 'Using Background Fetch to successfully fetch a single resource'); diff --git a/tests/wpt/web-platform-tests/background-fetch/get-ids.https.js b/tests/wpt/web-platform-tests/background-fetch/get-ids.https.js new file mode 100644 index 00000000000..ace782d6579 --- /dev/null +++ b/tests/wpt/web-platform-tests/background-fetch/get-ids.https.js @@ -0,0 +1,19 @@ +// META: script=/service-workers/service-worker/resources/test-helpers.sub.js +// META: script=resources/utils.js +'use strict'; + +// Covers functionality provided by BackgroundFetchManager.getIds(), which +// exposes the keys of active background fetches. +// +// https://wicg.github.io/background-fetch/#background-fetch-manager-getIds + +backgroundFetchTest(async (test, backgroundFetch) => { + const registrationId = uniqueId(); + const registration = await backgroundFetch.fetch( + registrationId, 'resources/feature-name.txt'); + + assert_equals(registration.id, registrationId); + + assert_true((await backgroundFetch.getIds()).includes(registrationId)); + +}, 'The BackgroundFetchManager exposes active fetches'); diff --git a/tests/wpt/web-platform-tests/background-fetch/interfaces.https.any.js b/tests/wpt/web-platform-tests/background-fetch/interfaces.https.any.js index 668a679b2c0..b95b8562b77 100644 --- a/tests/wpt/web-platform-tests/background-fetch/interfaces.https.any.js +++ b/tests/wpt/web-platform-tests/background-fetch/interfaces.https.any.js @@ -6,7 +6,12 @@ // https://wicg.github.io/background-fetch/ promise_test(async () => { - const srcs = ['background-fetch', 'dedicated-workers', 'ServiceWorker', 'dom']; + const srcs = [ + 'background-fetch', + 'dedicated-workers', + 'service-workers', + 'dom' + ]; const [idls, worker, serviceWorker, dom] = await Promise.all( srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); diff --git a/tests/wpt/web-platform-tests/background-fetch/mixed-content-and-allowed-schemes.https.window.js b/tests/wpt/web-platform-tests/background-fetch/mixed-content-and-allowed-schemes.https.window.js index f9ebafcbbf4..9f24f135818 100644 --- a/tests/wpt/web-platform-tests/background-fetch/mixed-content-and-allowed-schemes.https.window.js +++ b/tests/wpt/web-platform-tests/background-fetch/mixed-content-and-allowed-schemes.https.window.js @@ -15,65 +15,65 @@ // intended to check that blocking is enabled. backgroundFetchTest((t, bgFetch) => { - return bgFetch.fetch(uniqueTag(), 'https://example.com'); + return bgFetch.fetch(uniqueId(), 'https://example.com'); }, 'https: fetch should register ok'); backgroundFetchTest((t, bgFetch) => { - return bgFetch.fetch(uniqueTag(), 'http://127.0.0.1'); + return bgFetch.fetch(uniqueId(), 'http://127.0.0.1'); }, 'loopback IPv4 http: fetch should register ok'); backgroundFetchTest((t, bgFetch) => { - return bgFetch.fetch(uniqueTag(), 'http://[::1]'); + return bgFetch.fetch(uniqueId(), 'http://[::1]'); }, 'loopback IPv6 http: fetch should register ok'); backgroundFetchTest((t, bgFetch) => { - return bgFetch.fetch(uniqueTag(), 'http://localhost'); + return bgFetch.fetch(uniqueId(), 'http://localhost'); }, 'localhost http: fetch should register ok'); backgroundFetchTest((t, bgFetch) => { return promise_rejects(t, new TypeError(), - bgFetch.fetch(uniqueTag(), 'http://example.com')); + bgFetch.fetch(uniqueId(), 'http://example.com')); }, 'non-loopback http: fetch should reject'); backgroundFetchTest((t, bgFetch) => { return promise_rejects(t, new TypeError(), - bgFetch.fetch(uniqueTag(), 'http://192.0.2.0')); + bgFetch.fetch(uniqueId(), 'http://192.0.2.0')); }, 'non-loopback IPv4 http: fetch should reject'); backgroundFetchTest((t, bgFetch) => { return promise_rejects(t, new TypeError(), - bgFetch.fetch(uniqueTag(), 'http://[2001:db8::1]')); + bgFetch.fetch(uniqueId(), 'http://[2001:db8::1]')); }, 'non-loopback IPv6 http: fetch should reject'); backgroundFetchTest((t, bgFetch) => { return promise_rejects(t, new TypeError(), - bgFetch.fetch(uniqueTag(), ['https://example.com', - 'http://example.com'])); + bgFetch.fetch(uniqueId(), ['https://example.com', + 'http://example.com'])); }, 'https: and non-loopback http: fetch should reject'); backgroundFetchTest((t, bgFetch) => { return promise_rejects(t, new TypeError(), - bgFetch.fetch(uniqueTag(), ['http://example.com', - 'https://example.com'])); + bgFetch.fetch(uniqueId(), ['http://example.com', + 'https://example.com'])); }, 'non-loopback http: and https: fetch should reject'); backgroundFetchTest((t, bgFetch) => { return promise_rejects(t, new TypeError(), - bgFetch.fetch(uniqueTag(), 'wss:127.0.0.1')); + bgFetch.fetch(uniqueId(), 'wss:127.0.0.1')); }, 'wss: fetch should reject'); backgroundFetchTest((t, bgFetch) => { return promise_rejects(t, new TypeError(), - bgFetch.fetch(uniqueTag(), 'file:///')); + bgFetch.fetch(uniqueId(), 'file:///')); }, 'file: fetch should reject'); backgroundFetchTest((t, bgFetch) => { return promise_rejects(t, new TypeError(), - bgFetch.fetch(uniqueTag(), 'data:text/plain,foo')); + bgFetch.fetch(uniqueId(), 'data:text/plain,foo')); }, 'data: fetch should reject'); backgroundFetchTest((t, bgFetch) => { return promise_rejects(t, new TypeError(), - bgFetch.fetch(uniqueTag(), 'foobar:bazqux')); + bgFetch.fetch(uniqueId(), 'foobar:bazqux')); }, 'unknown scheme fetch should reject'); diff --git a/tests/wpt/web-platform-tests/background-fetch/port-blocking.https.window.js b/tests/wpt/web-platform-tests/background-fetch/port-blocking.https.window.js index dbf8a1a4d9f..564a1113626 100644 --- a/tests/wpt/web-platform-tests/background-fetch/port-blocking.https.window.js +++ b/tests/wpt/web-platform-tests/background-fetch/port-blocking.https.window.js @@ -9,27 +9,27 @@ // check that blocking is enabled. backgroundFetchTest((t, bgFetch) => { - return bgFetch.fetch(uniqueTag(), 'https://example.com'); + return bgFetch.fetch(uniqueId(), 'https://example.com'); }, 'fetch to default https port should register ok'); backgroundFetchTest((t, bgFetch) => { - return bgFetch.fetch(uniqueTag(), 'http://127.0.0.1'); + return bgFetch.fetch(uniqueId(), 'http://127.0.0.1'); }, 'fetch to default http port should register ok'); backgroundFetchTest((t, bgFetch) => { - return bgFetch.fetch(uniqueTag(), 'https://example.com:443'); + return bgFetch.fetch(uniqueId(), 'https://example.com:443'); }, 'fetch to port 443 should register ok'); backgroundFetchTest((t, bgFetch) => { - return bgFetch.fetch(uniqueTag(), 'https://example.com:80'); + return bgFetch.fetch(uniqueId(), 'https://example.com:80'); }, 'fetch to port 80 should register ok, even over https'); backgroundFetchTest((t, bgFetch) => { - return bgFetch.fetch(uniqueTag(), 'https://example.com:8080'); + return bgFetch.fetch(uniqueId(), 'https://example.com:8080'); }, 'fetch to non-default non-bad port (8080) should register ok'); backgroundFetchTest((t, bgFetch) => { return promise_rejects( t, new TypeError(), - bgFetch.fetch(uniqueTag(), 'https://example.com:587')); + bgFetch.fetch(uniqueId(), 'https://example.com:587')); }, 'fetch to bad port (SMTP) should reject'); diff --git a/tests/wpt/web-platform-tests/background-fetch/resources/feature-name.txt b/tests/wpt/web-platform-tests/background-fetch/resources/feature-name.txt new file mode 100644 index 00000000000..4d54f5054c4 --- /dev/null +++ b/tests/wpt/web-platform-tests/background-fetch/resources/feature-name.txt @@ -0,0 +1 @@ +Background Fetch \ No newline at end of file diff --git a/tests/wpt/web-platform-tests/background-fetch/resources/sw.js b/tests/wpt/web-platform-tests/background-fetch/resources/sw.js index d4dc941796a..8ac3f4c19b9 100644 --- a/tests/wpt/web-platform-tests/background-fetch/resources/sw.js +++ b/tests/wpt/web-platform-tests/background-fetch/resources/sw.js @@ -1 +1,24 @@ -// Deliberately left empty for now. \ No newline at end of file +let source = null; + +async function getFetchResult(settledFetch) { + if (!settledFetch.response) + return Promise.resolve(null); + + return { + url: settledFetch.response.url, + status: settledFetch.response.status, + text: await settledFetch.response.text(), + }; +} + +self.addEventListener('message', event => { + source = event.source; + source.postMessage('ready'); +}); + +self.addEventListener('backgroundfetched', event => { + event.waitUntil( + event.fetches.values() + .then(fetches => Promise.all(fetches.map(fetch => getFetchResult(fetch)))) + .then(results => source.postMessage({ type: event.type, results }))); +}); diff --git a/tests/wpt/web-platform-tests/background-fetch/resources/utils.js b/tests/wpt/web-platform-tests/background-fetch/resources/utils.js index f630f1085d4..8087f95d8f6 100644 --- a/tests/wpt/web-platform-tests/background-fetch/resources/utils.js +++ b/tests/wpt/web-platform-tests/background-fetch/resources/utils.js @@ -1,26 +1,52 @@ 'use strict'; +let nextBackgroundFetchId = 0; + +// Waits for a single message received from a registered Service Worker. +async function getMessageFromServiceWorker() { + return new Promise(resolve => { + function listener(event) { + navigator.serviceWorker.removeEventListener('message', listener); + resolve(event.data); + } + + navigator.serviceWorker.addEventListener('message', listener); + }); +} + +// Registers the instrumentation Service Worker located at "resources/sw.js" +// with a scope unique to the test page that's running, and waits for it to be +// activated. The Service Worker will be unregistered automatically. +// // Depends on /service-workers/service-worker/resources/test-helpers.sub.js async function registerAndActivateServiceWorker(test) { const script = 'resources/sw.js'; const scope = 'resources/scope' + location.pathname; + let serviceWorkerRegistration = await service_worker_unregister_and_register(test, script, scope); - add_completion_callback(() => { - serviceWorkerRegistration.unregister(); - }); + + add_completion_callback(() => serviceWorkerRegistration.unregister()); + await wait_for_state(test, serviceWorkerRegistration.installing, 'activated'); return serviceWorkerRegistration; } +// Creates a Promise test for |func| given the |description|. The |func| will be +// executed with the `backgroundFetch` object of an activated Service Worker +// Registration. function backgroundFetchTest(func, description) { promise_test(async t => { const serviceWorkerRegistration = await registerAndActivateServiceWorker(t); + serviceWorkerRegistration.active.postMessage(null /* unused */); + + assert_equals(await getMessageFromServiceWorker(), 'ready'); + return func(t, serviceWorkerRegistration.backgroundFetch); }, description); } -let _nextBackgroundFetchTag = 0; -function uniqueTag() { - return 'tag' + _nextBackgroundFetchTag++; -} \ No newline at end of file +// Returns a Background Fetch ID that's unique for the current page. +function uniqueId() { + return 'id' + nextBackgroundFetchId++; +} diff --git a/tests/wpt/web-platform-tests/battery-status/META.yml b/tests/wpt/web-platform-tests/battery-status/META.yml index d6bb8cc6250..eded36c5e2f 100644 --- a/tests/wpt/web-platform-tests/battery-status/META.yml +++ b/tests/wpt/web-platform-tests/battery-status/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/battery/ suggested_reviewers: - anssiko - dontcallmedom diff --git a/tests/wpt/web-platform-tests/beacon/META.yml b/tests/wpt/web-platform-tests/beacon/META.yml index c75a8d0ba91..94fa75c5178 100644 --- a/tests/wpt/web-platform-tests/beacon/META.yml +++ b/tests/wpt/web-platform-tests/beacon/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/beacon/ suggested_reviewers: - toddreifsteck - igrigorik diff --git a/tests/wpt/web-platform-tests/bluetooth/META.yml b/tests/wpt/web-platform-tests/bluetooth/META.yml index 13aeeb280a6..c93f16a3a5f 100644 --- a/tests/wpt/web-platform-tests/bluetooth/META.yml +++ b/tests/wpt/web-platform-tests/bluetooth/META.yml @@ -1,3 +1,4 @@ +spec: https://webbluetoothcg.github.io/web-bluetooth/ suggested_reviewers: - jyasskin - g-ortuno diff --git a/tests/wpt/web-platform-tests/bluetooth/idl/idl-NavigatorBluetooth.html b/tests/wpt/web-platform-tests/bluetooth/idl/idl-NavigatorBluetooth.html index b8649f11abe..678a0df5f88 100644 --- a/tests/wpt/web-platform-tests/bluetooth/idl/idl-NavigatorBluetooth.html +++ b/tests/wpt/web-platform-tests/bluetooth/idl/idl-NavigatorBluetooth.html @@ -3,14 +3,8 @@ diff --git a/tests/wpt/web-platform-tests/bluetooth/idl/idl-NavigatorBluetooth.https.html b/tests/wpt/web-platform-tests/bluetooth/idl/idl-NavigatorBluetooth.https.html new file mode 100644 index 00000000000..b8649f11abe --- /dev/null +++ b/tests/wpt/web-platform-tests/bluetooth/idl/idl-NavigatorBluetooth.https.html @@ -0,0 +1,16 @@ + + + + diff --git a/tests/wpt/web-platform-tests/bluetooth/idl/idlharness.tentative.https.window.js b/tests/wpt/web-platform-tests/bluetooth/idl/idlharness.tentative.https.window.js new file mode 100644 index 00000000000..4bacd5688f7 --- /dev/null +++ b/tests/wpt/web-platform-tests/bluetooth/idl/idlharness.tentative.https.window.js @@ -0,0 +1,25 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +// https://webbluetoothcg.github.io/web-bluetooth/ + +idl_test( + ['web-bluetooth'], + ['dom', 'html', 'permissions'], + idl_array => { + try { + self.event = new BluetoothAdvertisingEvent('type'); + } catch(e) { + // Surfaced when 'event' is undefined below. + } + + idl_array.add_objects({ + Navigator: ['navigator'], + Bluetooth: ['navigator.bluetooth'], + BluetoothAdvertisingEvent: ['event'], + }); + }, + 'web-bluetooth interfaces.' +); diff --git a/tests/wpt/web-platform-tests/bluetooth/idl/idlharness.tentative.window.js b/tests/wpt/web-platform-tests/bluetooth/idl/idlharness.tentative.window.js deleted file mode 100644 index 6214f133ffd..00000000000 --- a/tests/wpt/web-platform-tests/bluetooth/idl/idlharness.tentative.window.js +++ /dev/null @@ -1,19 +0,0 @@ -// META: script=/resources/WebIDLParser.js -// META: script=/resources/idlharness.js - -'use strict'; - -// https://webbluetoothcg.github.io/web-bluetooth/ - -promise_test(async () => { - const srcs = ['web-bluetooth', 'dom', 'html', 'permissions']; - const [idl, dom, html, permissions] = await Promise.all( - srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); - - const idl_array = new IdlArray(); - idl_array.add_idls(idl); - idl_array.add_dependency_idls(dom); - idl_array.add_dependency_idls(html); - idl_array.add_dependency_idls(permissions); - idl_array.test(); -}, 'web-bluetooth interfaces.'); diff --git a/tests/wpt/web-platform-tests/budget-api/META.yml b/tests/wpt/web-platform-tests/budget-api/META.yml index fe808bc6151..6cc0000f6ff 100644 --- a/tests/wpt/web-platform-tests/budget-api/META.yml +++ b/tests/wpt/web-platform-tests/budget-api/META.yml @@ -1,2 +1,3 @@ +spec: https://wicg.github.io/budget-api/ suggested_reviewers: - beverloo diff --git a/tests/wpt/web-platform-tests/clear-site-data/META.yml b/tests/wpt/web-platform-tests/clear-site-data/META.yml index 18d3ecb2f63..65ca96dbb9d 100644 --- a/tests/wpt/web-platform-tests/clear-site-data/META.yml +++ b/tests/wpt/web-platform-tests/clear-site-data/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/webappsec-clear-site-data/ suggested_reviewers: - mikewest - msramek diff --git a/tests/wpt/web-platform-tests/client-hints/accept_ch.tentative.https.html b/tests/wpt/web-platform-tests/client-hints/accept_ch.tentative.https.html index 64ce30f76f6..b8379de46a2 100644 --- a/tests/wpt/web-platform-tests/client-hints/accept_ch.tentative.https.html +++ b/tests/wpt/web-platform-tests/client-hints/accept_ch.tentative.https.html @@ -4,10 +4,10 @@ -
-

Apart from this webpage, the test opens another html web page. One test - is run in this web page, and another in the second web page. -

+ +function acceptChLoaded() { + // Open a new window. Verify that the user agent does not attach the client + // hints. + var verify_win = window.open("do_not_expect_client_hints_headers.html"); + assert_not_equals(verify_win, null, "Popup windows not allowed?"); +} +// Fetching this webpage should NOT cause user-agent to persist client hint +// preferences for the origin. +var win = window.open("resources/accept_ch.html"); +assert_not_equals(win, null, "Popup windows not allowed?"); +win.addEventListener('load', acceptChLoaded, false); + + diff --git a/tests/wpt/web-platform-tests/client-hints/accept_ch.sub.https.html b/tests/wpt/web-platform-tests/client-hints/accept_ch.tentative.sub.https.html similarity index 97% rename from tests/wpt/web-platform-tests/client-hints/accept_ch.sub.https.html rename to tests/wpt/web-platform-tests/client-hints/accept_ch.tentative.sub.https.html index 78c7ad0e185..43c1fb12c20 100644 --- a/tests/wpt/web-platform-tests/client-hints/accept_ch.sub.https.html +++ b/tests/wpt/web-platform-tests/client-hints/accept_ch.tentative.sub.https.html @@ -16,7 +16,7 @@ // of client hints it receives in the request headers. promise_test(t => { - return fetch("https://{{domains[]}}:{{ports[https][0]}}/client-hints/echo_client_hints_received.py", {"mode": "no-cors"}).then(r => { + return fetch("https://{{domains[]}}:{{ports[https][0]}}/client-hints/echo_client_hints_received.py").then(r => { assert_equals(r.status, 200) // Verify that the browser includes client hints in the headers for a // same-origin fetch. diff --git a/tests/wpt/web-platform-tests/client-hints/accept_ch.sub.https.html.headers b/tests/wpt/web-platform-tests/client-hints/accept_ch.tentative.sub.https.html.headers similarity index 100% rename from tests/wpt/web-platform-tests/client-hints/accept_ch.sub.https.html.headers rename to tests/wpt/web-platform-tests/client-hints/accept_ch.tentative.sub.https.html.headers diff --git a/tests/wpt/web-platform-tests/client-hints/accept_ch_lifetime.tentative.https.html b/tests/wpt/web-platform-tests/client-hints/accept_ch_lifetime.tentative.https.html index b785f304b58..0055b131f92 100644 --- a/tests/wpt/web-platform-tests/client-hints/accept_ch_lifetime.tentative.https.html +++ b/tests/wpt/web-platform-tests/client-hints/accept_ch_lifetime.tentative.https.html @@ -4,10 +4,10 @@ -
-

Apart from this webpage, the test opens another html web page. One test - is run in this web page, and another in the second web page. -

+ +function acceptChLifetimeLoaded() { + // Open a new window. Verify that the user agent attaches the client hints. + var verify_win = window.open("expect_client_hints_headers.html"); + assert_not_equals(verify_win, null, "Popup windows not allowed?"); +} +// Fetching this webpage should cause user-agent to persist client hint +// preferences for the origin. +var win = window.open("resources/accept_ch_lifetime.html"); +assert_not_equals(win, null, "Popup windows not allowed?"); +win.addEventListener('load', acceptChLifetimeLoaded, false); + + diff --git a/tests/wpt/web-platform-tests/client-hints/accept_ch_lifetime_cross_origin_iframe.tentative.sub.https.html b/tests/wpt/web-platform-tests/client-hints/accept_ch_lifetime_cross_origin_iframe.tentative.sub.https.html new file mode 100644 index 00000000000..8273ac78b27 --- /dev/null +++ b/tests/wpt/web-platform-tests/client-hints/accept_ch_lifetime_cross_origin_iframe.tentative.sub.https.html @@ -0,0 +1,68 @@ + +Accept-CH-Lifetime test with cross-origin iframe + + + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/client-hints/accept_ch_lifetime_same_origin_iframe.tentative.https.html b/tests/wpt/web-platform-tests/client-hints/accept_ch_lifetime_same_origin_iframe.tentative.https.html new file mode 100644 index 00000000000..4d339b6dbf2 --- /dev/null +++ b/tests/wpt/web-platform-tests/client-hints/accept_ch_lifetime_same_origin_iframe.tentative.https.html @@ -0,0 +1,67 @@ + +Accept-CH-Lifetime test with same-origin iframe + + + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/client-hints/accept_ch_lifetime_subresource.tentative.https.html b/tests/wpt/web-platform-tests/client-hints/accept_ch_lifetime_subresource.tentative.https.html new file mode 100644 index 00000000000..e3864294875 --- /dev/null +++ b/tests/wpt/web-platform-tests/client-hints/accept_ch_lifetime_subresource.tentative.https.html @@ -0,0 +1,71 @@ + +Accept-CH-Lifetime test with subresource + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch.tentative.http.html b/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch.tentative.http.html new file mode 100644 index 00000000000..2bdced2ece7 --- /dev/null +++ b/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch.tentative.http.html @@ -0,0 +1,35 @@ + + +Accept-CH http-equiv insecure transport test + + + + + + + diff --git a/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch.tentative.https.html b/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch.tentative.https.html new file mode 100644 index 00000000000..3e4d638ffc3 --- /dev/null +++ b/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch.tentative.https.html @@ -0,0 +1,49 @@ + + +Accept-CH http-equiv cross-navigation test + + + + +
+

Apart from this webpage, the test opens another html web page. One test + is run in this web page, and another in the second web page. +

+ + + + diff --git a/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch.tentative.sub.https.html b/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch.tentative.sub.https.html new file mode 100644 index 00000000000..459b00e973b --- /dev/null +++ b/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch.tentative.sub.https.html @@ -0,0 +1,62 @@ + + +Accept-CH http-equiv same-origin and cross-origin test + + + + + + + diff --git a/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch_lifetime.tentative.https.html b/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch_lifetime.tentative.https.html new file mode 100644 index 00000000000..73ca1fcdbe0 --- /dev/null +++ b/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch_lifetime.tentative.https.html @@ -0,0 +1,66 @@ + +Accept-CH-Lifetime test + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch_lifetime_cross_origin_iframe.tentative.sub.https.html b/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch_lifetime_cross_origin_iframe.tentative.sub.https.html new file mode 100644 index 00000000000..ab878f88961 --- /dev/null +++ b/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch_lifetime_cross_origin_iframe.tentative.sub.https.html @@ -0,0 +1,66 @@ + +Accept-CH-Lifetime test with cross-origin iframe + + + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch_lifetime_same_origin_iframe.tentative.https.html b/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch_lifetime_same_origin_iframe.tentative.https.html new file mode 100644 index 00000000000..9f7d1f35096 --- /dev/null +++ b/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch_lifetime_same_origin_iframe.tentative.https.html @@ -0,0 +1,67 @@ + +Accept-CH-Lifetime test with same-origin iframe + + + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch_lifetime_subresource.tentative.https.html b/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch_lifetime_subresource.tentative.https.html new file mode 100644 index 00000000000..17f287d3ea9 --- /dev/null +++ b/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch_lifetime_subresource.tentative.https.html @@ -0,0 +1,74 @@ + +Accept-CH-Lifetime test with subresource + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch_malformed_header.tentative.https.html b/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch_malformed_header.tentative.https.html new file mode 100644 index 00000000000..dd516a97c96 --- /dev/null +++ b/tests/wpt/web-platform-tests/client-hints/http_equiv_accept_ch_malformed_header.tentative.https.html @@ -0,0 +1,28 @@ + + +Accept-CH malformed http-equiv test + + + + + + + + diff --git a/tests/wpt/web-platform-tests/client-hints/resources/accept_ch_lifetime.html.headers b/tests/wpt/web-platform-tests/client-hints/resources/accept_ch_lifetime.html.headers index f49694d2bfa..ec146dfa87b 100644 --- a/tests/wpt/web-platform-tests/client-hints/resources/accept_ch_lifetime.html.headers +++ b/tests/wpt/web-platform-tests/client-hints/resources/accept_ch_lifetime.html.headers @@ -1,2 +1,2 @@ Accept-CH: device-memory -Accept-CH-Lifetime: 20 +Accept-CH-Lifetime: 5 diff --git a/tests/wpt/web-platform-tests/client-hints/resources/do_not_expect_client_hints_headers.html b/tests/wpt/web-platform-tests/client-hints/resources/do_not_expect_client_hints_headers.html index 06fdbf73128..b3cf5df4c27 100644 --- a/tests/wpt/web-platform-tests/client-hints/resources/do_not_expect_client_hints_headers.html +++ b/tests/wpt/web-platform-tests/client-hints/resources/do_not_expect_client_hints_headers.html @@ -1,8 +1,5 @@ - - - - diff --git a/tests/wpt/web-platform-tests/client-hints/resources/expect_client_hints_headers.html b/tests/wpt/web-platform-tests/client-hints/resources/expect_client_hints_headers.html index d767664d1af..8e64b1989ab 100644 --- a/tests/wpt/web-platform-tests/client-hints/resources/expect_client_hints_headers.html +++ b/tests/wpt/web-platform-tests/client-hints/resources/expect_client_hints_headers.html @@ -1,8 +1,5 @@ - - - - diff --git a/tests/wpt/web-platform-tests/client-hints/resources/http_equiv_accept_ch_lifetime.html b/tests/wpt/web-platform-tests/client-hints/resources/http_equiv_accept_ch_lifetime.html new file mode 100644 index 00000000000..2dd18068427 --- /dev/null +++ b/tests/wpt/web-platform-tests/client-hints/resources/http_equiv_accept_ch_lifetime.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/wpt/web-platform-tests/clipboard-apis/META.yml b/tests/wpt/web-platform-tests/clipboard-apis/META.yml index d971dece976..ecbac54806c 100644 --- a/tests/wpt/web-platform-tests/clipboard-apis/META.yml +++ b/tests/wpt/web-platform-tests/clipboard-apis/META.yml @@ -1,3 +1,3 @@ +spec: https://w3c.github.io/clipboard-apis/ suggested_reviewers: - garykac - - hallvors diff --git a/tests/wpt/web-platform-tests/compat/META.yml b/tests/wpt/web-platform-tests/compat/META.yml index ff92c06159f..f2aec22ba32 100644 --- a/tests/wpt/web-platform-tests/compat/META.yml +++ b/tests/wpt/web-platform-tests/compat/META.yml @@ -1,3 +1,4 @@ +spec: https://compat.spec.whatwg.org/ suggested_reviewers: - cdumez - foolip diff --git a/tests/wpt/web-platform-tests/compat/webkit-appearance.tentative.html b/tests/wpt/web-platform-tests/compat/webkit-appearance.tentative.html deleted file mode 100644 index 8c0273dcc5f..00000000000 --- a/tests/wpt/web-platform-tests/compat/webkit-appearance.tentative.html +++ /dev/null @@ -1,65 +0,0 @@ - --webkit-appearance support - - - - - - - -
- - diff --git a/tests/wpt/web-platform-tests/console/META.yml b/tests/wpt/web-platform-tests/console/META.yml index a8a6f3925ce..60c95d0d579 100644 --- a/tests/wpt/web-platform-tests/console/META.yml +++ b/tests/wpt/web-platform-tests/console/META.yml @@ -1,3 +1,4 @@ +spec: https://console.spec.whatwg.org/ suggested_reviewers: - domenic - pwnall diff --git a/tests/wpt/web-platform-tests/console/console-countReset-logging-manual.html b/tests/wpt/web-platform-tests/console/console-countReset-logging-manual.html index 62122fb214a..7fe01f50edb 100644 --- a/tests/wpt/web-platform-tests/console/console-countReset-logging-manual.html +++ b/tests/wpt/web-platform-tests/console/console-countReset-logging-manual.html @@ -4,7 +4,7 @@ Console Count Reset - Logging Manual Test - +

Open the console inside the developer tools. It should contain entries whose contents are:

diff --git a/tests/wpt/web-platform-tests/console/console-timing-logging-manual.html b/tests/wpt/web-platform-tests/console/console-timing-logging-manual.html new file mode 100644 index 00000000000..3b9e5cea21d --- /dev/null +++ b/tests/wpt/web-platform-tests/console/console-timing-logging-manual.html @@ -0,0 +1,70 @@ + + + +Console Timing Methods - Logging Manual Test + + + + + +

Open the console inside the developer tools. It should contain entries whose contents are:

+

default: <some time>

+

default: <some time>

+ +

default: <some time>

+

default: <some time> extra data

+

default: <some time>

+ +

default: <some time>

+

default: <some time> extra data

+

default: <some time>

+ +

default: <some time>

+

default: <some time> extra data

+

default: <some time>

+ +

custom toString(): <some time>

+

custom toString(): <some time> extra data

+

custom toString(): <some time>

+ +

a label: <some time>

+

a label: <some time> extra data

+

a label: <some time>

+ +

[some warning message indicating that a timer for label "b" does not exist]

+ + + + diff --git a/tests/wpt/web-platform-tests/content-security-policy/META.yml b/tests/wpt/web-platform-tests/content-security-policy/META.yml index 69172f5b39f..99c5a782cff 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/META.yml +++ b/tests/wpt/web-platform-tests/content-security-policy/META.yml @@ -1,2 +1,3 @@ +spec: https://w3c.github.io/webappsec-csp/ suggested_reviewers: - hillbrad diff --git a/tests/wpt/web-platform-tests/content-security-policy/embedded-enforcement/idlharness.window.js b/tests/wpt/web-platform-tests/content-security-policy/embedded-enforcement/idlharness.window.js new file mode 100644 index 00000000000..38fa663fd45 --- /dev/null +++ b/tests/wpt/web-platform-tests/content-security-policy/embedded-enforcement/idlharness.window.js @@ -0,0 +1,21 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://w3c.github.io/webappsec-csp/embedded/ + +'use strict'; + +promise_test(async () => { + const idl = await fetch('/interfaces/csp-embedded-enforcement.idl').then(r => r.text()); + const html = await fetch('/interfaces/html.idl').then(r => r.text()); + const dom = await fetch('/interfaces/dom.idl').then(r => r.text()); + + const idl_array = new IdlArray(); + idl_array.add_idls(idl); + idl_array.add_dependency_idls(html); + idl_array.add_dependency_idls(dom); + idl_array.add_objects({ + HTMLIFrameElement: ['document.createElement("iframe")'], + }); + idl_array.test(); +}, 'csp-embedded-enforcement IDL'); diff --git a/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/blockeduri-eval.html b/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/blockeduri-eval.html index c9d74e623f5..ddd5068df1f 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/blockeduri-eval.html +++ b/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/blockeduri-eval.html @@ -7,7 +7,8 @@ var watcher = new EventWatcher(t, document, 'securitypolicyviolation'); watcher.wait_for('securitypolicyviolation').then(t.step_func_done(e => { assert_equals(e.blockedURI, "eval"); - assert_equals(e.lineNumber, 14); + assert_equals(e.lineNumber, 15); + assert_equals(e.columnNumber, 12); })); try { diff --git a/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/blockeduri-inline.html b/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/blockeduri-inline.html index c4862337407..40c4865185a 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/blockeduri-inline.html +++ b/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/blockeduri-inline.html @@ -7,7 +7,8 @@ var watcher = new EventWatcher(t, document, 'securitypolicyviolation'); watcher.wait_for('securitypolicyviolation').then(t.step_func_done(e => { assert_equals(e.blockedURI, "inline"); - assert_equals(e.lineNumber, 14); + assert_equals(e.lineNumber, 15); + assert_equals(e.columnNumber, 1); })); }, "Inline violations have a blockedURI of 'inline'"); diff --git a/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/idl.html b/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/idl.html deleted file mode 100644 index 1849abc3446..00000000000 --- a/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/idl.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - diff --git a/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/idlharness.window.js b/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/idlharness.window.js new file mode 100644 index 00000000000..361282a327d --- /dev/null +++ b/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/idlharness.window.js @@ -0,0 +1,19 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://w3c.github.io/webappsec-csp/ + +'use strict'; + +idl_test( + ['CSP'], + ['dom'], + idl_array => { + idl_array.add_objects({ + SecurityPolicyViolationEvent: [ + 'new SecurityPolicyViolationEvent("securitypolicyviolation")' + ] + }) + }, + 'Test Content Security Policy IDL implementation' +); diff --git a/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/targeting.html b/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/targeting.html index 1464f4ec4b9..10b96e9e61d 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/targeting.html +++ b/tests/wpt/web-platform-tests/content-security-policy/securitypolicyviolation/targeting.html @@ -35,20 +35,30 @@ })) .then(t.step_func(e => { assert_equals(e.blockedURI, "inline"); - assert_equals(e.lineNumber, 132); - assert_equals(e.target, document, "Disconnected elements target the document"); + assert_equals(e.lineNumber, 118); + assert_equals(e.columnNumber, 4); + assert_equals(e.target, document, "Elements created in this document, but pushed into a same-origin frame trigger on that frame's document, not on this frame's document."); return watcher.wait_for('securitypolicyviolation'); })) .then(t.step_func(e => { assert_equals(e.blockedURI, "inline"); - assert_equals(e.lineNumber, 143); - assert_equals(e.target, document, "Elements disconnected after triggering target the document."); + assert_equals(e.lineNumber, 131); + assert_equals(e.columnNumber, 4); + assert_equals(e.target, document, "Elements created in this document, but pushed into a same-origin frame trigger on that frame's document, not on this frame's document."); return watcher.wait_for('securitypolicyviolation'); })) .then(t.step_func(e => { assert_equals(e.blockedURI, "inline"); - assert_equals(e.lineNumber, 157); - assert_equals(e.target, document, "Elements in DocumentFragments target the document"); + assert_equals(e.lineNumber, 139); + assert_equals(e.columnNumber, 4); + assert_equals(e.target, document, "Inline event handlers for disconnected elements target the document."); + return watcher.wait_for('securitypolicyviolation'); + })) + .then(t.step_func(e => { + assert_equals(e.blockedURI, "inline"); + assert_equals(e.lineNumber, 0); + assert_equals(e.columnNumber, 0); + assert_equals(e.target, document, "Inline event handlers for elements disconnected after triggering target the document."); })) .then(t.step_func_done(_ => { unexecuted_test.done(); @@ -119,7 +129,6 @@ assert_equals(events, 2); })); document.querySelector('#block6').contentDocument.body.appendChild(d); - d.click(); }, "Elements created in this document, but pushed into a same-origin frame trigger on that frame's document, not on this frame's document."); diff --git a/tests/wpt/web-platform-tests/content-security-policy/support/checkReport.sub.js b/tests/wpt/web-platform-tests/content-security-policy/support/checkReport.sub.js index 1ae7d098262..00079644445 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/support/checkReport.sub.js +++ b/tests/wpt/web-platform-tests/content-security-policy/support/checkReport.sub.js @@ -73,8 +73,8 @@ if(data["csp-report"] != undefined && data["csp-report"][reportField] != undefined) { assert_field_value(data["csp-report"][reportField], reportValue, reportField); - } else if (data[0] != undefined && data[0]["report"] != undefined && data[0]["report"][reportField] != undefined) { - assert_field_value(data[0]["report"][reportField], reportValue, reportField); + } else if (data[0] != undefined && data[0]["body"] != undefined && data[0]["body"][reportField] != undefined) { + assert_field_value(data[0]["body"][reportField], reportValue, reportField); } else { assert_equals("", reportField, "Expected report field could not be found in report"); } diff --git a/tests/wpt/web-platform-tests/content-security-policy/support/dedicated-worker-helper.js b/tests/wpt/web-platform-tests/content-security-policy/support/dedicated-worker-helper.js index c1ed208e931..8441ab0de72 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/support/dedicated-worker-helper.js +++ b/tests/wpt/web-platform-tests/content-security-policy/support/dedicated-worker-helper.js @@ -1,2 +1,5 @@ var url = new URL("../support/ping.js", document.baseURI).toString(); -assert_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback")); \ No newline at end of file +if (document.getElementById("foo").hasAttribute("blocked-worker")) + assert_worker_is_blocked(url, document.getElementById("foo").getAttribute("data-desc-fallback")); +else + assert_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback")); \ No newline at end of file diff --git a/tests/wpt/web-platform-tests/content-security-policy/support/service-worker-helper.js b/tests/wpt/web-platform-tests/content-security-policy/support/service-worker-helper.js index 4e8f8b5f5d2..b5f65c96a0c 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/support/service-worker-helper.js +++ b/tests/wpt/web-platform-tests/content-security-policy/support/service-worker-helper.js @@ -1,2 +1,5 @@ var url = new URL("../support/ping.js", document.baseURI).toString(); -assert_service_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback")); \ No newline at end of file +if (document.getElementById("foo").hasAttribute("blocked-worker")) + assert_service_worker_is_blocked(url, document.getElementById("foo").getAttribute("data-desc-fallback")); +else + assert_service_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback")); \ No newline at end of file diff --git a/tests/wpt/web-platform-tests/content-security-policy/support/shared-worker-helper.js b/tests/wpt/web-platform-tests/content-security-policy/support/shared-worker-helper.js index d0637ec4717..2a3873873f3 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/support/shared-worker-helper.js +++ b/tests/wpt/web-platform-tests/content-security-policy/support/shared-worker-helper.js @@ -1,2 +1,5 @@ var url = new URL("../support/ping.js", document.baseURI).toString(); -assert_shared_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback")); \ No newline at end of file +if (document.getElementById("foo").hasAttribute("blocked-worker")) + assert_shared_worker_is_blocked(url, document.getElementById("foo").getAttribute("data-desc-fallback")); +else + assert_shared_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback")); \ No newline at end of file diff --git a/tests/wpt/web-platform-tests/content-security-policy/worker-src/dedicated-worker-src-child-fallback-blocked.sub.html b/tests/wpt/web-platform-tests/content-security-policy/worker-src/dedicated-worker-src-child-fallback-blocked.sub.html new file mode 100644 index 00000000000..f9f68fe7498 --- /dev/null +++ b/tests/wpt/web-platform-tests/content-security-policy/worker-src/dedicated-worker-src-child-fallback-blocked.sub.html @@ -0,0 +1,9 @@ + + +Web platform test for dedicated worker allowed by worker-src self + + + + + + \ No newline at end of file diff --git a/tests/wpt/web-platform-tests/content-security-policy/worker-src/service-worker-src-child-fallback-blocked.https.sub.html b/tests/wpt/web-platform-tests/content-security-policy/worker-src/service-worker-src-child-fallback-blocked.https.sub.html new file mode 100644 index 00000000000..979abd580dc --- /dev/null +++ b/tests/wpt/web-platform-tests/content-security-policy/worker-src/service-worker-src-child-fallback-blocked.https.sub.html @@ -0,0 +1,9 @@ + + +Web platform test for service worker allowed by child-src self + + + + + + \ No newline at end of file diff --git a/tests/wpt/web-platform-tests/content-security-policy/worker-src/shared-worker-src-child-fallback-blocked.sub.html b/tests/wpt/web-platform-tests/content-security-policy/worker-src/shared-worker-src-child-fallback-blocked.sub.html new file mode 100644 index 00000000000..00dbdb4fc2d --- /dev/null +++ b/tests/wpt/web-platform-tests/content-security-policy/worker-src/shared-worker-src-child-fallback-blocked.sub.html @@ -0,0 +1,9 @@ + + +Web platform test for shared worker allowed by child-src self + + + + + + \ No newline at end of file diff --git a/tests/wpt/web-platform-tests/cookie-store/META.yml b/tests/wpt/web-platform-tests/cookie-store/META.yml index eeb57de0302..46da8a9fb65 100644 --- a/tests/wpt/web-platform-tests/cookie-store/META.yml +++ b/tests/wpt/web-platform-tests/cookie-store/META.yml @@ -1,3 +1,4 @@ +spec: https://wicg.github.io/cookie-store/ suggested_reviewers: - inexorabletash - pwnall diff --git a/tests/wpt/web-platform-tests/cookie-store/cookieListItem_attributes.tentative.https.window.js b/tests/wpt/web-platform-tests/cookie-store/cookieListItem_attributes.tentative.https.window.js index 8093ec40bff..3e7b02b1085 100644 --- a/tests/wpt/web-platform-tests/cookie-store/cookieListItem_attributes.tentative.https.window.js +++ b/tests/wpt/web-platform-tests/cookie-store/cookieListItem_attributes.tentative.https.window.js @@ -129,7 +129,7 @@ promise_test(async testCase => { 'expires set to a future Date'); promise_test(async testCase => { - await cookieStore.delete('cookie-name', { domain: kCurrentHostname }); + await cookieStore.delete({ name: 'cookie-name', domain: kCurrentHostname }); await cookieStore.set('cookie-name', 'cookie-value', { domain: kCurrentHostname }); @@ -144,7 +144,7 @@ promise_test(async testCase => { assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys); await async_cleanup(async () => { - await cookieStore.delete('cookie-name', { domain: kCurrentHostname }); + await cookieStore.delete({ name: 'cookie-name', domain: kCurrentHostname }); }); }, 'CookieListItem - cookieStore.set with domain set to the current hostname'); @@ -153,7 +153,7 @@ promise_test(async testCase => { const currentPath = currentUrl.pathname; const currentDirectory = currentPath.substr(0, currentPath.lastIndexOf('/') + 1); - await cookieStore.delete('cookie-name', { path: currentDirectory }); + await cookieStore.delete({ name: 'cookie-name', path: currentDirectory }); await cookieStore.set('cookie-name', 'cookie-value', { path: currentDirectory }); @@ -168,12 +168,12 @@ promise_test(async testCase => { assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys); await async_cleanup(async () => { - await cookieStore.delete('cookie-name', { path: currentDirectory }); + await cookieStore.delete({ name: 'cookie-name', path: currentDirectory }); }); }, 'CookieListItem - cookieStore.set with path set to the current directory'); promise_test(async testCase => { - await cookieStore.delete('cookie-name', { secure: false }); + await cookieStore.delete('cookie-name'); await cookieStore.set('cookie-name', 'cookie-value', { secure: false }); const cookie = await cookieStore.get('cookie-name'); @@ -186,14 +186,12 @@ promise_test(async testCase => { assert_equals(cookie.sameSite, 'strict'); assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys); - await async_cleanup(async () => { - await cookieStore.delete('cookie-name', { secure: false }); - }); + await async_cleanup(() => cookieStore.delete('cookie-name')); }, 'CookieListItem - cookieStore.set with secure set to false'); ['strict', 'lax', 'unrestricted'].forEach(sameSiteValue => { promise_test(async testCase => { - await cookieStore.delete('cookie-name', { sameSite: sameSiteValue }); + await cookieStore.delete('cookie-name'); await cookieStore.set({ name: 'cookie-name', value: 'cookie-value', sameSite: sameSiteValue }); @@ -207,13 +205,11 @@ promise_test(async testCase => { assert_equals(cookie.sameSite, sameSiteValue); assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys); - await async_cleanup(async () => { - await cookieStore.delete('cookie-name', { secure: sameSiteValue }); - }); + await async_cleanup(() => cookieStore.delete('cookie-name')); }, `CookieListItem - cookieStore.set with sameSite set to ${sameSiteValue}`); promise_test(async testCase => { - await cookieStore.delete('cookie-name', { sameSite: sameSiteValue }); + await cookieStore.delete('cookie-name'); await cookieStore.set('cookie-name', 'cookie-value', { sameSite: sameSiteValue }); @@ -227,9 +223,7 @@ promise_test(async testCase => { assert_equals(cookie.sameSite, sameSiteValue); assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys); - await async_cleanup(async () => { - await cookieStore.delete('cookie-name', { secure: sameSiteValue }); - }); + await async_cleanup(() => cookieStore.delete('cookie-name')); }, 'CookieListItem - cookieStore.set with positional name and value and ' + `sameSite set to ${sameSiteValue}`); }); diff --git a/tests/wpt/web-platform-tests/cookie-store/cookieStore_delete_arguments.tentative.https.window.js b/tests/wpt/web-platform-tests/cookie-store/cookieStore_delete_arguments.tentative.https.window.js index 9b10204437c..8cfa03dd054 100644 --- a/tests/wpt/web-platform-tests/cookie-store/cookieStore_delete_arguments.tentative.https.window.js +++ b/tests/wpt/web-platform-tests/cookie-store/cookieStore_delete_arguments.tentative.https.window.js @@ -31,54 +31,25 @@ promise_test(async testCase => { promise_test(async testCase => { await cookieStore.set('cookie-name', 'cookie-value'); - await promise_rejects(testCase, new TypeError(), cookieStore.delete( - 'cookie-name', { name: 'cookie-name' })); + await cookieStore.delete('cookie-name', { name: 'wrong-cookie-name' }); const cookie = await cookieStore.get('cookie-name'); - assert_equals(cookie.name, 'cookie-name'); - assert_equals(cookie.value, 'cookie-value'); + assert_equals(cookie, null); await async_cleanup(() => cookieStore.delete('cookie-name')); }, 'cookieStore.delete with name in both positional arguments and options'); -promise_test(async testCase => { - await cookieStore.set('cookie-name', 'cookie-value'); - - await promise_rejects(testCase, new TypeError(), cookieStore.delete( - 'cookie-name', { value: 'cookie-value' })); - const cookie = await cookieStore.get('cookie-name'); - assert_equals(cookie.name, 'cookie-name'); - assert_equals(cookie.value, 'cookie-value'); - - await async_cleanup(() => cookieStore.delete('cookie-name')); -}, 'cookieStore.delete with value in options'); - -promise_test(async testCase => { - await cookieStore.set('cookie-name', 'cookie-value'); - - const tenYears = 10 * 365 * 24 * 60 * 60 * 1000; - const tenYearsAgo = Date.now() - tenYears; - - await promise_rejects(testCase, new TypeError(), cookieStore.delete( - 'cookie-name', { expires: tenYearsAgo })); - const cookie = await cookieStore.get('cookie-name'); - assert_equals(cookie.name, 'cookie-name'); - assert_equals(cookie.value, 'cookie-value'); - - await async_cleanup(() => cookieStore.delete('cookie-name')); -}, 'cookieStore.delete with expires in options'); - promise_test(async testCase => { const currentUrl = new URL(self.location.href); const currentDomain = currentUrl.hostname; await cookieStore.set( 'cookie-name', 'cookie-value', { domain: currentDomain }); - await cookieStore.delete('cookie-name', { domain: currentDomain }); + await cookieStore.delete({ name: 'cookie-name', domain: currentDomain }); const cookie = await cookieStore.get('cookie-name'); assert_equals(cookie, null); await async_cleanup(async () => { - await cookieStore.delete('cookie-name', { domain: currentDomain }) + await cookieStore.delete({ name: 'cookie-name', domain: currentDomain }); }); }, 'cookieStore.delete with domain set to the current hostname'); @@ -88,7 +59,7 @@ promise_test(async testCase => { const subDomain = `sub.${currentDomain}`; await promise_rejects(testCase, new TypeError(), cookieStore.delete( - 'cookie-name', 'cookie-value', { domain: subDomain })); + { name: 'cookie-name', domain: subDomain })); }, 'cookieStore.delete with domain set to a subdomain of the current hostname'); promise_test(async testCase => { @@ -99,7 +70,7 @@ promise_test(async testCase => { const domainSuffix = currentDomain.substr(1); await promise_rejects(testCase, new TypeError(), cookieStore.delete( - 'cookie-name', { domain: domainSuffix })); + { name: 'cookie-name', domain: domainSuffix })); }, 'cookieStore.delete with domain set to a non-domain-matching suffix of ' + 'the current hostname'); @@ -114,7 +85,7 @@ promise_test(async testCase => { assert_equals(cookie, null); await async_cleanup(async () => { - await cookieStore.delete('cookie-name', { domain: currentDomain }) + await cookieStore.delete({ name: 'cookie-name', domain: currentDomain }); }); }, 'cookieStore.delete with name in options and domain set to the current ' + 'hostname'); @@ -149,12 +120,12 @@ promise_test(async testCase => { await cookieStore.set( 'cookie-name', 'cookie-value', { path: currentDirectory }); - await cookieStore.delete('cookie-name', { path: currentDirectory }); + await cookieStore.delete({ name: 'cookie-name', path: currentDirectory }); const cookie = await cookieStore.get('cookie-name'); assert_equals(cookie, null); async_cleanup(async () => { - await cookieStore.delete('cookie-name', { path: currentDirectory }) + await cookieStore.delete({ name: 'cookie-name', path: currentDirectory }); }); }, 'cookieStore.delete with path set to the current directory'); @@ -167,12 +138,26 @@ promise_test(async testCase => { await cookieStore.set( 'cookie-name', 'cookie-value', { path: currentDirectory }); - await cookieStore.delete('cookie-name', { path: subDirectory }); + await cookieStore.delete({ name: 'cookie-name', path: subDirectory }); const cookie = await cookieStore.get('cookie-name'); assert_equals(cookie.name, 'cookie-name'); assert_equals(cookie.value, 'cookie-value'); await async_cleanup(async () => { - await cookieStore.delete('cookie-name', { path: currentDirectory }) + await cookieStore.delete({ name: 'cookie-name', path: currentDirectory }); }); }, 'cookieStore.delete with path set to subdirectory of the current directory'); + +promise_test(async testCase => { + await cookieStore.set('cookie-name', 'cookie-value'); + + const cookie_attributes = await cookieStore.get('cookie-name'); + assert_equals(cookie_attributes.name, 'cookie-name'); + assert_equals(cookie_attributes.value, 'cookie-value'); + + await cookieStore.delete(cookie_attributes); + const cookie = await cookieStore.get('cookie-name'); + assert_equals(cookie, null); + + await async_cleanup(() => cookieStore.delete('cookie-name')); +}, 'cookieStore.delete with get result'); diff --git a/tests/wpt/web-platform-tests/cookie-store/cookieStore_getAll_arguments.tentative.https.window.js b/tests/wpt/web-platform-tests/cookie-store/cookieStore_getAll_arguments.tentative.https.window.js index ef7611d78c8..5106a6270cd 100644 --- a/tests/wpt/web-platform-tests/cookie-store/cookieStore_getAll_arguments.tentative.https.window.js +++ b/tests/wpt/web-platform-tests/cookie-store/cookieStore_getAll_arguments.tentative.https.window.js @@ -56,8 +56,11 @@ promise_test(async testCase => { await cookieStore.set('cookie-name', 'cookie-value'); await cookieStore.set('cookie-name-2', 'cookie-value-2'); - await promise_rejects(testCase, new TypeError(), cookieStore.get( - 'cookie-name', { name: 'cookie-name' })); + const cookies = await cookieStore.getAll('cookie-name', + { name: 'wrong-cookie-name' }); + assert_equals(cookies.length, 1); + assert_equals(cookies[0].name, 'cookie-name'); + assert_equals(cookies[0].value, 'cookie-value'); await async_cleanup(() => cookieStore.delete('cookie-name')); await async_cleanup(() => cookieStore.delete('cookie-name-2')); @@ -66,8 +69,8 @@ promise_test(async testCase => { promise_test(async testCase => { await cookieStore.set('cookie-name', 'cookie-value'); - const cookies = await cookieStore.getAll( - 'cookie-name', { matchType: 'equals' }); + const cookies = await cookieStore.getAll({ name: 'cookie-name', + matchType: 'equals' }); assert_equals(cookies.length, 1); assert_equals(cookies[0].name, 'cookie-name'); assert_equals(cookies[0].value, 'cookie-value'); @@ -83,8 +86,8 @@ promise_test(async testCase => { await cookieStore.set('cookie-name', 'cookie-value'); await cookieStore.set('cookie-name-2', 'cookie-value-2'); - const cookies = await cookieStore.getAll( - 'cookie-name-', { matchType: 'starts-with' }); + const cookies = await cookieStore.getAll({ name: 'cookie-name-', + matchType: 'starts-with' }); assert_equals(cookies.length, 1); assert_equals(cookies[0].name, 'cookie-name-2'); assert_equals(cookies[0].value, 'cookie-value-2'); @@ -98,7 +101,7 @@ promise_test(async testCase => { await cookieStore.set('cookie-name-2', 'cookie-value-2'); await promise_rejects(testCase, new TypeError(), cookieStore.getAll( - 'cookie-name', { matchType: 'invalid' })); + { name: 'cookie-name', matchType: 'invalid' })); await async_cleanup(() => cookieStore.delete('cookie-name')); await async_cleanup(() => cookieStore.delete('cookie-name-2')); @@ -106,14 +109,22 @@ promise_test(async testCase => { promise_test(async testCase => { await cookieStore.set('cookie-name', 'cookie-value'); - await cookieStore.set('cookie-name-2', 'cookie-value-2'); - const cookies = await cookieStore.getAll( - { matchType: 'starts-with', name: 'cookie-name-' }); + const cookies = await cookieStore.getAll({ matchType: 'equals' }); assert_equals(cookies.length, 1); - assert_equals(cookies[0].name, 'cookie-name-2'); - assert_equals(cookies[0].value, 'cookie-value-2'); + assert_equals(cookies[0].name, 'cookie-name'); + assert_equals(cookies[0].value, 'cookie-value'); - await async_cleanup(() => cookieStore.delete('cookie-name')); - await async_cleanup(() => cookieStore.delete('cookie-name-2')); -}, 'cookieStore.getAll with matchType set to starts-with and name in options'); + async_cleanup(() => cookieStore.delete('cookie-name')); +}, 'cookieStore.getAll with matchType set to equals and missing name'); + +promise_test(async testCase => { + await cookieStore.set('cookie-name', 'cookie-value'); + + const cookies = await cookieStore.getAll({ matchType: 'starts-with' }); + assert_equals(cookies.length, 1); + assert_equals(cookies[0].name, 'cookie-name'); + assert_equals(cookies[0].value, 'cookie-value'); + + async_cleanup(() => cookieStore.delete('cookie-name')); +}, 'cookieStore.getAll with matchType set to starts-with and missing name'); diff --git a/tests/wpt/web-platform-tests/cookie-store/cookieStore_get_arguments.tentative.https.window.js b/tests/wpt/web-platform-tests/cookie-store/cookieStore_get_arguments.tentative.https.window.js index ddc73bec890..bb126864ff7 100644 --- a/tests/wpt/web-platform-tests/cookie-store/cookieStore_get_arguments.tentative.https.window.js +++ b/tests/wpt/web-platform-tests/cookie-store/cookieStore_get_arguments.tentative.https.window.js @@ -10,6 +10,16 @@ async function async_cleanup(cleanup_function) { } } +promise_test(async testCase => { + await cookieStore.set('cookie-name', 'cookie-value'); + + const cookie = await cookieStore.get(); + assert_equals(cookie.name, 'cookie-name'); + assert_equals(cookie.value, 'cookie-value'); + + await async_cleanup(() => cookieStore.delete('cookie-name')); +}, 'cookieStore.get with no arguments'); + promise_test(async testCase => { await cookieStore.set('cookie-name', 'cookie-value'); @@ -33,8 +43,8 @@ promise_test(async testCase => { promise_test(async testCase => { await cookieStore.set('cookie-name', 'cookie-value'); - await promise_rejects(testCase, new TypeError(), cookieStore.get( - 'cookie-name', { name: 'cookie-name' })); + const cookie = await cookieStore.get('cookie-name', + { name: 'wrong-cookie-name' }); await async_cleanup(() => cookieStore.delete('cookie-name')); }, 'cookieStore.get with name in both positional arguments and options'); @@ -47,8 +57,8 @@ promise_test(async testCase => { assert_equals(cookie.name, 'cookie-name'); assert_equals(cookie.value, 'cookie-value'); - const no_cookie = await cookieStore.get( - 'cookie-na', { matchType: 'equals' }); + const no_cookie = await cookieStore.get({ name: 'cookie-na', + matchType: 'equals' }); assert_equals(no_cookie, null); await async_cleanup(() => cookieStore.delete('cookie-name')); @@ -57,8 +67,8 @@ promise_test(async testCase => { promise_test(async testCase => { await cookieStore.set('cookie-name', 'cookie-value'); - const cookie = await cookieStore.get( - 'cookie-na', { matchType: 'starts-with' }); + const cookie = await cookieStore.get({ name: 'cookie-na', + matchType: 'starts-with' }); assert_equals(cookie.name, 'cookie-name'); assert_equals(cookie.value, 'cookie-value'); @@ -69,7 +79,7 @@ promise_test(async testCase => { await cookieStore.set('cookie-name', 'cookie-value'); await promise_rejects(testCase, new TypeError(), cookieStore.get( - 'cookie-name', { matchType: 'invalid' })); + { name: 'cookie-name', matchType: 'invalid' })); await async_cleanup(() => cookieStore.delete('cookie-name')); }, 'cookieStore.get with invalid matchType'); @@ -77,10 +87,19 @@ promise_test(async testCase => { promise_test(async testCase => { await cookieStore.set('cookie-name', 'cookie-value'); - const cookie = await cookieStore.get( - { matchType: 'starts-with', name: 'cookie-na' }); + const cookie = await cookieStore.get({ matchType: 'equals' }); assert_equals(cookie.name, 'cookie-name'); assert_equals(cookie.value, 'cookie-value'); async_cleanup(() => cookieStore.delete('cookie-name')); -}, 'cookieStore.get with matchType set to starts-with and name in options'); +}, 'cookieStore.get with matchType set to equals and missing name'); + +promise_test(async testCase => { + await cookieStore.set('cookie-name', 'cookie-value'); + + const cookie = await cookieStore.get({ matchType: 'starts-with' }); + assert_equals(cookie.name, 'cookie-name'); + assert_equals(cookie.value, 'cookie-value'); + + async_cleanup(() => cookieStore.delete('cookie-name')); +}, 'cookieStore.get with matchType set to starts-with and missing name'); diff --git a/tests/wpt/web-platform-tests/cookie-store/cookieStore_set_arguments.tentative.https.window.js b/tests/wpt/web-platform-tests/cookie-store/cookieStore_set_arguments.tentative.https.window.js index 7f4982ed7c9..18f60ad974e 100644 --- a/tests/wpt/web-platform-tests/cookie-store/cookieStore_set_arguments.tentative.https.window.js +++ b/tests/wpt/web-platform-tests/cookie-store/cookieStore_set_arguments.tentative.https.window.js @@ -36,10 +36,10 @@ promise_test(async testCase => { promise_test(async testCase => { await cookieStore.delete('cookie-name'); - await promise_rejects(testCase, new TypeError(), cookieStore.set( - 'cookie-name', 'cookie-value', { name: 'cookie-name' })); + cookieStore.set('cookie-name', 'cookie-value', { name: 'wrong-cookie-name' }); const cookie = await cookieStore.get('cookie-name'); - assert_equals(cookie, null); + assert_equals(cookie.name, 'cookie-name'); + assert_equals(cookie.value, 'cookie-value'); await async_cleanup(() => cookieStore.delete('cookie-name')); }, 'cookieStore.set with name in both positional arguments and options'); @@ -47,10 +47,11 @@ promise_test(async testCase => { promise_test(async testCase => { await cookieStore.delete('cookie-name'); - await promise_rejects(testCase, new TypeError(), cookieStore.set( - 'cookie-name', 'cookie-value', { value: 'cookie-value' })); + cookieStore.set('cookie-name', 'cookie-value', + { value: 'wrong-cookie-value' }); const cookie = await cookieStore.get('cookie-name'); - assert_equals(cookie, null); + assert_equals(cookie.name, 'cookie-name'); + assert_equals(cookie.value, 'cookie-value'); await async_cleanup(() => cookieStore.delete('cookie-name')); }, 'cookieStore.set with value in both positional arguments and options'); @@ -139,7 +140,7 @@ promise_test(async testCase => { promise_test(async testCase => { const currentUrl = new URL(self.location.href); const currentDomain = currentUrl.hostname; - await cookieStore.delete('cookie-name', { domain: currentDomain }); + await cookieStore.delete({ name: 'cookie-name', domain: currentDomain }); await cookieStore.set( 'cookie-name', 'cookie-value', { domain: currentDomain }); @@ -148,7 +149,7 @@ promise_test(async testCase => { assert_equals(cookie.value, 'cookie-value'); await async_cleanup(async () => { - await cookieStore.delete('cookie-name', { domain: currentDomain }); + await cookieStore.delete({ name: 'cookie-name', domain: currentDomain }); }); }, 'cookieStore.set with domain set to the current hostname'); @@ -198,7 +199,7 @@ promise_test(async testCase => { await async_cleanup(async () => { await cookieStore.delete('cookie-name'); - await cookieStore.delete('cookie-name', { domain: currentDomain }); + await cookieStore.delete({ name: 'cookie-name', domain: currentDomain }); }); }, 'cookieStore.set default domain is null and differs from current hostname'); @@ -207,7 +208,7 @@ promise_test(async testCase => { const currentPath = currentUrl.pathname; const currentDirectory = currentPath.substr(0, currentPath.lastIndexOf('/') + 1); - await cookieStore.delete('cookie-name', { path: currentDirectory }); + await cookieStore.delete({ name: 'cookie-name', path: currentDirectory }); await cookieStore.set( 'cookie-name', 'cookie-value', { path: currentDirectory }); @@ -216,7 +217,7 @@ promise_test(async testCase => { assert_equals(cookie.value, 'cookie-value'); await async_cleanup(async () => { - await cookieStore.delete('cookie-name', { path: currentDirectory }); + await cookieStore.delete({ name: 'cookie-name', path: currentDirectory }); }); }, 'cookieStore.set with path set to the current directory'); @@ -226,8 +227,8 @@ promise_test(async testCase => { const currentDirectory = currentPath.substr(0, currentPath.lastIndexOf('/') + 1); const subDirectory = currentDirectory + "subdir/"; - await cookieStore.delete('cookie-name', { path: currentDirectory }); - await cookieStore.delete('cookie-name', { path: subDirectory }); + await cookieStore.delete({ name: 'cookie-name', path: currentDirectory }); + await cookieStore.delete({ name: 'cookie-name', path: subDirectory }); await cookieStore.set( 'cookie-name', 'cookie-value', { path: subDirectory }); @@ -235,7 +236,7 @@ promise_test(async testCase => { assert_equals(cookie, null); await async_cleanup(async () => { - await cookieStore.delete('cookie-name', { path: subDirectory }); + await cookieStore.delete({ name: 'cookie-name', path: subDirectory }); }); }, 'cookieStore.set with path set to a subdirectory of the current directory'); @@ -250,6 +251,24 @@ promise_test(async testCase => { assert_equals(cookies[0].name, 'cookie-name'); assert_equals(cookies[0].value, 'cookie-new-value'); - await async_cleanup(() => cookieStore.delete('cookie-name')); - await async_cleanup(() => cookieStore.delete('cookie-name', { path: '/' })); + await async_cleanup(async () => { + await cookieStore.delete('cookie-name'); + await cookieStore.delete({ name: 'cookie-name', path: '/' }); + }); }, 'cookieStore.set default path is /'); + +promise_test(async testCase => { + await cookieStore.set('cookie-name', 'old-cookie-value'); + + const cookie_attributes = await cookieStore.get('cookie-name'); + assert_equals(cookie_attributes.name, 'cookie-name'); + assert_equals(cookie_attributes.value, 'old-cookie-value'); + + cookie_attributes.value = 'new-cookie-value'; + await cookieStore.set(cookie_attributes); + const cookie = await cookieStore.get('cookie-name'); + assert_equals(cookie.name, 'cookie-name'); + assert_equals(cookie.value, 'new-cookie-value'); + + await async_cleanup(() => cookieStore.delete('cookie-name')); +}, 'cookieStore.set with get result'); diff --git a/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions.js b/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions.js index 93566cd2443..9913bf3aa2c 100644 --- a/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions.js +++ b/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions.js @@ -103,8 +103,8 @@ promise_test(async testCase => { assert_true(event instanceof ExtendableCookieChangeEvent); assert_true(event instanceof ExtendableEvent); - await async_cleanup(() => { - cookieStore.delete('cookie-name'); + await async_cleanup(async () => { + await cookieStore.delete('cookie-name'); g_cookie_changes = []; RearmCookieChangeReceivedPromise(); }); diff --git a/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_basic.js b/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_basic.js index ef4ddfbd60c..08eef849802 100644 --- a/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_basic.js +++ b/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_basic.js @@ -6,7 +6,7 @@ importScripts("/resources/testharness.js"); self.addEventListener('install', (event) => { event.waitUntil((async () => { - cookieStore.subscribeToChanges([ + await cookieStore.subscribeToChanges([ { name: 'cookie-name', matchType: 'equals', url: '/scope/path' }]); })()); }); @@ -57,7 +57,8 @@ promise_test(async testCase => { assert_true(event instanceof ExtendableCookieChangeEvent); assert_true(event instanceof ExtendableEvent); - await async_cleanup(() => { cookieStore.delete('cookie-name'); }); -}, 'cookiechange dispatched with cookie change that matches subscription'); + await async_cleanup(() => cookieStore.delete('cookie-name')); +}, 'cookiechange dispatched with cookie change that matches subscription ' + + 'to event handler registered with addEventListener'); done(); diff --git a/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_empty.js b/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_empty.js index 0da734d63d1..d355055d08a 100644 --- a/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_empty.js +++ b/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_empty.js @@ -6,7 +6,7 @@ importScripts("/resources/testharness.js"); self.addEventListener('install', (event) => { event.waitUntil((async () => { - cookieStore.subscribeToChanges([]); + await cookieStore.subscribeToChanges([]); })()); }); diff --git a/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_eventhandler_attribute.js b/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_eventhandler_attribute.js new file mode 100644 index 00000000000..1a5b67df353 --- /dev/null +++ b/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_eventhandler_attribute.js @@ -0,0 +1,51 @@ +self.GLOBAL = { + isWindow: function() { return false; }, + isWorker: function() { return true; }, +}; +importScripts("/resources/testharness.js"); + +self.addEventListener('install', (event) => { + event.waitUntil((async () => { + await cookieStore.subscribeToChanges([ + { name: 'cookie-name', matchType: 'equals', url: '/scope/path' }]); + })()); +}); + +// Workaround because add_cleanup doesn't support async functions yet. +// See https://github.com/web-platform-tests/wpt/issues/6075 +async function async_cleanup(cleanup_function) { + try { + await cleanup_function(); + } catch (e) { + // Errors in cleanup functions shouldn't result in test failures. + } +} + +// Resolves when the service worker receives the 'activate' event. +const kServiceWorkerActivatedPromise = new Promise(resolve => { + self.addEventListener('activate', event => { resolve(); }); +}); + +promise_test(async testCase => { + await kServiceWorkerActivatedPromise; + + const cookie_change_received_promise = new Promise((resolve) => { + self.oncookiechange = (event) => { resolve(event); }; + }); + + await cookieStore.set('cookie-name', 'cookie-value'); + + const event = await cookie_change_received_promise; + assert_equals(event.type, 'cookiechange'); + assert_equals(event.changed.length, 1); + assert_equals(event.changed[0].name, 'cookie-name'); + assert_equals(event.changed[0].value, 'cookie-value'); + assert_equals(event.deleted.length, 0); + assert_true(event instanceof ExtendableCookieChangeEvent); + assert_true(event instanceof ExtendableEvent); + + await async_cleanup(() => cookieStore.delete('cookie-name')); +}, 'cookiechange dispatched with cookie change that matches subscription ' + + 'to event handler registered with oncookiechange'); + +done(); diff --git a/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_eventhandler_attribute.tentative.https.html b/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_eventhandler_attribute.tentative.https.html new file mode 100644 index 00000000000..8f9255b4649 --- /dev/null +++ b/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_eventhandler_attribute.tentative.https.html @@ -0,0 +1,22 @@ + + +Async Cookies: oncookiechange event handler attribute in ServiceWorker + + + + + diff --git a/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_mismatch.js b/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_mismatch.js index 5e4ec4355f1..d7230051234 100644 --- a/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_mismatch.js +++ b/tests/wpt/web-platform-tests/cookie-store/serviceworker_cookieStore_subscriptions_mismatch.js @@ -6,7 +6,7 @@ importScripts("/resources/testharness.js"); self.addEventListener('install', (event) => { event.waitUntil((async () => { - cookieStore.subscribeToChanges([ + await cookieStore.subscribeToChanges([ { name: 'cookie-name', matchType: 'equals', url: '/scope/path' }]); })()); }); @@ -44,9 +44,9 @@ promise_test(async testCase => { assert_equals(event.changed[0].name, 'cookie-name'); assert_equals(event.changed[0].value, 'cookie-value'); - await async_cleanup(() => { - cookieStore.delete('another-cookie-name'); - cookieStore.delete('cookie-name'); + await async_cleanup(async () => { + await cookieStore.delete('another-cookie-name'); + await cookieStore.delete('cookie-name'); }); }, 'cookiechange not dispatched for change that does not match subscription'); diff --git a/tests/wpt/web-platform-tests/core-aam/META.yml b/tests/wpt/web-platform-tests/core-aam/META.yml index d99ed62b8e3..0569607ed7d 100644 --- a/tests/wpt/web-platform-tests/core-aam/META.yml +++ b/tests/wpt/web-platform-tests/core-aam/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/core-aam/ suggested_reviewers: - halindrome - joanmarie diff --git a/tests/wpt/web-platform-tests/cors/META.yml b/tests/wpt/web-platform-tests/cors/META.yml index b7e50cdf7b4..08dc73704f9 100644 --- a/tests/wpt/web-platform-tests/cors/META.yml +++ b/tests/wpt/web-platform-tests/cors/META.yml @@ -1,3 +1,4 @@ +spec: https://fetch.spec.whatwg.org/#http-cors-protocol suggested_reviewers: - zqzhang - odinho diff --git a/tests/wpt/web-platform-tests/credential-management/META.yml b/tests/wpt/web-platform-tests/credential-management/META.yml index d0743949b6a..7b186092131 100644 --- a/tests/wpt/web-platform-tests/credential-management/META.yml +++ b/tests/wpt/web-platform-tests/credential-management/META.yml @@ -1,2 +1,3 @@ +spec: https://w3c.github.io/webappsec-credential-management/ suggested_reviewers: - mikewest diff --git a/tests/wpt/web-platform-tests/css/CSS1/META.yml b/tests/wpt/web-platform-tests/css/CSS1/META.yml index 98c404edff8..f9226393775 100644 --- a/tests/wpt/web-platform-tests/css/CSS1/META.yml +++ b/tests/wpt/web-platform-tests/css/CSS1/META.yml @@ -1,2 +1,3 @@ +spec: https://www.w3.org/TR/CSS1/ suggested_reviewers: - fantasai diff --git a/tests/wpt/web-platform-tests/css/CSS2/META.yml b/tests/wpt/web-platform-tests/css/CSS2/META.yml index c8479a1247d..4ac0804d36d 100644 --- a/tests/wpt/web-platform-tests/css/CSS2/META.yml +++ b/tests/wpt/web-platform-tests/css/CSS2/META.yml @@ -1,9 +1,8 @@ +spec: https://drafts.csswg.org/css2/ suggested_reviewers: - fantasai - dbaron - svgeesus - - chenxix - kojiishi - - kwkbtr - frivoal - bert-github diff --git a/tests/wpt/web-platform-tests/css/CSS2/floats/floats-line-wrap-shifted-001-ref.html b/tests/wpt/web-platform-tests/css/CSS2/floats/floats-line-wrap-shifted-001-ref.html new file mode 100644 index 00000000000..ab06bba5240 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/CSS2/floats/floats-line-wrap-shifted-001-ref.html @@ -0,0 +1,23 @@ + + + + +
+ 1111
+ 2222 3333 +
+
+ + diff --git a/tests/wpt/web-platform-tests/css/CSS2/floats/floats-line-wrap-shifted-001.html b/tests/wpt/web-platform-tests/css/CSS2/floats/floats-line-wrap-shifted-001.html new file mode 100644 index 00000000000..c3f8a636839 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/CSS2/floats/floats-line-wrap-shifted-001.html @@ -0,0 +1,45 @@ + + + + + + + + + + +
+ 1111 + + 2222 + +
+ + 3333 +
+
+ diff --git a/tests/wpt/web-platform-tests/css/WOFF2/META.yml b/tests/wpt/web-platform-tests/css/WOFF2/META.yml index a9745dbefa2..a4ff5b19e74 100644 --- a/tests/wpt/web-platform-tests/css/WOFF2/META.yml +++ b/tests/wpt/web-platform-tests/css/WOFF2/META.yml @@ -1,4 +1,4 @@ +spec: https://w3c.github.io/woff/woff2/ suggested_reviewers: - svgeesus - - khaledhosny - rsheeter diff --git a/tests/wpt/web-platform-tests/css/compositing/META.yml b/tests/wpt/web-platform-tests/css/compositing/META.yml index 83b4c357126..e9fad203a3d 100644 --- a/tests/wpt/web-platform-tests/css/compositing/META.yml +++ b/tests/wpt/web-platform-tests/css/compositing/META.yml @@ -1,4 +1,4 @@ +spec: https://drafts.fxtf.org/compositing/ suggested_reviewers: - - cabanier - plinss - nikosandronikos diff --git a/tests/wpt/web-platform-tests/css/css-align/META.yml b/tests/wpt/web-platform-tests/css/css-align/META.yml index 3e293c4fd9a..1dc14690529 100644 --- a/tests/wpt/web-platform-tests/css/css-align/META.yml +++ b/tests/wpt/web-platform-tests/css/css-align/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-align/ suggested_reviewers: - dholbert - emilio diff --git a/tests/wpt/web-platform-tests/css/css-animations/META.yml b/tests/wpt/web-platform-tests/css/css-animations/META.yml index bd987aa1a85..3ef19970007 100644 --- a/tests/wpt/web-platform-tests/css/css-animations/META.yml +++ b/tests/wpt/web-platform-tests/css/css-animations/META.yml @@ -1,7 +1,6 @@ +spec: https://drafts.csswg.org/css-animations/ suggested_reviewers: - plinss - - chunywang - - yunxiaoxie - grorg - dbaron - tabatkins diff --git a/tests/wpt/web-platform-tests/css/css-animations/idlharness.html b/tests/wpt/web-platform-tests/css/css-animations/idlharness.html index 2c6191d4fd6..9c03c7c07d3 100644 --- a/tests/wpt/web-platform-tests/css/css-animations/idlharness.html +++ b/tests/wpt/web-platform-tests/css/css-animations/idlharness.html @@ -14,23 +14,34 @@
+ + - diff --git a/tests/wpt/web-platform-tests/css/css-animations/support/testcommon.js b/tests/wpt/web-platform-tests/css/css-animations/support/testcommon.js index affc34bedb6..b4fde4b967d 100644 --- a/tests/wpt/web-platform-tests/css/css-animations/support/testcommon.js +++ b/tests/wpt/web-platform-tests/css/css-animations/support/testcommon.js @@ -103,8 +103,6 @@ function waitForFrame() { /** * Waits for a requestAnimationFrame callback in the next refresh driver tick. - * Note that 'dom.animations-api.core.enabled' pref should be true to use this - * function. */ function waitForNextFrame() { const timeAtStart = document.timeline.currentTime; diff --git a/tests/wpt/web-platform-tests/css/css-backgrounds/META.yml b/tests/wpt/web-platform-tests/css/css-backgrounds/META.yml index 8e37320c5b0..d90a6e083b6 100644 --- a/tests/wpt/web-platform-tests/css/css-backgrounds/META.yml +++ b/tests/wpt/web-platform-tests/css/css-backgrounds/META.yml @@ -1,5 +1,5 @@ +spec: https://drafts.csswg.org/css-backgrounds/ suggested_reviewers: - - chenxix - dbaron - bert-github - fantasai diff --git a/tests/wpt/web-platform-tests/css/css-backgrounds/background-size-with-negative-value.html b/tests/wpt/web-platform-tests/css/css-backgrounds/background-size-with-negative-value.html new file mode 100644 index 00000000000..a9d57f86d60 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-backgrounds/background-size-with-negative-value.html @@ -0,0 +1,33 @@ + + + + + CSS Backgrounds and Borders Test: background-size - negative value + + + + + + + + +

Test passes if there is a filled green square and no red.

+
+
+ + diff --git a/tests/wpt/web-platform-tests/css/css-backgrounds/parsing/background-color-valid.html b/tests/wpt/web-platform-tests/css/css-backgrounds/parsing/background-color-valid.html index e5f582f820e..d7a5d967d55 100644 --- a/tests/wpt/web-platform-tests/css/css-backgrounds/parsing/background-color-valid.html +++ b/tests/wpt/web-platform-tests/css/css-backgrounds/parsing/background-color-valid.html @@ -12,9 +12,8 @@ + + + + +
+FOO
BAR
+
+ +
+FOO
BAR
+
+ +
+FOO
BAR
+
+ + diff --git a/tests/wpt/web-platform-tests/css/css-cascade/META.yml b/tests/wpt/web-platform-tests/css/css-cascade/META.yml index 27a5735cc45..96467729fe9 100644 --- a/tests/wpt/web-platform-tests/css/css-cascade/META.yml +++ b/tests/wpt/web-platform-tests/css/css-cascade/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-cascade/ suggested_reviewers: - fantasai - tabatkins diff --git a/tests/wpt/web-platform-tests/css/css-cascade/parsing/all-invalid.html b/tests/wpt/web-platform-tests/css/css-cascade/parsing/all-invalid.html new file mode 100644 index 00000000000..8b7c044a034 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-cascade/parsing/all-invalid.html @@ -0,0 +1,24 @@ + + + + +CSS Cascading and Inheritance Level 3: parsing all with invalid values + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/css/css-cascade/parsing/all-valid.html b/tests/wpt/web-platform-tests/css/css-cascade/parsing/all-valid.html new file mode 100644 index 00000000000..668a6c24241 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-cascade/parsing/all-valid.html @@ -0,0 +1,20 @@ + + + + +CSS Cascading and Inheritance Level 3: parsing all with valid values + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/css/css-cascade/parsing/support/parsing-testcommon.js b/tests/wpt/web-platform-tests/css/css-cascade/parsing/support/parsing-testcommon.js new file mode 100644 index 00000000000..b075882f89a --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-cascade/parsing/support/parsing-testcommon.js @@ -0,0 +1,39 @@ +'use strict'; + +// serializedValue can be the expected serialization of value, +// or an array of permitted serializations, +// or omitted if value should serialize as value. +function test_valid_value(property, value, serializedValue) { + if (arguments.length < 3) + serializedValue = value; + + var stringifiedValue = JSON.stringify(value); + + test(function(){ + var div = document.createElement('div'); + div.style[property] = value; + assert_not_equals(div.style.getPropertyValue(property), "", "property should be set"); + + var div = document.createElement('div'); + div.style[property] = value; + var readValue = div.style.getPropertyValue(property); + if (serializedValue instanceof Array) + assert_in_array(readValue, serializedValue, "serialization should be sound"); + else + assert_equals(readValue, serializedValue, "serialization should be canonical"); + + div.style[property] = readValue; + assert_equals(div.style.getPropertyValue(property), readValue, "serialization should round-trip"); + + }, "e.style['" + property + "'] = " + stringifiedValue + " should set the property value"); +} + +function test_invalid_value(property, value) { + var stringifiedValue = JSON.stringify(value); + + test(function(){ + var div = document.createElement('div'); + div.style[property] = value; + assert_equals(div.style.getPropertyValue(property), ""); + }, "e.style['" + property + "'] = " + stringifiedValue + " should not set the property value"); +} diff --git a/tests/wpt/web-platform-tests/css/css-color/META.yml b/tests/wpt/web-platform-tests/css/css-color/META.yml index 0ca5cb15304..a8d93c12a94 100644 --- a/tests/wpt/web-platform-tests/css/css-color/META.yml +++ b/tests/wpt/web-platform-tests/css/css-color/META.yml @@ -1,7 +1,6 @@ +spec: https://drafts.csswg.org/css-color/ suggested_reviewers: - dbaron - - JianfengXu - - chenxix - tantek - svgeesus - tabatkins diff --git a/tests/wpt/web-platform-tests/css/css-color/parsing/color-invalid.html b/tests/wpt/web-platform-tests/css/css-color/parsing/color-invalid.html new file mode 100644 index 00000000000..978eb895a2a --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-color/parsing/color-invalid.html @@ -0,0 +1,27 @@ + + + + +CSS Color Module Level 3: parsing color with invalid values + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/css/css-color/parsing/color-valid.html b/tests/wpt/web-platform-tests/css/css-color/parsing/color-valid.html new file mode 100644 index 00000000000..e94eb38f695 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-color/parsing/color-valid.html @@ -0,0 +1,32 @@ + + + + +CSS Color Module Level 3: parsing color with valid values + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/css/css-color/parsing/opacity-invalid.html b/tests/wpt/web-platform-tests/css/css-color/parsing/opacity-invalid.html new file mode 100644 index 00000000000..955903ff354 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-color/parsing/opacity-invalid.html @@ -0,0 +1,20 @@ + + + + +CSS opacity Module Level 3: parsing opacity with invalid values + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/css/css-color/parsing/opacity-valid.html b/tests/wpt/web-platform-tests/css/css-color/parsing/opacity-valid.html new file mode 100644 index 00000000000..738c3d07706 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-color/parsing/opacity-valid.html @@ -0,0 +1,22 @@ + + + + +CSS opacity Module Level 3: parsing opacity with valid values + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/css/css-color/parsing/resources/parsing-testcommon.js b/tests/wpt/web-platform-tests/css/css-color/parsing/resources/parsing-testcommon.js new file mode 100644 index 00000000000..b075882f89a --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-color/parsing/resources/parsing-testcommon.js @@ -0,0 +1,39 @@ +'use strict'; + +// serializedValue can be the expected serialization of value, +// or an array of permitted serializations, +// or omitted if value should serialize as value. +function test_valid_value(property, value, serializedValue) { + if (arguments.length < 3) + serializedValue = value; + + var stringifiedValue = JSON.stringify(value); + + test(function(){ + var div = document.createElement('div'); + div.style[property] = value; + assert_not_equals(div.style.getPropertyValue(property), "", "property should be set"); + + var div = document.createElement('div'); + div.style[property] = value; + var readValue = div.style.getPropertyValue(property); + if (serializedValue instanceof Array) + assert_in_array(readValue, serializedValue, "serialization should be sound"); + else + assert_equals(readValue, serializedValue, "serialization should be canonical"); + + div.style[property] = readValue; + assert_equals(div.style.getPropertyValue(property), readValue, "serialization should round-trip"); + + }, "e.style['" + property + "'] = " + stringifiedValue + " should set the property value"); +} + +function test_invalid_value(property, value) { + var stringifiedValue = JSON.stringify(value); + + test(function(){ + var div = document.createElement('div'); + div.style[property] = value; + assert_equals(div.style.getPropertyValue(property), ""); + }, "e.style['" + property + "'] = " + stringifiedValue + " should not set the property value"); +} diff --git a/tests/wpt/web-platform-tests/css/css-conditional/META.yml b/tests/wpt/web-platform-tests/css/css-conditional/META.yml index 56e9d3d11f6..ae24e3b1f6b 100644 --- a/tests/wpt/web-platform-tests/css/css-conditional/META.yml +++ b/tests/wpt/web-platform-tests/css/css-conditional/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-conditional/ suggested_reviewers: - dbaron - frivoal diff --git a/tests/wpt/web-platform-tests/css/css-contain/META.yml b/tests/wpt/web-platform-tests/css/css-contain/META.yml index bfbf8277e29..259c00b2a58 100644 --- a/tests/wpt/web-platform-tests/css/css-contain/META.yml +++ b/tests/wpt/web-platform-tests/css/css-contain/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-contain/ suggested_reviewers: - tabatkins - frivoal diff --git a/tests/wpt/web-platform-tests/css/css-contain/contain-size-borders.html b/tests/wpt/web-platform-tests/css/css-contain/contain-size-borders.html new file mode 100644 index 00000000000..16b5b06295f --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-contain/contain-size-borders.html @@ -0,0 +1,9 @@ + +contain:size on auto-height block width vertical borders + + + +

Test passes if there is a filled green square and no red.

+
+
+
diff --git a/tests/wpt/web-platform-tests/css/css-content/META.yml b/tests/wpt/web-platform-tests/css/css-content/META.yml index 7897951a189..848b42b9559 100644 --- a/tests/wpt/web-platform-tests/css/css-content/META.yml +++ b/tests/wpt/web-platform-tests/css/css-content/META.yml @@ -1,2 +1,3 @@ +spec: https://drafts.csswg.org/css-content/ suggested_reviewers: - dauwhe diff --git a/tests/wpt/web-platform-tests/css/css-content/element-replacement-alt-ref.html b/tests/wpt/web-platform-tests/css/css-content/element-replacement-alt-ref.html new file mode 100644 index 00000000000..ef8a6f3953c --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-content/element-replacement-alt-ref.html @@ -0,0 +1,4 @@ + +CSS Test Reference + +
diff --git a/tests/wpt/web-platform-tests/css/css-content/element-replacement-alt.html b/tests/wpt/web-platform-tests/css/css-content/element-replacement-alt.html new file mode 100644 index 00000000000..e9ee9344c26 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-content/element-replacement-alt.html @@ -0,0 +1,6 @@ + +The content CSS property with a broken image doesn't pull the alt attribute from that element + + + +
FAIL
diff --git a/tests/wpt/web-platform-tests/css/css-content/element-replacement-display-contents.html b/tests/wpt/web-platform-tests/css/css-content/element-replacement-display-contents.html new file mode 100644 index 00000000000..2723ff00659 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-content/element-replacement-display-contents.html @@ -0,0 +1,12 @@ + +The content CSS property doesn't override display: contents + + + + +
diff --git a/tests/wpt/web-platform-tests/css/css-content/element-replacement-display-none.html b/tests/wpt/web-platform-tests/css/css-content/element-replacement-display-none.html new file mode 100644 index 00000000000..bee1b0e01a1 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-content/element-replacement-display-none.html @@ -0,0 +1,12 @@ + +The content CSS property doesn't override display: none + + + + +
FAIL
diff --git a/tests/wpt/web-platform-tests/css/css-content/pseudo-element-inline-box-ref.html b/tests/wpt/web-platform-tests/css/css-content/pseudo-element-inline-box-ref.html new file mode 100644 index 00000000000..8294ae672d1 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-content/pseudo-element-inline-box-ref.html @@ -0,0 +1,8 @@ + +CSS Test Reference +

Should see a green image with a blue border

+
+ + + +
diff --git a/tests/wpt/web-platform-tests/css/css-content/pseudo-element-inline-box.html b/tests/wpt/web-platform-tests/css/css-content/pseudo-element-inline-box.html new file mode 100644 index 00000000000..5c1666261e9 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-content/pseudo-element-inline-box.html @@ -0,0 +1,15 @@ + +CSS Test: content: url() on pseudo-elements is under a non-replaced box. + + + + + +

Should see a green image with a blue border

+
diff --git a/tests/wpt/web-platform-tests/css/css-content/resources/blank.html b/tests/wpt/web-platform-tests/css/css-content/resources/blank.html new file mode 100644 index 00000000000..0a673e5b2a9 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-content/resources/blank.html @@ -0,0 +1,4 @@ + +CSS Test Reference + + diff --git a/tests/wpt/web-platform-tests/css/css-counter-styles/META.yml b/tests/wpt/web-platform-tests/css/css-counter-styles/META.yml index 24f3b8c52df..9b220d37977 100644 --- a/tests/wpt/web-platform-tests/css/css-counter-styles/META.yml +++ b/tests/wpt/web-platform-tests/css/css-counter-styles/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-counter-styles/ suggested_reviewers: - r12a - svgeesus diff --git a/tests/wpt/web-platform-tests/css/css-display/META.yml b/tests/wpt/web-platform-tests/css/css-display/META.yml index 282867cd618..4e70cb46303 100644 --- a/tests/wpt/web-platform-tests/css/css-display/META.yml +++ b/tests/wpt/web-platform-tests/css/css-display/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-display/ suggested_reviewers: - kojiishi - tabatkins diff --git a/tests/wpt/web-platform-tests/css/css-env/META.yml b/tests/wpt/web-platform-tests/css/css-env/META.yml index 51a24d0b7a3..9d264a62281 100644 --- a/tests/wpt/web-platform-tests/css/css-env/META.yml +++ b/tests/wpt/web-platform-tests/css/css-env/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-env/ suggested_reviewers: - rebeccahughes - lilles diff --git a/tests/wpt/web-platform-tests/css/css-exclusions/META.yml b/tests/wpt/web-platform-tests/css/css-exclusions/META.yml index 7b29dfcbe63..a954d85bb54 100644 --- a/tests/wpt/web-platform-tests/css/css-exclusions/META.yml +++ b/tests/wpt/web-platform-tests/css/css-exclusions/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-exclusions/ suggested_reviewers: - atanassov - astearns diff --git a/tests/wpt/web-platform-tests/css/css-fill-stroke/META.yml b/tests/wpt/web-platform-tests/css/css-fill-stroke/META.yml index 8c35c8e1dd7..237aea970a3 100644 --- a/tests/wpt/web-platform-tests/css/css-fill-stroke/META.yml +++ b/tests/wpt/web-platform-tests/css/css-fill-stroke/META.yml @@ -1,2 +1,3 @@ +spec: https://drafts.fxtf.org/fill-stroke/ suggested_reviewers: - tabatkins diff --git a/tests/wpt/web-platform-tests/css/css-filter/META.yml b/tests/wpt/web-platform-tests/css/css-filter/META.yml index a477613d074..8d0683319b0 100644 --- a/tests/wpt/web-platform-tests/css/css-filter/META.yml +++ b/tests/wpt/web-platform-tests/css/css-filter/META.yml @@ -1,2 +1,3 @@ +spec: https://drafts.fxtf.org/filter-effects/ suggested_reviewers: - chrishtr diff --git a/tests/wpt/web-platform-tests/css/css-flexbox/META.yml b/tests/wpt/web-platform-tests/css/css-flexbox/META.yml index a240d65eef1..64946c1e114 100644 --- a/tests/wpt/web-platform-tests/css/css-flexbox/META.yml +++ b/tests/wpt/web-platform-tests/css/css-flexbox/META.yml @@ -1,9 +1,9 @@ +spec: https://drafts.csswg.org/css-flexbox/ suggested_reviewers: - kojiishi - plinss - mrego - cbiesinger - - chenxix - atanassov - fantasai - tabatkins diff --git a/tests/wpt/web-platform-tests/css/css-font-loading/META.yml b/tests/wpt/web-platform-tests/css/css-font-loading/META.yml index 2b0d8067d85..3ac9b655b06 100644 --- a/tests/wpt/web-platform-tests/css/css-font-loading/META.yml +++ b/tests/wpt/web-platform-tests/css/css-font-loading/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-font-loading/ suggested_reviewers: - tabatkins - svgeesus diff --git a/tests/wpt/web-platform-tests/css/css-font-loading/idlharness.https.html b/tests/wpt/web-platform-tests/css/css-font-loading/idlharness.https.html index 037e62f9949..d507a61efaf 100644 --- a/tests/wpt/web-platform-tests/css/css-font-loading/idlharness.https.html +++ b/tests/wpt/web-platform-tests/css/css-font-loading/idlharness.https.html @@ -6,25 +6,24 @@ diff --git a/tests/wpt/web-platform-tests/css/css-fonts/META.yml b/tests/wpt/web-platform-tests/css/css-fonts/META.yml index 821246ae021..3c34ca4e751 100644 --- a/tests/wpt/web-platform-tests/css/css-fonts/META.yml +++ b/tests/wpt/web-platform-tests/css/css-fonts/META.yml @@ -1,6 +1,5 @@ +spec: https://drafts.csswg.org/css-fonts/ suggested_reviewers: - svgeesus - - yunxiaoxie - - nattokirai - litherum - drott diff --git a/tests/wpt/web-platform-tests/css/css-fonts/matching/META.yml b/tests/wpt/web-platform-tests/css/css-fonts/matching/META.yml index 214ee71738c..53487a6d85e 100644 --- a/tests/wpt/web-platform-tests/css/css-fonts/matching/META.yml +++ b/tests/wpt/web-platform-tests/css/css-fonts/matching/META.yml @@ -2,5 +2,4 @@ suggested_reviewers: - drott - fantasai - litherum - - nattokirai - svgeesus diff --git a/tests/wpt/web-platform-tests/css/css-fonts/variations/META.yml b/tests/wpt/web-platform-tests/css/css-fonts/variations/META.yml index 214ee71738c..53487a6d85e 100644 --- a/tests/wpt/web-platform-tests/css/css-fonts/variations/META.yml +++ b/tests/wpt/web-platform-tests/css/css-fonts/variations/META.yml @@ -2,5 +2,4 @@ suggested_reviewers: - drott - fantasai - litherum - - nattokirai - svgeesus diff --git a/tests/wpt/web-platform-tests/css/css-gcpm/META.yml b/tests/wpt/web-platform-tests/css/css-gcpm/META.yml index 8b57f87d3d2..b2e33e393da 100644 --- a/tests/wpt/web-platform-tests/css/css-gcpm/META.yml +++ b/tests/wpt/web-platform-tests/css/css-gcpm/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-gcpm/ suggested_reviewers: - plinss - dauwhe diff --git a/tests/wpt/web-platform-tests/css/css-grid/META.yml b/tests/wpt/web-platform-tests/css/css-grid/META.yml index e095d62963d..f8482e16f98 100644 --- a/tests/wpt/web-platform-tests/css/css-grid/META.yml +++ b/tests/wpt/web-platform-tests/css/css-grid/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-grid/ suggested_reviewers: - mrego - tomalec diff --git a/tests/wpt/web-platform-tests/css/css-images/META.yml b/tests/wpt/web-platform-tests/css/css-images/META.yml index 98fc86cc344..8d3b9472b2c 100644 --- a/tests/wpt/web-platform-tests/css/css-images/META.yml +++ b/tests/wpt/web-platform-tests/css/css-images/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-images/ suggested_reviewers: - plinss - tabatkins diff --git a/tests/wpt/web-platform-tests/css/css-images/img-orient-012.xht b/tests/wpt/web-platform-tests/css/css-images/img-orient-012.xht deleted file mode 100644 index 9bfbfa5ed15..00000000000 --- a/tests/wpt/web-platform-tests/css/css-images/img-orient-012.xht +++ /dev/null @@ -1,18 +0,0 @@ - - - - CSS Test: Image Orientation - Negative Values - - - - - - -
-

This arrow should appear sideways, with the tip of the arrow pointing left.

- FAIL: missing image -
- - \ No newline at end of file diff --git a/tests/wpt/web-platform-tests/css/css-images/parsing/image-orientation-invalid.html b/tests/wpt/web-platform-tests/css/css-images/parsing/image-orientation-invalid.html index b36d9b7dd55..c16c7bd91af 100644 --- a/tests/wpt/web-platform-tests/css/css-images/parsing/image-orientation-invalid.html +++ b/tests/wpt/web-platform-tests/css/css-images/parsing/image-orientation-invalid.html @@ -5,7 +5,7 @@ CSS Images Module Level 3: parsing image-orientation with invalid values - + @@ -13,7 +13,6 @@ diff --git a/tests/wpt/web-platform-tests/css/css-images/parsing/image-orientation-valid.html b/tests/wpt/web-platform-tests/css/css-images/parsing/image-orientation-valid.html index 1ed7548834d..d2d24baf608 100644 --- a/tests/wpt/web-platform-tests/css/css-images/parsing/image-orientation-valid.html +++ b/tests/wpt/web-platform-tests/css/css-images/parsing/image-orientation-valid.html @@ -5,7 +5,7 @@ CSS Images Module Level 3: parsing image-orientation with valid values - + @@ -13,9 +13,7 @@ diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/META.yml b/tests/wpt/web-platform-tests/css/css-layout-api/META.yml index 13be206a710..c85c2d4ccc0 100644 --- a/tests/wpt/web-platform-tests/css/css-layout-api/META.yml +++ b/tests/wpt/web-platform-tests/css/css-layout-api/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.css-houdini.org/css-layout-api/ suggested_reviewers: - bfgeek - tabatkins diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/box-tree-unregistered-ref.html b/tests/wpt/web-platform-tests/css/css-layout-api/box-tree-unregistered-ref.html index fc43ad2fec9..20312cff8f0 100644 --- a/tests/wpt/web-platform-tests/css/css-layout-api/box-tree-unregistered-ref.html +++ b/tests/wpt/web-platform-tests/css/css-layout-api/box-tree-unregistered-ref.html @@ -1,6 +1,7 @@ + +
+
+
+ + diff --git a/tests/wpt/web-platform-tests/css/css-properties-values-api/register-property-syntax-parsing.html b/tests/wpt/web-platform-tests/css/css-properties-values-api/register-property-syntax-parsing.html index 500add40ef3..15a4ab6040e 100644 --- a/tests/wpt/web-platform-tests/css/css-properties-values-api/register-property-syntax-parsing.html +++ b/tests/wpt/web-platform-tests/css/css-properties-values-api/register-property-syntax-parsing.html @@ -10,7 +10,7 @@ function assert_valid(syntax, initialValue) { // No actual assertions, this just shouldn't throw test(function() { var name = '--syntax-test-' + (test_count++); - CSS.registerProperty({name: name, syntax: syntax, initialValue: initialValue}); + CSS.registerProperty({name: name, syntax: syntax, initialValue: initialValue, inherits: false}); }, "syntax:'" + syntax + "', initialValue:'" + initialValue + "' is valid"); } @@ -18,7 +18,7 @@ function assert_invalid(syntax, initialValue) { test(function(){ var name = '--syntax-test-' + (test_count++); assert_throws(new SyntaxError(), - () => CSS.registerProperty({name: name, syntax: syntax, initialValue: initialValue})); + () => CSS.registerProperty({name: name, syntax: syntax, initialValue: initialValue, inherits: false})); }, "syntax:'" + syntax + "', initialValue:'" + initialValue + "' is invalid"); } @@ -64,6 +64,10 @@ assert_valid("
\ No newline at end of file + diff --git a/tests/wpt/web-platform-tests/css/css-scroll-snap/snap-inline-block.html b/tests/wpt/web-platform-tests/css/css-scroll-snap/snap-inline-block.html index d41dcc8a759..ea1442f6706 100644 --- a/tests/wpt/web-platform-tests/css/css-scroll-snap/snap-inline-block.html +++ b/tests/wpt/web-platform-tests/css/css-scroll-snap/snap-inline-block.html @@ -22,7 +22,7 @@ div { height: 200px; left: 300px; top: 300px; - scroll-snap-align: start end; + scroll-snap-align: end start; } diff --git a/tests/wpt/web-platform-tests/css/css-scrollbars/META.yml b/tests/wpt/web-platform-tests/css/css-scrollbars/META.yml index c0212134b02..9209d5d1f41 100644 --- a/tests/wpt/web-platform-tests/css/css-scrollbars/META.yml +++ b/tests/wpt/web-platform-tests/css/css-scrollbars/META.yml @@ -1,2 +1,3 @@ +spec: https://drafts.csswg.org/css-scrollbars/ suggested_reviewers: - tantek diff --git a/tests/wpt/web-platform-tests/css/css-shadow-parts/META.yml b/tests/wpt/web-platform-tests/css/css-shadow-parts/META.yml index 8c35c8e1dd7..6cce42664a6 100644 --- a/tests/wpt/web-platform-tests/css/css-shadow-parts/META.yml +++ b/tests/wpt/web-platform-tests/css/css-shadow-parts/META.yml @@ -1,2 +1,3 @@ +spec: https://drafts.csswg.org/css-shadow-parts/ suggested_reviewers: - tabatkins diff --git a/tests/wpt/web-platform-tests/css/css-shapes/META.yml b/tests/wpt/web-platform-tests/css/css-shapes/META.yml index 4c8e01c330e..99136818e66 100644 --- a/tests/wpt/web-platform-tests/css/css-shapes/META.yml +++ b/tests/wpt/web-platform-tests/css/css-shapes/META.yml @@ -1,7 +1,7 @@ +spec: https://drafts.csswg.org/css-shapes/ suggested_reviewers: - bemjb - kojiishi - - zhorvath - plinss - atanassov - astearns diff --git a/tests/wpt/web-platform-tests/css/css-sizing/META.yml b/tests/wpt/web-platform-tests/css/css-sizing/META.yml index 543b992c969..086e654a8e0 100644 --- a/tests/wpt/web-platform-tests/css/css-sizing/META.yml +++ b/tests/wpt/web-platform-tests/css/css-sizing/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-sizing/ suggested_reviewers: - tabatkins - fantasai diff --git a/tests/wpt/web-platform-tests/css/css-speech/META.yml b/tests/wpt/web-platform-tests/css/css-speech/META.yml index d407d55822a..b0097dd021a 100644 --- a/tests/wpt/web-platform-tests/css/css-speech/META.yml +++ b/tests/wpt/web-platform-tests/css/css-speech/META.yml @@ -1,2 +1,4 @@ +spec: https://drafts.csswg.org/css-speech/ suggested_reviewers: - danielweck + - musingvirtual diff --git a/tests/wpt/web-platform-tests/css/css-style-attr/META.yml b/tests/wpt/web-platform-tests/css/css-style-attr/META.yml index a5413c1ffde..72438735ccd 100644 --- a/tests/wpt/web-platform-tests/css/css-style-attr/META.yml +++ b/tests/wpt/web-platform-tests/css/css-style-attr/META.yml @@ -1,4 +1,4 @@ +spec: https://drafts.csswg.org/css-style-attr/ suggested_reviewers: - - chenxix - tantek - fantasai diff --git a/tests/wpt/web-platform-tests/css/css-syntax/META.yml b/tests/wpt/web-platform-tests/css/css-syntax/META.yml index 7fbd2ffb23f..17489e1bc21 100644 --- a/tests/wpt/web-platform-tests/css/css-syntax/META.yml +++ b/tests/wpt/web-platform-tests/css/css-syntax/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-syntax/ suggested_reviewers: - gregwhitworth - tabatkins diff --git a/tests/wpt/web-platform-tests/css/css-tables/META.yml b/tests/wpt/web-platform-tests/css/css-tables/META.yml index 2e007116112..ac81381ef56 100644 --- a/tests/wpt/web-platform-tests/css/css-tables/META.yml +++ b/tests/wpt/web-platform-tests/css/css-tables/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-tables/ suggested_reviewers: - dbaron - FremyCompany diff --git a/tests/wpt/web-platform-tests/css/css-tables/anonymous-table-cell-margin-collapsing.html b/tests/wpt/web-platform-tests/css/css-tables/anonymous-table-cell-margin-collapsing.html new file mode 100644 index 00000000000..23b467ebacc --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-tables/anonymous-table-cell-margin-collapsing.html @@ -0,0 +1,20 @@ + +Anonymous table cells with semi-complex margin collapsing inside + + + +

Test passes if there is a filled green square and no red.

+
+
+
+
+
+
+
+
+
+
+ +
+
diff --git a/tests/wpt/web-platform-tests/css/css-text-decor/META.yml b/tests/wpt/web-platform-tests/css/css-text-decor/META.yml index 6f911b29e8a..51a4fba49fc 100644 --- a/tests/wpt/web-platform-tests/css/css-text-decor/META.yml +++ b/tests/wpt/web-platform-tests/css/css-text-decor/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-text-decor/ suggested_reviewers: - kojiishi - fantasai diff --git a/tests/wpt/web-platform-tests/css/css-text/META.yml b/tests/wpt/web-platform-tests/css/css-text/META.yml index 0c0c8b4e69e..042b858557d 100644 --- a/tests/wpt/web-platform-tests/css/css-text/META.yml +++ b/tests/wpt/web-platform-tests/css/css-text/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-text/ suggested_reviewers: - kojiishi - plinss diff --git a/tests/wpt/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-break-word-002.html b/tests/wpt/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-break-word-002.html index f4e94939ce5..660b7f16302 100644 --- a/tests/wpt/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-break-word-002.html +++ b/tests/wpt/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-break-word-002.html @@ -1,9 +1,9 @@ -CSS Text Test: overflow-wrap: break-word+break-spaces +CSS Text Test: overflow-wrap: break-word + white-space:break-spaces - + + +

Test passes if there is a filled green square and no red.

+

XXXXX
+
XXXXX
+ diff --git a/tests/wpt/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html b/tests/wpt/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html new file mode 100644 index 00000000000..5b3b1f19d7a --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html @@ -0,0 +1,24 @@ + + +CSS Text Test: overflow-wrap: break-word and intrinsic sizing + + + + + + + + +

Test passes if the glyphs are completely inside the blue box. +

+
நிிிிநிிிி
+
diff --git a/tests/wpt/web-platform-tests/css/css-text/overflow-wrap/reference/overflow-wrap-break-word-003-ref.html b/tests/wpt/web-platform-tests/css/css-text/overflow-wrap/reference/overflow-wrap-break-word-003-ref.html index 6f7315d6f40..e9ec3b346c0 100644 --- a/tests/wpt/web-platform-tests/css/css-text/overflow-wrap/reference/overflow-wrap-break-word-003-ref.html +++ b/tests/wpt/web-platform-tests/css/css-text/overflow-wrap/reference/overflow-wrap-break-word-003-ref.html @@ -1,6 +1,6 @@ -CSS Text Test: overflow-wrap: break-word+break-spaces +CSS Text Test reference + +

Test passes if the glyphs are completely inside the blue box. +

+
நிிிி
நிிிி
+
diff --git a/tests/wpt/web-platform-tests/css/css-text/white-space/pre-wrap-008.html b/tests/wpt/web-platform-tests/css/css-text/white-space/break-spaces-001.html similarity index 74% rename from tests/wpt/web-platform-tests/css/css-text/white-space/pre-wrap-008.html rename to tests/wpt/web-platform-tests/css/css-text/white-space/break-spaces-001.html index e739a21e9f7..a1a498e11be 100644 --- a/tests/wpt/web-platform-tests/css/css-text/white-space/pre-wrap-008.html +++ b/tests/wpt/web-platform-tests/css/css-text/white-space/break-spaces-001.html @@ -1,23 +1,22 @@ -CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap is wrapped when overflow-wrap is break-spaces +CSS Text level 3 Test: preserved white space at the end of line and white-space is break-spaces - + - + diff --git a/tests/wpt/web-platform-tests/css/css-text/white-space/pre-wrap-009.html b/tests/wpt/web-platform-tests/css/css-text/white-space/break-spaces-002.html similarity index 79% rename from tests/wpt/web-platform-tests/css/css-text/white-space/pre-wrap-009.html rename to tests/wpt/web-platform-tests/css/css-text/white-space/break-spaces-002.html index a70ad8ff6c6..dd9b9919fbb 100644 --- a/tests/wpt/web-platform-tests/css/css-text/white-space/pre-wrap-009.html +++ b/tests/wpt/web-platform-tests/css/css-text/white-space/break-spaces-002.html @@ -1,23 +1,22 @@ -CSS Text level 3 Test: single preserved white space at the end of with white-space:pre-wrap overflow-wrap:break-spaces +CSS Text level 3 Test: single preserved white space at the end of line with white-space:break-spaces - + - + diff --git a/tests/wpt/web-platform-tests/css/css-text/white-space/pre-wrap-010.html b/tests/wpt/web-platform-tests/css/css-text/white-space/break-spaces-003.html similarity index 77% rename from tests/wpt/web-platform-tests/css/css-text/white-space/pre-wrap-010.html rename to tests/wpt/web-platform-tests/css/css-text/white-space/break-spaces-003.html index c00fe74209b..58ec3f3cbd9 100644 --- a/tests/wpt/web-platform-tests/css/css-text/white-space/pre-wrap-010.html +++ b/tests/wpt/web-platform-tests/css/css-text/white-space/break-spaces-003.html @@ -1,23 +1,24 @@ -CSS Text level 3 Test: single preserved white space at the end of with white-space:pre-wrap overflow-wrap:break-spaces break-word +CSS Text level 3 Test: single preserved white space at the end of the line with white-space:break-spaces overflow-wrap:break-word + - + diff --git a/tests/wpt/web-platform-tests/css/css-text/white-space/textarea-pre-wrap-008.html b/tests/wpt/web-platform-tests/css/css-text/white-space/textarea-break-spaces-001.html similarity index 78% rename from tests/wpt/web-platform-tests/css/css-text/white-space/textarea-pre-wrap-008.html rename to tests/wpt/web-platform-tests/css/css-text/white-space/textarea-break-spaces-001.html index 71eca500d3c..b109f45913c 100644 --- a/tests/wpt/web-platform-tests/css/css-text/white-space/textarea-pre-wrap-008.html +++ b/tests/wpt/web-platform-tests/css/css-text/white-space/textarea-break-spaces-001.html @@ -1,11 +1,11 @@ -CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap is wrapped when overflow-wrap is break-spaces in a textarea +CSS Text level 3 Test: preserved white space at the end of line is wrapped when white-space is break-spaces in a textarea - + - + diff --git a/tests/wpt/web-platform-tests/css/css-text/white-space/textarea-pre-wrap-009.html b/tests/wpt/web-platform-tests/css/css-text/white-space/textarea-break-spaces-002.html similarity index 87% rename from tests/wpt/web-platform-tests/css/css-text/white-space/textarea-pre-wrap-009.html rename to tests/wpt/web-platform-tests/css/css-text/white-space/textarea-break-spaces-002.html index aedca630155..f5fe98c1c2b 100644 --- a/tests/wpt/web-platform-tests/css/css-text/white-space/textarea-pre-wrap-009.html +++ b/tests/wpt/web-platform-tests/css/css-text/white-space/textarea-break-spaces-002.html @@ -1,9 +1,9 @@ -CSS Text level 3 Test: single preserved white space at the end of with white-space:pre-wrap overflow-wrap:break-spaces in a textarea +CSS Text level 3 Test: single preserved white space at the end of with white-space:break-spaces in a textarea - + diff --git a/tests/wpt/web-platform-tests/css/css-text/white-space/textarea-pre-wrap-010.html b/tests/wpt/web-platform-tests/css/css-text/white-space/textarea-break-spaces-003.html similarity index 81% rename from tests/wpt/web-platform-tests/css/css-text/white-space/textarea-pre-wrap-010.html rename to tests/wpt/web-platform-tests/css/css-text/white-space/textarea-break-spaces-003.html index 7c5d13842a3..364c4f522cd 100644 --- a/tests/wpt/web-platform-tests/css/css-text/white-space/textarea-pre-wrap-010.html +++ b/tests/wpt/web-platform-tests/css/css-text/white-space/textarea-break-spaces-003.html @@ -1,11 +1,12 @@ -CSS Text level 3 Test: single preserved white space at the end of with white-space:pre-wrap overflow-wrap:break-spaces break-word in a textarea +CSS Text level 3 Test: single preserved white space at the end of the line with white-space:break-spaces overflow-wrap:break-word in a textarea + - + diff --git a/tests/wpt/web-platform-tests/css/css-text/word-break/reference/word-break-break-all-010-ref.html b/tests/wpt/web-platform-tests/css/css-text/word-break/reference/word-break-break-all-010-ref.html new file mode 100644 index 00000000000..0e0300a72dc --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-text/word-break/reference/word-break-break-all-010-ref.html @@ -0,0 +1,16 @@ + + +CSS Text Reference File + + + +

Test passes if there is a filled green square and no red.

+
+ diff --git a/tests/wpt/web-platform-tests/css/css-text/word-break/word-break-break-all-010.html b/tests/wpt/web-platform-tests/css/css-text/word-break/word-break-break-all-010.html new file mode 100644 index 00000000000..1ab97fb146a --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-text/word-break/word-break-break-all-010.html @@ -0,0 +1,37 @@ + + +CSS Text Test: overflow-wrap: break-word + + + + + + + +

Test passes if there is a filled green square and no red.

+
XXXX
X
+
XXXXX
+ diff --git a/tests/wpt/web-platform-tests/css/css-text/word-break/word-break-break-all-011.html b/tests/wpt/web-platform-tests/css/css-text/word-break/word-break-break-all-011.html new file mode 100644 index 00000000000..ed07aeb7368 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-text/word-break/word-break-break-all-011.html @@ -0,0 +1,36 @@ + + +CSS Text Test: overflow-wrap: break-word + + + + + + + +

Test passes if there is a filled green square and no red.

+
X
X
X
+
XX
+ diff --git a/tests/wpt/web-platform-tests/css/css-timing/META.yml b/tests/wpt/web-platform-tests/css/css-timing/META.yml index 9ceb5432fb3..1ee250307b7 100644 --- a/tests/wpt/web-platform-tests/css/css-timing/META.yml +++ b/tests/wpt/web-platform-tests/css/css-timing/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-timing/ suggested_reviewers: - birtles - BorisChiou diff --git a/tests/wpt/web-platform-tests/css/css-transforms/META.yml b/tests/wpt/web-platform-tests/css/css-transforms/META.yml index 78a0a217e33..33c1fce3379 100644 --- a/tests/wpt/web-platform-tests/css/css-transforms/META.yml +++ b/tests/wpt/web-platform-tests/css/css-transforms/META.yml @@ -1,8 +1,7 @@ +spec: https://drafts.csswg.org/css-transforms/ suggested_reviewers: - dbaron - - chunywang - plinss - - minxhuang - dirkschulze - hober - grorg diff --git a/tests/wpt/web-platform-tests/css/css-transitions/META.yml b/tests/wpt/web-platform-tests/css/css-transitions/META.yml index 9c8334c04f7..581515c493e 100644 --- a/tests/wpt/web-platform-tests/css/css-transitions/META.yml +++ b/tests/wpt/web-platform-tests/css/css-transitions/META.yml @@ -1,2 +1,3 @@ +spec: https://drafts.csswg.org/css-transitions/ suggested_reviewers: - dbaron diff --git a/tests/wpt/web-platform-tests/css/css-transitions/pseudo-elements-002.html b/tests/wpt/web-platform-tests/css/css-transitions/pseudo-elements-002.html new file mode 100644 index 00000000000..f84d64a794e --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-transitions/pseudo-elements-002.html @@ -0,0 +1,28 @@ + +CSS Transitions Test: Transition pseudo element with ancestor display change + + + + + + +
+
+
+ diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/META.yml b/tests/wpt/web-platform-tests/css/css-typed-om/META.yml index 90795b44924..a448fc800d2 100644 --- a/tests/wpt/web-platform-tests/css/css-typed-om/META.yml +++ b/tests/wpt/web-platform-tests/css/css-typed-om/META.yml @@ -1,2 +1,3 @@ +spec: https://drafts.css-houdini.org/css-typed-om/ suggested_reviewers: - darrnshn diff --git a/tests/wpt/web-platform-tests/css/css-ui/META.yml b/tests/wpt/web-platform-tests/css/css-ui/META.yml index 58316cb93b9..e78564bcc0d 100644 --- a/tests/wpt/web-platform-tests/css/css-ui/META.yml +++ b/tests/wpt/web-platform-tests/css/css-ui/META.yml @@ -1,7 +1,7 @@ +spec: https://drafts.csswg.org/css-ui/ suggested_reviewers: - frivoal - mrego - - web-flow - plinss - svgeesus - tantek diff --git a/tests/wpt/web-platform-tests/css/css-values/META.yml b/tests/wpt/web-platform-tests/css/css-values/META.yml index 57520a84fab..a22882a9996 100644 --- a/tests/wpt/web-platform-tests/css/css-values/META.yml +++ b/tests/wpt/web-platform-tests/css/css-values/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-values/ suggested_reviewers: - frivoal - dbaron diff --git a/tests/wpt/web-platform-tests/css/css-values/line-break-ch-unit.html b/tests/wpt/web-platform-tests/css/css-values/line-break-ch-unit.html new file mode 100644 index 00000000000..295b418f304 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-values/line-break-ch-unit.html @@ -0,0 +1,52 @@ + +CSS Values and Units Test: Lines of the ch unit can fit the specified number of characters + + + + + +
+ + diff --git a/tests/wpt/web-platform-tests/css/css-variables/META.yml b/tests/wpt/web-platform-tests/css/css-variables/META.yml index 4630568e93d..a1747aadc08 100644 --- a/tests/wpt/web-platform-tests/css/css-variables/META.yml +++ b/tests/wpt/web-platform-tests/css/css-variables/META.yml @@ -1,3 +1,4 @@ +spec: https://drafts.csswg.org/css-variables/ suggested_reviewers: - dbaron - svgeesus diff --git a/tests/wpt/web-platform-tests/css/css-will-change/META.yml b/tests/wpt/web-platform-tests/css/css-will-change/META.yml new file mode 100644 index 00000000000..8d265f24986 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-will-change/META.yml @@ -0,0 +1,4 @@ +spec: https://drafts.csswg.org/css-will-change/ +suggested_reviewers: + - dbaron + - tabatkins diff --git a/tests/wpt/web-platform-tests/css/css-will-change/will-change-will-change-1.html b/tests/wpt/web-platform-tests/css/css-will-change/will-change-will-change-1.html new file mode 100644 index 00000000000..812dc814a09 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-will-change/will-change-will-change-1.html @@ -0,0 +1,17 @@ + +CSS Test: 'will-change: will-change' is invalid + + + + + +

Test passes if there is a filled green square and no red.

+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/META.yml b/tests/wpt/web-platform-tests/css/css-writing-modes/META.yml index 0941889642d..c74fff07de5 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/META.yml +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/META.yml @@ -1,9 +1,8 @@ +spec: https://drafts.csswg.org/css-writing-modes/ suggested_reviewers: - kojiishi - fantasai - - hshiozawa - myakura - - snsk - r12a - plinss - upsuper diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-004.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-004.xht index bc53bc6a0cb..5670da75fe9 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-004.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-004.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: 'writing-mode' - initial value is 'horizontal-tb' - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-htb-001.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-htb-001.xht index f594210c0e0..f6186b296eb 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-htb-001.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-htb-001.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: horizontal-tb - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-003.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-003.xht index 23ccb6948f6..fabe8f96781 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-003.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-003.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: vertical-lr - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-007.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-007.xht index c30d1ce1990..5853d828c19 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-007.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-007.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: 'float: right' and 'vertical-lr' - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-008.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-008.xht index cb1b2a35c51..4a07092d43e 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-008.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-008.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: 'float: right' and 'vertical-lr' - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-010.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-010.xht index bec4e6398ae..5c0ed27ebf3 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-010.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-010.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: position absolute and 'vertical-lr' - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-014.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-014.xht index b5cde2d074c..ea2f25c3bed 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-014.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-014.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: inline-block and 'vertical-lr' - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-015.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-015.xht index fcef14f0c79..da1b1af1beb 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-015.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-015.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: inline-block and 'vertical-lr' - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-016.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-016.xht index 5dc58f0afbd..d75986b9105 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-016.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-016.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: inline-block and 'vertical-lr' - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-018.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-018.xht index 016e48ac166..9043023df70 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-018.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-018.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: table-cell and 'vertical-lr' - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-020.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-020.xht index c2bbfce1571..61392893c0f 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-020.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-020.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: table-caption and 'vertical-lr' - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-022.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-022.xht index 9fa9ae275d7..4e5774831b2 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-022.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-022.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: list and vertical-lr - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-023.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-023.xht index fc65bcc1ce1..7ac79b94f3a 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-023.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-023.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: vertical-lr - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-002.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-002.xht index 26042d0611d..134570f9a2f 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-002.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-002.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: vertical-rl - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-005.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-005.xht index 7755a3ee132..49f843ee25f 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-005.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-005.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: 'float: left' and 'vertical-rl' - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-006.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-006.xht index b8c0581b313..7affbc98380 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-006.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-006.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: 'float: left' and 'vertical-rl' - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-009.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-009.xht index 0eddd2b24e2..06382cf904a 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-009.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-009.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: position absolute and 'vertical-rl' - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-011.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-011.xht index 22621de9253..5fb7da2e671 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-011.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-011.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: inline-block and 'vertical-rl' - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-012.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-012.xht index b8c041519ac..23b29860d69 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-012.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-012.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: inline-block and 'vertical-rl' - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-013.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-013.xht index 3badfbd2400..b3c6489b6e4 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-013.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-013.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: inline-block and 'vertical-rl' - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-017.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-017.xht index 0fe88ec6d2a..ea8c946ede5 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-017.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-017.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: table-cell and 'vertical-rl' - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-019.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-019.xht index 24967343e3c..6f6b7abb165 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-019.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-019.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: table-caption and 'vertical-rl' - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-021.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-021.xht index daec06c238b..139bacdf1de 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-021.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-021.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: list and vertical-rl - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-024.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-024.xht index 10b43b17f78..4012889dee3 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-024.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-024.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: vertical-rl - block flow direction of block-level boxes - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-025.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-025.xht index 998cb417bde..92685d3d0bd 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-025.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-025.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: writing mode of document - horizontal position of first block - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/different-block-flow-dir-001.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/different-block-flow-dir-001.xht index 1df60394883..d885e1acc56 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/different-block-flow-dir-001.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/different-block-flow-dir-001.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: descendant inline with a different 'writing-mode' value - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/different-block-flow-dir-002.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/different-block-flow-dir-002.xht index 93811d4794b..a02095a5467 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/different-block-flow-dir-002.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/different-block-flow-dir-002.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: descendant inline with a different 'writing-mode' value - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/first-page-vlr-003.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/first-page-vlr-003.xht index d89d5608e83..ce94a0793b4 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/first-page-vlr-003.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/first-page-vlr-003.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: first page of a document with vertical-lr writing-mode - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/first-page-vrl-002.xht b/tests/wpt/web-platform-tests/css/css-writing-modes/first-page-vrl-002.xht index f035d6f0b77..8ba53e233db 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/first-page-vrl-002.xht +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/first-page-vrl-002.xht @@ -7,7 +7,7 @@ CSS Writing Modes Test: first page of a document with vertical-rl writing-mode - + diff --git a/tests/wpt/web-platform-tests/css/css-writing-modes/flexbox_align-items-stretch-writing-modes.html b/tests/wpt/web-platform-tests/css/css-writing-modes/flexbox_align-items-stretch-writing-modes.html index 5c59a317dac..0f013e3b5e1 100644 --- a/tests/wpt/web-platform-tests/css/css-writing-modes/flexbox_align-items-stretch-writing-modes.html +++ b/tests/wpt/web-platform-tests/css/css-writing-modes/flexbox_align-items-stretch-writing-modes.html @@ -5,7 +5,7 @@ - + @@ -31,14 +24,14 @@
  1. If the user-agent does not claim to support the :focus-visible pseudo-class then SKIP this test.
  2. Use the TAB key on the keyboard to focus the element below that says "Focus me."
  3. -
  4. If the element does not have a blue outline, then the test result is FAILURE. If the element has a blue outline, then the test result is SUCCESS.
  5. +
  6. If the element has a red background, then the test result is FAILURE. If the element has a green outline, then the test result is SUCCESS.

Focus me.
@@ -31,7 +24,7 @@
  1. If the user-agent does not claim to support the :focus-visible pseudo-class then SKIP this test.
  2. Click each form element below to focus it.
  3. -
  4. If the element does not have a blue outline, then the test result is FAILURE. If the element has a blue outline, then the test result is SUCCESS.
  5. +
  6. If the element has a red background, then the test result is FAILURE. If the element has a green outline, then the test result is SUCCESS.

@@ -86,7 +79,7 @@ async_test(function(t) { function testNextTarget(e) { let el = e.target; - assert_equals(getComputedStyle(el).outlineColor, "rgb(59, 153, 252)"); + assert_equals(getComputedStyle(el).outlineColor, "rgb(0, 100, 0)"); el.dataset.tested = true; let nextTarget = document.querySelector("[data-tested=false]"); if (nextTarget) { diff --git a/tests/wpt/web-platform-tests/css/selectors/focus-visible-003-manual.html b/tests/wpt/web-platform-tests/css/selectors/focus-visible-003-manual.html index 47b41016805..eeb2904d7d3 100644 --- a/tests/wpt/web-platform-tests/css/selectors/focus-visible-003-manual.html +++ b/tests/wpt/web-platform-tests/css/selectors/focus-visible-003-manual.html @@ -8,21 +8,14 @@ @@ -31,7 +24,7 @@
  1. If the user-agent does not claim to support the :focus-visible pseudo-class then SKIP this test.
  2. Click each element element below to focus it.
  3. -
  4. If the element has a blue outline, then the test result is FAILURE. If the element does NOT have a blue outline, then the test result is SUCCESS.
  5. +
  6. If the element has a red outline, then the test result is FAILURE. If the element has a green background, then the test result is SUCCESS.

diff --git a/tests/wpt/web-platform-tests/css/selectors/focus-visible-004-manual.html b/tests/wpt/web-platform-tests/css/selectors/focus-visible-004-manual.html index 2a95f72de9f..dba057cc9c8 100644 --- a/tests/wpt/web-platform-tests/css/selectors/focus-visible-004-manual.html +++ b/tests/wpt/web-platform-tests/css/selectors/focus-visible-004-manual.html @@ -8,21 +8,14 @@ @@ -31,7 +24,7 @@
  1. If the user-agent does not claim to support the :focus-visible pseudo-class then SKIP this test.
  2. Click each element element below to focus it.
  3. -
  4. If the element has a blue outline, then the test result is FAILURE. If the element does NOT have a blue outline, then the test result is SUCCESS.
  5. +
  6. If the element has a red outline, then the test result is FAILURE. If the element has a green background, then the test result is SUCCESS.

diff --git a/tests/wpt/web-platform-tests/css/selectors/focus-visible-005.html b/tests/wpt/web-platform-tests/css/selectors/focus-visible-005.html index 448579961af..b5d58435db1 100644 --- a/tests/wpt/web-platform-tests/css/selectors/focus-visible-005.html +++ b/tests/wpt/web-platform-tests/css/selectors/focus-visible-005.html @@ -7,31 +7,26 @@ + + - This test checks that programmatically focusing an element causes :focus-visible matching to trigger. + This test checks that programmatically focusing an element after a click does not cause :focus-visible matching to trigger.
  1. If the user-agent does not claim to support the :focus-visible pseudo-class then SKIP this test.
  2. Click the button below that says "Click me."
  3. -
  4. If the element that says "I will be focused programmatically." does not have a blue outline, then the test result is FAILURE. If the element has a blue outline, then the test result is SUCCESS.
  5. +
  6. If the element that says "I will be focused programmatically." has a red outline, then the test result is FAILURE. If the element has a green background, then the test result is SUCCESS.

@@ -41,12 +36,12 @@ el.focus(); }); async_test(function(t) { - el.addEventListener("focus", t.step_func(() => { - assert_equals(getComputedStyle(el).outlineColor, "rgb(59, 153, 252)"); + el.addEventListener("focus", t.step_func(function() { + assert_equals(getComputedStyle(el).outlineStyle, "none"); t.done(); })); - el.focus(); - }, "Programmatic focus should always match :focus-visible"); + test_driver.click(button); + }, "Programmatic focus after click should not match :focus-visible"); diff --git a/tests/wpt/web-platform-tests/css/selectors/focus-visible-006-manual.html b/tests/wpt/web-platform-tests/css/selectors/focus-visible-006-manual.html index e61a8857e74..974abc0024e 100644 --- a/tests/wpt/web-platform-tests/css/selectors/focus-visible-006-manual.html +++ b/tests/wpt/web-platform-tests/css/selectors/focus-visible-006-manual.html @@ -14,21 +14,14 @@ padding: 2px 5px; } - :root { - --focus-background: hsl(50, 94%, 72%); - --focus-ring-color: rgb(59, 153, 252); - } - :focus-visible { - outline: var(--focus-ring-color) auto 5px; + outline: darkgreen dotted 1px; /* fallback for Edge */ + outline: darkgreen auto 5px; } - * { + :focus:not(:focus-visible) { outline: 0; - } - - :focus { - background-color: var(--focus-background); + background-color: tomato; } @@ -37,7 +30,7 @@
  1. If the user-agent does not claim to support the :focus-visible pseudo-class then SKIP this test.
  2. Click the content editable span below to focus it.
  3. -
  4. If the element does not have a blue outline, then the test result is FAILURE. If the element has a blue outline, then the test result is SUCCESS.
  5. +
  6. If the element has a red background, then the test result is FAILURE. If the element has a blue outline, then the test result is SUCCESS.

@@ -46,7 +39,7 @@ @@ -33,13 +37,11 @@
  1. If the user-agent does not claim to support the :focus-visible pseudo-class then SKIP this test.
  2. Use the mouse to focus the element below that says "Click me first."
  3. -
  4. If the element has a blue outline, then the test result is FAILURE.
  5. +
  6. If the element has a red outline, then the test result is FAILURE.
  7. Press the SHIFT key.
  8. -
  9. If the element now DOES NOT have a blue outline, then the test result is FAILURE..
  10. -
  11. Use the mouse to click the element that says "Click me first." a second time
  12. -
  13. If the element now DOES NOT still have a blue outline, then the test result is FAILURE.
  14. +
  15. If the element now has a red background, then the test result is FAILURE.
  16. Use the mouse to click the element below that says "Click me second."
  17. -
  18. If the element does not have a blue outline then the test result is SUCCESS.
  19. +
  20. If the element has a green background, the test result is SUCCESS.
Click me first.
@@ -51,16 +53,10 @@ }, true); document.body.addEventListener("mousedown", (e) => { + delete document.body.dataset.hadkeydown; document.body.dataset.hadmousedown = ""; }, true); - document.body.addEventListener("focus", (e) => { - if ("hadmousedown" in document.body.dataset) { - delete document.body.dataset.hadmousedown; - delete document.body.dataset.hadkeydown; - } - }, true); - async_test(async function(t) { let tested_modality_change = false; let tested_modality_unchanged_by_mouse_click = false; @@ -104,7 +100,7 @@ test_driver.click(one); })).catch(t.step_func((e) => { // TODO(crbug.com/828858): Remove this check once bug is resolved. - assert_true(false, "send_keys not implmented yet"); + assert_true(false, "send_keys not implemented yet"); t.done(); })); }, "Using keyboard while element is focused should trigger :focus-visible; using mouse without moving focus should not cancel it; moving focus using mouse should cancel it."); diff --git a/tests/wpt/web-platform-tests/css/selectors/focus-visible-008.html b/tests/wpt/web-platform-tests/css/selectors/focus-visible-008.html new file mode 100644 index 00000000000..b7f61d2fa80 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/selectors/focus-visible-008.html @@ -0,0 +1,44 @@ + + + + + CSS Test (Selectors): Keyboard focus enables :focus-visible + + + + + + + + This test checks that programmatically focusing an element after a keypress causes :focus-visible to match. +
    +
  1. Use the tab key to move focus to the button below that says "Tab to me and press ENTER."
  2. +
  3. Press ENTER.
  4. +
  5. If the element that says "I will be focused programmatically." has a red background, then the test result is FAILURE. If the element has a green outline, then the test result is SUCCESS.
  6. +
+
+ +
I will be focused programmatically. + + + diff --git a/tests/wpt/web-platform-tests/css/selectors/focus-visible-009.html b/tests/wpt/web-platform-tests/css/selectors/focus-visible-009.html new file mode 100644 index 00000000000..c7d682baa43 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/selectors/focus-visible-009.html @@ -0,0 +1,44 @@ + + + + + CSS Test (Selectors): Keyboard focus enables :focus-visible + + + + + + + + This test checks that any element focused via an autofocus attribute will have :focus-visible matching enabled. +
    +
  • If the button that says "I will be focused automatically" has a red background, then the test result is FAILURE. If it has a green outline, then the test result is SUCCESS.
  • +
+
+ + + + diff --git a/tests/wpt/web-platform-tests/css/selectors/focus-visible-010.html b/tests/wpt/web-platform-tests/css/selectors/focus-visible-010.html new file mode 100644 index 00000000000..eb01204b29c --- /dev/null +++ b/tests/wpt/web-platform-tests/css/selectors/focus-visible-010.html @@ -0,0 +1,41 @@ + + + + + CSS Test (Selectors): Keyboard focus enables :focus-visible + + + + + + + + This test checks that any element focused programmatically on page load will have :focus-visible matching enabled. +
    +
  • If the element that says "I will be focused automatically" has a red background, then the test result is FAILURE. If the element has a green outline, then the test result is SUCCESS.
  • +
+
+
I will be focused automatically. + + + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-block-001-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-block-001-ref.html new file mode 100644 index 00000000000..b8f983a8153 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-block-001-ref.html @@ -0,0 +1,57 @@ + + + + + CSS Reftest Reference + + + + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ outside before
outside after +
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-block-001.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-block-001.html new file mode 100644 index 00000000000..c5bdc6adead --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-block-001.html @@ -0,0 +1,81 @@ + + + + + CSS Test: 'contain: size' on block elements should cause them to be sized and baseline-aligned as if they had no contents. + + + + + + + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
+ outside before
inner
outside after +
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-button-001-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-button-001-ref.html new file mode 100644 index 00000000000..0cb421bae95 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-button-001-ref.html @@ -0,0 +1,73 @@ + + + + + CSS Reftest Reference + + + + + +
+ + +
+ + +
+ + +
+ + +
+ + outside beforeoutside after +
+ + +
+ + +
+ + +
+ + +
+ + sendtext +
+ + + + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-button-001.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-button-001.html new file mode 100644 index 00000000000..015d33ecc49 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-button-001.html @@ -0,0 +1,101 @@ + + + + + CSS Test: 'contain: size' on buttons should cause them to be sized and baseline-aligned as if they had no contents. + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + outside beforeoutside after +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + sendtext +
+ + + + + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-flex-001-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-flex-001-ref.html new file mode 100644 index 00000000000..995c45197fd --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-flex-001-ref.html @@ -0,0 +1,49 @@ + + + + + CSS Reftest Reference + + + + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-flex-001.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-flex-001.html new file mode 100644 index 00000000000..1866dfd230b --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-flex-001.html @@ -0,0 +1,72 @@ + + + + + CSS Test: 'contain: size' on flex elements should cause them to be sized and baseline-aligned as if they had no contents. + + + + + + + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-block-001-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-block-001-ref.html new file mode 100644 index 00000000000..56d1cdd8cee --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-block-001-ref.html @@ -0,0 +1,38 @@ + + + + + CSS Reftest Reference + + + + +
+
+ + outside before
outside after +
+ +
+
+ +
+
+ +
+
+ +
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-block-001.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-block-001.html new file mode 100644 index 00000000000..48f8bc279a6 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-block-001.html @@ -0,0 +1,59 @@ + + + + + CSS Test: 'contain: size' on inline-block elements should cause them to be sized and baseline-aligned as if they had no contents. + + + + + + + +
inner
+
+ + + outside before
inner
outside after +
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-flex-001-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-flex-001-ref.html new file mode 100644 index 00000000000..fb013752d05 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-flex-001-ref.html @@ -0,0 +1,23 @@ + + + + + CSS Reftest Reference + + + + + aa
bb +
+ + aa
bb + + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-flex-001.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-flex-001.html new file mode 100644 index 00000000000..e79d0c18599 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-flex-001.html @@ -0,0 +1,34 @@ + + + + + CSS Test: 'contain: size' on inline-flex elements should cause them to be sized and baseline-aligned as if they had no contents. + + + + + + + + aa
inner
bb +
+ + + aa
inner
bb + + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-001-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-001-ref.html new file mode 100644 index 00000000000..32dd4b6ab68 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-001-ref.html @@ -0,0 +1,31 @@ + + + + + CSS Reftest Reference + + + + +
+ + + +
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-001.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-001.html new file mode 100644 index 00000000000..4a1cee5c270 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-001.html @@ -0,0 +1,34 @@ + + + + + CSS Test: 'contain: size' should force elements to be monolithic, i.e. to not fragment inside a multicol element. + + + + + + +
+
+
+
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-002-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-002-ref.html new file mode 100644 index 00000000000..c1c9f1388ed --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-002-ref.html @@ -0,0 +1,49 @@ + + + + + CSS Reftest Reference + + + + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-002.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-002.html new file mode 100644 index 00000000000..0e35e2fed26 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-002.html @@ -0,0 +1,72 @@ + + + + + CSS Test: 'contain: size' on multicol elements should cause them to be sized as if they had no contents. + + + + + + + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-003-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-003-ref.html new file mode 100644 index 00000000000..59cb99144e2 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-003-ref.html @@ -0,0 +1,57 @@ + + + + + CSS Reftest Reference + + + + +
+ outside before
outside after +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-003.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-003.html new file mode 100644 index 00000000000..335324281fd --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-003.html @@ -0,0 +1,73 @@ + + + + + CSS Test: 'contain: size' on multicol elements should cause them to be sized and baseline-aligned as if they had no contents. + + + + + + + +
+ outside before
inner
outside after +
+
+ + + +
inner
+
+ +
inner
+
+ +
inner
+
+ +
inner
+
+ +
+
+
inner
+
+
+
+ +
+
+
inner
+
+
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/reftest.list b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/reftest.list index 7e762eceb77..c5fefcb6d87 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/reftest.list +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/contain/reftest.list @@ -16,3 +16,11 @@ == contain-paint-ignored-cases-ruby-stacking-and-clipping-001.html contain-paint-ignored-cases-ruby-stacking-and-clipping-001-ref.html == contain-paint-stacking-context-001a.html contain-paint-stacking-context-001-ref.html == contain-paint-stacking-context-001b.html contain-paint-stacking-context-001-ref.html +== contain-size-button-001.html contain-size-button-001-ref.html +== contain-size-block-001.html contain-size-block-001-ref.html +== contain-size-inline-block-001.html contain-size-inline-block-001-ref.html +== contain-size-flex-001.html contain-size-flex-001-ref.html +== contain-size-inline-flex-001.html contain-size-inline-flex-001-ref.html +== contain-size-multicol-001.html contain-size-multicol-001-ref.html +== contain-size-multicol-002.html contain-size-multicol-002-ref.html +== contain-size-multicol-003.html contain-size-multicol-003-ref.html diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-001-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-001-ref.html new file mode 100644 index 00000000000..0606afe5398 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-001-ref.html @@ -0,0 +1,97 @@ + + + + + + Reference: Testing row and column gaps in horizontal and vertical multi-line flex containers with the space-around property and auto margins + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-001.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-001.html new file mode 100644 index 00000000000..25b28e80947 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-001.html @@ -0,0 +1,65 @@ + + + + + + CSS Test: Testing row and column gaps in horizontal and vertical multi-line flex containers with the space-around property and auto margins + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-002-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-002-ref.html new file mode 100644 index 00000000000..e23ddfe2615 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-002-ref.html @@ -0,0 +1,67 @@ + + + + + + Reference: Testing row and column gaps in vertical writing mode multi-line flex containers + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-002.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-002.html new file mode 100644 index 00000000000..fcd19cf8d48 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-002.html @@ -0,0 +1,62 @@ + + + + + + CSS Test: Testing row and column gaps in vertical writing mode multi-line flex containers + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-003-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-003-ref.html new file mode 100644 index 00000000000..6e7f220b447 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-003-ref.html @@ -0,0 +1,63 @@ + + + + + Reference: Testing cross size computation with row and column gaps in horizontal multi-line flex containers + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-003.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-003.html new file mode 100644 index 00000000000..2dcd0271731 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-003.html @@ -0,0 +1,61 @@ + + + + + CSS Test: Testing cross size computation with row and column gaps in horizontal multi-line flex containers + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/reftest.list b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/reftest.list index 5c38083f0d8..82c9ce650b5 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/reftest.list +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/reftest.list @@ -98,6 +98,11 @@ == flexbox-collapsed-item-horiz-002.html flexbox-collapsed-item-horiz-002-ref.html == flexbox-collapsed-item-horiz-003.html flexbox-collapsed-item-horiz-003-ref.html +# Tests for "row gap" and "column gap" +== flexbox-column-row-gap-001.html flexbox-column-row-gap-001-ref.html +== flexbox-column-row-gap-002.html flexbox-column-row-gap-002-ref.html +== flexbox-column-row-gap-003.html flexbox-column-row-gap-003-ref.html + # Tests for "flex-basis: content" == flexbox-flex-basis-content-001a.html flexbox-flex-basis-content-001-ref.html == flexbox-flex-basis-content-001b.html flexbox-flex-basis-content-001-ref.html diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/multicol3/moz-multicol3-column-balancing-break-inside-avoid-1-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/multicol3/moz-multicol3-column-balancing-break-inside-avoid-1-ref.html index 0b786e01fb5..c39deb12f00 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/multicol3/moz-multicol3-column-balancing-break-inside-avoid-1-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/multicol3/moz-multicol3-column-balancing-break-inside-avoid-1-ref.html @@ -10,7 +10,7 @@ html,body { color:black; background-color:white; font-size:16px; padding:0; margin:0; } - + .colset { column-count: 3; column-gap: 0; diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/multicol3/moz-multicol3-column-balancing-break-inside-avoid-1.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/multicol3/moz-multicol3-column-balancing-break-inside-avoid-1.html index 47bfa4a42c6..f18a9ceefa1 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/multicol3/moz-multicol3-column-balancing-break-inside-avoid-1.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/multicol3/moz-multicol3-column-balancing-break-inside-avoid-1.html @@ -12,7 +12,7 @@ html,body { color:black; background-color:white; font-size:16px; padding:0; margin:0; } - + .colset { column-count: 3; column-gap: 0; diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-005-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-005-ref.html index fd1d0ff9177..6c56ff4de20 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-005-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-005-ref.html @@ -44,11 +44,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-006-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-006-ref.html index efe1c47cba6..2f4ab382579 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-006-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-006-ref.html @@ -45,11 +45,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-007-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-007-ref.html index 9e0e6f04447..1a1b0e39cf2 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-007-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-007-ref.html @@ -44,11 +44,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-008-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-008-ref.html index 41dbcd22872..bf155edd2a0 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-008-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-008-ref.html @@ -45,11 +45,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-009-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-009-ref.html index 713ce3441a6..0dde92c78b8 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-009-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-009-ref.html @@ -44,11 +44,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-010-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-010-ref.html index 776a3608d45..00ce96cf5b4 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-010-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-010-ref.html @@ -45,11 +45,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-011-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-011-ref.html index f8fa6f2d451..7097a6452e6 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-011-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-011-ref.html @@ -44,11 +44,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-012-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-012-ref.html index 61d97e7dca6..775d984d1d9 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-012-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-012-ref.html @@ -45,11 +45,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-048-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-048-ref.html index 5ffdb55b9a6..668f2a8dafb 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-048-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-048-ref.html @@ -43,12 +43,12 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-049-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-049-ref.html index 2024166b29e..d38adc31d44 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-049-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-049-ref.html @@ -44,12 +44,12 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-050-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-050-ref.html index 58d33349475..54359ed0338 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-050-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-050-ref.html @@ -43,12 +43,12 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-051-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-051-ref.html index 21ac48b5e12..24fdb7fcf5b 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-051-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-051-ref.html @@ -43,12 +43,12 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-052-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-052-ref.html index 3e80b9422ec..a035a5b3e07 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-052-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-052-ref.html @@ -43,12 +43,12 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-053-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-053-ref.html index 843b9ff5e92..7fac4137281 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-053-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-053-ref.html @@ -44,12 +44,12 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-054-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-054-ref.html index 16a36fc7b07..8dc291eda68 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-054-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-054-ref.html @@ -43,12 +43,12 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-055-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-055-ref.html index c2cea3d8acf..cd7f9b282ab 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-055-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-055-ref.html @@ -44,12 +44,12 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-046-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-046-ref.html index 8af751a26f7..85934258804 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-046-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-046-ref.html @@ -38,9 +38,9 @@
-
-
-
-
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-047-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-047-ref.html index c6ff6200c5f..d6c4215b4b1 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-047-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-047-ref.html @@ -39,9 +39,9 @@
-
-
-
-
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-048-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-048-ref.html index 06a9c9b7d55..0cb81c7d985 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-048-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-048-ref.html @@ -38,9 +38,9 @@
-
-
-
-
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-049-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-049-ref.html index 373ab729f60..494edc84230 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-049-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-049-ref.html @@ -39,9 +39,9 @@
-
-
-
-
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-050-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-050-ref.html index 6f80fd30664..5acbca772af 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-050-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-050-ref.html @@ -38,9 +38,9 @@
-
-
-
-
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-051-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-051-ref.html index 71e0e7bd42b..d3bc6615b43 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-051-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-051-ref.html @@ -39,9 +39,9 @@
-
-
-
-
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-020-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-020-ref.html index 3f8ff9842f0..6d2121ca953 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-020-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-020-ref.html @@ -41,11 +41,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-021-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-021-ref.html index 1514264eab1..daf161d82cb 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-021-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-021-ref.html @@ -42,11 +42,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-022-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-022-ref.html index 8601aa51a0e..4f0378b00f8 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-022-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-022-ref.html @@ -41,11 +41,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-023-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-023-ref.html index 8db2ae93551..f6e655f84bb 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-023-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-023-ref.html @@ -42,11 +42,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-024-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-024-ref.html index 0b495346230..8fdfb4b3048 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-024-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-024-ref.html @@ -41,11 +41,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-025-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-025-ref.html index 0b9858a06f0..66b835f21c7 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-025-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-025-ref.html @@ -42,11 +42,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-026-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-026-ref.html index 9321e35858a..fbee45dd14b 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-026-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-026-ref.html @@ -41,11 +41,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-027-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-027-ref.html index 477e4a5acc9..24ae7ee6460 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-027-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-027-ref.html @@ -42,11 +42,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-020-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-020-ref.html index 41ed8bd22b3..f7287a1fcaa 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-020-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-020-ref.html @@ -41,11 +41,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-021-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-021-ref.html index 6c827c0265a..9e0cc4889f3 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-021-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-021-ref.html @@ -42,11 +42,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-022-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-022-ref.html index f29267edcdd..40cb31fb46b 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-022-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-022-ref.html @@ -41,11 +41,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-023-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-023-ref.html index 17f97781aa9..445129dcf7e 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-023-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-023-ref.html @@ -42,11 +42,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-024-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-024-ref.html index 75ab17f1283..aba8605f5b9 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-024-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-024-ref.html @@ -41,11 +41,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-025-ref.html b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-025-ref.html index 35d5d7bf891..6a334c5d1da 100644 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-025-ref.html +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-025-ref.html @@ -42,11 +42,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/sync-tests.sh b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/sync-tests.sh index a4d43c9d3fb..b5f358b8f0a 100755 --- a/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/sync-tests.sh +++ b/tests/wpt/web-platform-tests/css/vendor-imports/mozilla/mozilla-central-reftests/sync-tests.sh @@ -1,6 +1,10 @@ #!/bin/bash -MOZTREE="$HOME/builds/clean-mozilla-central/mozilla/" +if [ "x$1" != "x" ]; then + MOZTREE="$1" +else + MOZTREE="$HOME/builds/clean-mozilla-central/mozilla/" +fi cd "$(dirname "$0")" @@ -10,8 +14,15 @@ then exit 1 fi +if [ -e "$MOZTREE/.git" ] +then + MOZREV="$(cd "$MOZTREE" && git cinnabar git2hg HEAD)" +else + MOZREV="$(cd "$MOZTREE" && hg par --temp='{node}')" +fi + rsync -avz --delete --filter=". ./sync-tests-filter" "$MOZTREE"/layout/reftests/w3c-css/submitted/ ./ sed -i -e 's/^\(\(fails\|needs-focus\|random\|skip\|asserts\|slow\|require-or\|silentfail\|pref\|test-pref\|ref-pref\|fuzzy\)[^ ]* *\?\)\+//;/^default-preferences /d;s/ \?# \?\(TC: \)\?[bB]ug.*//;s/ # Initial mulet triage:.*//' $(find . -name reftest.list) -sed -i -e 's/-moz-column/column/g;s/-moz-crisp-edges/pixelated/g' $(find . -regex ".*\.\(xht\|xhtml\|html\|css\)") +sed -i -e 's/-moz-crisp-edges/pixelated/g;s/-moz-min-content/min-content/g;s/-moz-max-content/max-content/g' $(find . -regex ".*\.\(xht\|xhtml\|html\|css\)") git add -A . -git commit -m"Sync Mozilla tests as of https://hg.mozilla.org/mozilla-central/rev/$(cd "$MOZTREE" && hg par --temp='{node}') ." . +git commit -m"Sync Mozilla tests as of https://hg.mozilla.org/mozilla-central/rev/$MOZREV ." . diff --git a/tests/wpt/web-platform-tests/custom-elements/Document-createElement.html b/tests/wpt/web-platform-tests/custom-elements/Document-createElement.html index fc43fc44cfc..8173c761388 100644 --- a/tests/wpt/web-platform-tests/custom-elements/Document-createElement.html +++ b/tests/wpt/web-platform-tests/custom-elements/Document-createElement.html @@ -263,7 +263,7 @@ document_types().forEach(function (entry, testNumber) { return; var getDocument = entry.create; - var docuemntName = entry.name; + var documentName = entry.name; promise_test(function () { return getDocument().then(function (doc) { @@ -282,7 +282,7 @@ document_types().forEach(function (entry, testNumber) { assert_equals(instance.localName, name); assert_true(instance instanceof HTMLUnknownElement); }); - }, 'document.createElement must report a NotSupportedError when the element is adopted into a ' + docuemntName + ' during construction'); + }, `document.createElement must report a NotSupportedError when the element is adopted into a ${documentName} during construction`); promise_test(function () { return getDocument().then(function (doc) { @@ -301,7 +301,7 @@ document_types().forEach(function (entry, testNumber) { assert_equals(instance.localName, name); assert_true(instance instanceof HTMLUnknownElement); }); - }, 'document.createElement must report a NotSupportedError when the element is inserted into a ' + docuemntName + ' during construction'); + }, `document.createElement must report a NotSupportedError when the element is inserted into a ${documentName} during construction`); promise_test(function () { return getDocument().then(function (doc) { @@ -319,7 +319,7 @@ document_types().forEach(function (entry, testNumber) { assert_not_reports(function () { instance = document.createElement(name); }); assert_true(instance instanceof ElementThatGetAdoptedBack); }); - }, 'document.createElement must not report a NotSupportedError when the element is adopted back from a ' + docuemntName + ' during construction'); + }, `document.createElement must not report a NotSupportedError when the element is adopted back from a ${documentName} during construction`); }); test(function () { diff --git a/tests/wpt/web-platform-tests/custom-elements/META.yml b/tests/wpt/web-platform-tests/custom-elements/META.yml index 3f6ace51c8a..e30f6fc97f9 100644 --- a/tests/wpt/web-platform-tests/custom-elements/META.yml +++ b/tests/wpt/web-platform-tests/custom-elements/META.yml @@ -1,11 +1,8 @@ +spec: https://html.spec.whatwg.org/multipage/custom-elements.html suggested_reviewers: - snuggs - - alsemenov - - deepak-sa - domenic - - dominiccooney - hayatoito - kojiishi - rniwa - - sgrekhov - takayoshikochi diff --git a/tests/wpt/web-platform-tests/device-memory/META.yml b/tests/wpt/web-platform-tests/device-memory/META.yml index 35a7308e8b1..b393c6b8337 100644 --- a/tests/wpt/web-platform-tests/device-memory/META.yml +++ b/tests/wpt/web-platform-tests/device-memory/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/device-memory/ suggested_reviewers: - tdresser - npm1 diff --git a/tests/wpt/web-platform-tests/dom/META.yml b/tests/wpt/web-platform-tests/dom/META.yml index 815d7800d1f..6fd5b12664d 100644 --- a/tests/wpt/web-platform-tests/dom/META.yml +++ b/tests/wpt/web-platform-tests/dom/META.yml @@ -1,5 +1,5 @@ +spec: https://dom.spec.whatwg.org/ suggested_reviewers: - - ayg - jdm - zqzhang - annevk diff --git a/tests/wpt/web-platform-tests/dom/nodes/ParentNode-querySelector-All-xht.xht b/tests/wpt/web-platform-tests/dom/nodes/ParentNode-querySelector-All-xht.xht index f6d8280b7cd..f2d94da1dad 100644 --- a/tests/wpt/web-platform-tests/dom/nodes/ParentNode-querySelector-All-xht.xht +++ b/tests/wpt/web-platform-tests/dom/nodes/ParentNode-querySelector-All-xht.xht @@ -87,6 +87,8 @@ function init(target) { var fragment = doc.createDocumentFragment(); // Fragment Node tests fragment.appendChild(element.cloneNode(true)); + var empty = document.createElement("div"); // Empty Node tests + // Setup Tests interfaceCheck("Document", doc); interfaceCheck("Detached Element", detached); @@ -107,6 +109,7 @@ function init(target) { runInvalidSelectorTest("Detached Element", detached, invalidSelectors); runInvalidSelectorTest("Fragment", fragment, invalidSelectors); runInvalidSelectorTest("In-document Element", element, invalidSelectors); + runInvalidSelectorTest("Empty Element", empty, invalidSelectors); runValidSelectorTest("Document", doc, validSelectors, testType, docType); runValidSelectorTest("Detached Element", detached, validSelectors, testType, docType); diff --git a/tests/wpt/web-platform-tests/dom/nodes/ParentNode-querySelector-All.html b/tests/wpt/web-platform-tests/dom/nodes/ParentNode-querySelector-All.html index 465898c67c0..7d68e7f2975 100644 --- a/tests/wpt/web-platform-tests/dom/nodes/ParentNode-querySelector-All.html +++ b/tests/wpt/web-platform-tests/dom/nodes/ParentNode-querySelector-All.html @@ -85,6 +85,8 @@ function init(target) { var fragment = doc.createDocumentFragment(); // Fragment Node tests fragment.appendChild(element.cloneNode(true)); + var empty = document.createElement("div"); // Empty Node tests + // Setup Tests interfaceCheck("Document", doc); interfaceCheck("Detached Element", detached); @@ -105,6 +107,7 @@ function init(target) { runInvalidSelectorTest("Detached Element", detached, invalidSelectors); runInvalidSelectorTest("Fragment", fragment, invalidSelectors); runInvalidSelectorTest("In-document Element", element, invalidSelectors); + runInvalidSelectorTest("Empty Element", empty, invalidSelectors); runValidSelectorTest("Document", doc, validSelectors, testType, docType); runValidSelectorTest("Detached Element", detached, validSelectors, testType, docType); diff --git a/tests/wpt/web-platform-tests/domparsing/META.yml b/tests/wpt/web-platform-tests/domparsing/META.yml index a4a9048ced0..72f66c4301c 100644 --- a/tests/wpt/web-platform-tests/domparsing/META.yml +++ b/tests/wpt/web-platform-tests/domparsing/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/DOM-Parsing/ suggested_reviewers: - ChrisParis - jdm diff --git a/tests/wpt/web-platform-tests/domxpath/META.yml b/tests/wpt/web-platform-tests/domxpath/META.yml index a03fca23e91..6c9963a8222 100644 --- a/tests/wpt/web-platform-tests/domxpath/META.yml +++ b/tests/wpt/web-platform-tests/domxpath/META.yml @@ -1,3 +1,4 @@ +spec: https://www.w3.org/TR/DOM-Level-3-XPath/ suggested_reviewers: - gsnedders - zqzhang diff --git a/tests/wpt/web-platform-tests/dpub-aam/META.yml b/tests/wpt/web-platform-tests/dpub-aam/META.yml index d99ed62b8e3..a382778f375 100644 --- a/tests/wpt/web-platform-tests/dpub-aam/META.yml +++ b/tests/wpt/web-platform-tests/dpub-aam/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/dpub-aam/ suggested_reviewers: - halindrome - joanmarie diff --git a/tests/wpt/web-platform-tests/dpub-aria/META.yml b/tests/wpt/web-platform-tests/dpub-aria/META.yml index a157432430e..c6e339af636 100644 --- a/tests/wpt/web-platform-tests/dpub-aria/META.yml +++ b/tests/wpt/web-platform-tests/dpub-aria/META.yml @@ -1,2 +1,3 @@ +spec: https://w3c.github.io/dpub-aria/ suggested_reviewers: - halindrome diff --git a/tests/wpt/web-platform-tests/editing/META.yml b/tests/wpt/web-platform-tests/editing/META.yml index a70815bb400..f7f2f109d65 100644 --- a/tests/wpt/web-platform-tests/editing/META.yml +++ b/tests/wpt/web-platform-tests/editing/META.yml @@ -1,2 +1,3 @@ +spec: https://w3c.github.io/editing/execCommand.html suggested_reviewers: - - ayg + - johanneswilm diff --git a/tests/wpt/web-platform-tests/editing/data/delete.js b/tests/wpt/web-platform-tests/editing/data/delete.js index 8a2bd707531..e5ca838f647 100644 --- a/tests/wpt/web-platform-tests/editing/data/delete.js +++ b/tests/wpt/web-platform-tests/editing/data/delete.js @@ -520,6 +520,11 @@ var browserTests = [ "
foo[]bar
", [true], {"delete":[false,false,"",false,false,""]}], +["foo
b[]
baz", + [["delete",""]], + "foo
[]
baz", + [true], + {"delete":[false,false,"",false,false,""]}], ["foo
[]bar
baz", [["delete",""]], "foo
[]bar
baz", diff --git a/tests/wpt/web-platform-tests/editing/data/forwarddelete.js b/tests/wpt/web-platform-tests/editing/data/forwarddelete.js index eb8d14ee0e5..bbc2b11a3ca 100644 --- a/tests/wpt/web-platform-tests/editing/data/forwarddelete.js +++ b/tests/wpt/web-platform-tests/editing/data/forwarddelete.js @@ -215,6 +215,11 @@ var browserTests = [ "foo{}", [true,true], {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"forwarddelete":[false,false,"",false,false,""]}], +["
[]b
foo", + [["forwarddelete",""]], + "
[]
foo", + [true], + {"forwarddelete":[false,false,"",false,false,""]}], ["
{}
foo", [["forwarddelete",""]], "
{}
foo", diff --git a/tests/wpt/web-platform-tests/editing/manual/delete.manual.html b/tests/wpt/web-platform-tests/editing/manual/delete-manual.html similarity index 100% rename from tests/wpt/web-platform-tests/editing/manual/delete.manual.html rename to tests/wpt/web-platform-tests/editing/manual/delete-manual.html diff --git a/tests/wpt/web-platform-tests/editing/manual/forwarddelete.manual.html b/tests/wpt/web-platform-tests/editing/manual/forwarddelete-manual.html similarity index 100% rename from tests/wpt/web-platform-tests/editing/manual/forwarddelete.manual.html rename to tests/wpt/web-platform-tests/editing/manual/forwarddelete-manual.html diff --git a/tests/wpt/web-platform-tests/editing/manual/insertlinebreak.manual.html b/tests/wpt/web-platform-tests/editing/manual/insertlinebreak-manual.html similarity index 100% rename from tests/wpt/web-platform-tests/editing/manual/insertlinebreak.manual.html rename to tests/wpt/web-platform-tests/editing/manual/insertlinebreak-manual.html diff --git a/tests/wpt/web-platform-tests/editing/manual/insertparagraph.manual.html b/tests/wpt/web-platform-tests/editing/manual/insertparagraph-manual.html similarity index 100% rename from tests/wpt/web-platform-tests/editing/manual/insertparagraph.manual.html rename to tests/wpt/web-platform-tests/editing/manual/insertparagraph-manual.html diff --git a/tests/wpt/web-platform-tests/editing/manual/inserttext.manual.html b/tests/wpt/web-platform-tests/editing/manual/inserttext-manual.html similarity index 100% rename from tests/wpt/web-platform-tests/editing/manual/inserttext.manual.html rename to tests/wpt/web-platform-tests/editing/manual/inserttext-manual.html diff --git a/tests/wpt/web-platform-tests/editing/manual/inserttext2.manual.html b/tests/wpt/web-platform-tests/editing/manual/inserttext2-manual.html similarity index 100% rename from tests/wpt/web-platform-tests/editing/manual/inserttext2.manual.html rename to tests/wpt/web-platform-tests/editing/manual/inserttext2-manual.html diff --git a/tests/wpt/web-platform-tests/encoding/META.yml b/tests/wpt/web-platform-tests/encoding/META.yml index 1ee2bbe3948..a219a492f0b 100644 --- a/tests/wpt/web-platform-tests/encoding/META.yml +++ b/tests/wpt/web-platform-tests/encoding/META.yml @@ -1,3 +1,4 @@ +spec: https://encoding.spec.whatwg.org/ suggested_reviewers: - inexorabletash - annevk diff --git a/tests/wpt/web-platform-tests/encoding/api-basics.html b/tests/wpt/web-platform-tests/encoding/api-basics.any.js similarity index 91% rename from tests/wpt/web-platform-tests/encoding/api-basics.html rename to tests/wpt/web-platform-tests/encoding/api-basics.any.js index 83670ce7dc3..941b878738c 100644 --- a/tests/wpt/web-platform-tests/encoding/api-basics.html +++ b/tests/wpt/web-platform-tests/encoding/api-basics.any.js @@ -1,8 +1,4 @@ - -Encoding API: Basics - - - diff --git a/tests/wpt/web-platform-tests/encoding/api-invalid-label.html b/tests/wpt/web-platform-tests/encoding/api-invalid-label.any.js similarity index 70% rename from tests/wpt/web-platform-tests/encoding/api-invalid-label.html rename to tests/wpt/web-platform-tests/encoding/api-invalid-label.any.js index 3c7486fa0fa..38c0e9a55fd 100644 --- a/tests/wpt/web-platform-tests/encoding/api-invalid-label.html +++ b/tests/wpt/web-platform-tests/encoding/api-invalid-label.any.js @@ -1,10 +1,7 @@ - -Encoding API: invalid label - - - - - diff --git a/tests/wpt/web-platform-tests/encoding/api-replacement-encodings.html b/tests/wpt/web-platform-tests/encoding/api-replacement-encodings.any.js similarity index 65% rename from tests/wpt/web-platform-tests/encoding/api-replacement-encodings.html rename to tests/wpt/web-platform-tests/encoding/api-replacement-encodings.any.js index 63402636fa7..6d1e494ac39 100644 --- a/tests/wpt/web-platform-tests/encoding/api-replacement-encodings.html +++ b/tests/wpt/web-platform-tests/encoding/api-replacement-encodings.any.js @@ -1,9 +1,5 @@ - -Encoding API: replacement encoding - - - - diff --git a/tests/wpt/web-platform-tests/encoding/api-surrogates-utf8.html b/tests/wpt/web-platform-tests/encoding/api-surrogates-utf8.any.js similarity index 86% rename from tests/wpt/web-platform-tests/encoding/api-surrogates-utf8.html rename to tests/wpt/web-platform-tests/encoding/api-surrogates-utf8.any.js index ef0ad4075c8..a4ced03d428 100644 --- a/tests/wpt/web-platform-tests/encoding/api-surrogates-utf8.html +++ b/tests/wpt/web-platform-tests/encoding/api-surrogates-utf8.any.js @@ -1,8 +1,4 @@ - -Encoding API: Invalid UTF-16 surrogates with UTF-8 encoding - - - diff --git a/tests/wpt/web-platform-tests/encoding/iso-2022-jp-decoder.any.js b/tests/wpt/web-platform-tests/encoding/iso-2022-jp-decoder.any.js new file mode 100644 index 00000000000..b02259b9600 --- /dev/null +++ b/tests/wpt/web-platform-tests/encoding/iso-2022-jp-decoder.any.js @@ -0,0 +1,50 @@ +function decode(input, output, desc) { + test(function() { + var d = new TextDecoder("iso-2022-jp"), + buffer = new ArrayBuffer(input.length), + view = new Int8Array(buffer) + for(var i = 0, l = input.length; i < l; i++) { + view[i] = input[i] + } + assert_equals(d.decode(view), output) + }, "iso-2022-jp decoder: " + desc) +} +decode([0x1b, 0x24], "�$", "Error ESC") +decode([0x1b, 0x24, 0x50], "�$P", "Error ESC, character") +decode([0x1b, 0x28, 0x42, 0x50], "P", "ASCII ESC, character") +decode([0x1b, 0x28, 0x42, 0x1b, 0x28, 0x42, 0x50], "�P", "Double ASCII ESC, character") +decode([0x50, 0x1b, 0x28, 0x42, 0x50], "PP", "character, ASCII ESC, character") +decode([0x5C, 0x5D, 0x7E], "\\]~", "characters") +decode([0x0D, 0x0E, 0x0F, 0x10], "\x0D��\x10", "SO / SI") + +decode([0x1b, 0x28, 0x4A, 0x5C, 0x5D, 0x7E], "¥]‾", "Roman ESC, characters") +decode([0x1b, 0x28, 0x4A, 0x0D, 0x0E, 0x0F, 0x10], "\x0D��\x10", "Roman ESC, SO / SI") +decode([0x1b, 0x28, 0x4A, 0x1b, 0x1b, 0x28, 0x49, 0x50], "�ミ", "Roman ESC, error ESC, Katakana ESC") + +decode([0x1b, 0x28, 0x49, 0x50], "ミ", "Katakana ESC, character") +decode([0x1b, 0x28, 0x49, 0x1b, 0x24, 0x40, 0x50, 0x50], "�佩", "Katakana ESC, multibyte ESC, character") +decode([0x1b, 0x28, 0x49, 0x1b, 0x50], "�ミ", "Katakana ESC, error ESC, character") +decode([0x1b, 0x28, 0x49, 0x1b, 0x24, 0x50], "�、ミ", "Katakana ESC, error ESC #2, character") +decode([0x1b, 0x28, 0x49, 0x50, 0x1b, 0x28, 0x49, 0x50], "ミミ", "Katakana ESC, character, Katakana ESC, character") +decode([0x1b, 0x28, 0x49, 0x0D, 0x0E, 0x0F, 0x10], "����", "Katakana ESC, SO / SI") + +decode([0x1b, 0x24, 0x40, 0x50, 0x50], "佩", "Multibyte ESC, character") +decode([0x1b, 0x24, 0x42, 0x50, 0x50], "佩", "Multibyte ESC #2, character") +decode([0x1b, 0x24, 0x42, 0x1b, 0x50, 0x50], "�佩", "Multibyte ESC, error ESC, character") +decode([0x1b, 0x24, 0x40, 0x1b, 0x24, 0x40], "�", "Double multibyte ESC") +decode([0x1b, 0x24, 0x40, 0x1b, 0x24, 0x40, 0x50, 0x50], "�佩", "Double multibyte ESC, character") +decode([0x1b, 0x24, 0x40, 0x1b, 0x24, 0x42, 0x50, 0x50], "�佩", "Double multibyte ESC #2, character") +decode([0x1b, 0x24, 0x40, 0x1b, 0x24, 0x50, 0x50], "�ば�", "Multibyte ESC, error ESC #2, character") + +decode([0x1b, 0x24, 0x40, 0x50, 0x1b, 0x24, 0x40, 0x50, 0x50], "�佩", "Multibyte ESC, single byte, multibyte ESC, character") +decode([0x1b, 0x24, 0x40, 0x20, 0x50], "��", "Multibyte ESC, lead error byte") +decode([0x1b, 0x24, 0x40, 0x50, 0x20], "�", "Multibyte ESC, trail error byte") + +decode([0x50, 0x1b], "P�", "character, error ESC") +decode([0x50, 0x1b, 0x24], "P�$", "character, error ESC #2") +decode([0x50, 0x1b, 0x50], "P�P", "character, error ESC #3") +decode([0x50, 0x1b, 0x28, 0x42], "P", "character, ASCII ESC") +decode([0x50, 0x1b, 0x28, 0x4A], "P", "character, Roman ESC") +decode([0x50, 0x1b, 0x28, 0x49], "P", "character, Katakana ESC") +decode([0x50, 0x1b, 0x24, 0x40], "P", "character, Multibyte ESC") +decode([0x50, 0x1b, 0x24, 0x42], "P", "character, Multibyte ESC #2") diff --git a/tests/wpt/web-platform-tests/encoding/iso-2022-jp-decoder.html b/tests/wpt/web-platform-tests/encoding/iso-2022-jp-decoder.html deleted file mode 100644 index c0b858c74f4..00000000000 --- a/tests/wpt/web-platform-tests/encoding/iso-2022-jp-decoder.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - -
- diff --git a/tests/wpt/web-platform-tests/encoding/legacy-mb-korean/euc-kr/euckr-decode-ksc_5601.html b/tests/wpt/web-platform-tests/encoding/legacy-mb-korean/euc-kr/euckr-decode-ksc_5601.html index 6499ab578f9..afda7233cd6 100644 --- a/tests/wpt/web-platform-tests/encoding/legacy-mb-korean/euc-kr/euckr-decode-ksc_5601.html +++ b/tests/wpt/web-platform-tests/encoding/legacy-mb-korean/euc-kr/euckr-decode-ksc_5601.html @@ -6,6 +6,7 @@ + diff --git a/tests/wpt/web-platform-tests/encoding/replacement-encodings.html b/tests/wpt/web-platform-tests/encoding/replacement-encodings.any.js similarity index 66% rename from tests/wpt/web-platform-tests/encoding/replacement-encodings.html rename to tests/wpt/web-platform-tests/encoding/replacement-encodings.any.js index 4be3c858b23..784dd953e33 100644 --- a/tests/wpt/web-platform-tests/encoding/replacement-encodings.html +++ b/tests/wpt/web-platform-tests/encoding/replacement-encodings.any.js @@ -1,10 +1,6 @@ - -Encoding API: replacement encoding - - - - - diff --git a/tests/wpt/web-platform-tests/encoding/textdecoder-byte-order-marks.html b/tests/wpt/web-platform-tests/encoding/textdecoder-byte-order-marks.any.js similarity index 88% rename from tests/wpt/web-platform-tests/encoding/textdecoder-byte-order-marks.html rename to tests/wpt/web-platform-tests/encoding/textdecoder-byte-order-marks.any.js index 8ef16794381..9ef0d73141a 100644 --- a/tests/wpt/web-platform-tests/encoding/textdecoder-byte-order-marks.html +++ b/tests/wpt/web-platform-tests/encoding/textdecoder-byte-order-marks.any.js @@ -1,8 +1,4 @@ - -Encoding API: Byte-order marks - - - diff --git a/tests/wpt/web-platform-tests/encoding/textdecoder-fatal-single-byte.html b/tests/wpt/web-platform-tests/encoding/textdecoder-fatal-single-byte.any.js similarity index 92% rename from tests/wpt/web-platform-tests/encoding/textdecoder-fatal-single-byte.html rename to tests/wpt/web-platform-tests/encoding/textdecoder-fatal-single-byte.any.js index d9bf412826f..9d12134edc5 100644 --- a/tests/wpt/web-platform-tests/encoding/textdecoder-fatal-single-byte.html +++ b/tests/wpt/web-platform-tests/encoding/textdecoder-fatal-single-byte.any.js @@ -1,8 +1,4 @@ - -Encoding API: Fatal flag for single byte encodings - - - diff --git a/tests/wpt/web-platform-tests/encoding/textdecoder-fatal-streaming.html b/tests/wpt/web-platform-tests/encoding/textdecoder-fatal-streaming.any.js similarity index 88% rename from tests/wpt/web-platform-tests/encoding/textdecoder-fatal-streaming.html rename to tests/wpt/web-platform-tests/encoding/textdecoder-fatal-streaming.any.js index 2ccac9f230d..e4fa64dbd7c 100644 --- a/tests/wpt/web-platform-tests/encoding/textdecoder-fatal-streaming.html +++ b/tests/wpt/web-platform-tests/encoding/textdecoder-fatal-streaming.any.js @@ -1,8 +1,4 @@ - -Encoding API: End-of-file - - - diff --git a/tests/wpt/web-platform-tests/encoding/textdecoder-fatal.html b/tests/wpt/web-platform-tests/encoding/textdecoder-fatal.any.js similarity index 95% rename from tests/wpt/web-platform-tests/encoding/textdecoder-fatal.html rename to tests/wpt/web-platform-tests/encoding/textdecoder-fatal.any.js index e8cc9f64c66..3cb75736b2c 100644 --- a/tests/wpt/web-platform-tests/encoding/textdecoder-fatal.html +++ b/tests/wpt/web-platform-tests/encoding/textdecoder-fatal.any.js @@ -1,8 +1,4 @@ - -Encoding API: Fatal flag - - - diff --git a/tests/wpt/web-platform-tests/encoding/textdecoder-ignorebom.html b/tests/wpt/web-platform-tests/encoding/textdecoder-ignorebom.any.js similarity index 89% rename from tests/wpt/web-platform-tests/encoding/textdecoder-ignorebom.html rename to tests/wpt/web-platform-tests/encoding/textdecoder-ignorebom.any.js index 26381568f59..1f5dabd7b51 100644 --- a/tests/wpt/web-platform-tests/encoding/textdecoder-ignorebom.html +++ b/tests/wpt/web-platform-tests/encoding/textdecoder-ignorebom.any.js @@ -1,8 +1,4 @@ - -Encoding API: TextDecoder ignoreBOM option - - - diff --git a/tests/wpt/web-platform-tests/encoding/textdecoder-labels.html b/tests/wpt/web-platform-tests/encoding/textdecoder-labels.any.js similarity index 84% rename from tests/wpt/web-platform-tests/encoding/textdecoder-labels.html rename to tests/wpt/web-platform-tests/encoding/textdecoder-labels.any.js index 67dc33334a4..ed407a32547 100644 --- a/tests/wpt/web-platform-tests/encoding/textdecoder-labels.html +++ b/tests/wpt/web-platform-tests/encoding/textdecoder-labels.any.js @@ -1,9 +1,6 @@ - -Encoding API: Encoding labels - - - - diff --git a/tests/wpt/web-platform-tests/encoding/textdecoder-streaming.html b/tests/wpt/web-platform-tests/encoding/textdecoder-streaming.any.js similarity index 86% rename from tests/wpt/web-platform-tests/encoding/textdecoder-streaming.html rename to tests/wpt/web-platform-tests/encoding/textdecoder-streaming.any.js index 2b567aaa1e1..0863385b9af 100644 --- a/tests/wpt/web-platform-tests/encoding/textdecoder-streaming.html +++ b/tests/wpt/web-platform-tests/encoding/textdecoder-streaming.any.js @@ -1,9 +1,5 @@ - -Encoding API: Streaming decode - - - - diff --git a/tests/wpt/web-platform-tests/encoding/textdecoder-utf16-surrogates.html b/tests/wpt/web-platform-tests/encoding/textdecoder-utf16-surrogates.any.js similarity index 85% rename from tests/wpt/web-platform-tests/encoding/textdecoder-utf16-surrogates.html rename to tests/wpt/web-platform-tests/encoding/textdecoder-utf16-surrogates.any.js index 207cf372baa..3b8418703da 100644 --- a/tests/wpt/web-platform-tests/encoding/textdecoder-utf16-surrogates.html +++ b/tests/wpt/web-platform-tests/encoding/textdecoder-utf16-surrogates.any.js @@ -1,8 +1,4 @@ - -Encoding API: UTF-16 surrogate handling - - - diff --git a/tests/wpt/web-platform-tests/encoding/textencoder-constructor-non-utf.html b/tests/wpt/web-platform-tests/encoding/textencoder-constructor-non-utf.any.js similarity index 71% rename from tests/wpt/web-platform-tests/encoding/textencoder-constructor-non-utf.html rename to tests/wpt/web-platform-tests/encoding/textencoder-constructor-non-utf.any.js index 1fa1ffcc816..c7136da4dce 100644 --- a/tests/wpt/web-platform-tests/encoding/textencoder-constructor-non-utf.html +++ b/tests/wpt/web-platform-tests/encoding/textencoder-constructor-non-utf.any.js @@ -1,9 +1,5 @@ - -Encoding API: Legacy encodings - - - - diff --git a/tests/wpt/web-platform-tests/encoding/textencoder-utf16-surrogates.html b/tests/wpt/web-platform-tests/encoding/textencoder-utf16-surrogates.any.js similarity index 83% rename from tests/wpt/web-platform-tests/encoding/textencoder-utf16-surrogates.html rename to tests/wpt/web-platform-tests/encoding/textencoder-utf16-surrogates.any.js index 46407528f70..014a0ebb12d 100644 --- a/tests/wpt/web-platform-tests/encoding/textencoder-utf16-surrogates.html +++ b/tests/wpt/web-platform-tests/encoding/textencoder-utf16-surrogates.any.js @@ -1,8 +1,4 @@ - -Encoding API: USVString surrogate handling when encoding - - - diff --git a/tests/wpt/web-platform-tests/encoding/unsupported-encodings.html b/tests/wpt/web-platform-tests/encoding/unsupported-encodings.any.js similarity index 83% rename from tests/wpt/web-platform-tests/encoding/unsupported-encodings.html rename to tests/wpt/web-platform-tests/encoding/unsupported-encodings.any.js index 7584d3d17ca..461188ea2b4 100644 --- a/tests/wpt/web-platform-tests/encoding/unsupported-encodings.html +++ b/tests/wpt/web-platform-tests/encoding/unsupported-encodings.any.js @@ -1,9 +1,5 @@ - -Encoding API: unsupported encodings - - - - diff --git a/tests/wpt/web-platform-tests/encrypted-media/META.yml b/tests/wpt/web-platform-tests/encrypted-media/META.yml index 3d55df9bf87..3168f7d96f8 100644 --- a/tests/wpt/web-platform-tests/encrypted-media/META.yml +++ b/tests/wpt/web-platform-tests/encrypted-media/META.yml @@ -1,2 +1,3 @@ +spec: https://w3c.github.io/encrypted-media/ suggested_reviewers: - ddorwin diff --git a/tests/wpt/web-platform-tests/entries-api/META.yml b/tests/wpt/web-platform-tests/entries-api/META.yml index f8444ff7d80..69f68452f29 100644 --- a/tests/wpt/web-platform-tests/entries-api/META.yml +++ b/tests/wpt/web-platform-tests/entries-api/META.yml @@ -1,3 +1,4 @@ +spec: https://wicg.github.io/entries-api/ suggested_reviewers: - aliams - inexorabletash diff --git a/tests/wpt/web-platform-tests/eventsource/META.yml b/tests/wpt/web-platform-tests/eventsource/META.yml index 300bd0c5d5d..92f10363385 100644 --- a/tests/wpt/web-platform-tests/eventsource/META.yml +++ b/tests/wpt/web-platform-tests/eventsource/META.yml @@ -1,3 +1,4 @@ +spec: https://html.spec.whatwg.org/multipage/server-sent-events.html suggested_reviewers: - zqzhang - odinho diff --git a/tests/wpt/web-platform-tests/feature-policy/META.yml b/tests/wpt/web-platform-tests/feature-policy/META.yml index 41bdcaa00e2..44ab62ca724 100644 --- a/tests/wpt/web-platform-tests/feature-policy/META.yml +++ b/tests/wpt/web-platform-tests/feature-policy/META.yml @@ -1,2 +1,3 @@ +spec: https://wicg.github.io/feature-policy/ suggested_reviewers: - clelland diff --git a/tests/wpt/web-platform-tests/fetch/META.yml b/tests/wpt/web-platform-tests/fetch/META.yml index a2c36028f0b..43f9dc51cfd 100644 --- a/tests/wpt/web-platform-tests/fetch/META.yml +++ b/tests/wpt/web-platform-tests/fetch/META.yml @@ -1,3 +1,4 @@ +spec: https://fetch.spec.whatwg.org/ suggested_reviewers: - jdm - youennf diff --git a/tests/wpt/web-platform-tests/fetch/api/abort/destroyed-context.html b/tests/wpt/web-platform-tests/fetch/api/abort/destroyed-context.html new file mode 100644 index 00000000000..161d39bd9ce --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/api/abort/destroyed-context.html @@ -0,0 +1,27 @@ + + + + + + diff --git a/tests/wpt/web-platform-tests/fetch/api/abort/keepalive.html b/tests/wpt/web-platform-tests/fetch/api/abort/keepalive.html new file mode 100644 index 00000000000..db12df0d289 --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/api/abort/keepalive.html @@ -0,0 +1,85 @@ + + + + + + + + diff --git a/tests/wpt/web-platform-tests/fetch/api/response/response-cancel-stream.html b/tests/wpt/web-platform-tests/fetch/api/response/response-cancel-stream.html index 58d6745a12a..fcaed04d83e 100644 --- a/tests/wpt/web-platform-tests/fetch/api/response/response-cancel-stream.html +++ b/tests/wpt/web-platform-tests/fetch/api/response/response-cancel-stream.html @@ -30,7 +30,9 @@ promise_test(function(test) { var closedPromise = reader.closed.then(function() { return reader.cancel(); }); - reader.read(); + reader.read().then(function readMore({done, value}) { + if (!done) return reader.read().then(readMore); + }); return closedPromise; }, "Cancelling a closed blob Response stream"); diff --git a/tests/wpt/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.js b/tests/wpt/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.js index c1acdeeb4ab..b3b6f2bb2f1 100644 --- a/tests/wpt/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.js +++ b/tests/wpt/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.js @@ -1,20 +1,24 @@ +// META: global=window,worker // META: script=/resources/WebIDLParser.js // META: script=/resources/idlharness.js -promise_test(async () => { - const idl = await fetch('/interfaces/cors-rfc1918.idl').then(r => r.text()); - const html = await fetch('/interfaces/html.idl').then(r => r.text()); - const dom = await fetch('/interfaces/dom.idl').then(r => r.text()); +'use strict'; - const idlArray = new IdlArray(); - idlArray.add_idls(idl); - idlArray.add_dependency_idls(html); - idlArray.add_dependency_idls(dom); +// https://wicg.github.io/cors-rfc1918/ - const objects = { - Document: ['document'], - WorkerGlobalScope: ['self'], - }; - idlArray.add_objects(objects); - idlArray.test(); -}, 'Test CORS RFC1918 interfaces'); +idl_test( + ['cors-rfc1918'], + ['html', 'dom'], + idlArray => { + if (self.GLOBAL.isWorker()) { + idlArray.add_objects({ + WorkerGlobalScope: ['self'], + }); + } else { + idlArray.add_objects({ + Document: ['document'], + }); + } + }, + 'Test CORS RFC1918 interfaces' +); diff --git a/tests/wpt/web-platform-tests/fetch/http-cache/304-update.html b/tests/wpt/web-platform-tests/fetch/http-cache/304-update.html index 663191a8785..f0bd82196e5 100644 --- a/tests/wpt/web-platform-tests/fetch/http-cache/304-update.html +++ b/tests/wpt/web-platform-tests/fetch/http-cache/304-update.html @@ -4,6 +4,7 @@ HTTP Cache - 304 Updates + @@ -14,19 +15,19 @@ @@ -20,7 +21,7 @@ template: "fresh" }, { request_method: "POST", - request_body: "abc", + request_body: "abc" }, { expected_type: "not_cached" } @@ -48,7 +49,7 @@ }, { template: "fresh", request_method: "PUT", - request_body: "abc", + request_body: "abc" }, { expected_type: "not_cached" } @@ -61,7 +62,7 @@ template: "fresh" }, { request_method: "DELETE", - request_body: "abc", + request_body: "abc" }, { expected_type: "not_cached" } @@ -74,7 +75,7 @@ template: "fresh" }, { request_method: "FOO", - request_body: "abc", + request_body: "abc" }, { expected_type: "not_cached" } @@ -121,7 +122,7 @@ }, { template: "lcl_response", request_method: "PUT", - request_body: "abc", + request_body: "abc" }, { template: "location", expected_type: "not_cached" @@ -136,7 +137,7 @@ }, { template: "lcl_response", request_method: "DELETE", - request_body: "abc", + request_body: "abc" }, { template: "location", expected_type: "not_cached" @@ -151,7 +152,7 @@ }, { template: "lcl_response", request_method: "FOO", - request_body: "abc", + request_body: "abc" }, { template: "location", expected_type: "not_cached" @@ -200,7 +201,7 @@ }, { template: "lcl_response", request_method: "PUT", - request_body: "abc", + request_body: "abc" }, { template: "content_location", expected_type: "not_cached" @@ -215,7 +216,7 @@ }, { template: "lcl_response", request_method: "DELETE", - request_body: "abc", + request_body: "abc" }, { template: "content_location", expected_type: "not_cached" @@ -230,7 +231,7 @@ }, { template: "lcl_response", request_method: "FOO", - request_body: "abc", + request_body: "abc" }, { template: "content_location", expected_type: "not_cached" diff --git a/tests/wpt/web-platform-tests/fetch/http-cache/partial.html b/tests/wpt/web-platform-tests/fetch/http-cache/partial.html index 8d5d61d46c4..8f0b528e8ce 100644 --- a/tests/wpt/web-platform-tests/fetch/http-cache/partial.html +++ b/tests/wpt/web-platform-tests/fetch/http-cache/partial.html @@ -15,7 +15,7 @@ - - - - diff --git a/tests/wpt/web-platform-tests/generic-sensor/idlharness.https.window.js b/tests/wpt/web-platform-tests/generic-sensor/idlharness.https.window.js new file mode 100644 index 00000000000..8da0307cf65 --- /dev/null +++ b/tests/wpt/web-platform-tests/generic-sensor/idlharness.https.window.js @@ -0,0 +1,23 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://w3c.github.io/sensors/ + +'use strict'; + +function cast(i, t) { + return Object.assign(Object.create(t.prototype), i); +} + +idl_test( + ['generic-sensor'], + ['dom', 'html', 'WebIDL'], + idl_array => { + idl_array.add_objects({ + Sensor: ['cast(new Accelerometer(), Sensor)'], + SensorErrorEvent: [ + 'new SensorErrorEvent("error", { error: new DOMException });' + ], + }); + }, + 'Test IDL implementation of Generic Sensor'); diff --git a/tests/wpt/web-platform-tests/geolocation-API/META.yml b/tests/wpt/web-platform-tests/geolocation-API/META.yml index b47dfa409a5..fa243042560 100644 --- a/tests/wpt/web-platform-tests/geolocation-API/META.yml +++ b/tests/wpt/web-platform-tests/geolocation-API/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/geolocation-api/ suggested_reviewers: - jdm - yellowdoge diff --git a/tests/wpt/web-platform-tests/geolocation-API/idlharness.window.js b/tests/wpt/web-platform-tests/geolocation-API/idlharness.window.js new file mode 100644 index 00000000000..f8c92c12135 --- /dev/null +++ b/tests/wpt/web-platform-tests/geolocation-API/idlharness.window.js @@ -0,0 +1,18 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://www.w3.org/TR/geolocation-API/ + +promise_test(async () => { + const idl = await fetch('/interfaces/geolocation-API.idl').then(r => r.text()); + const html = await fetch('/interfaces/html.idl').then(r => r.text()); + + const idl_array = new IdlArray(); + idl_array.add_idls(idl); + idl_array.add_dependency_idls(html); + idl_array.add_objects({ + Navigator: ["navigator"], + Geolocation: ["navigator.geolocation"] + }); + idl_array.test(); +}, 'geolocation-API interfaces'); diff --git a/tests/wpt/web-platform-tests/geolocation-API/interfaces.html b/tests/wpt/web-platform-tests/geolocation-API/interfaces.html deleted file mode 100644 index 0db4204653d..00000000000 --- a/tests/wpt/web-platform-tests/geolocation-API/interfaces.html +++ /dev/null @@ -1,95 +0,0 @@ - - -Geolocation API IDL tests - - - - - - - -

Geolocation API IDL tests

-
- - - - - - - diff --git a/tests/wpt/web-platform-tests/geolocation-sensor/GeolocationSensor-iframe-access.https.html b/tests/wpt/web-platform-tests/geolocation-sensor/GeolocationSensor-iframe-access.https.html new file mode 100644 index 00000000000..68a99029f63 --- /dev/null +++ b/tests/wpt/web-platform-tests/geolocation-sensor/GeolocationSensor-iframe-access.https.html @@ -0,0 +1,14 @@ + + +GeolocationSensor iframe test + + + + + + + +
+ diff --git a/tests/wpt/web-platform-tests/geolocation-sensor/META.yml b/tests/wpt/web-platform-tests/geolocation-sensor/META.yml index 447e8b08ddf..836a47ba4d1 100644 --- a/tests/wpt/web-platform-tests/geolocation-sensor/META.yml +++ b/tests/wpt/web-platform-tests/geolocation-sensor/META.yml @@ -1,3 +1,4 @@ +spec: https://wicg.github.io/geolocation-sensor/ suggested_reviewers: - anssiko - Honry diff --git a/tests/wpt/web-platform-tests/graphics-aam/META.yml b/tests/wpt/web-platform-tests/graphics-aam/META.yml index d99ed62b8e3..69446b204e7 100644 --- a/tests/wpt/web-platform-tests/graphics-aam/META.yml +++ b/tests/wpt/web-platform-tests/graphics-aam/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/graphics-aam/ suggested_reviewers: - halindrome - joanmarie diff --git a/tests/wpt/web-platform-tests/gyroscope/META.yml b/tests/wpt/web-platform-tests/gyroscope/META.yml index 2eeea5b1e99..3c10460607d 100644 --- a/tests/wpt/web-platform-tests/gyroscope/META.yml +++ b/tests/wpt/web-platform-tests/gyroscope/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/gyroscope/ suggested_reviewers: - zqzhang - dontcallmedom diff --git a/tests/wpt/web-platform-tests/hr-time/META.yml b/tests/wpt/web-platform-tests/hr-time/META.yml index ee0e032763c..2be354920aa 100644 --- a/tests/wpt/web-platform-tests/hr-time/META.yml +++ b/tests/wpt/web-platform-tests/hr-time/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/hr-time/ suggested_reviewers: - plehegar - igrigorik diff --git a/tests/wpt/web-platform-tests/html-imports/document/document-method-changes.html b/tests/wpt/web-platform-tests/html-imports/document/document-method-changes.html deleted file mode 100644 index c71012ff524..00000000000 --- a/tests/wpt/web-platform-tests/html-imports/document/document-method-changes.html +++ /dev/null @@ -1,22 +0,0 @@ - - - -The import attribute - - - - - - - - -
- - - diff --git a/tests/wpt/web-platform-tests/html-imports/document/resources/body-only.html b/tests/wpt/web-platform-tests/html-imports/document/resources/body-only.html deleted file mode 100644 index 0ed2a55bbc8..00000000000 --- a/tests/wpt/web-platform-tests/html-imports/document/resources/body-only.html +++ /dev/null @@ -1,4 +0,0 @@ - - -Hello - diff --git a/tests/wpt/web-platform-tests/html-imports/document/resources/test-in-import.html b/tests/wpt/web-platform-tests/html-imports/document/resources/test-in-import.html deleted file mode 100644 index fc25e85a406..00000000000 --- a/tests/wpt/web-platform-tests/html-imports/document/resources/test-in-import.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/tests/wpt/web-platform-tests/html-imports/fetching/already-in-import-map.html b/tests/wpt/web-platform-tests/html-imports/fetching/already-in-import-map.html deleted file mode 100644 index a5b006500c5..00000000000 --- a/tests/wpt/web-platform-tests/html-imports/fetching/already-in-import-map.html +++ /dev/null @@ -1,26 +0,0 @@ - - - -Fetching import - - - - - - - - - - -
- - - diff --git a/tests/wpt/web-platform-tests/html-imports/fetching/loading-attempt.html b/tests/wpt/web-platform-tests/html-imports/fetching/loading-attempt.html deleted file mode 100644 index 7c1b442b11a..00000000000 --- a/tests/wpt/web-platform-tests/html-imports/fetching/loading-attempt.html +++ /dev/null @@ -1,76 +0,0 @@ - - - -Fetching import - - - - - - - - - - - - - -
- - diff --git a/tests/wpt/web-platform-tests/html-imports/fetching/resources/async.html b/tests/wpt/web-platform-tests/html-imports/fetching/resources/async.html deleted file mode 100644 index 18de0861803..00000000000 --- a/tests/wpt/web-platform-tests/html-imports/fetching/resources/async.html +++ /dev/null @@ -1,2 +0,0 @@ - -Async diff --git a/tests/wpt/web-platform-tests/html-imports/fetching/resources/dynamic.html b/tests/wpt/web-platform-tests/html-imports/fetching/resources/dynamic.html deleted file mode 100644 index bf17a13bae9..00000000000 --- a/tests/wpt/web-platform-tests/html-imports/fetching/resources/dynamic.html +++ /dev/null @@ -1,2 +0,0 @@ - -Dyamic diff --git a/tests/wpt/web-platform-tests/html-imports/fetching/resources/hello.html b/tests/wpt/web-platform-tests/html-imports/fetching/resources/hello.html deleted file mode 100644 index 949f6c66abb..00000000000 --- a/tests/wpt/web-platform-tests/html-imports/fetching/resources/hello.html +++ /dev/null @@ -1,2 +0,0 @@ - -Hello diff --git a/tests/wpt/web-platform-tests/html-imports/fetching/resources/parent-of-hello.html b/tests/wpt/web-platform-tests/html-imports/fetching/resources/parent-of-hello.html deleted file mode 100644 index 195e37adde0..00000000000 --- a/tests/wpt/web-platform-tests/html-imports/fetching/resources/parent-of-hello.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/wpt/web-platform-tests/html-imports/html-link-element/import-attribute.html b/tests/wpt/web-platform-tests/html-imports/html-link-element/import-attribute.html deleted file mode 100644 index 41b63751f3c..00000000000 --- a/tests/wpt/web-platform-tests/html-imports/html-link-element/import-attribute.html +++ /dev/null @@ -1,43 +0,0 @@ - - - -The import attribute - - - - - - - - - - - -
- - - - diff --git a/tests/wpt/web-platform-tests/html-imports/html-link-element/resources/body-only-0.html b/tests/wpt/web-platform-tests/html-imports/html-link-element/resources/body-only-0.html deleted file mode 100644 index cac33c7a316..00000000000 --- a/tests/wpt/web-platform-tests/html-imports/html-link-element/resources/body-only-0.html +++ /dev/null @@ -1,4 +0,0 @@ - - -Hello - diff --git a/tests/wpt/web-platform-tests/html-imports/html-link-element/resources/body-only-1.html b/tests/wpt/web-platform-tests/html-imports/html-link-element/resources/body-only-1.html deleted file mode 100644 index c0eedf4e48e..00000000000 --- a/tests/wpt/web-platform-tests/html-imports/html-link-element/resources/body-only-1.html +++ /dev/null @@ -1,4 +0,0 @@ - - -Hello - diff --git a/tests/wpt/web-platform-tests/html-imports/html-link-element/resources/body-only-2.html b/tests/wpt/web-platform-tests/html-imports/html-link-element/resources/body-only-2.html deleted file mode 100644 index 9a6a1e4381b..00000000000 --- a/tests/wpt/web-platform-tests/html-imports/html-link-element/resources/body-only-2.html +++ /dev/null @@ -1,4 +0,0 @@ - - -Hello - diff --git a/tests/wpt/web-platform-tests/html-imports/html-link-element/resources/hello.css b/tests/wpt/web-platform-tests/html-imports/html-link-element/resources/hello.css deleted file mode 100644 index 9054080ffcc..00000000000 --- a/tests/wpt/web-platform-tests/html-imports/html-link-element/resources/hello.css +++ /dev/null @@ -1,3 +0,0 @@ -h1 { - color: red; -} \ No newline at end of file diff --git a/tests/wpt/web-platform-tests/html-longdesc/META.yml b/tests/wpt/web-platform-tests/html-longdesc/META.yml index 4c41f0cad02..e6fbaa9d91f 100644 --- a/tests/wpt/web-platform-tests/html-longdesc/META.yml +++ b/tests/wpt/web-platform-tests/html-longdesc/META.yml @@ -1,3 +1,4 @@ +spec: https://www.w3.org/TR/html-longdesc/ suggested_reviewers: - chaals - cptvitamin diff --git a/tests/wpt/web-platform-tests/html-media-capture/META.yml b/tests/wpt/web-platform-tests/html-media-capture/META.yml index f104d897f8b..706dbdf8b6a 100644 --- a/tests/wpt/web-platform-tests/html-media-capture/META.yml +++ b/tests/wpt/web-platform-tests/html-media-capture/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/html-media-capture/ suggested_reviewers: - haoxli - zqzhang diff --git a/tests/wpt/web-platform-tests/html/META.yml b/tests/wpt/web-platform-tests/html/META.yml index 8e713fab58c..d491c94e30c 100644 --- a/tests/wpt/web-platform-tests/html/META.yml +++ b/tests/wpt/web-platform-tests/html/META.yml @@ -1,4 +1,10 @@ +spec: https://html.spec.whatwg.org/multipage/ suggested_reviewers: + - annevk + - domenic + - foolip - jdm - jgraham + - sideshowbarker + - zcorpan - zqzhang diff --git a/tests/wpt/web-platform-tests/html/browsers/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/aborting-a-document-load/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/aborting-a-document-load/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/history-traversal/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/history-traversal/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/navigating-across-documents/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/navigating-across-documents/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/read-html/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/read-html/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/read-media/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/read-media/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/read-multipart-x-mixed-replace/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/read-multipart-x-mixed-replace/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/read-plugin/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/read-plugin/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/read-text/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/read-text/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/read-ua-inline/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/read-ua-inline/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/read-xml/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/read-xml/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/history/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/history/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/history/history-notes/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/history/history-notes/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/history/the-history-interface/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/history/the-history-interface/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/history/the-location-interface/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/history/the-location-interface/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/history/the-session-history-of-browsing-contexts/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/history/the-session-history-of-browsing-contexts/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/offline/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/offline/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/offline/appcache/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/offline/appcache/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/offline/application-cache-api/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/offline/application-cache-api/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/offline/browser-state/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/offline/browser-state/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/offline/changestonetworkingmodel/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/offline/changestonetworkingmodel/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/offline/disk-space/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/offline/disk-space/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/offline/downloading-or-updating-an-application-cache/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/offline/downloading-or-updating-an-application-cache/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/offline/expiring-application-caches/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/offline/expiring-application-caches/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/offline/introduction-4/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/offline/introduction-4/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/offline/manifests/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/offline/manifests/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/offline/the-application-cache-selection-algorithm/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/offline/the-application-cache-selection-algorithm/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/sandboxing/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/sandboxing/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/the-window-object/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/the-window-object/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/the-window-object/accessing-other-browsing-contexts/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/the-window-object/accessing-other-browsing-contexts/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/the-window-object/browser-interface-elements/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/the-window-object/browser-interface-elements/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/the-window-object/closing-browsing-contexts/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/the-window-object/closing-browsing-contexts/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/the-window-object/security-window/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/the-window-object/security-window/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/the-window-object/the-windowproxy-object/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/the-window-object/the-windowproxy-object/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/windows/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/windows/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/windows/browsing-context-names/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/windows/browsing-context-names/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/windows/groupings-of-browsing-contexts/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/windows/groupings-of-browsing-contexts/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/windows/nested-browsing-contexts/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/windows/nested-browsing-contexts/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/windows/secondary-browsing-contexts/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/windows/secondary-browsing-contexts/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/browsers/windows/security-nav/.gitkeep b/tests/wpt/web-platform-tests/html/browsers/windows/security-nav/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/.gitkeep b/tests/wpt/web-platform-tests/html/dom/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/documents/.gitkeep b/tests/wpt/web-platform-tests/html/dom/documents/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/documents/dom-tree-accessors/.gitkeep b/tests/wpt/web-platform-tests/html/dom/documents/dom-tree-accessors/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/documents/loading-xml-documents/.gitkeep b/tests/wpt/web-platform-tests/html/dom/documents/loading-xml-documents/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/documents/resource-metadata-management/.gitkeep b/tests/wpt/web-platform-tests/html/dom/documents/resource-metadata-management/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/documents/security-document/.gitkeep b/tests/wpt/web-platform-tests/html/dom/documents/security-document/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/documents/the-document-object/.gitkeep b/tests/wpt/web-platform-tests/html/dom/documents/the-document-object/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/.gitkeep b/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/closing-the-input-stream/.gitkeep b/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/closing-the-input-stream/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/.gitkeep b/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-writeln/.gitkeep b/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-writeln/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/.gitkeep b/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/elements/.gitkeep b/tests/wpt/web-platform-tests/html/dom/elements/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/elements/content-models/.gitkeep b/tests/wpt/web-platform-tests/html/dom/elements/content-models/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/elements/element-definitions/.gitkeep b/tests/wpt/web-platform-tests/html/dom/elements/element-definitions/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/elements/elements-in-the-dom/.gitkeep b/tests/wpt/web-platform-tests/html/dom/elements/elements-in-the-dom/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/elements/global-attributes/.gitkeep b/tests/wpt/web-platform-tests/html/dom/elements/global-attributes/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/elements/requirements-relating-to-bidirectional-algorithm-formatting-characters/.gitkeep b/tests/wpt/web-platform-tests/html/dom/elements/requirements-relating-to-bidirectional-algorithm-formatting-characters/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/elements/semantics-0/.gitkeep b/tests/wpt/web-platform-tests/html/dom/elements/semantics-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/elements/the-innertext-idl-attribute/getter-tests.js b/tests/wpt/web-platform-tests/html/dom/elements/the-innertext-idl-attribute/getter-tests.js index 77a3ebbfc01..af860c98e93 100644 --- a/tests/wpt/web-platform-tests/html/dom/elements/the-innertext-idl-attribute/getter-tests.js +++ b/tests/wpt/web-platform-tests/html/dom/elements/the-innertext-idl-attribute/getter-tests.js @@ -56,6 +56,7 @@ testText("
abc def", "abc /**** Soft line breaks ****/ testText("
abc def", "abc def", "Soft line breaks ignored"); +testText("
abc def", "abc def", "Whitespace text node preserved"); /**** first-line/first-letter ****/ diff --git a/tests/wpt/web-platform-tests/html/dom/elements/wai-aria/.gitkeep b/tests/wpt/web-platform-tests/html/dom/elements/wai-aria/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/interactions-with-xpath-and-xslt/.gitkeep b/tests/wpt/web-platform-tests/html/dom/interactions-with-xpath-and-xslt/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/.gitkeep b/tests/wpt/web-platform-tests/html/editing/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/activation/.gitkeep b/tests/wpt/web-platform-tests/html/editing/activation/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/assigning-keyboard-shortcuts/.gitkeep b/tests/wpt/web-platform-tests/html/editing/assigning-keyboard-shortcuts/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/assigning-keyboard-shortcuts/introduction-6/.gitkeep b/tests/wpt/web-platform-tests/html/editing/assigning-keyboard-shortcuts/introduction-6/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/assigning-keyboard-shortcuts/processing-model-4/.gitkeep b/tests/wpt/web-platform-tests/html/editing/assigning-keyboard-shortcuts/processing-model-4/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/assigning-keyboard-shortcuts/the-accesskey-attribute/.gitkeep b/tests/wpt/web-platform-tests/html/editing/assigning-keyboard-shortcuts/the-accesskey-attribute/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/dnd/canvas/cross-domain/001.manual.xhtml b/tests/wpt/web-platform-tests/html/editing/dnd/canvas/cross-domain/001-manual.xhtml similarity index 100% rename from tests/wpt/web-platform-tests/html/editing/dnd/canvas/cross-domain/001.manual.xhtml rename to tests/wpt/web-platform-tests/html/editing/dnd/canvas/cross-domain/001-manual.xhtml diff --git a/tests/wpt/web-platform-tests/html/editing/dnd/cross-document/002.manual.html b/tests/wpt/web-platform-tests/html/editing/dnd/cross-document/002-manual.html similarity index 94% rename from tests/wpt/web-platform-tests/html/editing/dnd/cross-document/002.manual.html rename to tests/wpt/web-platform-tests/html/editing/dnd/cross-document/002-manual.html index cd7c18c888e..0a549d38046 100644 --- a/tests/wpt/web-platform-tests/html/editing/dnd/cross-document/002.manual.html +++ b/tests/wpt/web-platform-tests/html/editing/dnd/cross-document/002-manual.html @@ -21,5 +21,5 @@ window.onload = function() {

- diff --git a/tests/wpt/web-platform-tests/html/editing/dnd/images/cross-domain/001.manual.xhtml b/tests/wpt/web-platform-tests/html/editing/dnd/images/cross-domain/001-manual.xhtml similarity index 100% rename from tests/wpt/web-platform-tests/html/editing/dnd/images/cross-domain/001.manual.xhtml rename to tests/wpt/web-platform-tests/html/editing/dnd/images/cross-domain/001-manual.xhtml diff --git a/tests/wpt/web-platform-tests/html/editing/editing-0/.gitkeep b/tests/wpt/web-platform-tests/html/editing/editing-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/editing-0/best-practices-for-in-page-editors/.gitkeep b/tests/wpt/web-platform-tests/html/editing/editing-0/best-practices-for-in-page-editors/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/editing-0/contenteditable/.gitkeep b/tests/wpt/web-platform-tests/html/editing/editing-0/contenteditable/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/editing-0/editing-apis/.gitkeep b/tests/wpt/web-platform-tests/html/editing/editing-0/editing-apis/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/editing-0/making-entire-documents-editable-the-designmode-idl-attribute/.gitkeep b/tests/wpt/web-platform-tests/html/editing/editing-0/making-entire-documents-editable-the-designmode-idl-attribute/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/editing-0/spelling-and-grammar-checking/.gitkeep b/tests/wpt/web-platform-tests/html/editing/editing-0/spelling-and-grammar-checking/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/focus/.gitkeep b/tests/wpt/web-platform-tests/html/editing/focus/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/focus/document-level-focus-apis/.gitkeep b/tests/wpt/web-platform-tests/html/editing/focus/document-level-focus-apis/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/focus/element-level-focus-apis/.gitkeep b/tests/wpt/web-platform-tests/html/editing/focus/element-level-focus-apis/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/focus/focus-management/.gitkeep b/tests/wpt/web-platform-tests/html/editing/focus/focus-management/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/.gitkeep b/tests/wpt/web-platform-tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/inert-subtrees/.gitkeep b/tests/wpt/web-platform-tests/html/editing/inert-subtrees/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/inert-subtrees/the-inert-attribute/.gitkeep b/tests/wpt/web-platform-tests/html/editing/inert-subtrees/the-inert-attribute/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/editing/the-hidden-attribute/.gitkeep b/tests/wpt/web-platform-tests/html/editing/the-hidden-attribute/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/iana/.gitkeep b/tests/wpt/web-platform-tests/html/iana/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/iana/application-x-www-form-urlencoded/.gitkeep b/tests/wpt/web-platform-tests/html/iana/application-x-www-form-urlencoded/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/iana/application-xhtml-xml/.gitkeep b/tests/wpt/web-platform-tests/html/iana/application-xhtml-xml/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/iana/multipart-x-mixed-replace/.gitkeep b/tests/wpt/web-platform-tests/html/iana/multipart-x-mixed-replace/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/iana/ping-to/.gitkeep b/tests/wpt/web-platform-tests/html/iana/ping-to/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/iana/text-cache-manifest/.gitkeep b/tests/wpt/web-platform-tests/html/iana/text-cache-manifest/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/iana/text-html/.gitkeep b/tests/wpt/web-platform-tests/html/iana/text-html/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/iana/web-scheme-prefix/.gitkeep b/tests/wpt/web-platform-tests/html/iana/web-scheme-prefix/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/case-sensitivity-and-string-comparison/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/case-sensitivity-and-string-comparison/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/collections/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/collections/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/domstringmap/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/domstringmap/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/garbage-collection/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/garbage-collection/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/reflecting-content-attributes-in-idl-attributes/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/reflecting-content-attributes-in-idl-attributes/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/safe-passing-of-structured-data/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/safe-passing-of-structured-data/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/transferable-objects/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/transferable-objects/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/boolean-attributes/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/boolean-attributes/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/colors/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/colors/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/comma-separated-tokens/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/comma-separated-tokens/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/common-parser-idioms/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/common-parser-idioms/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/dates-and-times/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/dates-and-times/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/keywords-and-enumerated-attributes/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/keywords-and-enumerated-attributes/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/mq/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/mq/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/numbers/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/numbers/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/space-separated-tokens/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/space-separated-tokens/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/syntax-references/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/common-microsyntaxes/syntax-references/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/conformance-requirements/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/conformance-requirements/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/conformance-requirements/conformance-classes/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/conformance-requirements/conformance-classes/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/conformance-requirements/dependencies/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/conformance-requirements/dependencies/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/conformance-requirements/extensibility/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/conformance-requirements/extensibility/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/fetching-resources/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/fetching-resources/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/fetching-resources/content-type-sniffing/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/fetching-resources/content-type-sniffing/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/fetching-resources/cors-enabled-fetch/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/fetching-resources/cors-enabled-fetch/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/fetching-resources/cors-settings-attributes/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/fetching-resources/cors-settings-attributes/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/fetching-resources/encrypted-http-and-related-security-concerns/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/fetching-resources/encrypted-http-and-related-security-concerns/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/fetching-resources/extracting-character-encodings-from-meta-elements/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/fetching-resources/extracting-character-encodings-from-meta-elements/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/fetching-resources/processing-model/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/fetching-resources/processing-model/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/fetching-resources/terminology-1/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/fetching-resources/terminology-1/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/namespaces/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/namespaces/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/terminology/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/terminology/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/terminology/character-encodings/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/terminology/character-encodings/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/terminology/dom-trees/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/terminology/dom-trees/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/terminology/plugins/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/terminology/plugins/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/terminology/resources/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/terminology/resources/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/terminology/scripting-0/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/terminology/scripting-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/terminology/xml/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/terminology/xml/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/urls/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/urls/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/urls/base-urls/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/urls/base-urls/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/urls/dynamic-changes-to-base-urls/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/urls/dynamic-changes-to-base-urls/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/urls/interfaces-for-url-manipulation/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/urls/interfaces-for-url-manipulation/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/urls/parsing-urls/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/urls/parsing-urls/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/urls/resolving-urls/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/urls/resolving-urls/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/urls/resolving-urls/query-encoding/attributes.sub.html b/tests/wpt/web-platform-tests/html/infrastructure/urls/resolving-urls/query-encoding/attributes.sub.html index c6521f0a886..c3d550a39b3 100644 --- a/tests/wpt/web-platform-tests/html/infrastructure/urls/resolving-urls/query-encoding/attributes.sub.html +++ b/tests/wpt/web-platform-tests/html/infrastructure/urls/resolving-urls/query-encoding/attributes.sub.html @@ -25,7 +25,7 @@ function assert_ends_with(input, endsWith) { test(t => { const elm = document.createElement(localName); document.body.appendChild(elm); - t.add_cleanup(() => document.body.removeChild(elm)); + t.add_cleanup(() => { document.body.removeChild(elm); }); elm.setAttribute("background", "?\u00FF"); assert_ends_with(getComputedStyle(elm).backgroundImage, expected(document.characterSet) + "\")"); }, "getComputedStyle <" + localName + " background>"); diff --git a/tests/wpt/web-platform-tests/html/infrastructure/urls/terminology-0/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/urls/terminology-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/urls/url-manipulation-and-creation/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/urls/url-manipulation-and-creation/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/utf-8/.gitkeep b/tests/wpt/web-platform-tests/html/infrastructure/utf-8/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/a-quick-introduction-to-html/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/a-quick-introduction-to-html/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/a-quick-introduction-to-html/common-pitfalls-to-avoid-when-using-the-scripting-apis/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/a-quick-introduction-to-html/common-pitfalls-to-avoid-when-using-the-scripting-apis/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/a-quick-introduction-to-html/writing-secure-applications-with-html/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/a-quick-introduction-to-html/writing-secure-applications-with-html/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/audience/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/audience/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/background/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/background/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/conformance-requirements-for-authors/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/conformance-requirements-for-authors/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/conformance-requirements-for-authors/presentational-markup/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/conformance-requirements-for-authors/presentational-markup/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/conformance-requirements-for-authors/restrictions-on-content-models-and-on-attribute-values/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/conformance-requirements-for-authors/restrictions-on-content-models-and-on-attribute-values/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/conformance-requirements-for-authors/syntax-errors/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/conformance-requirements-for-authors/syntax-errors/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/design-notes/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/design-notes/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/design-notes/compliance-with-other-specifications/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/design-notes/compliance-with-other-specifications/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/design-notes/serializability-of-script-execution/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/design-notes/serializability-of-script-execution/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/fingerprint/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/fingerprint/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/history-0/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/history-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/html-vs-xhtml/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/html-vs-xhtml/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/scope/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/scope/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/structure-of-this-specification/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/structure-of-this-specification/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/structure-of-this-specification/how-to-read-this-specification/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/structure-of-this-specification/how-to-read-this-specification/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/structure-of-this-specification/typographic-conventions/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/structure-of-this-specification/typographic-conventions/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/introduction/suggested-reading/.gitkeep b/tests/wpt/web-platform-tests/html/introduction/suggested-reading/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/obsolete/.gitkeep b/tests/wpt/web-platform-tests/html/obsolete/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/obsolete/META.yml b/tests/wpt/web-platform-tests/html/obsolete/META.yml index a70815bb400..c1dd8dddf9e 100644 --- a/tests/wpt/web-platform-tests/html/obsolete/META.yml +++ b/tests/wpt/web-platform-tests/html/obsolete/META.yml @@ -1,2 +1,2 @@ suggested_reviewers: - - ayg + - foolip diff --git a/tests/wpt/web-platform-tests/html/obsolete/non-conforming-features/.gitkeep b/tests/wpt/web-platform-tests/html/obsolete/non-conforming-features/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/obsolete/obsolete-but-conforming-features/.gitkeep b/tests/wpt/web-platform-tests/html/obsolete/obsolete-but-conforming-features/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/obsolete/obsolete-but-conforming-features/warnings-for-obsolete-but-conforming-features/.gitkeep b/tests/wpt/web-platform-tests/html/obsolete/obsolete-but-conforming-features/warnings-for-obsolete-but-conforming-features/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/.gitkeep b/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/frames/.gitkeep b/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/frames/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/.gitkeep b/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/the-applet-element/.gitkeep b/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/the-applet-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/the-marquee-element-0/.gitkeep b/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/the-marquee-element-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/bindings/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/bindings/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/bindings/introduction-9/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/bindings/introduction-9/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/bindings/the-details-element-0/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/bindings/the-details-element-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/bindings/the-input-element-as-a-button/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/bindings/the-input-element-as-a-button/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/bindings/the-input-element-as-a-checkbox-and-radio-button-widgets/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/bindings/the-input-element-as-a-checkbox-and-radio-button-widgets/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/bindings/the-input-element-as-a-color-well/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/bindings/the-input-element-as-a-color-well/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/bindings/the-input-element-as-a-file-upload-control/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/bindings/the-input-element-as-a-file-upload-control/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/bindings/the-input-element-as-a-range-control/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/bindings/the-input-element-as-a-range-control/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/bindings/the-input-element-as-a-text-entry-widget/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/bindings/the-input-element-as-a-text-entry-widget/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/bindings/the-input-element-as-domain-specific-widgets/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/bindings/the-input-element-as-domain-specific-widgets/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/bindings/the-marquee-element/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/bindings/the-marquee-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/bindings/the-meter-element-0/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/bindings/the-meter-element-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/bindings/the-progress-element-0/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/bindings/the-progress-element-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/bindings/the-select-element-0/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/bindings/the-select-element-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/bindings/the-textarea-element-0/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/bindings/the-textarea-element-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/frames-and-framesets/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/frames-and-framesets/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/interactive-media/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/interactive-media/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/interactive-media/editing-hosts/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/interactive-media/editing-hosts/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/interactive-media/links-forms-and-navigation/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/interactive-media/links-forms-and-navigation/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/interactive-media/text-rendered-in-native-user-interfaces/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/interactive-media/text-rendered-in-native-user-interfaces/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/interactive-media/the-title-attribute-0/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/interactive-media/the-title-attribute-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/introduction-8/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/introduction-8/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/bidirectional-text/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/bidirectional-text/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/flow-content-0/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/flow-content-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/form-controls/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/form-controls/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/hidden-elements/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/hidden-elements/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/lists/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/lists/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/phrasing-content-0/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/phrasing-content-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/quotes/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/quotes/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/sections-and-headings/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/sections-and-headings/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/tables/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/tables/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-element-0/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-element-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-page/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-page/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/print-media/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/print-media/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/replaced-elements/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-1.html b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-1.html new file mode 100644 index 00000000000..6e32206d916 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-1.html @@ -0,0 +1,3 @@ + + + diff --git a/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-2.html b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-2.html new file mode 100644 index 00000000000..d58848aa535 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-2.html @@ -0,0 +1,3 @@ + + + diff --git a/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-ref.html b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-ref.html new file mode 100644 index 00000000000..55f06ef96bb --- /dev/null +++ b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-align-right-ref.html @@ -0,0 +1,2 @@ + + diff --git a/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-type-change-from-image-1-ref.html b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-type-change-from-image-1-ref.html new file mode 100644 index 00000000000..7768379e915 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-type-change-from-image-1-ref.html @@ -0,0 +1,2 @@ + + diff --git a/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-type-change-from-image-1.html b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-type-change-from-image-1.html new file mode 100644 index 00000000000..00747a5fbf6 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-type-change-from-image-1.html @@ -0,0 +1,10 @@ + + + + diff --git a/tests/wpt/web-platform-tests/html/rendering/replaced-elements/embedded-content-rendering-rules/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/embedded-content-rendering-rules/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/replaced-elements/image-maps-0/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/image-maps-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/replaced-elements/images/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/images/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/replaced-elements/toolbars-0/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/toolbars-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/rendering/unstyled-xml-documents/.gitkeep b/tests/wpt/web-platform-tests/html/rendering/unstyled-xml-documents/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/META.yml b/tests/wpt/web-platform-tests/html/semantics/META.yml deleted file mode 100644 index a70815bb400..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/META.yml +++ /dev/null @@ -1,2 +0,0 @@ -suggested_reviewers: - - ayg diff --git a/tests/wpt/web-platform-tests/html/semantics/common-idioms/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/common-idioms/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/common-idioms/conversations/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/common-idioms/conversations/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/common-idioms/footnotes/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/common-idioms/footnotes/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/common-idioms/rel-up/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/common-idioms/rel-up/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/common-idioms/tag-clouds/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/common-idioms/tag-clouds/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/common-idioms/the-main-part-of-the-content/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/common-idioms/the-main-part-of-the-content/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/disabled-elements/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/disabled-elements/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/document-metadata/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/document-metadata/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/document-metadata/styling/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/document-metadata/styling/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/document-metadata/the-base-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/document-metadata/the-base-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/document-metadata/the-head-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/document-metadata/the-head-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/document-metadata/the-link-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/document-metadata/the-link-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/document-metadata/the-meta-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/document-metadata/the-meta-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/document-metadata/the-style-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/document-metadata/the-style-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/document-metadata/the-title-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/document-metadata/the-title-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/edits/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/edits/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/edits/attributes-common-to-ins-and-del-elements/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/edits/attributes-common-to-ins-and-del-elements/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/edits/edits-and-lists/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/edits/edits-and-lists/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/edits/edits-and-paragraphs/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/edits/edits-and-paragraphs/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/edits/edits-and-tables/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/edits/edits-and-tables/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/edits/the-del-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/edits/the-del-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/edits/the-ins-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/edits/the-ins-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/META.yml b/tests/wpt/web-platform-tests/html/semantics/embedded-content/META.yml new file mode 100644 index 00000000000..199c4c412fe --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/embedded-content/META.yml @@ -0,0 +1,3 @@ +suggested_reviewers: + - foolip + - zcorpan diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/dimension-attributes/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/dimension-attributes/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/image-maps/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/image-maps/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/mathml/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/mathml/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/audio_loop_base.html b/tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/audio_loop_base.html index 01aa23757ab..418e1b19c38 100644 --- a/tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/audio_loop_base.html +++ b/tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/audio_loop_base.html @@ -6,7 +6,6 @@ - @@ -36,7 +35,7 @@ media.addEventListener("error", t.unreached_func()); media.addEventListener("seeking", startTest, false); media.loop = true; - media.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random(); + media.src = getAudioURI("/media/sound_0") + "?" + new Date() + Math.random(); media.play(); diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/video_loop_base.html b/tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/video_loop_base.html index 348f1cdae2f..9b5d69b31a0 100644 --- a/tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/video_loop_base.html +++ b/tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/video_loop_base.html @@ -6,7 +6,6 @@ - @@ -34,7 +33,7 @@ media.addEventListener("seeking", startTest, false); media.loop = true; - media.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random(); + media.src = getVideoURI("/media/2x2-green") + "?" + new Date() + Math.random(); media.play(); diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/svg/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/svg/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-audio-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-audio-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-canvas-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-canvas-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-embed-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-embed-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-iframe-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-iframe-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-img-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-img-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-map-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-map-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-object-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-object-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-object-element/object-setcustomvalidity.html b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-object-element/object-setcustomvalidity.html new file mode 100644 index 00000000000..44574ffd11f --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-object-element/object-setcustomvalidity.html @@ -0,0 +1,17 @@ + +object setCustomValidity + + + + + + diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-param-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-param-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-source-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-source-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-track-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-track-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-video-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-video-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/META.yml b/tests/wpt/web-platform-tests/html/semantics/forms/META.yml new file mode 100644 index 00000000000..ce84e4ae4c9 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/forms/META.yml @@ -0,0 +1,2 @@ +suggested_reviewers: + - tkent-google diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/attributes-common-to-form-controls/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/attributes-common-to-form-controls/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/categories/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/categories/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/constraints/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/constraints/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/form-control-infrastructure/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/form-control-infrastructure/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/form-submission-0/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/form-submission-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/introduction-1/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/introduction-1/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/resetting-a-form/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/resetting-a-form/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/textfieldselection/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/textfieldselection/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-button-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/the-button-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-button-element/button-setcustomvalidity.html b/tests/wpt/web-platform-tests/html/semantics/forms/the-button-element/button-setcustomvalidity.html index 64406ab3193..1747bd727aa 100644 --- a/tests/wpt/web-platform-tests/html/semantics/forms/the-button-element/button-setcustomvalidity.html +++ b/tests/wpt/web-platform-tests/html/semantics/forms/the-button-element/button-setcustomvalidity.html @@ -1,43 +1,17 @@ - - - Forms - - - - -

-

button_setCustomValidity

-

+button setCustomValidity + + -
+ -
+ - - - + diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-datalist-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/the-datalist-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-fieldset-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/the-fieldset-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-fieldset-element/fieldset-setcustomvalidity.html b/tests/wpt/web-platform-tests/html/semantics/forms/the-fieldset-element/fieldset-setcustomvalidity.html index 6a6d445ac97..64aa374f190 100644 --- a/tests/wpt/web-platform-tests/html/semantics/forms/the-fieldset-element/fieldset-setcustomvalidity.html +++ b/tests/wpt/web-platform-tests/html/semantics/forms/the-fieldset-element/fieldset-setcustomvalidity.html @@ -1,44 +1,17 @@ - - - Forms - - - - -

-

FieldSet_setCustomValidity

-

+fieldset setCustomValidity + + -
+
-
+ - - - + diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-form-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/the-form-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-input-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/the-input-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-input-element/input-setcustomvalidity.html b/tests/wpt/web-platform-tests/html/semantics/forms/the-input-element/input-setcustomvalidity.html index 7d210972589..accb24d8f95 100644 --- a/tests/wpt/web-platform-tests/html/semantics/forms/the-input-element/input-setcustomvalidity.html +++ b/tests/wpt/web-platform-tests/html/semantics/forms/the-input-element/input-setcustomvalidity.html @@ -1,43 +1,17 @@ - - - Forms - - - - -

-

input_setCustomValidity

-

+input setCustomValidity + + -
+ -
+ - - - + diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-label-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/the-label-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-label-element/label-attributes.sub.html b/tests/wpt/web-platform-tests/html/semantics/forms/the-label-element/label-attributes.sub.html index 25c7e5118b4..8149a87cb75 100644 --- a/tests/wpt/web-platform-tests/html/semantics/forms/the-label-element/label-attributes.sub.html +++ b/tests/wpt/web-platform-tests/html/semantics/forms/the-label-element/label-attributes.sub.html @@ -227,7 +227,8 @@ }, "A labelable element is moved to iframe."); test(function () { - var labels1 = document.getElementById("test14").labels; + var test14 = document.getElementById("test14"); + var labels1 = test14.labels; var labels2 = document.getElementById("test15").labels; assert_true(labels1 instanceof NodeList, "A form control's 'labels' property should be an instance of a NodeList."); @@ -237,12 +238,17 @@ "The number of labels associated with a form control should be the number of label elements for which it is a labeled control."); assert_array_equals(labels1, [document.getElementById("lbl14")], "The labels for a form control should be returned in tree order."); + assert_array_equals(labels2, [document.getElementById("lbl15")], + "The labels for a form control should be returned in tree order."); document.getElementById('div6').removeChild(document.getElementById('div7')); - assert_equals(labels1.length, 0, - "The number of labels should be 0 after the labelable element is removed."); + assert_equals(labels1.length, 1, + "The number of labels should be 1 after the labelable element is removed but label element is still in the same tree."); assert_equals(labels2.length, 0, "The number of labels should be 0 since there is no label with a 'for' attribute associated with this labelable element."); + test14.remove(); + assert_equals(labels1.length, 0, + "The number of labels should be 0 after the labelable element is removed."); }, "A div element which contains labelable element is removed."); test(function () { diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-legend-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/the-legend-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-meter-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/the-meter-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-optgroup-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/the-optgroup-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-option-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/the-option-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-output-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/the-output-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-output-element/output-setcustomvalidity.html b/tests/wpt/web-platform-tests/html/semantics/forms/the-output-element/output-setcustomvalidity.html new file mode 100644 index 00000000000..1166eeb610f --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/forms/the-output-element/output-setcustomvalidity.html @@ -0,0 +1,17 @@ + +output setCustomValidity + + + + + + diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-select-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/the-select-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-select-element/select-setcustomvalidity.html b/tests/wpt/web-platform-tests/html/semantics/forms/the-select-element/select-setcustomvalidity.html new file mode 100644 index 00000000000..15308c1a8f0 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/forms/the-select-element/select-setcustomvalidity.html @@ -0,0 +1,17 @@ + +select setCustomValidity + + + + + + diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-textarea-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/forms/the-textarea-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-textarea-element/textarea-setcustomvalidity.html b/tests/wpt/web-platform-tests/html/semantics/forms/the-textarea-element/textarea-setcustomvalidity.html new file mode 100644 index 00000000000..922a1e73e6f --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/forms/the-textarea-element/textarea-setcustomvalidity.html @@ -0,0 +1,17 @@ + +textarea setCustomValidity + + + + + + diff --git a/tests/wpt/web-platform-tests/html/editing/META.yml b/tests/wpt/web-platform-tests/html/semantics/grouping-content/META.yml similarity index 63% rename from tests/wpt/web-platform-tests/html/editing/META.yml rename to tests/wpt/web-platform-tests/html/semantics/grouping-content/META.yml index a70815bb400..0f3cf596537 100644 --- a/tests/wpt/web-platform-tests/html/editing/META.yml +++ b/tests/wpt/web-platform-tests/html/semantics/grouping-content/META.yml @@ -1,2 +1,2 @@ suggested_reviewers: - - ayg + - domenic diff --git a/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-blockquote-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-blockquote-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-dd-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-dd-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-div-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-div-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-dl-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-dl-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-dt-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-dt-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-figcaption-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-figcaption-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-figure-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-figure-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-hr-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-hr-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-p-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-p-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-pre-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-pre-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-ul-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/grouping-content/the-ul-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/interactive-elements/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html-imports/META.yml b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/META.yml similarity index 65% rename from tests/wpt/web-platform-tests/html-imports/META.yml rename to tests/wpt/web-platform-tests/html/semantics/interactive-elements/META.yml index 6816f49b5fc..c1dd8dddf9e 100644 --- a/tests/wpt/web-platform-tests/html-imports/META.yml +++ b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/META.yml @@ -1,2 +1,2 @@ suggested_reviewers: - - omo + - foolip diff --git a/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/interactive-elements/the-details-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/the-details-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/interactive-elements/the-menu-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/the-menu-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/interactive-elements/the-summary-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/the-summary-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/links/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/links/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/META.yml b/tests/wpt/web-platform-tests/html/semantics/links/META.yml similarity index 65% rename from tests/wpt/web-platform-tests/html/dom/META.yml rename to tests/wpt/web-platform-tests/html/semantics/links/META.yml index a70815bb400..b2167370d14 100644 --- a/tests/wpt/web-platform-tests/html/dom/META.yml +++ b/tests/wpt/web-platform-tests/html/semantics/links/META.yml @@ -1,2 +1,2 @@ suggested_reviewers: - - ayg + - annevk diff --git a/tests/wpt/web-platform-tests/html/semantics/links/downloading-resources/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/links/downloading-resources/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/links/following-hyperlinks/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/links/following-hyperlinks/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/links/introduction-3/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/links/introduction-3/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/links/linktypes/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/links/linktypes/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/scripting-1/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/infrastructure/META.yml b/tests/wpt/web-platform-tests/html/semantics/scripting-1/META.yml similarity index 63% rename from tests/wpt/web-platform-tests/html/infrastructure/META.yml rename to tests/wpt/web-platform-tests/html/semantics/scripting-1/META.yml index a70815bb400..0f3cf596537 100644 --- a/tests/wpt/web-platform-tests/html/infrastructure/META.yml +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/META.yml @@ -1,2 +1,2 @@ suggested_reviewers: - - ayg + - domenic diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-noscript-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-noscript-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-url.html b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-url.html index fa1c7dee9d2..79f08ebaee3 100644 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-url.html +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-url.html @@ -21,6 +21,27 @@ test(() => { base + "/import-meta-dependent.js"); }, "import.meta.url in a dependent external script"); +test(() => { + assert_equals(typeof importMetaOnRootModule, "object"); + assert_not_equals(importMetaOnRootModule, null); +}, "import.meta is an object"); + +test(() => { + importMetaOnRootModule.newProperty = 1; + assert_true(Object.isExtensible(importMetaOnRootModule)); +}, "import.meta is extensible"); + +test(() => { + let names = new Set(Reflect.ownKeys(importMetaOnRootModule)); + for (name of names) { + var desc = Object.getOwnPropertyDescriptor(importMetaOnRootModule, name); + assert_equals(desc.writable, true); + assert_equals(desc.enumerable, true); + assert_equals(desc.configurable, true); + } +}, "import.meta's properties are writable, configurable, and enumerable"); + + import { importMetaOnRootModule as hashedImportMetaOnRootModule1, importMetaOnDependentModule as hashedImportMetaOnDependentModule1 } from "./import-meta-root.js#1"; diff --git a/tests/wpt/web-platform-tests/html/semantics/sections/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/sections/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/sections/headings-and-sections/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/sections/headings-and-sections/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/sections/the-address-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/sections/the-address-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/sections/the-article-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/sections/the-article-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/sections/the-aside-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/sections/the-aside-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/sections/the-body-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/sections/the-body-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/sections/the-footer-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/sections/the-footer-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/sections/the-h1-h2-h3-h4-h5-and-h6-elements/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/sections/the-h1-h2-h3-h4-h5-and-h6-elements/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/sections/the-header-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/sections/the-header-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/sections/the-hgroup-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/sections/the-hgroup-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/sections/the-nav-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/sections/the-nav-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/sections/the-section-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/sections/the-section-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/sections/usage-summary-0/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/sections/usage-summary-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/selectors/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/selectors/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/selectors/META.yml b/tests/wpt/web-platform-tests/html/semantics/selectors/META.yml new file mode 100644 index 00000000000..546b7791d54 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/selectors/META.yml @@ -0,0 +1,3 @@ +suggested_reviewers: + - lilles + - zcorpan diff --git a/tests/wpt/web-platform-tests/html/semantics/selectors/case-sensitivity/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/selectors/case-sensitivity/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/tabular-data/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/tabular-data/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/tabular-data/META.yml b/tests/wpt/web-platform-tests/html/semantics/tabular-data/META.yml new file mode 100644 index 00000000000..ce84e4ae4c9 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/tabular-data/META.yml @@ -0,0 +1,2 @@ +suggested_reviewers: + - tkent-google diff --git a/tests/wpt/web-platform-tests/html/semantics/tabular-data/attributes-common-to-td-and-th-elements/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/tabular-data/attributes-common-to-td-and-th-elements/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/tabular-data/examples/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/tabular-data/examples/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/tabular-data/processing-model-1/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/tabular-data/processing-model-1/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-caption-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-caption-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-col-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-col-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-colgroup-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-colgroup-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-table-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-table-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-tbody-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-tbody-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-td-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-td-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-tfoot-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-tfoot-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-th-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-th-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-thead-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-thead-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-tr-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/tabular-data/the-tr-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-a-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-a-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-abbr-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-abbr-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-b-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-b-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-bdi-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-bdi-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-bdo-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-bdo-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-br-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-br-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-cite-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-cite-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-code-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-code-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-dfn-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-dfn-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-em-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-em-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-i-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-i-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-kbd-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-kbd-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-mark-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-mark-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-q-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-q-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-rp-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-rp-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-rt-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-rt-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-ruby-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-ruby-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-s-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-s-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-samp-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-samp-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-small-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-small-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-span-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-span-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-strong-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-strong-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-sub-and-sup-elements/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-sub-and-sup-elements/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-time-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-time-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-u-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-u-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-var-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-var-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/usage-summary/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/usage-summary/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/the-root-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/the-root-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/semantics/the-root-element/the-html-element/.gitkeep b/tests/wpt/web-platform-tests/html/semantics/the-root-element/the-html-element/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/syntax/.gitkeep b/tests/wpt/web-platform-tests/html/syntax/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/syntax/parsing-html-fragments/.gitkeep b/tests/wpt/web-platform-tests/html/syntax/parsing-html-fragments/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/syntax/parsing/.gitkeep b/tests/wpt/web-platform-tests/html/syntax/parsing/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/syntax/serializing-html-fragments/.gitkeep b/tests/wpt/web-platform-tests/html/syntax/serializing-html-fragments/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/syntax/writing/.gitkeep b/tests/wpt/web-platform-tests/html/syntax/writing/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/syntax/writing/cdata-sections/.gitkeep b/tests/wpt/web-platform-tests/html/syntax/writing/cdata-sections/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/syntax/writing/character-references/.gitkeep b/tests/wpt/web-platform-tests/html/syntax/writing/character-references/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/syntax/writing/comments/.gitkeep b/tests/wpt/web-platform-tests/html/syntax/writing/comments/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/syntax/writing/elements-0/.gitkeep b/tests/wpt/web-platform-tests/html/syntax/writing/elements-0/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/syntax/writing/text/.gitkeep b/tests/wpt/web-platform-tests/html/syntax/writing/text/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/syntax/writing/the-doctype/.gitkeep b/tests/wpt/web-platform-tests/html/syntax/writing/the-doctype/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/the-xhtml-syntax/.gitkeep b/tests/wpt/web-platform-tests/html/the-xhtml-syntax/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/the-xhtml-syntax/parsing-xhtml-documents/.gitkeep b/tests/wpt/web-platform-tests/html/the-xhtml-syntax/parsing-xhtml-documents/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/the-xhtml-syntax/parsing-xhtml-fragments/.gitkeep b/tests/wpt/web-platform-tests/html/the-xhtml-syntax/parsing-xhtml-fragments/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/the-xhtml-syntax/serializing-xhtml-fragments/.gitkeep b/tests/wpt/web-platform-tests/html/the-xhtml-syntax/serializing-xhtml-fragments/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/the-xhtml-syntax/writing-xhtml-documents/.gitkeep b/tests/wpt/web-platform-tests/html/the-xhtml-syntax/writing-xhtml-documents/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/user-activation/activation-api-click.tentative.html b/tests/wpt/web-platform-tests/html/user-activation/activation-api-click.tentative.html new file mode 100644 index 00000000000..7f170a04ab1 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/user-activation/activation-api-click.tentative.html @@ -0,0 +1,34 @@ + + + + + + + + + + +

Clicking on document sets user activation

+

Click anywhere in the document.

+ + + diff --git a/tests/wpt/web-platform-tests/html/user-activation/activation-api-iframe-no-activate.tenative.html b/tests/wpt/web-platform-tests/html/user-activation/activation-api-iframe-no-activate.tenative.html new file mode 100644 index 00000000000..8c7610e28b0 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/user-activation/activation-api-iframe-no-activate.tenative.html @@ -0,0 +1,58 @@ + + + + + + + + + + +

Clicking in parent frame does not propagate state to child

+
    +
  1. Click this instruction text. +
+ + + + diff --git a/tests/wpt/web-platform-tests/html/user-activation/activation-api-iframe.tenative.html b/tests/wpt/web-platform-tests/html/user-activation/activation-api-iframe.tenative.html new file mode 100644 index 00000000000..2202048ae91 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/user-activation/activation-api-iframe.tenative.html @@ -0,0 +1,52 @@ + + + + + + + + + + +

Clicking in iframe has activation state in child

+
    +
  1. Click inside the red area. +
+ + + + diff --git a/tests/wpt/web-platform-tests/html/user-activation/activation-api-setTimeout.tentative.html b/tests/wpt/web-platform-tests/html/user-activation/activation-api-setTimeout.tentative.html new file mode 100644 index 00000000000..a8eba38c60e --- /dev/null +++ b/tests/wpt/web-platform-tests/html/user-activation/activation-api-setTimeout.tentative.html @@ -0,0 +1,36 @@ + + + + + + + + + + +

Clicking on document sets user activation even after setTimeout

+

Click anywhere in the document.

+ + + diff --git a/tests/wpt/web-platform-tests/html/user-activation/resources/child-one.html b/tests/wpt/web-platform-tests/html/user-activation/resources/child-one.html new file mode 100644 index 00000000000..9c99729b6a9 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/user-activation/resources/child-one.html @@ -0,0 +1,20 @@ + + + + diff --git a/tests/wpt/web-platform-tests/html/user-activation/resources/child-two.html b/tests/wpt/web-platform-tests/html/user-activation/resources/child-two.html new file mode 100644 index 00000000000..7d48789878a --- /dev/null +++ b/tests/wpt/web-platform-tests/html/user-activation/resources/child-two.html @@ -0,0 +1,7 @@ + + + + diff --git a/tests/wpt/web-platform-tests/html/webappapis/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/webappapis/atob/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/atob/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/closing-the-input-stream/document.close-01.xhtml b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/closing-the-input-stream/document.close-01.xhtml similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/closing-the-input-stream/document.close-01.xhtml rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/closing-the-input-stream/document.close-01.xhtml diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/001.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/001.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/001.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/001.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/002.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/002.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/002.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/002.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/003.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/003.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/003.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/003.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/004.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/004.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/004.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/004.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/005.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/005.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/005.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/005.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/005.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/005.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/005.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/005.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/006.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/006.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/006.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/006.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/006.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/006.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/006.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/006.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/007.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/007.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/007.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/007.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/007.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/007.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/007.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/007.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/008-1.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/008-1.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/008-1.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/008-1.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/008.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/008.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/008.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/008.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/008.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/008.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/008.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/008.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/009.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/009.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/009.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/009.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/010-1.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/010-1.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/010-1.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/010-1.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/010.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/010.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/010.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/010.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/010.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/010.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/010.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/010.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/011-1.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/011-1.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/011-1.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/011-1.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/011.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/011.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/011.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/011.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/011.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/011.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/011.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/011.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/012.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/012.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/012.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/012.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/012.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/012.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/012.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/012.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/013.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/013.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/013.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/013.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/013.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/013.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/013.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/013.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/014.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/014.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/014.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/014.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/015.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/015.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/015.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/015.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/016.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/016.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/016.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/016.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/017.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/017.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/017.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/017.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/018.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/018.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/018.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/018.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/019.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/019.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/019.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/019.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/020.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/020.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/020.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/020.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/021.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/021.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/021.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/021.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/022.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/022.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/022.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/022.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/023.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/023.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/023.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/023.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/024.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/024.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/024.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/024.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/025.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/025.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/025.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/025.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/026.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/026.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/026.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/026.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/027.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/027.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/027.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/027.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/028.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/028.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/028.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/028.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/029.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/029.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/029.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/029.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/030.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/030.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/030.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/030.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/031.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/031.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/031.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/031.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/032.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/032.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/032.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/032.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/033.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/033.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/033.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/033.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/034.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/034.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/034.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/034.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/035.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/035.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/035.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/035.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/036.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/036.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/036.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/036.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/037.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/037.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/037.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/037.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/038.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/038.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/038.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/038.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/039.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/039.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/039.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/039.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/040.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/040.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/040.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/040.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/041.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/041.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/041.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/041.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/042.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/042.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/042.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/042.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/043.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/043.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/043.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/043.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/044.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/044.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/044.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/044.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/045.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/045.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/045.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/045.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/046.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/046.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/046.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/046.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/047.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/047.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/047.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/047.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/048.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/048.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/048.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/048.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/049.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/049.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/049.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/049.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/050.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/050.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/050.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/050.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/051.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/051.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/051.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/051.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/contentType.window.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/contentType.window.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/contentType.window.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/contentType.window.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/document.write-01.xhtml b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/document.write-01.xhtml similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/document.write-01.xhtml rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/document.write-01.xhtml diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/document.write-02.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/document.write-02.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/document.write-02.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/document.write-02.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/empty.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/empty.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/empty.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/empty.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_001.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_001.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_001.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_001.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_002.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_002.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_002.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_002.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_003.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_003.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_003.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_003.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_004.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_004.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_004.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_004.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_005.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_005.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_005.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_005.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_005.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_005.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_005.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_005.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_006.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_006.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_006.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_006.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_007.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_007.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_007.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_007.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_008.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_008.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_008.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_008.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_009.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_009.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_009.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_009.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_010.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_010.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/iframe_010.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_010.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/nested-document-write-1.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/nested-document-write-1.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/nested-document-write-1.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/nested-document-write-1.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/nested-document-write-2.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/nested-document-write-2.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/nested-document-write-2.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/nested-document-write-2.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/nested-document-write-external.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/nested-document-write-external.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/nested-document-write-external.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/nested-document-write-external.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/original-id.json b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/original-id.json similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/original-id.json rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/original-id.json diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_001.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_001.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_001.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_001.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_002.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_002.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_002.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_002.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_003.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_003.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_003.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_003.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_004.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_004.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_004.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_004.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_005.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_005.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_005.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_005.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_006.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_006.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_006.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_006.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_007.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_007.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_007.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_007.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_008.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_008.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_008.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_008.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_009.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_009.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_009.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_009.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_010.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_010.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_010.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_010.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_011.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_011.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_011.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_011.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_012.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_012.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_012.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_012.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_013.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_013.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/script_013.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/script_013.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/write-active-document.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/write-active-document.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/write-active-document.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-write/write-active-document.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-01.xhtml b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-writeln/document.writeln-01.xhtml similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-01.xhtml rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-writeln/document.writeln-01.xhtml diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-02.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-writeln/document.writeln-02.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-02.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-writeln/document.writeln-02.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-03.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-writeln/document.writeln-03.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-03.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-writeln/document.writeln-03.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-writeln/original-id.json b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-writeln/original-id.json similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-writeln/original-id.json rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/document-writeln/original-id.json diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/001.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/001.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/001.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/001.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/002.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/002.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/002.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/002.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/004-1.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/004-1.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/004-1.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/004-1.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/004.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/004.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/004.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/004.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/005.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/005.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/005.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/005.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/006.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/006.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/006.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/006.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/007.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/007.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/007.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/007.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/008.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/008.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/008.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/008.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/009.https.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/009.https.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/009.https.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/009.https.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/010-1.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010-1.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/010-1.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010-1.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/010-2.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010-2.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/010-2.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010-2.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/010.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/010.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/011-1.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/011-1.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/011-1.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/011-1.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/011.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/011.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/011.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/011.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/012-1.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/012-1.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/012-1.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/012-1.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/012.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/012.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/012.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/012.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/013-1.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/013-1.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/013-1.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/013-1.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/013.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/013.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/013.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/013.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/014-1.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/014-1.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/014-1.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/014-1.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/014.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/014.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/014.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/014.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/015-1.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/015-1.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/015-1.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/015-1.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/015.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/015.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/015.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/015.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/016-1.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/016-1.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/016-1.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/016-1.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/016.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/016.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/016.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/016.html diff --git a/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js new file mode 100644 index 00000000000..1d94de8a7c9 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js @@ -0,0 +1,28 @@ +// document.open() bails out early if there is an **active parser** with +// non-zero script nesting level. window.stop() aborts the current parser and +// makes it no longer active, and should allow document.open() to work. +// For more details, see https://bugzilla.mozilla.org/show_bug.cgi?id=1475000. + +window.handlers = {}; + +async_test(t => { + const frame = document.body.appendChild(document.createElement("iframe")); + frame.src = "resources/aborted-parser-frame.html"; + window.handlers.afterOpen = t.step_func_done(() => { + const openCalled = frame.contentDocument.childNodes.length === 0; + frame.remove(); + assert_true(openCalled, "child document should be empty"); + }); +}, "document.open() after parser is aborted"); + +// Note: This test should pass even if window.close() is not there, as +// document.open() is not executed synchronously in an inline script. +async_test(t => { + const frame = document.body.appendChild(document.createElement("iframe")); + frame.src = "resources/aborted-parser-async-frame.html"; + window.handlers.afterOpenAsync = t.step_func_done(() => { + const openCalled = frame.contentDocument.childNodes.length === 0; + frame.remove(); + assert_true(openCalled, "child document should be empty"); + }); +}, "async document.open() after parser is aborted"); diff --git a/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/custom-element.window.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/custom-element.window.js new file mode 100644 index 00000000000..015df8fdc04 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/custom-element.window.js @@ -0,0 +1,39 @@ +// The document open steps have: +// +// 2. If document's throw-on-dynamic-markup-insertion counter is greater than +// 0, then throw an "InvalidStateError" DOMException. +// +// The throw-on-dynamic-markup-insertion counter is only incremented when the +// parser creates a custom element, not when createElement is called. Test for +// this. +// +// See: https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#document-open-steps + +const noError = Symbol("no error"); +let err = noError; + +class CustomElement extends HTMLElement { + constructor() { + super(); + try { + document.open(); + } catch (e) { + err = e; + } + } +} +customElements.define("custom-element", CustomElement); + +test(t => { + err = noError; + document.createElement("custom-element"); + assert_equals(err, noError); +}, "document.open() works in custom element constructor for createElement()"); + +test(t => { + err = noError; + document.write(""); + assert_throws("InvalidStateError", () => { + throw err; + }); +}, "document.open() is forbidden in custom element constructor when creating element from parser"); diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-01.xhtml b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-01.xhtml similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-01.xhtml rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-01.xhtml diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03-frame.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-03-frame.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03-frame.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-03-frame.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/encoding.window.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/encoding.window.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/encoding.window.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/encoding.window.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js diff --git a/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-async-frame.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-async-frame.html new file mode 100644 index 00000000000..d5535630be0 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-async-frame.html @@ -0,0 +1,9 @@ + +

Text

+ diff --git a/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-frame.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-frame.html new file mode 100644 index 00000000000..d9ec23590bf --- /dev/null +++ b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-frame.html @@ -0,0 +1,7 @@ + +

Text

+ diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/resources/encoding-frame.html b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/encoding-frame.html similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/resources/encoding-frame.html rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/encoding-frame.html diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext-subframe.txt b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext-subframe.txt similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext-subframe.txt rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext-subframe.txt diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext.window.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext.window.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext.window.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/type-argument-plaintext.window.js diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/type-argument.window.js b/tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/type-argument.window.js similarity index 100% rename from tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/type-argument.window.js rename to tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/type-argument.window.js diff --git a/tests/wpt/web-platform-tests/html/webappapis/scripting/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/scripting/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/webappapis/scripting/enabling-and-disabling-scripting/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/scripting/enabling-and-disabling-scripting/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/webappapis/scripting/event-loops/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/scripting/event-loops/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/webappapis/scripting/events/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/scripting/events/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/webappapis/scripting/introduction-5/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/scripting/introduction-5/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/webappapis/scripting/javascript-protocol/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/scripting/javascript-protocol/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/webappapis/scripting/processing-model-2/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/scripting/processing-model-2/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/webappapis/system-state-and-capabilities/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/system-state-and-capabilities/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/webappapis/system-state-and-capabilities/the-external-interface/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/system-state-and-capabilities/the-external-interface/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/webappapis/timers/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/timers/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/webappapis/user-prompts/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/user-prompts/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/webappapis/user-prompts/dialogs-implemented-using-separate-documents/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/user-prompts/dialogs-implemented-using-separate-documents/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/webappapis/user-prompts/printing/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/user-prompts/printing/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/html/webappapis/user-prompts/simple-dialogs/.gitkeep b/tests/wpt/web-platform-tests/html/webappapis/user-prompts/simple-dialogs/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/wpt/web-platform-tests/imagebitmap-renderingcontext/META.yml b/tests/wpt/web-platform-tests/imagebitmap-renderingcontext/META.yml index 3c0af55426e..f6a06f4e7d7 100644 --- a/tests/wpt/web-platform-tests/imagebitmap-renderingcontext/META.yml +++ b/tests/wpt/web-platform-tests/imagebitmap-renderingcontext/META.yml @@ -1,3 +1,4 @@ +spec: https://html.spec.whatwg.org/multipage/canvas.html#the-imagebitmap-rendering-context suggested_reviewers: - AmeliaBR - annevk diff --git a/tests/wpt/web-platform-tests/images/META.yml b/tests/wpt/web-platform-tests/images/META.yml index 4956799b077..603bfc58d7d 100644 --- a/tests/wpt/web-platform-tests/images/META.yml +++ b/tests/wpt/web-platform-tests/images/META.yml @@ -1,4 +1,3 @@ suggested_reviewers: - zqzhang - - tagawa - gsnedders diff --git a/tests/wpt/web-platform-tests/input-device-capabilities/META.yml b/tests/wpt/web-platform-tests/input-device-capabilities/META.yml index 2d6845a47e5..f7b8c74fa40 100644 --- a/tests/wpt/web-platform-tests/input-device-capabilities/META.yml +++ b/tests/wpt/web-platform-tests/input-device-capabilities/META.yml @@ -1,3 +1,4 @@ +spec: https://wicg.github.io/InputDeviceCapabilities/ suggested_reviewers: - SummerLW - NavidZ diff --git a/tests/wpt/web-platform-tests/input-events/META.yml b/tests/wpt/web-platform-tests/input-events/META.yml index aab7ed05c23..79e0cbe5229 100644 --- a/tests/wpt/web-platform-tests/input-events/META.yml +++ b/tests/wpt/web-platform-tests/input-events/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/input-events/ suggested_reviewers: - johanneswilm - siusin diff --git a/tests/wpt/web-platform-tests/interfaces/CSP.idl b/tests/wpt/web-platform-tests/interfaces/CSP.idl new file mode 100644 index 00000000000..03d4306e0e3 --- /dev/null +++ b/tests/wpt/web-platform-tests/interfaces/CSP.idl @@ -0,0 +1,39 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Content Security Policy Level 3" spec. +// See: https://w3c.github.io/webappsec-csp/ + +enum SecurityPolicyViolationEventDisposition { + "enforce", "report" +}; + +[Constructor(DOMString type, optional SecurityPolicyViolationEventInit eventInitDict)] +interface SecurityPolicyViolationEvent : Event { + readonly attribute USVString documentURI; + readonly attribute USVString referrer; + readonly attribute USVString blockedURI; + readonly attribute DOMString violatedDirective; + readonly attribute DOMString effectiveDirective; + readonly attribute DOMString originalPolicy; + readonly attribute USVString sourceFile; + readonly attribute DOMString sample; + readonly attribute SecurityPolicyViolationEventDisposition disposition; + readonly attribute unsigned short statusCode; + readonly attribute unsigned long lineNumber; + readonly attribute unsigned long columnNumber; +}; + +dictionary SecurityPolicyViolationEventInit : EventInit { + required USVString documentURI; + USVString referrer = ""; + USVString blockedURI = ""; + required DOMString violatedDirective; + required DOMString effectiveDirective; + required DOMString originalPolicy; + USVString sourceFile = ""; + DOMString sample = ""; + required SecurityPolicyViolationEventDisposition disposition; + required unsigned short statusCode; + unsigned long lineNumber = 0; + unsigned long columnNumber = 0; +}; diff --git a/tests/wpt/web-platform-tests/interfaces/DOM-Parsing.idl b/tests/wpt/web-platform-tests/interfaces/DOM-Parsing.idl index 71d659bac1f..83a8fe167fc 100644 --- a/tests/wpt/web-platform-tests/interfaces/DOM-Parsing.idl +++ b/tests/wpt/web-platform-tests/interfaces/DOM-Parsing.idl @@ -15,15 +15,19 @@ enum SupportedType { "application/xhtml+xml", "image/svg+xml" }; + [Constructor, Exposed=Window] + interface XMLSerializer { DOMString serializeToString(Node root); }; + partial interface Element { [CEReactions, TreatNullAs=EmptyString] attribute DOMString innerHTML; [CEReactions, TreatNullAs=EmptyString] attribute DOMString outerHTML; [CEReactions] void insertAdjacentHTML(DOMString position, DOMString text); }; + partial interface Range { [CEReactions, NewObject] DocumentFragment createContextualFragment(DOMString fragment); }; diff --git a/tests/wpt/web-platform-tests/interfaces/FileAPI.idl b/tests/wpt/web-platform-tests/interfaces/FileAPI.idl index af094c8a280..690d777338f 100644 --- a/tests/wpt/web-platform-tests/interfaces/FileAPI.idl +++ b/tests/wpt/web-platform-tests/interfaces/FileAPI.idl @@ -1,6 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT -// Content of this file was automatically extracted from the FileAPI spec. -// See https://w3c.github.io/FileAPI/ +// Content of this file was automatically extracted from the +// "File API" spec. +// See: https://w3c.github.io/FileAPI/ [Constructor(optional sequence blobParts, optional BlobPropertyBag options), diff --git a/tests/wpt/web-platform-tests/interfaces/IndexedDB.idl b/tests/wpt/web-platform-tests/interfaces/IndexedDB.idl index 25e9a9c8e9c..2aa6e2c4b16 100644 --- a/tests/wpt/web-platform-tests/interfaces/IndexedDB.idl +++ b/tests/wpt/web-platform-tests/interfaces/IndexedDB.idl @@ -1,6 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT -// Content of this file was automatically extracted from the Indexed Database API spec. -// See https://w3c.github.io/IndexedDB/ +// Content of this file was automatically extracted from the +// "Indexed Database API 3.0" spec. +// See: https://w3c.github.io/IndexedDB/ [Exposed=(Window,Worker)] interface IDBRequest : EventTarget { @@ -39,7 +40,7 @@ dictionary IDBVersionChangeEventInit : EventInit { unsigned long long? newVersion = null; }; -partial interface WindowOrWorkerGlobalScope { +partial interface mixin WindowOrWorkerGlobalScope { [SameObject] readonly attribute IDBFactory indexedDB; }; diff --git a/tests/wpt/web-platform-tests/interfaces/InputDeviceCapabilities.idl b/tests/wpt/web-platform-tests/interfaces/InputDeviceCapabilities.idl index 6be9be7aa60..868d8171d30 100644 --- a/tests/wpt/web-platform-tests/interfaces/InputDeviceCapabilities.idl +++ b/tests/wpt/web-platform-tests/interfaces/InputDeviceCapabilities.idl @@ -5,18 +5,19 @@ [Constructor(optional InputDeviceCapabilitiesInit deviceInitDict)] interface InputDeviceCapabilities { - readonly attribute boolean firesTouchEvents; - readonly attribute boolean pointerMovementScrolls; + readonly attribute boolean firesTouchEvents; + readonly attribute boolean pointerMovementScrolls; }; dictionary InputDeviceCapabilitiesInit { - boolean firesTouchEvents = false; - boolean pointerMovementScrolls = false; + boolean firesTouchEvents = false; + boolean pointerMovementScrolls = false; }; + partial interface UIEvent { - readonly attribute InputDeviceCapabilities? sourceCapabilities; + readonly attribute InputDeviceCapabilities? sourceCapabilities; }; partial dictionary UIEventInit { - InputDeviceCapabilities? sourceCapabilities = null; + InputDeviceCapabilities? sourceCapabilities = null; }; diff --git a/tests/wpt/web-platform-tests/interfaces/webappsec-subresource-integrity.idl b/tests/wpt/web-platform-tests/interfaces/SRI.idl similarity index 53% rename from tests/wpt/web-platform-tests/interfaces/webappsec-subresource-integrity.idl rename to tests/wpt/web-platform-tests/interfaces/SRI.idl index 899f4710188..2d0d21f905e 100644 --- a/tests/wpt/web-platform-tests/interfaces/webappsec-subresource-integrity.idl +++ b/tests/wpt/web-platform-tests/interfaces/SRI.idl @@ -1,6 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT -// Content of this file was automatically extracted from the Subresource Integrity spec. -// See https://w3c.github.io/webappsec-subresource-integrity/ +// Content of this file was automatically extracted from the +// "Subresource Integrity" spec. +// See: https://w3c.github.io/webappsec-subresource-integrity/ partial interface HTMLLinkElement { attribute DOMString integrity; diff --git a/tests/wpt/web-platform-tests/interfaces/WebCryptoAPI.idl b/tests/wpt/web-platform-tests/interfaces/WebCryptoAPI.idl index f48eaf12e61..04051196e13 100644 --- a/tests/wpt/web-platform-tests/interfaces/WebCryptoAPI.idl +++ b/tests/wpt/web-platform-tests/interfaces/WebCryptoAPI.idl @@ -1,14 +1,15 @@ -[NoInterfaceObject] -interface GlobalCrypto { +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Web Cryptography API" spec. +// See: https://w3c.github.io/webcrypto/Overview.html + +partial interface mixin WindowOrWorkerGlobalScope { readonly attribute Crypto crypto; }; -//Window implements GlobalCrypto; -//WorkerGlobalScope implements GlobalCrypto; - [Exposed=(Window,Worker)] interface Crypto { - readonly attribute SubtleCrypto subtle; + [SecureContext] readonly attribute SubtleCrypto subtle; ArrayBufferView getRandomValues(ArrayBufferView array); }; @@ -28,7 +29,7 @@ enum KeyType { "public", "private", "secret" }; enum KeyUsage { "encrypt", "decrypt", "sign", "verify", "deriveKey", "deriveBits", "wrapKey", "unwrapKey" }; -[Exposed=(Window,Worker)] +[SecureContext,Exposed=(Window,Worker)] interface CryptoKey { readonly attribute KeyType type; readonly attribute boolean extractable; @@ -36,10 +37,9 @@ interface CryptoKey { readonly attribute object usages; }; - enum KeyFormat { "raw", "spki", "pkcs8", "jwk" }; -[Exposed=(Window,Worker)] +[SecureContext,Exposed=(Window,Worker)] interface SubtleCrypto { Promise encrypt(AlgorithmIdentifier algorithm, CryptoKey key, @@ -65,11 +65,11 @@ interface SubtleCrypto { AlgorithmIdentifier derivedKeyType, boolean extractable, sequence keyUsages ); - Promise deriveBits(AlgorithmIdentifier algorithm, + Promise deriveBits(AlgorithmIdentifier algorithm, CryptoKey baseKey, unsigned long length); - Promise importKey(KeyFormat format, + Promise importKey(KeyFormat format, (BufferSource or JsonWebKey) keyData, AlgorithmIdentifier algorithm, boolean extractable, @@ -80,7 +80,7 @@ interface SubtleCrypto { CryptoKey key, CryptoKey wrappingKey, AlgorithmIdentifier wrapAlgorithm); - Promise unwrapKey(KeyFormat format, + Promise unwrapKey(KeyFormat format, BufferSource wrappedKey, CryptoKey unwrappingKey, AlgorithmIdentifier unwrapAlgorithm, @@ -90,7 +90,7 @@ interface SubtleCrypto { }; dictionary RsaOtherPrimesInfo { - // The following fields are defined in Section 6.3.2.7 of JSON Web Algorithms + // The following fields are defined in Section 6.3.2.7 of JSON Web Algorithms DOMString r; DOMString d; DOMString t; @@ -153,125 +153,125 @@ dictionary RsaHashedKeyAlgorithm : RsaKeyAlgorithm { required KeyAlgorithm hash; }; -dictionary RsaHashedImportParams { +dictionary RsaHashedImportParams : Algorithm { // The hash algorithm to use required HashAlgorithmIdentifier hash; }; dictionary RsaPssParams : Algorithm { -// The desired length of the random salt -[EnforceRange] required unsigned long saltLength; + // The desired length of the random salt + [EnforceRange] required unsigned long saltLength; }; dictionary RsaOaepParams : Algorithm { -// The optional label/application data to associate with the message -BufferSource label; + // The optional label/application data to associate with the message + BufferSource label; }; dictionary EcdsaParams : Algorithm { -// The hash algorithm to use -required HashAlgorithmIdentifier hash; + // The hash algorithm to use + required HashAlgorithmIdentifier hash; }; typedef DOMString NamedCurve; dictionary EcKeyGenParams : Algorithm { -// A named curve -required NamedCurve namedCurve; + // A named curve + required NamedCurve namedCurve; }; dictionary EcKeyAlgorithm : KeyAlgorithm { -// The named curve that the key uses -required NamedCurve namedCurve; + // The named curve that the key uses + required NamedCurve namedCurve; }; dictionary EcKeyImportParams : Algorithm { -// A named curve -required NamedCurve namedCurve; + // A named curve + required NamedCurve namedCurve; }; dictionary EcdhKeyDeriveParams : Algorithm { -// The peer's EC public key. -required CryptoKey public; + // The peer's EC public key. + required CryptoKey public; }; dictionary AesCtrParams : Algorithm { -// The initial value of the counter block. counter MUST be 16 bytes -// (the AES block size). The counter bits are the rightmost length -// bits of the counter block. The rest of the counter block is for -// the nonce. The counter bits are incremented using the standard -// incrementing function specified in NIST SP 800-38A Appendix B.1: -// the counter bits are interpreted as a big-endian integer and -// incremented by one. -required BufferSource counter; -// The length, in bits, of the rightmost part of the counter block -// that is incremented. -[EnforceRange] required octet length; + // The initial value of the counter block. counter MUST be 16 bytes + // (the AES block size). The counter bits are the rightmost length + // bits of the counter block. The rest of the counter block is for + // the nonce. The counter bits are incremented using the standard + // incrementing function specified in NIST SP 800-38A Appendix B.1: + // the counter bits are interpreted as a big-endian integer and + // incremented by one. + required BufferSource counter; + // The length, in bits, of the rightmost part of the counter block + // that is incremented. + [EnforceRange] required octet length; }; dictionary AesKeyAlgorithm : KeyAlgorithm { -// The length, in bits, of the key. -required unsigned short length; + // The length, in bits, of the key. + required unsigned short length; }; dictionary AesKeyGenParams : Algorithm { -// The length, in bits, of the key. -[EnforceRange] required unsigned short length; + // The length, in bits, of the key. + [EnforceRange] required unsigned short length; }; dictionary AesDerivedKeyParams : Algorithm { -// The length, in bits, of the key. -[EnforceRange] required unsigned short length; + // The length, in bits, of the key. + [EnforceRange] required unsigned short length; }; dictionary AesCbcParams : Algorithm { -// The initialization vector. MUST be 16 bytes. -required BufferSource iv; + // The initialization vector. MUST be 16 bytes. + required BufferSource iv; }; dictionary AesGcmParams : Algorithm { -// The initialization vector to use. May be up to 2^64-1 bytes long. -required BufferSource iv; -// The additional authentication data to include. -BufferSource additionalData; -// The desired length of the authentication tag. May be 0 - 128. -[EnforceRange] octet tagLength; + // The initialization vector to use. May be up to 2^64-1 bytes long. + required BufferSource iv; + // The additional authentication data to include. + BufferSource additionalData; + // The desired length of the authentication tag. May be 0 - 128. + [EnforceRange] octet tagLength; }; dictionary HmacImportParams : Algorithm { -// The inner hash function to use. -HashAlgorithmIdentifier hash; -// The length (in bits) of the key. -[EnforceRange] unsigned long length; + // The inner hash function to use. + required HashAlgorithmIdentifier hash; + // The length (in bits) of the key. + [EnforceRange] unsigned long length; }; dictionary HmacKeyAlgorithm : KeyAlgorithm { -// The inner hash function to use. -required KeyAlgorithm hash; -// The length (in bits) of the key. -required unsigned long length; + // The inner hash function to use. + required KeyAlgorithm hash; + // The length (in bits) of the key. + required unsigned long length; }; dictionary HmacKeyGenParams : Algorithm { -// The inner hash function to use. -required HashAlgorithmIdentifier hash; -// The length (in bits) of the key to generate. If unspecified, the -// recommended length will be used, which is the size of the associated hash function's block -// size. -[EnforceRange] unsigned long length; + // The inner hash function to use. + required HashAlgorithmIdentifier hash; + // The length (in bits) of the key to generate. If unspecified, the + // recommended length will be used, which is the size of the associated hash function's block + // size. + [EnforceRange] unsigned long length; }; -dictionary HkdfCtrParams : Algorithm { -// The algorithm to use with HMAC (e.g.: SHA-256) -required HashAlgorithmIdentifier hash; -// A bit string that corresponds to the label that identifies the purpose for the derived keying material. -required BufferSource label; -// A bit string that corresponds to the context of the key derivation, as described in Section 5 of [NIST SP800-108] -required BufferSource context; +dictionary HkdfParams : Algorithm { + // The algorithm to use with HMAC (e.g.: SHA-256) + required HashAlgorithmIdentifier hash; + // A bit string that corresponds to the salt used in the extract step. + required BufferSource salt; + // A bit string that corresponds to the context and application specific context for the derived keying material. + required BufferSource info; }; dictionary Pbkdf2Params : Algorithm { -required BufferSource salt; -[EnforceRange] required unsigned long iterations; -required HashAlgorithmIdentifier hash; + required BufferSource salt; + [EnforceRange] required unsigned long iterations; + required HashAlgorithmIdentifier hash; }; diff --git a/tests/wpt/web-platform-tests/interfaces/webidl.idl b/tests/wpt/web-platform-tests/interfaces/WebIDL.idl similarity index 92% rename from tests/wpt/web-platform-tests/interfaces/webidl.idl rename to tests/wpt/web-platform-tests/interfaces/WebIDL.idl index 924fc57a0a7..2dc52129041 100644 --- a/tests/wpt/web-platform-tests/interfaces/webidl.idl +++ b/tests/wpt/web-platform-tests/interfaces/WebIDL.idl @@ -1,9 +1,13 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Web IDL" spec. +// See: https://heycam.github.io/webidl/ + typedef (Int8Array or Int16Array or Int32Array or Uint8Array or Uint16Array or Uint32Array or Uint8ClampedArray or Float32Array or Float64Array or DataView) ArrayBufferView; typedef (ArrayBufferView or ArrayBuffer) BufferSource; - [ Exposed=(Window,Worker), Constructor(optional DOMString message = "", optional DOMString name = "Error") @@ -41,7 +45,5 @@ interface DOMException { // but see below note about ECMAScript binding }; typedef unsigned long long DOMTimeStamp; - callback Function = any (any... arguments); - callback VoidFunction = void (); diff --git a/tests/wpt/web-platform-tests/interfaces/appmanifest.idl b/tests/wpt/web-platform-tests/interfaces/appmanifest.idl new file mode 100644 index 00000000000..273b4f0255e --- /dev/null +++ b/tests/wpt/web-platform-tests/interfaces/appmanifest.idl @@ -0,0 +1,81 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Web App Manifest" spec. +// See: https://w3c.github.io/manifest/ + +enum AppBannerPromptOutcome { + "accepted", + "dismissed" +}; + +[Constructor(DOMString type, optional EventInit eventInitDict), + Exposed=Window] +interface BeforeInstallPromptEvent : Event { + Promise prompt(); +}; +dictionary PromptResponseObject { + AppBannerPromptOutcome userChoice; +}; + +partial interface Window { + attribute EventHandler onappinstalled; + attribute EventHandler onbeforeinstallprompt; +}; + +dictionary WebAppManifest { + TextDirectionType dir = "auto"; + DOMString lang; + USVString name; + USVString short_name; + USVString description; + sequence icons; + sequence screenshots; + sequence categories; + DOMString iarc_rating_id; + USVString start_url; + DisplayModeType display = "browser"; + OrientationLockType orientation; + USVString theme_color; + USVString background_color; + USVString scope; + ServiceWorkerRegistrationObject serviceworker; + sequence related_applications; + boolean prefer_related_applications = "false"; +}; + +enum TextDirectionType { "ltr", "rtl", "auto" }; + +enum DisplayModeType { + "fullscreen", + "standalone", + "minimal-ui", + "browser" +}; + +dictionary ImageResource { + required USVString src; + DOMString sizes; + USVString type; + USVString purpose; + USVString platform; +}; + +dictionary ServiceWorkerRegistrationObject { + required USVString src; + USVString scope; + WorkerType type = "classic"; + ServiceWorkerUpdateViaCache update_via_cache = "imports"; +}; + +dictionary ExternalApplicationResource { + required USVString platform; + USVString url; + DOMString id; + USVString min_version; + sequence fingerprints; +}; + +dictionary Fingerprint { + USVString type; + USVString value; +}; diff --git a/tests/wpt/web-platform-tests/interfaces/audio-output.idl b/tests/wpt/web-platform-tests/interfaces/audio-output.idl new file mode 100644 index 00000000000..c1869ab0e9c --- /dev/null +++ b/tests/wpt/web-platform-tests/interfaces/audio-output.idl @@ -0,0 +1,9 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Audio Output Devices API" spec. +// See: https://w3c.github.io/mediacapture-output/ + +partial interface HTMLMediaElement { + readonly attribute DOMString sinkId; + Promise setSinkId(DOMString sinkId); +}; diff --git a/tests/wpt/web-platform-tests/interfaces/cookie-store.idl b/tests/wpt/web-platform-tests/interfaces/cookie-store.idl index 63ddc090778..4f53dbf0a47 100644 --- a/tests/wpt/web-platform-tests/interfaces/cookie-store.idl +++ b/tests/wpt/web-platform-tests/interfaces/cookie-store.idl @@ -7,13 +7,13 @@ enum CookieSameSite { }; dictionary CookieListItem { - USVString name; + required USVString name; USVString value; - USVString? domain; - USVString path; - DOMTimeStamp? expires; - boolean secure; - CookieSameSite sameSite; + USVString? domain = null; + USVString path = "/"; + DOMTimeStamp? expires = null; + boolean secure = true; + CookieSameSite sameSite = "strict"; }; typedef sequence CookieList; @@ -50,6 +50,14 @@ enum CookieMatchType { "starts-with" }; +dictionary CookieStoreDeleteOptions { + required USVString name; + USVString? domain = null; + USVString path = "/"; + boolean secure = true; + CookieSameSite sameSite = "strict"; +}; + dictionary CookieStoreGetOptions { USVString name; USVString url; @@ -57,31 +65,34 @@ dictionary CookieStoreGetOptions { }; dictionary CookieStoreSetOptions { - USVString name; - USVString value; DOMTimeStamp? expires = null; - USVString domain; + USVString? domain = null; USVString path = "/"; boolean secure = true; boolean httpOnly = false; CookieSameSite sameSite = "strict"; }; +dictionary CookieStoreSetExtraOptions : CookieStoreSetOptions { + required USVString name; + required USVString value; +}; + [ Exposed=(ServiceWorker,Window), SecureContext ] interface CookieStore : EventTarget { - Promise getAll(USVString name, optional CookieStoreGetOptions options); - Promise getAll(optional CookieStoreGetOptions options); - - Promise get(USVString name, optional CookieStoreGetOptions options); + Promise get(USVString name); Promise get(optional CookieStoreGetOptions options); - Promise set(USVString name, USVString value, optional CookieStoreSetOptions options); - Promise set(CookieStoreSetOptions options); + Promise getAll(USVString name); + Promise getAll(optional CookieStoreGetOptions options); - Promise delete(USVString name, optional CookieStoreSetOptions options); - Promise delete(CookieStoreSetOptions options); + Promise set(USVString name, USVString value, optional CookieStoreSetOptions options); + Promise set(CookieStoreSetExtraOptions options); + + Promise delete(USVString name); + Promise delete(CookieStoreDeleteOptions options); [Exposed=ServiceWorker] Promise subscribeToChanges(sequence subscriptions); @@ -97,4 +108,5 @@ partial interface Window { partial interface ServiceWorkerGlobalScope { [Replaceable, SameObject] readonly attribute CookieStore cookieStore; + attribute EventHandler oncookiechange; }; diff --git a/tests/wpt/web-platform-tests/interfaces/csp-embedded-enforcement.idl b/tests/wpt/web-platform-tests/interfaces/csp-embedded-enforcement.idl new file mode 100644 index 00000000000..7d752ebc7d8 --- /dev/null +++ b/tests/wpt/web-platform-tests/interfaces/csp-embedded-enforcement.idl @@ -0,0 +1,8 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Content Security Policy: Embedded Enforcement" spec. +// See: https://w3c.github.io/webappsec-csp/embedded/ + +partial interface HTMLIFrameElement { + [CEReactions] attribute DOMString csp; +}; diff --git a/tests/wpt/web-platform-tests/interfaces/css-animations.idl b/tests/wpt/web-platform-tests/interfaces/css-animations.idl index 3162c9e83bf..8511f8e72eb 100644 --- a/tests/wpt/web-platform-tests/interfaces/css-animations.idl +++ b/tests/wpt/web-platform-tests/interfaces/css-animations.idl @@ -37,7 +37,7 @@ interface CSSKeyframesRule : CSSRule { CSSKeyframeRule? findRule(CSSOMString select); }; -partial interface GlobalEventHandlers { +partial interface mixin GlobalEventHandlers { attribute EventHandler onanimationstart; attribute EventHandler onanimationiteration; attribute EventHandler onanimationend; diff --git a/tests/wpt/web-platform-tests/interfaces/dom.idl b/tests/wpt/web-platform-tests/interfaces/dom.idl index 3779e3d6141..1d3216f951c 100644 --- a/tests/wpt/web-platform-tests/interfaces/dom.idl +++ b/tests/wpt/web-platform-tests/interfaces/dom.idl @@ -360,6 +360,7 @@ interface Element : Node { void setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString value); void removeAttribute(DOMString qualifiedName); void removeAttributeNS(DOMString? namespace, DOMString localName); + boolean toggleAttribute(DOMString qualifiedName, optional boolean force); boolean hasAttribute(DOMString qualifiedName); boolean hasAttributeNS(DOMString? namespace, DOMString localName); diff --git a/tests/wpt/web-platform-tests/interfaces/encoding.idl b/tests/wpt/web-platform-tests/interfaces/encoding.idl index 8f4189be796..7788464081e 100644 --- a/tests/wpt/web-platform-tests/interfaces/encoding.idl +++ b/tests/wpt/web-platform-tests/interfaces/encoding.idl @@ -1,3 +1,8 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Encoding Standard" spec. +// See: https://encoding.spec.whatwg.org/ + dictionary TextDecoderOptions { boolean fatal = false; boolean ignoreBOM = false; @@ -15,7 +20,6 @@ interface TextDecoder { readonly attribute boolean ignoreBOM; USVString decode(optional BufferSource input, optional TextDecodeOptions options); }; - [Constructor, Exposed=(Window,Worker)] interface TextEncoder { diff --git a/tests/wpt/web-platform-tests/interfaces/encrypted-media.idl b/tests/wpt/web-platform-tests/interfaces/encrypted-media.idl index 607ed6be9d3..8c2e8d2989d 100644 --- a/tests/wpt/web-platform-tests/interfaces/encrypted-media.idl +++ b/tests/wpt/web-platform-tests/interfaces/encrypted-media.idl @@ -8,11 +8,13 @@ partial interface Navigator { [SecureContext] Promise requestMediaKeySystemAccess(DOMString keySystem, sequence supportedConfigurations); }; + enum MediaKeysRequirement { "required", "optional", "not-allowed" }; + dictionary MediaKeySystemConfiguration { DOMString label = ""; sequence initDataTypes = []; @@ -22,10 +24,12 @@ dictionary MediaKeySystemConfiguration { MediaKeysRequirement persistentState = "optional"; sequence sessionTypes; }; + dictionary MediaKeySystemMediaCapability { DOMString contentType = ""; DOMString robustness = ""; }; + [Exposed=Window, SecureContext] interface MediaKeySystemAccess { @@ -33,16 +37,19 @@ interface MediaKeySystemAccess { MediaKeySystemConfiguration getConfiguration(); Promise createMediaKeys(); }; + enum MediaKeySessionType { "temporary", "persistent-license" }; + [Exposed=Window, SecureContext] interface MediaKeys { MediaKeySession createSession(optional MediaKeySessionType sessionType = "temporary"); Promise setServerCertificate(BufferSource serverCertificate); }; + [Exposed=Window, SecureContext] interface MediaKeySession : EventTarget { @@ -59,6 +66,7 @@ interface MediaKeySession : EventTarget { Promise close(); Promise remove(); }; + [Exposed=Window, SecureContext] interface MediaKeyStatusMap { @@ -67,6 +75,7 @@ interface MediaKeyStatusMap { boolean has(BufferSource keyId); any get(BufferSource keyId); }; + enum MediaKeyStatus { "usable", "expired", @@ -76,12 +85,14 @@ enum MediaKeyStatus { "status-pending", "internal-error" }; + enum MediaKeyMessageType { "license-request", "license-renewal", "license-release", "individualization-request" }; + [Exposed=Window, SecureContext, Constructor(DOMString type, MediaKeyMessageEventInit eventInitDict)] @@ -89,10 +100,12 @@ interface MediaKeyMessageEvent : Event { readonly attribute MediaKeyMessageType messageType; readonly attribute ArrayBuffer message; }; + dictionary MediaKeyMessageEventInit : EventInit { required MediaKeyMessageType messageType; required ArrayBuffer message; }; + [Exposed=Window] partial interface HTMLMediaElement { [SecureContext] @@ -101,12 +114,14 @@ partial interface HTMLMediaElement { attribute EventHandler onwaitingforkey; [SecureContext] Promise setMediaKeys(MediaKeys? mediaKeys); }; + [Exposed=Window, Constructor(DOMString type, optional MediaEncryptedEventInit eventInitDict)] interface MediaEncryptedEvent : Event { readonly attribute DOMString initDataType; readonly attribute ArrayBuffer? initData; }; + dictionary MediaEncryptedEventInit : EventInit { DOMString initDataType = ""; ArrayBuffer? initData = null; diff --git a/tests/wpt/web-platform-tests/interfaces/gamepad.idl b/tests/wpt/web-platform-tests/interfaces/gamepad.idl index 575e12a3d1e..9fed140b384 100644 --- a/tests/wpt/web-platform-tests/interfaces/gamepad.idl +++ b/tests/wpt/web-platform-tests/interfaces/gamepad.idl @@ -1,7 +1,9 @@ // GENERATED CONTENT - DO NOT EDIT -// Content of this file was automatically extracted from the Gamepad spec. -// See https://w3c.github.io/gamepad/ +// Content of this file was automatically extracted from the +// "Gamepad" spec. +// See: https://w3c.github.io/gamepad/ +[Exposed=Window] interface Gamepad { readonly attribute DOMString id; readonly attribute long index; @@ -12,6 +14,7 @@ interface Gamepad { readonly attribute FrozenArray buttons; }; +[Exposed=Window] interface GamepadButton { readonly attribute boolean pressed; readonly attribute boolean touched; @@ -23,15 +26,17 @@ enum GamepadMappingType { "standard", }; +[Exposed=Window] partial interface Navigator { sequence getGamepads(); }; -[Constructor(GamepadEventInit eventInitDict)] -interface GamepadEvent: Event { - readonly attribute Gamepad gamepad; +[Constructor(DOMString type, GamepadEventInit eventInitDict), Exposed=Window] + +interface GamepadEvent : Event { + [SameObject] readonly attribute Gamepad gamepad; }; -dictionary GamepadEventInit: EventInit { +dictionary GamepadEventInit : EventInit { required Gamepad gamepad; }; diff --git a/tests/wpt/web-platform-tests/interfaces/sensors.idl b/tests/wpt/web-platform-tests/interfaces/generic-sensor.idl similarity index 79% rename from tests/wpt/web-platform-tests/interfaces/sensors.idl rename to tests/wpt/web-platform-tests/interfaces/generic-sensor.idl index ec51671bf9a..34505a6cecb 100644 --- a/tests/wpt/web-platform-tests/interfaces/sensors.idl +++ b/tests/wpt/web-platform-tests/interfaces/generic-sensor.idl @@ -1,3 +1,8 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Generic Sensor API" spec. +// See: https://w3c.github.io/sensors/ + [SecureContext, Exposed=Window] interface Sensor : EventTarget { readonly attribute boolean activated; diff --git a/tests/wpt/web-platform-tests/interfaces/geolocation-API.idl b/tests/wpt/web-platform-tests/interfaces/geolocation-API.idl new file mode 100644 index 00000000000..2972539e03b --- /dev/null +++ b/tests/wpt/web-platform-tests/interfaces/geolocation-API.idl @@ -0,0 +1,59 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Geolocation API Specification 2nd Edition" spec. +// See: https://www.w3.org/TR/geolocation-API/ + +partial interface Navigator { + readonly attribute Geolocation geolocation; + }; + + + [NoInterfaceObject] + interface Geolocation { + void getCurrentPosition(PositionCallback successCallback, + optional PositionErrorCallback errorCallback, + optional PositionOptions options); + + long watchPosition(PositionCallback successCallback, + optional PositionErrorCallback errorCallback, + optional PositionOptions options); + + void clearWatch(long watchId); + }; + + callback PositionCallback = void (Position position); + + callback PositionErrorCallback = void (PositionError positionError); + + dictionary PositionOptions { + boolean enableHighAccuracy = false; + [Clamp] unsigned long timeout = 0xFFFFFFFF; + [Clamp] unsigned long maximumAge = 0; + }; + + + [NoInterfaceObject] + interface Position { + readonly attribute Coordinates coords; + readonly attribute DOMTimeStamp timestamp; + }; + + [NoInterfaceObject] + interface Coordinates { + readonly attribute double latitude; + readonly attribute double longitude; + readonly attribute double? altitude; + readonly attribute double accuracy; + readonly attribute double? altitudeAccuracy; + readonly attribute double? heading; + readonly attribute double? speed; + }; + + [NoInterfaceObject] + interface PositionError { + const unsigned short PERMISSION_DENIED = 1; + const unsigned short POSITION_UNAVAILABLE = 2; + const unsigned short TIMEOUT = 3; + readonly attribute unsigned short code; + readonly attribute DOMString message; + }; diff --git a/tests/wpt/web-platform-tests/interfaces/html.idl b/tests/wpt/web-platform-tests/interfaces/html.idl index 8d9cb2fea53..60b1527c113 100644 --- a/tests/wpt/web-platform-tests/interfaces/html.idl +++ b/tests/wpt/web-platform-tests/interfaces/html.idl @@ -1550,6 +1550,7 @@ interface Window : EventTarget { void cancelAnimationFrame(unsigned long handle); void postMessage(any message, USVString targetOrigin, optional sequence transfer = []); + void postMessage(any message, optional sequence transfer = [], optional WindowPostMessageOptions options); // also has obsolete members }; @@ -1558,6 +1559,10 @@ Window includes WindowEventHandlers; callback FrameRequestCallback = void (DOMHighResTimeStamp time); +dictionary WindowPostMessageOptions { + USVString targetOrigin = "/"; +}; + [Exposed=Window] interface BarProp { readonly attribute boolean visible; diff --git a/tests/wpt/web-platform-tests/interfaces/input-events.idl b/tests/wpt/web-platform-tests/interfaces/input-events.idl index d229547790f..be276361738 100644 --- a/tests/wpt/web-platform-tests/interfaces/input-events.idl +++ b/tests/wpt/web-platform-tests/interfaces/input-events.idl @@ -1,11 +1,16 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Input Events Level 1" spec. +// See: https://rawgit.com/w3c/input-events/v1/index.html + partial interface InputEvent { - readonly attribute DOMString inputType; - readonly attribute DataTransfer? dataTransfer; - sequence getTargetRanges(); + readonly attribute DOMString inputType; + readonly attribute DataTransfer? dataTransfer; + sequence getTargetRanges(); }; partial dictionary InputEventInit { - DOMString inputType = ""; - DataTransfer? dataTransfer = null; - sequence targetRanges = []; + DOMString inputType = ""; + DataTransfer? dataTransfer = null; + sequence targetRanges = []; }; diff --git a/tests/wpt/web-platform-tests/interfaces/longtasks.idl b/tests/wpt/web-platform-tests/interfaces/longtasks.idl new file mode 100644 index 00000000000..8671b17a9be --- /dev/null +++ b/tests/wpt/web-platform-tests/interfaces/longtasks.idl @@ -0,0 +1,15 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Long Tasks API 1" spec. +// See: https://w3c.github.io/longtasks/ + +interface PerformanceLongTaskTiming : PerformanceEntry { + readonly attribute FrozenArray attribution; +}; + +interface TaskAttributionTiming : PerformanceEntry { + readonly attribute DOMString containerType; + readonly attribute DOMString containerSrc; + readonly attribute DOMString containerId; + readonly attribute DOMString containerName; +}; diff --git a/tests/wpt/web-platform-tests/interfaces/media-capabilities.idl b/tests/wpt/web-platform-tests/interfaces/media-capabilities.idl index 8e242c594b0..7b7b0785366 100644 --- a/tests/wpt/web-platform-tests/interfaces/media-capabilities.idl +++ b/tests/wpt/web-platform-tests/interfaces/media-capabilities.idl @@ -1,3 +1,8 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Media Capabilities" spec. +// See: https://wicg.github.io/media-capabilities/ + dictionary MediaConfiguration { VideoConfiguration video; AudioConfiguration audio; @@ -36,6 +41,7 @@ dictionary AudioConfiguration { unsigned long samplerate; }; +[Exposed=(Window, Worker)] interface MediaCapabilitiesInfo { readonly attribute boolean supported; readonly attribute boolean smooth; diff --git a/tests/wpt/web-platform-tests/interfaces/mediacapture-depth.idl b/tests/wpt/web-platform-tests/interfaces/mediacapture-depth.idl index d39c7e8bfec..d28c3cf8f6c 100644 --- a/tests/wpt/web-platform-tests/interfaces/mediacapture-depth.idl +++ b/tests/wpt/web-platform-tests/interfaces/mediacapture-depth.idl @@ -17,48 +17,52 @@ partial dictionary MediaTrackSupportedConstraints { boolean depthFar = false; boolean depthToVideoTransform = false; }; + partial dictionary MediaTrackCapabilities { // Apply to both depth stream track and color stream track: - DOMString videoKind; + DOMString videoKind; (double or DoubleRange) focalLengthX; (double or DoubleRange) focalLengthY; (double or DoubleRange) principalPointX; (double or DoubleRange) principalPointY; - boolean deprojectionDistortionCoefficients; - boolean projectionDistortionCoefficients; + boolean deprojectionDistortionCoefficients; + boolean projectionDistortionCoefficients; // Apply to depth stream track: (double or DoubleRange) depthNear; (double or DoubleRange) depthFar; - boolean depthToVideoTransform; + boolean depthToVideoTransform; }; + partial dictionary MediaTrackConstraintSet { // Apply to both depth stream track and color stream track: ConstrainDOMString videoKind; - ConstrainDouble focalLengthX; - ConstrainDouble focalLengthY; - ConstrainDouble principalPointX; - ConstrainDouble principalPointY; - ConstrainBoolean deprojectionDistortionCoefficients; - ConstrainBoolean projectionDistortionCoefficients; + ConstrainDouble focalLengthX; + ConstrainDouble focalLengthY; + ConstrainDouble principalPointX; + ConstrainDouble principalPointY; + ConstrainBoolean deprojectionDistortionCoefficients; + ConstrainBoolean projectionDistortionCoefficients; // Apply to depth stream track: - ConstrainDouble depthNear; - ConstrainDouble depthFar; - ConstrainBoolean depthToVideoTransform; + ConstrainDouble depthNear; + ConstrainDouble depthFar; + ConstrainBoolean depthToVideoTransform; }; + partial dictionary MediaTrackSettings { // Apply to both depth stream track and color stream track: - DOMString videoKind; - double focalLengthX; - double focalLengthY; - double principalPointX; - double principalPointY; + DOMString videoKind; + double focalLengthX; + double focalLengthY; + double principalPointX; + double principalPointY; DistortionCoefficients deprojectionDistortionCoefficients; DistortionCoefficients projectionDistortionCoefficients; // Apply to depth stream track: - double depthNear; - double depthFar; - Transformation depthToVideoTransform; + double depthNear; + double depthFar; + Transformation depthToVideoTransform; }; + dictionary DistortionCoefficients { double k1; double k2; @@ -66,10 +70,12 @@ dictionary DistortionCoefficients { double p2; double k3; }; + dictionary Transformation { - Float32Array transformationMatrix; - DOMString videoDeviceId; + Float32Array transformationMatrix; + DOMString videoDeviceId; }; + enum VideoKindEnum { "color", "depth" diff --git a/tests/wpt/web-platform-tests/interfaces/mediacapture-fromelement.idl b/tests/wpt/web-platform-tests/interfaces/mediacapture-fromelement.idl index 7b35de99e8e..003bcb4cc81 100644 --- a/tests/wpt/web-platform-tests/interfaces/mediacapture-fromelement.idl +++ b/tests/wpt/web-platform-tests/interfaces/mediacapture-fromelement.idl @@ -6,11 +6,12 @@ partial interface HTMLMediaElement { MediaStream captureStream(); }; + partial interface HTMLCanvasElement { MediaStream captureStream(optional double frameRequestRate); }; -[Exposed=Window] -interface CanvasCaptureMediaStreamTrack : MediaStreamTrack { - readonly attribute HTMLCanvasElement canvas; + +[Exposed=Window] interface CanvasCaptureMediaStreamTrack : MediaStreamTrack { + readonly attribute HTMLCanvasElement canvas; void requestFrame(); }; diff --git a/tests/wpt/web-platform-tests/interfaces/mediacapture-main.idl b/tests/wpt/web-platform-tests/interfaces/mediacapture-main.idl deleted file mode 100644 index d5e39e342a5..00000000000 --- a/tests/wpt/web-platform-tests/interfaces/mediacapture-main.idl +++ /dev/null @@ -1,272 +0,0 @@ -// GENERATED CONTENT - DO NOT EDIT -// Content of this file was automatically extracted from the Media Capture and Streams spec. -// See https://w3c.github.io/mediacapture-main/ - -[Exposed=Window, - Constructor, - Constructor (MediaStream stream), - Constructor (sequence tracks)] -interface MediaStream : EventTarget { - readonly attribute DOMString id; - sequence getAudioTracks (); - sequence getVideoTracks (); - sequence getTracks (); - MediaStreamTrack? getTrackById (DOMString trackId); - void addTrack (MediaStreamTrack track); - void removeTrack (MediaStreamTrack track); - MediaStream clone (); - readonly attribute boolean active; - attribute EventHandler onaddtrack; - attribute EventHandler onremovetrack; -}; - -[Exposed=Window] -interface MediaStreamTrack : EventTarget { - readonly attribute DOMString kind; - readonly attribute DOMString id; - readonly attribute DOMString label; - attribute boolean enabled; - readonly attribute boolean muted; - attribute EventHandler onmute; - attribute EventHandler onunmute; - readonly attribute MediaStreamTrackState readyState; - attribute EventHandler onended; - MediaStreamTrack clone (); - void stop (); - MediaTrackCapabilities getCapabilities (); - MediaTrackConstraints getConstraints (); - MediaTrackSettings getSettings (); - Promise applyConstraints (optional MediaTrackConstraints constraints); - attribute EventHandler onoverconstrained; -}; - -enum MediaStreamTrackState { - "live", - "ended" -}; - -dictionary MediaTrackSupportedConstraints { - boolean width = true; - boolean height = true; - boolean aspectRatio = true; - boolean frameRate = true; - boolean facingMode = true; - boolean resizeMode = true; - boolean volume = true; - boolean sampleRate = true; - boolean sampleSize = true; - boolean echoCancellation = true; - boolean autoGainControl = true; - boolean noiseSuppression = true; - boolean latency = true; - boolean channelCount = true; - boolean deviceId = true; - boolean groupId = true; -}; - -dictionary MediaTrackCapabilities { - ULongRange width; - ULongRange height; - DoubleRange aspectRatio; - DoubleRange frameRate; - sequence facingMode; - sequence resizeMode; - DoubleRange volume; - ULongRange sampleRate; - ULongRange sampleSize; - sequence echoCancellation; - sequence autoGainControl; - sequence noiseSuppression; - DoubleRange latency; - ULongRange channelCount; - DOMString deviceId; - DOMString groupId; -}; - - dictionary MediaTrackConstraints : MediaTrackConstraintSet { - sequence advanced; -}; - -dictionary MediaTrackConstraintSet { - ConstrainULong width; - ConstrainULong height; - ConstrainDouble aspectRatio; - ConstrainDouble frameRate; - ConstrainDOMString facingMode; - ConstrainDOMString resizeMode; - ConstrainDouble volume; - ConstrainULong sampleRate; - ConstrainULong sampleSize; - ConstrainBoolean echoCancellation; - ConstrainBoolean autoGainControl; - ConstrainBoolean noiseSuppression; - ConstrainDouble latency; - ConstrainULong channelCount; - ConstrainDOMString deviceId; - ConstrainDOMString groupId; -}; - -dictionary MediaTrackSettings { - long width; - long height; - double aspectRatio; - double frameRate; - DOMString facingMode; - DOMString resizeMode; - double volume; - long sampleRate; - long sampleSize; - boolean echoCancellation; - boolean autoGainControl; - boolean noiseSuppression; - double latency; - long channelCount; - DOMString deviceId; - DOMString groupId; -}; - -enum VideoFacingModeEnum { - "user", - "environment", - "left", - "right" -}; - -enum VideoResizeModeEnum { - "none", - "crop-and-scale" -}; - -[Exposed=Window, - Constructor (DOMString type, MediaStreamTrackEventInit eventInitDict)] -interface MediaStreamTrackEvent : Event { - [SameObject] - readonly attribute MediaStreamTrack track; -}; - -dictionary MediaStreamTrackEventInit : EventInit { - required MediaStreamTrack track; -}; - -[Exposed=Window, - Constructor (DOMString type, OverconstrainedErrorEventInit eventInitDict)] -interface OverconstrainedErrorEvent : Event { - readonly attribute OverconstrainedError? error; -}; - -dictionary OverconstrainedErrorEventInit : EventInit { - OverconstrainedError? error = null; -}; - -[Exposed=Window, NoInterfaceObject] -interface NavigatorUserMedia { - [SameObject] - readonly attribute MediaDevices mediaDevices; -}; - -Navigator implements NavigatorUserMedia; - -[Exposed=Window] -interface MediaDevices : EventTarget { - attribute EventHandler ondevicechange; - Promise> enumerateDevices (); -}; - -[Exposed=Window] -interface MediaDeviceInfo { - readonly attribute DOMString deviceId; - readonly attribute MediaDeviceKind kind; - readonly attribute DOMString label; - readonly attribute DOMString groupId; - [Default] object toJSON(); -}; - -enum MediaDeviceKind { - "audioinput", - "audiooutput", - "videoinput" -}; - - [Exposed=Window] interface InputDeviceInfo : MediaDeviceInfo { - MediaTrackCapabilities getCapabilities (); -}; - -partial interface NavigatorUserMedia { - void getUserMedia (MediaStreamConstraints constraints, NavigatorUserMediaSuccessCallback successCallback, NavigatorUserMediaErrorCallback errorCallback); -}; - -partial interface MediaDevices { - MediaTrackSupportedConstraints getSupportedConstraints (); - Promise getUserMedia (optional MediaStreamConstraints constraints); -}; - -dictionary MediaStreamConstraints { - (boolean or MediaTrackConstraints) video = false; - (boolean or MediaTrackConstraints) audio = false; -}; - -callback NavigatorUserMediaSuccessCallback = void (MediaStream stream); - -callback NavigatorUserMediaErrorCallback = void (MediaStreamError error); - -typedef object MediaStreamError; - -[NoInterfaceObject] -interface ConstrainablePattern { - Capabilities getCapabilities (); - Constraints getConstraints (); - Settings getSettings (); - Promise applyConstraints (optional Constraints constraints); - attribute EventHandler onoverconstrained; -}; - -dictionary DoubleRange { - double max; - double min; -}; - -dictionary ConstrainDoubleRange : DoubleRange { - double exact; - double ideal; -}; - -dictionary ULongRange { - [Clamp] unsigned long max; - [Clamp] unsigned long min; -}; - -dictionary ConstrainULongRange : ULongRange { - [Clamp] unsigned long exact; - [Clamp] unsigned long ideal; -}; - -dictionary ConstrainBooleanParameters { - boolean exact; - boolean ideal; -}; - -dictionary ConstrainDOMStringParameters { - (DOMString or sequence) exact; - (DOMString or sequence) ideal; -}; - -typedef ([Clamp] unsigned long or ConstrainULongRange) ConstrainULong; - -typedef (double or ConstrainDoubleRange) ConstrainDouble; - -typedef (boolean or ConstrainBooleanParameters) ConstrainBoolean; - -typedef (DOMString or sequence or ConstrainDOMStringParameters) ConstrainDOMString; - -dictionary Capabilities { -}; - -dictionary Settings { -}; - -dictionary ConstraintSet { -}; - -dictionary Constraints : ConstraintSet { - sequence advanced; -}; diff --git a/tests/wpt/web-platform-tests/interfaces/mediacapture-streams.idl b/tests/wpt/web-platform-tests/interfaces/mediacapture-streams.idl new file mode 100644 index 00000000000..1d2dd31ffb0 --- /dev/null +++ b/tests/wpt/web-platform-tests/interfaces/mediacapture-streams.idl @@ -0,0 +1,238 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Media Capture and Streams" spec. +// See: https://w3c.github.io/mediacapture-main/ + +[Exposed=Window, + Constructor, + Constructor(MediaStream stream), + Constructor(sequence tracks)] +interface MediaStream : EventTarget { + readonly attribute DOMString id; + sequence getAudioTracks(); + sequence getVideoTracks(); + sequence getTracks(); + MediaStreamTrack? getTrackById(DOMString trackId); + void addTrack(MediaStreamTrack track); + void removeTrack(MediaStreamTrack track); + MediaStream clone(); + readonly attribute boolean active; + attribute EventHandler onaddtrack; + attribute EventHandler onremovetrack; +}; +[Exposed=Window] +interface MediaStreamTrack : EventTarget { + readonly attribute DOMString kind; + readonly attribute DOMString id; + readonly attribute DOMString label; + attribute boolean enabled; + readonly attribute boolean muted; + attribute EventHandler onmute; + attribute EventHandler onunmute; + readonly attribute MediaStreamTrackState readyState; + attribute EventHandler onended; + MediaStreamTrack clone(); + void stop(); + MediaTrackCapabilities getCapabilities(); + MediaTrackConstraints getConstraints(); + MediaTrackSettings getSettings(); + Promise applyConstraints(optional MediaTrackConstraints constraints); + attribute EventHandler onoverconstrained; +}; +enum MediaStreamTrackState { + "live", + "ended" +}; +dictionary MediaTrackSupportedConstraints { + boolean width = true; + boolean height = true; + boolean aspectRatio = true; + boolean frameRate = true; + boolean facingMode = true; + boolean resizeMode = true; + boolean volume = true; + boolean sampleRate = true; + boolean sampleSize = true; + boolean echoCancellation = true; + boolean autoGainControl = true; + boolean noiseSuppression = true; + boolean latency = true; + boolean channelCount = true; + boolean deviceId = true; + boolean groupId = true; +}; +dictionary MediaTrackCapabilities { + ULongRange width; + ULongRange height; + DoubleRange aspectRatio; + DoubleRange frameRate; + sequence facingMode; + sequence resizeMode; + DoubleRange volume; + ULongRange sampleRate; + ULongRange sampleSize; + sequence echoCancellation; + sequence autoGainControl; + sequence noiseSuppression; + DoubleRange latency; + ULongRange channelCount; + DOMString deviceId; + DOMString groupId; +}; +dictionary MediaTrackConstraints : MediaTrackConstraintSet { + sequence advanced; +}; +dictionary MediaTrackConstraintSet { + ConstrainULong width; + ConstrainULong height; + ConstrainDouble aspectRatio; + ConstrainDouble frameRate; + ConstrainDOMString facingMode; + ConstrainDOMString resizeMode; + ConstrainDouble volume; + ConstrainULong sampleRate; + ConstrainULong sampleSize; + ConstrainBoolean echoCancellation; + ConstrainBoolean autoGainControl; + ConstrainBoolean noiseSuppression; + ConstrainDouble latency; + ConstrainULong channelCount; + ConstrainDOMString deviceId; + ConstrainDOMString groupId; +}; +dictionary MediaTrackSettings { + long width; + long height; + double aspectRatio; + double frameRate; + DOMString facingMode; + DOMString resizeMode; + double volume; + long sampleRate; + long sampleSize; + boolean echoCancellation; + boolean autoGainControl; + boolean noiseSuppression; + double latency; + long channelCount; + DOMString deviceId; + DOMString groupId; +}; +enum VideoFacingModeEnum { + "user", + "environment", + "left", + "right" +}; +enum VideoResizeModeEnum { + "none", + "crop-and-scale" +}; +[Exposed=Window, + Constructor(DOMString type, MediaStreamTrackEventInit eventInitDict)] +interface MediaStreamTrackEvent : Event { + [SameObject] + readonly attribute MediaStreamTrack track; +}; +dictionary MediaStreamTrackEventInit : EventInit { + required MediaStreamTrack track; +}; +[Exposed=Window, + Constructor(DOMString type, OverconstrainedErrorEventInit eventInitDict)] +interface OverconstrainedErrorEvent : Event { + readonly attribute OverconstrainedError? error; +}; +dictionary OverconstrainedErrorEventInit : EventInit { + OverconstrainedError? error = null; +}; +partial interface Navigator { + [SameObject] + readonly attribute MediaDevices mediaDevices; +}; +[Exposed=Window] +interface MediaDevices : EventTarget { + attribute EventHandler ondevicechange; + Promise> enumerateDevices(); +}; +[Exposed=Window] +interface MediaDeviceInfo { + readonly attribute DOMString deviceId; + readonly attribute MediaDeviceKind kind; + readonly attribute DOMString label; + readonly attribute DOMString groupId; + [Default] object toJSON(); +}; +enum MediaDeviceKind { + "audioinput", + "audiooutput", + "videoinput" +}; +[Exposed=Window] +interface InputDeviceInfo : MediaDeviceInfo { + MediaTrackCapabilities getCapabilities(); +}; +partial interface Navigator { + void getUserMedia(MediaStreamConstraints constraints, + NavigatorUserMediaSuccessCallback successCallback, + NavigatorUserMediaErrorCallback errorCallback); +}; +partial interface MediaDevices { + MediaTrackSupportedConstraints getSupportedConstraints(); + Promise getUserMedia(optional MediaStreamConstraints constraints); +}; +dictionary MediaStreamConstraints { + (boolean or MediaTrackConstraints) video = false; + (boolean or MediaTrackConstraints) audio = false; +}; +callback NavigatorUserMediaSuccessCallback = void (MediaStream stream); +callback NavigatorUserMediaErrorCallback = void (MediaStreamError error); +typedef object MediaStreamError; +[NoInterfaceObject] +interface ConstrainablePattern { + Capabilities getCapabilities(); + Constraints getConstraints(); + Settings getSettings(); + Promise applyConstraints(optional Constraints constraints); + attribute EventHandler onoverconstrained; +}; +dictionary DoubleRange { + double max; + double min; +}; +dictionary ConstrainDoubleRange : DoubleRange { + double exact; + double ideal; +}; +dictionary ULongRange { + [Clamp] + unsigned long max; + [Clamp] + unsigned long min; +}; +dictionary ConstrainULongRange : ULongRange { + [Clamp] + unsigned long exact; + [Clamp] + unsigned long ideal; +}; +dictionary ConstrainBooleanParameters { + boolean exact; + boolean ideal; +}; +dictionary ConstrainDOMStringParameters { + (DOMString or sequence) exact; + (DOMString or sequence) ideal; +}; +typedef ([Clamp] unsigned long or ConstrainULongRange) ConstrainULong; +typedef (double or ConstrainDoubleRange) ConstrainDouble; +typedef (boolean or ConstrainBooleanParameters) ConstrainBoolean; +typedef (DOMString or sequence or ConstrainDOMStringParameters) ConstrainDOMString; +dictionary Capabilities { +}; +dictionary Settings { +}; +dictionary ConstraintSet { +}; +dictionary Constraints : ConstraintSet { + sequence advanced; +}; diff --git a/tests/wpt/web-platform-tests/interfaces/mediasession.idl b/tests/wpt/web-platform-tests/interfaces/mediasession.idl index fded300e430..3c6935ce1db 100644 --- a/tests/wpt/web-platform-tests/interfaces/mediasession.idl +++ b/tests/wpt/web-platform-tests/interfaces/mediasession.idl @@ -1,3 +1,8 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Media Session Standard" spec. +// See: https://wicg.github.io/mediasession/ + [Exposed=Window] partial interface Navigator { [SameObject] readonly attribute MediaSession mediaSession; @@ -23,7 +28,9 @@ callback MediaSessionActionHandler = void(); [Exposed=Window] interface MediaSession { attribute MediaMetadata? metadata; + attribute MediaSessionPlaybackState playbackState; + void setActionHandler(MediaSessionAction action, MediaSessionActionHandler? handler); }; diff --git a/tests/wpt/web-platform-tests/interfaces/mediacapture-record.idl b/tests/wpt/web-platform-tests/interfaces/mediastream-recording.idl similarity index 91% rename from tests/wpt/web-platform-tests/interfaces/mediacapture-record.idl rename to tests/wpt/web-platform-tests/interfaces/mediastream-recording.idl index d1a2f211dd6..9d28ea27782 100644 --- a/tests/wpt/web-platform-tests/interfaces/mediacapture-record.idl +++ b/tests/wpt/web-platform-tests/interfaces/mediastream-recording.idl @@ -1,6 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT -// Content of this file was automatically extracted from the MediaStream Recording spec. -// See https://w3c.github.io/mediacapture-record/ +// Content of this file was automatically extracted from the +// "MediaStream Recording" spec. +// See: https://w3c.github.io/mediacapture-record/ [Exposed=Window, Constructor(MediaStream stream, optional MediaRecorderOptions options)] diff --git a/tests/wpt/web-platform-tests/interfaces/navigation-timing.idl b/tests/wpt/web-platform-tests/interfaces/navigation-timing.idl new file mode 100644 index 00000000000..59f29fbdcf9 --- /dev/null +++ b/tests/wpt/web-platform-tests/interfaces/navigation-timing.idl @@ -0,0 +1,67 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Navigation Timing Level 2" spec. +// See: https://w3c.github.io/navigation-timing/ + +[Exposed=Window] +interface PerformanceNavigationTiming : PerformanceResourceTiming { + readonly attribute DOMHighResTimeStamp unloadEventStart; + readonly attribute DOMHighResTimeStamp unloadEventEnd; + readonly attribute DOMHighResTimeStamp domInteractive; + readonly attribute DOMHighResTimeStamp domContentLoadedEventStart; + readonly attribute DOMHighResTimeStamp domContentLoadedEventEnd; + readonly attribute DOMHighResTimeStamp domComplete; + readonly attribute DOMHighResTimeStamp loadEventStart; + readonly attribute DOMHighResTimeStamp loadEventEnd; + readonly attribute NavigationType type; + readonly attribute unsigned short redirectCount; + [Default] object toJSON(); +}; +enum NavigationType { + "navigate", + "reload", + "back_forward", + "prerender" +}; +[Exposed=Window] +interface PerformanceTiming { + readonly attribute unsigned long long navigationStart; + readonly attribute unsigned long long unloadEventStart; + readonly attribute unsigned long long unloadEventEnd; + readonly attribute unsigned long long redirectStart; + readonly attribute unsigned long long redirectEnd; + readonly attribute unsigned long long fetchStart; + readonly attribute unsigned long long domainLookupStart; + readonly attribute unsigned long long domainLookupEnd; + readonly attribute unsigned long long connectStart; + readonly attribute unsigned long long connectEnd; + readonly attribute unsigned long long secureConnectionStart; + readonly attribute unsigned long long requestStart; + readonly attribute unsigned long long responseStart; + readonly attribute unsigned long long responseEnd; + readonly attribute unsigned long long domLoading; + readonly attribute unsigned long long domInteractive; + readonly attribute unsigned long long domContentLoadedEventStart; + readonly attribute unsigned long long domContentLoadedEventEnd; + readonly attribute unsigned long long domComplete; + readonly attribute unsigned long long loadEventStart; + readonly attribute unsigned long long loadEventEnd; + [Default] object toJSON(); +}; +[Exposed=Window] +interface PerformanceNavigation { + const unsigned short TYPE_NAVIGATE = 0; + const unsigned short TYPE_RELOAD = 1; + const unsigned short TYPE_BACK_FORWARD = 2; + const unsigned short TYPE_RESERVED = 255; + readonly attribute unsigned short type; + readonly attribute unsigned short redirectCount; + [Default] object toJSON(); +}; +[Exposed=Window] +partial interface Performance { + [SameObject] + readonly attribute PerformanceTiming timing; + [SameObject] + readonly attribute PerformanceNavigation navigation; +}; diff --git a/tests/wpt/web-platform-tests/interfaces/netinfo.idl b/tests/wpt/web-platform-tests/interfaces/netinfo.idl new file mode 100644 index 00000000000..75edd350968 --- /dev/null +++ b/tests/wpt/web-platform-tests/interfaces/netinfo.idl @@ -0,0 +1,45 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Network Information API" spec. +// See: https://wicg.github.io/netinfo/ + +enum ConnectionType { + "bluetooth", + "cellular", + "ethernet", + "mixed", + "none", + "other", + "unknown", + "wifi", + "wimax" +}; +enum EffectiveConnectionType { + "2g", + "3g", + "4g", + "slow-2g" +}; +[NoInterfaceObject, + Exposed=(Window,Worker)] +interface NavigatorNetworkInformation { + readonly attribute NetworkInformation connection; +}; + +Navigator implements NavigatorNetworkInformation; + +WorkerNavigator implements NavigatorNetworkInformation; +[Exposed=(Window,Worker)] +interface NetworkInformation : EventTarget { + readonly attribute ConnectionType type; + readonly attribute EffectiveConnectionType effectiveType; + readonly attribute Megabit downlinkMax; + readonly attribute Megabit downlink; + readonly attribute Millisecond rtt; + readonly attribute boolean saveData; + attribute EventHandler onchange; +}; + +typedef unrestricted double Megabit; + +typedef unsigned long long Millisecond; diff --git a/tests/wpt/web-platform-tests/interfaces/orientation-event.idl b/tests/wpt/web-platform-tests/interfaces/orientation-event.idl index aa74fa32350..5f874186ade 100644 --- a/tests/wpt/web-platform-tests/interfaces/orientation-event.idl +++ b/tests/wpt/web-platform-tests/interfaces/orientation-event.idl @@ -22,7 +22,7 @@ partial interface Window { boolean absolute = false; }; - partial interface Window { +partial interface Window { attribute EventHandler ondevicemotion; }; diff --git a/tests/wpt/web-platform-tests/interfaces/orientation-sensor.idl b/tests/wpt/web-platform-tests/interfaces/orientation-sensor.idl index df2ea38e408..cbc3b1ab8b1 100644 --- a/tests/wpt/web-platform-tests/interfaces/orientation-sensor.idl +++ b/tests/wpt/web-platform-tests/interfaces/orientation-sensor.idl @@ -1,3 +1,8 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Orientation Sensor" spec. +// See: https://w3c.github.io/orientation-sensor/ + typedef (Float32Array or Float64Array or DOMMatrix) RotationMatrixType; [SecureContext, Exposed=Window] @@ -8,7 +13,7 @@ interface OrientationSensor : Sensor { enum OrientationSensorLocalCoordinateSystem { "device", "screen" }; -dictionary OrientationSensorOptions : SensorOptions { +dictionary OrientationSensorOptions : SensorOptions { OrientationSensorLocalCoordinateSystem referenceFrame = "device"; }; diff --git a/tests/wpt/web-platform-tests/interfaces/page-visibility.idl b/tests/wpt/web-platform-tests/interfaces/page-visibility.idl new file mode 100644 index 00000000000..6a20eb430aa --- /dev/null +++ b/tests/wpt/web-platform-tests/interfaces/page-visibility.idl @@ -0,0 +1,14 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Page Visibility Level 2" spec. +// See: https://w3c.github.io/page-visibility/ + +enum VisibilityState { + "hidden", "visible", "prerender" +}; + +partial interface Document { + readonly attribute boolean hidden; + readonly attribute VisibilityState visibilityState; + attribute EventHandler onvisibilitychange; +}; diff --git a/tests/wpt/web-platform-tests/interfaces/payment-handler.idl b/tests/wpt/web-platform-tests/interfaces/payment-handler.idl index ec42e215b09..e14a54bb031 100644 --- a/tests/wpt/web-platform-tests/interfaces/payment-handler.idl +++ b/tests/wpt/web-platform-tests/interfaces/payment-handler.idl @@ -1,15 +1,25 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Payment Handler API" spec. +// See: https://w3c.github.io/payment-handler/ + +partial interface ServiceWorkerRegistration { + [SameObject] + readonly attribute PaymentManager paymentManager; +}; [SecureContext, Exposed=(Window,Worker)] interface PaymentManager { [SameObject] readonly attribute PaymentInstruments instruments; [Exposed=Window] static Promise requestPermission(); + attribute DOMString userHint; }; [SecureContext, Exposed=(Window,Worker)] interface PaymentInstruments { Promise delete(DOMString instrumentKey); - Promise get(DOMString instrumentKey); + Promise get(DOMString instrumentKey); Promise> keys(); Promise has(DOMString instrumentKey); Promise set(DOMString instrumentKey, @@ -27,25 +37,31 @@ dictionary ImageObject { DOMString sizes; DOMString type; }; +partial interface ServiceWorkerGlobalScope { + attribute EventHandler oncanmakepayment; +}; [Constructor(DOMString type, CanMakePaymentEventInit eventInitDict), Exposed=ServiceWorker] interface CanMakePaymentEvent : ExtendableEvent { - readonly attribute USVString topLevelOrigin; + readonly attribute USVString topOrigin; readonly attribute USVString paymentRequestOrigin; readonly attribute FrozenArray methodData; readonly attribute FrozenArray modifiers; void respondWith(Promise canMakePaymentResponse); }; dictionary CanMakePaymentEventInit : ExtendableEventInit { - USVString topLevelOrigin; + USVString topOrigin; USVString paymentRequestOrigin; sequence methodData; sequence modifiers; }; +partial interface ServiceWorkerGlobalScope { + attribute EventHandler onpaymentrequest; +}; [Constructor(DOMString type, PaymentRequestEventInit eventInitDict), Exposed=ServiceWorker] interface PaymentRequestEvent : ExtendableEvent { - readonly attribute USVString topLevelOrigin; + readonly attribute USVString topOrigin; readonly attribute USVString paymentRequestOrigin; readonly attribute DOMString paymentRequestId; readonly attribute FrozenArray methodData; @@ -53,10 +69,10 @@ interface PaymentRequestEvent : ExtendableEvent { readonly attribute FrozenArray modifiers; readonly attribute DOMString instrumentKey; Promise openWindow(USVString url); - void respondWith(Promise handlerResponse); + void respondWith(Promise handlerResponsePromise); }; dictionary PaymentRequestEventInit : ExtendableEventInit { - USVString topLevelOrigin; + USVString topOrigin; USVString paymentRequestOrigin; DOMString paymentRequestId; sequence methodData; diff --git a/tests/wpt/web-platform-tests/interfaces/payment-method-basic-card.idl b/tests/wpt/web-platform-tests/interfaces/payment-method-basic-card.idl new file mode 100644 index 00000000000..3ed8b5a35b5 --- /dev/null +++ b/tests/wpt/web-platform-tests/interfaces/payment-method-basic-card.idl @@ -0,0 +1,20 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Payment Method: Basic Card" spec. +// See: https://w3c.github.io/payment-method-basic-card/ + +dictionary BasicCardRequest { + sequence supportedNetworks; + sequence supportedTypes; + }; + +enum BasicCardType { "credit", "debit", "prepaid" }; + +dictionary BasicCardResponse { + required DOMString cardNumber; + DOMString cardholderName; + DOMString cardSecurityCode; + DOMString expiryMonth; + DOMString expiryYear; + PaymentAddress? billingAddress; + }; diff --git a/tests/wpt/web-platform-tests/interfaces/payment-request.idl b/tests/wpt/web-platform-tests/interfaces/payment-request.idl index 94e1cf91f8c..6e42524cf0c 100644 --- a/tests/wpt/web-platform-tests/interfaces/payment-request.idl +++ b/tests/wpt/web-platform-tests/interfaces/payment-request.idl @@ -4,134 +4,191 @@ // See: https://w3c.github.io/payment-request/ [Constructor(sequence methodData, PaymentDetailsInit details, optional PaymentOptions options), - SecureContext, - Exposed=Window] +SecureContext, Exposed=Window] interface PaymentRequest : EventTarget { - Promise show(optional Promise detailsPromise); - Promise abort(); - Promise canMakePayment(); + [NewObject] + Promise show(optional Promise detailsPromise); + [NewObject] + Promise abort(); + [NewObject] + Promise canMakePayment(); - readonly attribute DOMString id; - readonly attribute PaymentAddress? shippingAddress; - readonly attribute DOMString? shippingOption; - readonly attribute PaymentShippingType? shippingType; + readonly attribute DOMString id; + readonly attribute PaymentAddress? shippingAddress; + readonly attribute DOMString? shippingOption; + readonly attribute PaymentShippingType? shippingType; - attribute EventHandler onshippingaddresschange; - - attribute EventHandler onshippingoptionchange; + attribute EventHandler onshippingaddresschange; + attribute EventHandler onshippingoptionchange; + attribute EventHandler onpaymentmethodchange; }; + dictionary PaymentMethodData { - required DOMString supportedMethods; - object data; + required DOMString supportedMethods; + object data; }; + dictionary PaymentCurrencyAmount { - required DOMString currency; - required DOMString value; + required DOMString currency; + required DOMString value; }; + dictionary PaymentDetailsBase { - sequence displayItems; - sequence shippingOptions; - sequence modifiers; + sequence displayItems; + sequence shippingOptions; + sequence modifiers; }; + dictionary PaymentDetailsInit : PaymentDetailsBase { - DOMString id; - required PaymentItem total; + DOMString id; + required PaymentItem total; }; + dictionary PaymentDetailsUpdate : PaymentDetailsBase { - DOMString error; - PaymentItem total; + DOMString error; + PaymentItem total; + AddressErrors shippingAddressErrors; }; + dictionary PaymentDetailsModifier { - required DOMString supportedMethods; - PaymentItem total; - sequence additionalDisplayItems; - object data; + required DOMString supportedMethods; + PaymentItem total; + sequence additionalDisplayItems; + object data; }; + enum PaymentShippingType { - "shipping", - "delivery", - "pickup" + "shipping", + "delivery", + "pickup" }; + dictionary PaymentOptions { - boolean requestPayerName = false; - boolean requestPayerEmail = false; - boolean requestPayerPhone = false; - boolean requestShipping = false; - PaymentShippingType shippingType = "shipping"; + boolean requestPayerName = false; + boolean requestPayerEmail = false; + boolean requestPayerPhone = false; + boolean requestShipping = false; + PaymentShippingType shippingType = "shipping"; }; + dictionary PaymentItem { - required DOMString label; - required PaymentCurrencyAmount amount; - boolean pending = false; - // Note: type member is "at risk" of being removed! - PaymentItemType type; + required DOMString label; + required PaymentCurrencyAmount amount; + boolean pending = false; + // Note: type member is "at risk" of being removed! + PaymentItemType type; }; + enum PaymentItemType { - "tax" + "tax" }; -[SecureContext, - Exposed=(Window)] + +[SecureContext, Exposed=(Window)] interface PaymentAddress { - [Default] object toJSON(); - readonly attribute DOMString city; - readonly attribute DOMString country; - readonly attribute DOMString dependentLocality; - readonly attribute DOMString languageCode; - readonly attribute DOMString organization; - readonly attribute DOMString phone; - readonly attribute DOMString postalCode; - readonly attribute DOMString recipient; - readonly attribute DOMString region; - readonly attribute DOMString regionCode; - readonly attribute DOMString sortingCode; - readonly attribute FrozenArray addressLine; + [Default] object toJSON(); + readonly attribute DOMString city; + readonly attribute DOMString country; + readonly attribute DOMString dependentLocality; + readonly attribute DOMString languageCode; + readonly attribute DOMString organization; + readonly attribute DOMString phone; + readonly attribute DOMString postalCode; + readonly attribute DOMString recipient; + readonly attribute DOMString region; + readonly attribute DOMString regionCode; + readonly attribute DOMString sortingCode; + readonly attribute FrozenArray addressLine; }; + dictionary AddressInit { - DOMString country; - sequence addressLine; - DOMString region; - DOMString regionCode; - DOMString city; - DOMString dependentLocality; - DOMString postalCode; - DOMString sortingCode; - DOMString languageCode; - DOMString organization; - DOMString recipient; - DOMString phone; + DOMString country; + sequence addressLine; + DOMString region; + DOMString regionCode; + DOMString city; + DOMString dependentLocality; + DOMString postalCode; + DOMString sortingCode; + DOMString languageCode; + DOMString organization; + DOMString recipient; + DOMString phone; }; + +dictionary AddressErrors { + DOMString addressLine; + DOMString city; + DOMString country; + DOMString dependentLocality; + DOMString languageCode; + DOMString organization; + DOMString phone; + DOMString postalCode; + DOMString recipient; + DOMString region; + DOMString regionCode; + DOMString sortingCode; +}; + dictionary PaymentShippingOption { - required DOMString id; - required DOMString label; - required PaymentCurrencyAmount amount; - boolean selected = false; + required DOMString id; + required DOMString label; + required PaymentCurrencyAmount amount; + boolean selected = false; }; + enum PaymentComplete { - "fail", - "success", - "unknown" + "fail", + "success", + "unknown" }; -[SecureContext, - Exposed=Window] -interface PaymentResponse { - [Default] object toJSON(); - readonly attribute DOMString requestId; - readonly attribute DOMString methodName; - readonly attribute object details; - readonly attribute PaymentAddress? shippingAddress; - readonly attribute DOMString? shippingOption; - readonly attribute DOMString? payerName; - readonly attribute DOMString? payerEmail; - readonly attribute DOMString? payerPhone; +[SecureContext, Exposed=Window] +interface PaymentResponse : EventTarget { + [Default] object toJSON(); - Promise complete(optional PaymentComplete result = "unknown"); + readonly attribute DOMString requestId; + readonly attribute DOMString methodName; + readonly attribute object details; + readonly attribute PaymentAddress? shippingAddress; + readonly attribute DOMString? shippingOption; + readonly attribute DOMString? payerName; + readonly attribute DOMString? payerEmail; + readonly attribute DOMString? payerPhone; + + [NewObject] + Promise complete(optional PaymentComplete result = "unknown"); + [NewObject] + Promise retry(PaymentValidationErrors errorFields); + + attribute EventHandler onpayerdetailchange; }; -[Constructor(DOMString type, optional PaymentRequestUpdateEventInit eventInitDict), - SecureContext, - Exposed=Window] + +dictionary PaymentValidationErrors { + PayerErrorFields payer; + AddressErrorFields shippingAddress; +}; + +dictionary PayerErrorFields { + DOMString email; + DOMString name; + DOMString phone; +}; + +[Constructor(DOMString type, optional PaymentMethodChangeEventInit eventInitDict), SecureContext, Exposed=Window] +interface PaymentMethodChangeEvent : PaymentRequestUpdateEvent { + readonly attribute DOMString methodName; + readonly attribute object? methodDetails; +}; + +dictionary PaymentMethodChangeEventInit : PaymentRequestUpdateEventInit { + required DOMString methodName; + object? methodDetails; +}; + +[Constructor(DOMString type, optional PaymentRequestUpdateEventInit eventInitDict), SecureContext, Exposed=Window] interface PaymentRequestUpdateEvent : Event { - void updateWith(Promise detailsPromise); -}; -dictionary PaymentRequestUpdateEventInit : EventInit { + void updateWith(Promise detailsPromise); }; + +dictionary PaymentRequestUpdateEventInit : EventInit {}; diff --git a/tests/wpt/web-platform-tests/interfaces/performance-timeline.idl b/tests/wpt/web-platform-tests/interfaces/performance-timeline.idl index 857be8c6dac..0eda1be9603 100644 --- a/tests/wpt/web-platform-tests/interfaces/performance-timeline.idl +++ b/tests/wpt/web-platform-tests/interfaces/performance-timeline.idl @@ -4,37 +4,37 @@ // See: https://w3c.github.io/performance-timeline/ partial interface Performance { - PerformanceEntryList getEntries(); - PerformanceEntryList getEntriesByType(DOMString type); - PerformanceEntryList getEntriesByName(DOMString name, - optional DOMString type); -}; -typedef sequence PerformanceEntryList; + PerformanceEntryList getEntries(); + PerformanceEntryList getEntriesByType(DOMString type); + PerformanceEntryList getEntriesByName(DOMString name, optional DOMString type); +};typedef sequence PerformanceEntryList; + [Exposed=(Window,Worker)] interface PerformanceEntry { - readonly attribute DOMString name; - readonly attribute DOMString entryType; - readonly attribute DOMHighResTimeStamp startTime; - readonly attribute DOMHighResTimeStamp duration; - [Default] object toJSON(); + readonly attribute DOMString name; + readonly attribute DOMString entryType; + readonly attribute DOMHighResTimeStamp startTime; + readonly attribute DOMHighResTimeStamp duration; + [Default] object toJSON(); }; + callback PerformanceObserverCallback = void (PerformanceObserverEntryList entries, PerformanceObserver observer); -[Constructor(PerformanceObserverCallback callback), - Exposed=(Window,Worker)] +[Constructor(PerformanceObserverCallback callback), Exposed=(Window,Worker)] interface PerformanceObserver { - void observe(PerformanceObserverInit options); - void disconnect(); - PerformanceEntryList takeRecords(); + void observe(PerformanceObserverInit options); + void disconnect(); + PerformanceEntryList takeRecords(); }; + dictionary PerformanceObserverInit { - required sequence entryTypes; - boolean buffered = false; + required sequence entryTypes; + boolean buffered = false; }; + [Exposed=(Window,Worker)] interface PerformanceObserverEntryList { - PerformanceEntryList getEntries(); - PerformanceEntryList getEntriesByType(DOMString type); - PerformanceEntryList getEntriesByName(DOMString name, - optional DOMString type); + PerformanceEntryList getEntries(); + PerformanceEntryList getEntriesByType(DOMString type); + PerformanceEntryList getEntriesByName(DOMString name, optional DOMString type); }; diff --git a/tests/wpt/web-platform-tests/interfaces/picture-in-picture.idl b/tests/wpt/web-platform-tests/interfaces/picture-in-picture.idl new file mode 100644 index 00000000000..cafcae11df7 --- /dev/null +++ b/tests/wpt/web-platform-tests/interfaces/picture-in-picture.idl @@ -0,0 +1,30 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Picture-in-Picture" spec. +// See: https://wicg.github.io/picture-in-picture/ + +partial interface HTMLVideoElement { + [NewObject] Promise requestPictureInPicture(); + + attribute EventHandler onenterpictureinpicture; + attribute EventHandler onleavepictureinpicture; + + [CEReactions] attribute boolean disablePictureInPicture; +}; + +partial interface Document { + readonly attribute boolean pictureInPictureEnabled; + + [NewObject] Promise exitPictureInPicture(); +}; + +partial interface DocumentOrShadowRoot { + readonly attribute Element? pictureInPictureElement; +}; + +interface PictureInPictureWindow { + readonly attribute long width; + readonly attribute long height; + + attribute EventHandler onresize; +}; diff --git a/tests/wpt/web-platform-tests/interfaces/pointerevents.idl b/tests/wpt/web-platform-tests/interfaces/pointerevents.idl index 3a36c6aaa1b..ef577f80b34 100644 --- a/tests/wpt/web-platform-tests/interfaces/pointerevents.idl +++ b/tests/wpt/web-platform-tests/interfaces/pointerevents.idl @@ -1,40 +1,40 @@ // GENERATED CONTENT - DO NOT EDIT -// Content of this file was automatically extracted from the Pointer Events spec. -// See https://w3c.github.io/pointerevents/ +// Content of this file was automatically extracted from the +// "Pointer Events" spec. +// See: https://w3c.github.io/pointerevents/ dictionary PointerEventInit : MouseEventInit { - long pointerId = 0; - double width = 1; - double height = 1; - float pressure = 0; - float tangentialPressure = 0; - long tiltX = 0; - long tiltY = 0; - long twist = 0; - DOMString pointerType = ""; - boolean isPrimary = false; + long pointerId = 0; + double width = 1; + double height = 1; + float pressure = 0; + float tangentialPressure = 0; + long tiltX = 0; + long tiltY = 0; + long twist = 0; + DOMString pointerType = ""; + boolean isPrimary = false; }; -[Constructor(DOMString type, optional PointerEventInit eventInitDict), Exposed=Window] +[Constructor(DOMString type, optional PointerEventInit eventInitDict), + Exposed=Window] interface PointerEvent : MouseEvent { - readonly attribute long pointerId; - readonly attribute double width; - readonly attribute double height; - readonly attribute float pressure; - readonly attribute float tangentialPressure; - readonly attribute long tiltX; - readonly attribute long tiltY; - readonly attribute long twist; - readonly attribute DOMString pointerType; - readonly attribute boolean isPrimary; + readonly attribute long pointerId; + readonly attribute double width; + readonly attribute double height; + readonly attribute float pressure; + readonly attribute float tangentialPressure; + readonly attribute long tiltX; + readonly attribute long tiltY; + readonly attribute long twist; + readonly attribute DOMString pointerType; + readonly attribute boolean isPrimary; }; - partial interface Element { - void setPointerCapture (long pointerId); - void releasePointerCapture (long pointerId); - boolean hasPointerCapture (long pointerId); + void setPointerCapture(long pointerId); + void releasePointerCapture(long pointerId); + boolean hasPointerCapture(long pointerId); }; - partial interface GlobalEventHandlers { attribute EventHandler ongotpointercapture; attribute EventHandler onlostpointercapture; @@ -47,7 +47,6 @@ partial interface GlobalEventHandlers { attribute EventHandler onpointerenter; attribute EventHandler onpointerleave; }; - partial interface Navigator { - readonly attribute long maxTouchPoints; + readonly attribute long maxTouchPoints; }; diff --git a/tests/wpt/web-platform-tests/interfaces/pointerlock.idl b/tests/wpt/web-platform-tests/interfaces/pointerlock.idl index e406b53abdf..a4fd9ce1175 100644 --- a/tests/wpt/web-platform-tests/interfaces/pointerlock.idl +++ b/tests/wpt/web-platform-tests/interfaces/pointerlock.idl @@ -1,6 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT -// Content of this file was automatically extracted from the Pointer Lock spec. -// See https://w3c.github.io/pointerlock/ +// Content of this file was automatically extracted from the +// "Pointer Lock 2.0" spec. +// See: https://w3c.github.io/pointerlock/ partial interface Element { void requestPointerLock(); @@ -13,7 +14,7 @@ partial interface Document { }; partial interface DocumentOrShadowRoot { - readonly attribute Element ? pointerLockElement; + readonly attribute Element? pointerLockElement; }; partial interface MouseEvent { diff --git a/tests/wpt/web-platform-tests/interfaces/presentation-api.idl b/tests/wpt/web-platform-tests/interfaces/presentation-api.idl index 3f6e6310023..14bbbdf93b8 100644 --- a/tests/wpt/web-platform-tests/interfaces/presentation-api.idl +++ b/tests/wpt/web-platform-tests/interfaces/presentation-api.idl @@ -4,108 +4,93 @@ // See: https://w3c.github.io/presentation-api/ partial interface Navigator { - [SecureContext, - SameObject] - readonly attribute Presentation presentation; + [SecureContext, SameObject] readonly attribute Presentation presentation; }; -[SecureContext, - Exposed=Window] +[SecureContext, Exposed=Window] interface Presentation { }; + partial interface Presentation { - attribute PresentationRequest? defaultRequest; + attribute PresentationRequest? defaultRequest; }; + partial interface Presentation { - readonly attribute PresentationReceiver? receiver; + readonly attribute PresentationReceiver? receiver; }; + [Constructor(USVString url), Constructor(sequence urls), - SecureContext, - Exposed=Window] + SecureContext, Exposed=Window] interface PresentationRequest : EventTarget { - Promise start(); - Promise reconnect(USVString presentationId); - Promise getAvailability(); + Promise start(); + Promise reconnect(USVString presentationId); + Promise getAvailability(); - attribute EventHandler onconnectionavailable; + attribute EventHandler onconnectionavailable; }; -[SecureContext, - Exposed=Window] + +[SecureContext, Exposed=Window] interface PresentationAvailability : EventTarget { - readonly attribute boolean value; + readonly attribute boolean value; - attribute EventHandler onchange; + attribute EventHandler onchange; }; + [Constructor(DOMString type, PresentationConnectionAvailableEventInit eventInitDict), - SecureContext, - Exposed=Window] + SecureContext, Exposed=Window] interface PresentationConnectionAvailableEvent : Event { - [SameObject] - readonly attribute PresentationConnection connection; + [SameObject] readonly attribute PresentationConnection connection; }; dictionary PresentationConnectionAvailableEventInit : EventInit { - required PresentationConnection connection; -}; -enum PresentationConnectionState { - "connecting", - "connected", - "closed", - "terminated" + required PresentationConnection connection; }; -enum BinaryType { - "blob", - "arraybuffer" -}; +enum PresentationConnectionState { "connecting", "connected", "closed", "terminated" }; +enum BinaryType { "blob", "arraybuffer" }; -[SecureContext, - Exposed=Window] +[SecureContext, Exposed=Window] interface PresentationConnection : EventTarget { - readonly attribute USVString id; - readonly attribute USVString url; - readonly attribute PresentationConnectionState state; - void close(); - void terminate(); - attribute EventHandler onconnect; - attribute EventHandler onclose; - attribute EventHandler onterminate; + readonly attribute USVString id; + readonly attribute USVString url; + readonly attribute PresentationConnectionState state; + void close(); + void terminate(); + attribute EventHandler onconnect; + attribute EventHandler onclose; + attribute EventHandler onterminate; - // Communication - attribute BinaryType binaryType; - attribute EventHandler onmessage; - void send(DOMString message); - void send(Blob data); - void send(ArrayBuffer data); - void send(ArrayBufferView data); -}; -enum PresentationConnectionCloseReason { - "error", - "closed", - "wentaway" + // Communication + attribute BinaryType binaryType; + attribute EventHandler onmessage; + void send(DOMString message); + void send(Blob data); + void send(ArrayBuffer data); + void send(ArrayBufferView data); }; +enum PresentationConnectionCloseReason { "error", "closed", "wentaway" }; + [Constructor(DOMString type, PresentationConnectionCloseEventInit eventInitDict), - SecureContext, - Exposed=Window] + SecureContext, Exposed=Window] interface PresentationConnectionCloseEvent : Event { - readonly attribute PresentationConnectionCloseReason reason; - readonly attribute DOMString message; + readonly attribute PresentationConnectionCloseReason reason; + readonly attribute DOMString message; }; dictionary PresentationConnectionCloseEventInit : EventInit { - required PresentationConnectionCloseReason reason; - DOMString message = ""; + required PresentationConnectionCloseReason reason; + DOMString message = ""; }; -[SecureContext, - Exposed=Window] + +[SecureContext, Exposed=Window] interface PresentationReceiver { - readonly attribute Promise connectionList; + readonly attribute Promise connectionList; }; -[SecureContext, - Exposed=Window] + +[SecureContext, Exposed=Window] interface PresentationConnectionList : EventTarget { - readonly attribute FrozenArray connections; - attribute EventHandler onconnectionavailable; + readonly attribute FrozenArray connections; + attribute EventHandler onconnectionavailable; }; diff --git a/tests/wpt/web-platform-tests/interfaces/remote-playback.idl b/tests/wpt/web-platform-tests/interfaces/remote-playback.idl index b1aa93d3f3c..8cea3f417bf 100644 --- a/tests/wpt/web-platform-tests/interfaces/remote-playback.idl +++ b/tests/wpt/web-platform-tests/interfaces/remote-playback.idl @@ -1,6 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT -// Content of this file was automatically extracted from the Remote Playback API spec. -// See https://w3c.github.io/remote-playback/ +// Content of this file was automatically extracted from the +// "Remote Playback API" spec. +// See: https://w3c.github.io/remote-playback/ [Exposed=Window] interface RemotePlayback : EventTarget { @@ -22,7 +23,7 @@ enum RemotePlaybackState { "disconnected" }; -callback RemotePlaybackAvailabilityCallback = void(boolean available); +callback RemotePlaybackAvailabilityCallback = void (boolean available); partial interface HTMLMediaElement { [SameObject] readonly attribute RemotePlayback remote; diff --git a/tests/wpt/web-platform-tests/interfaces/requestidlecallback.idl b/tests/wpt/web-platform-tests/interfaces/requestidlecallback.idl new file mode 100644 index 00000000000..195f3767d5f --- /dev/null +++ b/tests/wpt/web-platform-tests/interfaces/requestidlecallback.idl @@ -0,0 +1,22 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Cooperative Scheduling of Background Tasks" spec. +// See: https://w3c.github.io/requestidlecallback/ + +partial interface Window { + unsigned long requestIdleCallback(IdleRequestCallback callback, + optional IdleRequestOptions options); + void cancelIdleCallback(unsigned long handle); +}; + +dictionary IdleRequestOptions { + unsigned long timeout; +}; + +[Exposed=Window] +interface IdleDeadline { + DOMHighResTimeStamp timeRemaining(); + readonly attribute boolean didTimeout; +}; + +callback IdleRequestCallback = void (IdleDeadline deadline); diff --git a/tests/wpt/web-platform-tests/interfaces/screen-orientation.idl b/tests/wpt/web-platform-tests/interfaces/screen-orientation.idl index faa1c93b70b..74202484561 100644 --- a/tests/wpt/web-platform-tests/interfaces/screen-orientation.idl +++ b/tests/wpt/web-platform-tests/interfaces/screen-orientation.idl @@ -1,6 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT -// Content of this file was automatically extracted from the Screen Orientation API spec. -// See https://w3c.github.io/screen-orientation/ +// Content of this file was automatically extracted from the +// "The Screen Orientation API" spec. +// See: https://w3c.github.io/screen-orientation/ partial interface Screen { [SameObject] readonly attribute ScreenOrientation orientation; diff --git a/tests/wpt/web-platform-tests/interfaces/selection-api.idl b/tests/wpt/web-platform-tests/interfaces/selection-api.idl index a06226bd4b8..b2d2f86885a 100644 --- a/tests/wpt/web-platform-tests/interfaces/selection-api.idl +++ b/tests/wpt/web-platform-tests/interfaces/selection-api.idl @@ -1,42 +1,45 @@ // GENERATED CONTENT - DO NOT EDIT -// Content of this file was automatically extracted from the Selection API spec. -// See https://w3c.github.io/selection-api/ +// Content of this file was automatically extracted from the +// "Selection API" spec. +// See: https://w3c.github.io/selection-api/ interface Selection { - readonly attribute Node? anchorNode; - readonly attribute unsigned long anchorOffset; - readonly attribute Node? focusNode; - readonly attribute unsigned long focusOffset; - readonly attribute boolean isCollapsed; - readonly attribute unsigned long rangeCount; - readonly attribute DOMString type; - Range getRangeAt(unsigned long index); - void addRange(Range range); - void removeRange(Range range); - void removeAllRanges(); - void empty(); - void collapse(Node? node, optional unsigned long offset = 0); - void setPosition(Node? node, optional unsigned long offset = 0); - void collapseToStart(); - void collapseToEnd(); - void extend(Node node, optional unsigned long offset = 0); - void setBaseAndExtent(Node anchorNode, unsigned long anchorOffset, Node focusNode, unsigned long focusOffset); - void selectAllChildren(Node node); - [CEReactions] - void deleteFromDocument(); - boolean containsNode(Node node, optional boolean allowPartialContainment = false); - stringifier DOMString (); + readonly attribute Node? anchorNode; + readonly attribute unsigned long anchorOffset; + readonly attribute Node? focusNode; + readonly attribute unsigned long focusOffset; + readonly attribute boolean isCollapsed; + readonly attribute unsigned long rangeCount; + readonly attribute DOMString type; + Range getRangeAt(unsigned long index); + void addRange(Range range); + void removeRange(Range range); + void removeAllRanges(); + void empty(); + void collapse(Node? node, + optional unsigned long offset = 0); + void setPosition(Node? node, + optional unsigned long offset = 0); + void collapseToStart(); + void collapseToEnd(); + void extend(Node node, optional unsigned long offset = 0); + void setBaseAndExtent(Node anchorNode, + unsigned long anchorOffset, + Node focusNode, + unsigned long focusOffset); + void selectAllChildren(Node node); + [CEReactions] void deleteFromDocument(); + boolean containsNode(Node node, + optional boolean allowPartialContainment = false); + stringifier DOMString (); }; - partial interface Document { - Selection ? getSelection(); + Selection? getSelection(); }; - partial interface Window { - Selection? getSelection(); + Selection? getSelection(); }; - partial interface GlobalEventHandlers { - attribute EventHandler onselectstart; - attribute EventHandler onselectionchange; + attribute EventHandler onselectstart; + attribute EventHandler onselectionchange; }; diff --git a/tests/wpt/web-platform-tests/interfaces/server-timing.idl b/tests/wpt/web-platform-tests/interfaces/server-timing.idl index 1fbc426bcbe..8f5cf616760 100644 --- a/tests/wpt/web-platform-tests/interfaces/server-timing.idl +++ b/tests/wpt/web-platform-tests/interfaces/server-timing.idl @@ -5,12 +5,13 @@ [Exposed=(Window,Worker)] interface PerformanceServerTiming { - readonly attribute DOMString name; - readonly attribute DOMHighResTimeStamp duration; - readonly attribute DOMString description; - [Default] object toJSON(); + readonly attribute DOMString name; + readonly attribute DOMHighResTimeStamp duration; + readonly attribute DOMString description; + [Default] object toJSON(); }; + [Exposed=(Window,Worker)] partial interface PerformanceResourceTiming { - readonly attribute FrozenArray serverTiming; + readonly attribute FrozenArray serverTiming; }; diff --git a/tests/wpt/web-platform-tests/interfaces/ServiceWorker.idl b/tests/wpt/web-platform-tests/interfaces/service-workers.idl similarity index 88% rename from tests/wpt/web-platform-tests/interfaces/ServiceWorker.idl rename to tests/wpt/web-platform-tests/interfaces/service-workers.idl index e9899cc0412..edf2985bdf4 100644 --- a/tests/wpt/web-platform-tests/interfaces/ServiceWorker.idl +++ b/tests/wpt/web-platform-tests/interfaces/service-workers.idl @@ -1,6 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT -// Content of this file was automatically extracted from the Service Workers spec. -// See https://w3c.github.io/ServiceWorker/ +// Content of this file was automatically extracted from the +// "Service Workers 1" spec. +// See: https://w3c.github.io/ServiceWorker/v1/ [SecureContext, Exposed=(Window,Worker)] interface ServiceWorker : EventTarget { @@ -11,7 +12,7 @@ interface ServiceWorker : EventTarget { // event attribute EventHandler onstatechange; }; -ServiceWorker includes AbstractWorker; +ServiceWorker implements AbstractWorker; enum ServiceWorkerState { "installing", @@ -26,7 +27,6 @@ interface ServiceWorkerRegistration : EventTarget { readonly attribute ServiceWorker? installing; readonly attribute ServiceWorker? waiting; readonly attribute ServiceWorker? active; - [SameObject] readonly attribute NavigationPreloadManager navigationPreload; readonly attribute USVString scope; readonly attribute ServiceWorkerUpdateViaCache updateViaCache; @@ -76,19 +76,6 @@ dictionary RegistrationOptions { ServiceWorkerUpdateViaCache updateViaCache = "imports"; }; -[SecureContext, Exposed=(Window,Worker)] -interface NavigationPreloadManager { - Promise enable(); - Promise disable(); - Promise setHeaderValue(ByteString value); - Promise getState(); -}; - -dictionary NavigationPreloadState { - boolean enabled = false; - ByteString headerValue; -}; - [Global=(Worker,ServiceWorker), Exposed=ServiceWorker] interface ServiceWorkerGlobalScope : WorkerGlobalScope { [SameObject] readonly attribute Clients clients; @@ -155,20 +142,14 @@ dictionary ExtendableEventInit : EventInit { [Constructor(DOMString type, FetchEventInit eventInitDict), Exposed=ServiceWorker] interface FetchEvent : ExtendableEvent { [SameObject] readonly attribute Request request; - readonly attribute Promise preloadResponse; readonly attribute DOMString clientId; - readonly attribute DOMString resultingClientId; - readonly attribute DOMString targetClientId; void respondWith(Promise r); }; dictionary FetchEventInit : ExtendableEventInit { required Request request; - required Promise preloadResponse; DOMString clientId = ""; - DOMString resultingClientId = ""; - DOMString targetClientId = ""; }; [Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict), Exposed=ServiceWorker] diff --git a/tests/wpt/web-platform-tests/interfaces/vibration.idl b/tests/wpt/web-platform-tests/interfaces/vibration.idl index 58b34bb5847..758ffda276d 100644 --- a/tests/wpt/web-platform-tests/interfaces/vibration.idl +++ b/tests/wpt/web-platform-tests/interfaces/vibration.idl @@ -1,9 +1,10 @@ // GENERATED CONTENT - DO NOT EDIT -// Content of this file was automatically extracted from the Vibration API spec. -// See https://w3c.github.io/vibration/ +// Content of this file was automatically extracted from the +// "Vibration API (Second Edition)" spec. +// See: https://w3c.github.io/vibration/ typedef (unsigned long or sequence) VibratePattern; partial interface Navigator { - boolean vibrate (VibratePattern pattern); + boolean vibrate(VibratePattern pattern); }; diff --git a/tests/wpt/web-platform-tests/interfaces/wake-lock.idl b/tests/wpt/web-platform-tests/interfaces/wake-lock.idl index 4e2b257d24e..384468ab3e5 100644 --- a/tests/wpt/web-platform-tests/interfaces/wake-lock.idl +++ b/tests/wpt/web-platform-tests/interfaces/wake-lock.idl @@ -1,23 +1,21 @@ -enum WakeLockType { - "screen", - "system" -}; +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Wake Lock API" spec. +// See: https://w3c.github.io/wake-lock/ + +enum WakeLockType { "screen", "system" }; partial interface Navigator { - [SecureContext] Promise getWakeLock(WakeLockType type); + [SecureContext] Promise getWakeLock(WakeLockType type); }; -[SecureContext, - Exposed=Window] -interface WakeLock : EventTarget { - readonly attribute WakeLockType type; - readonly attribute boolean active; - attribute EventHandler onactivechange; - WakeLockRequest createRequest(); +[SecureContext, Exposed=Window] interface WakeLock : EventTarget { + readonly attribute WakeLockType type; + readonly attribute boolean active; + attribute EventHandler onactivechange; + WakeLockRequest createRequest(); }; -[SecureContext, - Exposed=Window] -interface WakeLockRequest { - void cancel(); +[SecureContext, Exposed=Window] interface WakeLockRequest { + void cancel(); }; diff --git a/tests/wpt/web-platform-tests/interfaces/wasm-js-api.idl b/tests/wpt/web-platform-tests/interfaces/wasm-js-api.idl new file mode 100644 index 00000000000..646fcf00af3 --- /dev/null +++ b/tests/wpt/web-platform-tests/interfaces/wasm-js-api.idl @@ -0,0 +1,103 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "WebAssembly JavaScript Interface" spec. +// See: https://webassembly.github.io/spec/js-api/ + +dictionary WebAssemblyInstantiatedSource { + required Module module; + required Instance instance; +}; + +[Exposed=(Window,Worker,Worklet)] +namespace WebAssembly { + boolean validate(BufferSource bytes); + Promise compile(BufferSource bytes); + + Promise instantiate( + BufferSource bytes, optional object importObject); + + Promise instantiate( + Module moduleObject, optional object importObject); +}; + +enum ImportExportKind { + "function", + "table", + "memory", + "global" +}; + +dictionary ModuleExportDescriptor { + required USVString name; + required ImportExportKind kind; + // Note: Other fields such as signature may be added in the future. +}; + +dictionary ModuleImportDescriptor { + required USVString module; + required USVString name; + required ImportExportKind kind; +}; + +[LegacyNamespace=WebAssembly, Constructor(BufferSource bytes), Exposed=(Window,Worker,Worklet)] +interface Module { + static sequence exports(Module module); + static sequence imports(Module module); + static sequence customSections(Module module, USVString sectionName); +}; + +[LegacyNamespace=WebAssembly, Constructor(Module module, optional object importObject), Exposed=(Window,Worker,Worklet)] +interface Instance { + readonly attribute object exports; +}; + +dictionary MemoryDescriptor { + required [EnforceRange] unsigned long initial; + [EnforceRange] unsigned long maximum; +}; + +[LegacyNamespace=WebAssembly, Constructor(MemoryDescriptor descriptor), Exposed=(Window,Worker,Worklet)] +interface Memory { + unsigned long grow([EnforceRange] unsigned long delta); + readonly attribute ArrayBuffer buffer; +}; + +enum TableKind { + "anyfunc", + // Note: More values may be added in future iterations, + // e.g., typed function references, typed GC references +}; + +dictionary TableDescriptor { + required TableKind element; + required [EnforceRange] unsigned long initial; + [EnforceRange] unsigned long maximum; +}; + +[LegacyNamespace=WebAssembly, Constructor(TableDescriptor descriptor), Exposed=(Window,Worker,Worklet)] +interface Table { + unsigned long grow([EnforceRange] unsigned long delta); + Function? get([EnforceRange] unsigned long index); + void set([EnforceRange] unsigned long index, Function? value); + readonly attribute unsigned long length; +}; + +dictionary GlobalDescriptor { + required USVString value; + boolean mutable = false; +}; + +[LegacyNamespace=WebAssembly, Constructor(GlobalDescriptor descriptor, optional any value), Exposed=(Window,Worker,Worklet)] +interface Global { + any valueOf(); + attribute any value; +}; + +[LegacyNamespace=WebAssembly] +interface CompileError { }; + +[LegacyNamespace=WebAssembly] +interface LinkError { }; + +[LegacyNamespace=WebAssembly] +interface RuntimeError { }; diff --git a/tests/wpt/web-platform-tests/interfaces/web-bluetooth.idl b/tests/wpt/web-platform-tests/interfaces/web-bluetooth.idl index 7046fec40f1..f8f039e63ef 100644 --- a/tests/wpt/web-platform-tests/interfaces/web-bluetooth.idl +++ b/tests/wpt/web-platform-tests/interfaces/web-bluetooth.idl @@ -23,14 +23,12 @@ dictionary RequestDeviceOptions { boolean acceptAllDevices = false; }; +[SecureContext] interface Bluetooth : EventTarget { - [SecureContext] Promise getAvailability(); - [SecureContext] attribute EventHandler onavailabilitychanged; - [SecureContext, SameObject] + [SameObject] readonly attribute BluetoothDevice? referringDevice; - [SecureContext] Promise requestDevice(optional RequestDeviceOptions options); }; Bluetooth implements BluetoothDeviceEventHandlers; @@ -59,7 +57,10 @@ interface BluetoothPermissionResult : PermissionStatus { attribute FrozenArray devices; }; -[Constructor(DOMString type, optional ValueEventInit initDict)] +[ + Constructor(DOMString type, optional ValueEventInit initDict), + SecureContext +] interface ValueEvent : Event { readonly attribute any value; }; @@ -68,6 +69,7 @@ dictionary ValueEventInit : EventInit { any value = null; }; +[SecureContext] interface BluetoothDevice { readonly attribute DOMString id; readonly attribute DOMString? name; @@ -82,13 +84,18 @@ BluetoothDevice implements BluetoothDeviceEventHandlers; BluetoothDevice implements CharacteristicEventHandlers; BluetoothDevice implements ServiceEventHandlers; +[SecureContext] interface BluetoothManufacturerDataMap { readonly maplike; }; +[SecureContext] interface BluetoothServiceDataMap { readonly maplike; }; -[Constructor(DOMString type, BluetoothAdvertisingEventInit init)] +[ + Constructor(DOMString type, BluetoothAdvertisingEventInit init), + SecureContext +] interface BluetoothAdvertisingEvent : Event { [SameObject] readonly attribute BluetoothDevice device; @@ -113,6 +120,7 @@ dictionary BluetoothAdvertisingEventInit : EventInit { Map serviceData; }; +[SecureContext] interface BluetoothRemoteGATTServer { [SameObject] readonly attribute BluetoothDevice device; @@ -124,6 +132,7 @@ interface BluetoothRemoteGATTServer { getPrimaryServices(optional BluetoothServiceUUID service); }; +[SecureContext] interface BluetoothRemoteGATTService { [SameObject] readonly attribute BluetoothDevice device; @@ -142,6 +151,7 @@ BluetoothRemoteGATTService implements EventTarget; BluetoothRemoteGATTService implements CharacteristicEventHandlers; BluetoothRemoteGATTService implements ServiceEventHandlers; +[SecureContext] interface BluetoothRemoteGATTCharacteristic { [SameObject] readonly attribute BluetoothRemoteGATTService service; @@ -159,6 +169,7 @@ interface BluetoothRemoteGATTCharacteristic { BluetoothRemoteGATTCharacteristic implements EventTarget; BluetoothRemoteGATTCharacteristic implements CharacteristicEventHandlers; +[SecureContext] interface BluetoothCharacteristicProperties { readonly attribute boolean broadcast; readonly attribute boolean read; @@ -171,6 +182,7 @@ interface BluetoothCharacteristicProperties { readonly attribute boolean writableAuxiliaries; }; +[SecureContext] interface BluetoothRemoteGATTDescriptor { [SameObject] readonly attribute BluetoothRemoteGATTCharacteristic characteristic; @@ -180,17 +192,17 @@ interface BluetoothRemoteGATTDescriptor { Promise writeValue(BufferSource value); }; -[NoInterfaceObject] +[NoInterfaceObject, SecureContext] interface CharacteristicEventHandlers { attribute EventHandler oncharacteristicvaluechanged; }; -[NoInterfaceObject] +[NoInterfaceObject, SecureContext] interface BluetoothDeviceEventHandlers { attribute EventHandler ongattserverdisconnected; }; -[NoInterfaceObject] +[NoInterfaceObject, SecureContext] interface ServiceEventHandlers { attribute EventHandler onserviceadded; attribute EventHandler onservicechanged; @@ -210,6 +222,7 @@ typedef (DOMString or unsigned long) BluetoothServiceUUID; typedef (DOMString or unsigned long) BluetoothCharacteristicUUID; typedef (DOMString or unsigned long) BluetoothDescriptorUUID; +[SecureContext] partial interface Navigator { [SameObject] readonly attribute Bluetooth bluetooth; diff --git a/tests/wpt/web-platform-tests/interfaces/web-nfc.idl b/tests/wpt/web-platform-tests/interfaces/web-nfc.idl index 30f57ca6233..fca52e882ba 100644 --- a/tests/wpt/web-platform-tests/interfaces/web-nfc.idl +++ b/tests/wpt/web-platform-tests/interfaces/web-nfc.idl @@ -1,63 +1,65 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Web NFC API" spec. +// See: https://w3c.github.io/web-nfc/ + dictionary NFCMessage { - sequence records; - USVString url; + sequence records; + USVString url; }; typedef (DOMString or unrestricted double or ArrayBuffer or Dictionary) NFCRecordData; dictionary NFCRecord { - NFCRecordType recordType; - USVString mediaType; - NFCRecordData data; + NFCRecordType recordType; + USVString mediaType; + NFCRecordData data; }; enum NFCRecordType { - "empty", - "text", - "url", - "json", - "opaque" + "empty", + "text", + "url", + "json", + "opaque" }; partial interface Navigator { - [SecureContext, - SameObject] - readonly attribute NFC nfc; + [SecureContext, SameObject] readonly attribute NFC nfc; }; typedef (DOMString or ArrayBuffer or NFCMessage) NFCPushMessage; [SecureContext] interface NFC { - Promise push(NFCPushMessage message, optional NFCPushOptions options); - Promise cancelPush(optional NFCPushTarget target = "any"); - Promise watch(MessageCallback callback, - optional NFCWatchOptions options); - Promise cancelWatch(optional long id); + Promise push(NFCPushMessage message, optional NFCPushOptions options); + Promise cancelPush(optional NFCPushTarget target = "any"); + Promise watch(MessageCallback callback, optional NFCWatchOptions options); + Promise cancelWatch(optional long id); }; callback MessageCallback = void (NFCMessage message); dictionary NFCPushOptions { - NFCPushTarget target = "any"; - unrestricted double timeout = Infinity; - boolean ignoreRead = true; + NFCPushTarget target = "any"; + unrestricted double timeout = Infinity; + boolean ignoreRead = true; }; enum NFCPushTarget { - "tag", - "peer", - "any" + "tag", + "peer", + "any" }; dictionary NFCWatchOptions { - USVString url = ""; - NFCRecordType? recordType; - USVString mediaType = ""; - NFCWatchMode mode = "web-nfc-only"; + USVString url = ""; + NFCRecordType? recordType; + USVString mediaType = ""; + NFCWatchMode mode = "web-nfc-only"; }; enum NFCWatchMode { - "web-nfc-only", - "any" + "web-nfc-only", + "any" }; diff --git a/tests/wpt/web-platform-tests/interfaces/web-share.idl b/tests/wpt/web-platform-tests/interfaces/web-share.idl index 7403af3e2f7..176cc57f78d 100644 --- a/tests/wpt/web-platform-tests/interfaces/web-share.idl +++ b/tests/wpt/web-platform-tests/interfaces/web-share.idl @@ -1,6 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT -// Content of this file was automatically extracted from the Web Share API spec. -// See https://wicg.github.io/web-share/ +// Content of this file was automatically extracted from the +// "Web Share API" spec. +// See: https://wicg.github.io/web-share/ partial interface Navigator { [SecureContext] Promise share(optional ShareData data); diff --git a/tests/wpt/web-platform-tests/interfaces/webauthn.idl b/tests/wpt/web-platform-tests/interfaces/webauthn.idl index 2d2ef507feb..1347986199e 100644 --- a/tests/wpt/web-platform-tests/interfaces/webauthn.idl +++ b/tests/wpt/web-platform-tests/interfaces/webauthn.idl @@ -1,6 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT -// Content of this file was automatically extracted from the Web Authentication spec. -// See https://w3c.github.io/webauthn/ +// Content of this file was automatically extracted from the +// "Web Authentication: An API for accessing Public Key Credentials - Level 1" spec. +// See: https://w3c.github.io/webauthn/ [SecureContext, Exposed=Window] interface PublicKeyCredential : Credential { @@ -18,7 +19,7 @@ partial dictionary CredentialRequestOptions { }; partial interface PublicKeyCredential { - static Promise < boolean > isUserVerifyingPlatformAuthenticatorAvailable(); + static Promise isUserVerifyingPlatformAuthenticatorAvailable(); }; [SecureContext, Exposed=Window] @@ -78,8 +79,8 @@ dictionary AuthenticatorSelectionCriteria { }; enum AuthenticatorAttachment { - "platform", // Platform attachment - "cross-platform" // Cross-platform attachment + "platform", + "cross-platform" }; enum AttestationConveyancePreference { @@ -117,7 +118,7 @@ dictionary TokenBinding { DOMString id; }; -enum TokenBindingStatus { "present", "supported", "not-supported" }; +enum TokenBindingStatus { "present", "supported" }; enum PublicKeyCredentialType { "public-key" @@ -132,7 +133,8 @@ dictionary PublicKeyCredentialDescriptor { enum AuthenticatorTransport { "usb", "nfc", - "ble" + "ble", + "internal" }; typedef long COSEAlgorithmIdentifier; diff --git a/tests/wpt/web-platform-tests/interfaces/webdriver.idl b/tests/wpt/web-platform-tests/interfaces/webdriver.idl index 14087d8b8e5..10343d9194c 100644 --- a/tests/wpt/web-platform-tests/interfaces/webdriver.idl +++ b/tests/wpt/web-platform-tests/interfaces/webdriver.idl @@ -1,9 +1,10 @@ // GENERATED CONTENT - DO NOT EDIT // Content of this file was automatically extracted from the // "WebDriver" spec. -// See: https://w3c.github.io/webdriver/webdriver-spec.html +// See: https://w3c.github.io/webdriver/ Navigator includes NavigatorAutomationInformation; + interface mixin NavigatorAutomationInformation { - readonly attribute boolean webdriver; + readonly attribute boolean webdriver; }; diff --git a/tests/wpt/web-platform-tests/interfaces/webusb.idl b/tests/wpt/web-platform-tests/interfaces/webusb.idl index f40bbb93059..edbbf03f07f 100644 --- a/tests/wpt/web-platform-tests/interfaces/webusb.idl +++ b/tests/wpt/web-platform-tests/interfaces/webusb.idl @@ -40,13 +40,14 @@ dictionary USBConnectionEventInit : EventInit { [ Constructor(DOMString type, USBConnectionEventInit eventInitDict), - Exposed=(DedicatedWorker,SharedWorker,Window) + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext ] interface USBConnectionEvent : Event { [SameObject] readonly attribute USBDevice device; }; -[Exposed=(DedicatedWorker,SharedWorker,Window)] +[Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext] interface USBDevice { readonly attribute octet usbVersionMajor; readonly attribute octet usbVersionMinor; @@ -110,7 +111,8 @@ dictionary USBControlTransferParameters { [ Constructor(USBTransferStatus status, optional DataView? data), - Exposed=(DedicatedWorker,SharedWorker,Window) + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext ] interface USBInTransferResult { readonly attribute DataView? data; @@ -119,7 +121,8 @@ interface USBInTransferResult { [ Constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0), - Exposed=(DedicatedWorker,SharedWorker,Window) + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext ] interface USBOutTransferResult { readonly attribute unsigned long bytesWritten; @@ -128,7 +131,8 @@ interface USBOutTransferResult { [ Constructor(USBTransferStatus status, optional DataView? data), - Exposed=(DedicatedWorker,SharedWorker,Window) + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext ] interface USBIsochronousInTransferPacket { readonly attribute DataView? data; @@ -137,7 +141,8 @@ interface USBIsochronousInTransferPacket { [ Constructor(sequence packets, optional DataView? data), - Exposed=(DedicatedWorker,SharedWorker,Window) + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext ] interface USBIsochronousInTransferResult { readonly attribute DataView? data; @@ -146,7 +151,8 @@ interface USBIsochronousInTransferResult { [ Constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0), - Exposed=(DedicatedWorker,SharedWorker,Window) + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext ] interface USBIsochronousOutTransferPacket { readonly attribute unsigned long bytesWritten; @@ -155,7 +161,8 @@ interface USBIsochronousOutTransferPacket { [ Constructor(sequence packets), - Exposed=(DedicatedWorker,SharedWorker,Window) + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext ] interface USBIsochronousOutTransferResult { readonly attribute FrozenArray packets; @@ -163,7 +170,8 @@ interface USBIsochronousOutTransferResult { [ Constructor(USBDevice device, octet configurationValue), - Exposed=(DedicatedWorker,SharedWorker,Window) + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext ] interface USBConfiguration { readonly attribute octet configurationValue; @@ -173,7 +181,8 @@ interface USBConfiguration { [ Constructor(USBConfiguration configuration, octet interfaceNumber), - Exposed=(DedicatedWorker,SharedWorker,Window) + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext ] interface USBInterface { readonly attribute octet interfaceNumber; @@ -184,7 +193,8 @@ interface USBInterface { [ Constructor(USBInterface deviceInterface, octet alternateSetting), - Exposed=(DedicatedWorker,SharedWorker,Window) + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext ] interface USBAlternateInterface { readonly attribute octet alternateSetting; @@ -208,7 +218,8 @@ enum USBEndpointType { [ Constructor(USBAlternateInterface alternate, octet endpointNumber, USBDirection direction), - Exposed=(DedicatedWorker,SharedWorker,Window) + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext ] interface USBEndpoint { readonly attribute octet endpointNumber; diff --git a/tests/wpt/web-platform-tests/interfaces/webxr.idl b/tests/wpt/web-platform-tests/interfaces/webxr.idl index 73b55b3149e..ca6d3fc7843 100644 --- a/tests/wpt/web-platform-tests/interfaces/webxr.idl +++ b/tests/wpt/web-platform-tests/interfaces/webxr.idl @@ -11,21 +11,21 @@ partial interface Navigator { [SameObject] readonly attribute XR xr; }; -[SecureContext, Exposed=Window] interface XRDevice : EventTarget { +[SecureContext, Exposed=Window] interface XRDevice { // Methods Promise supportsSession(optional XRSessionCreationOptions options); Promise requestSession(optional XRSessionCreationOptions options); }; dictionary XRSessionCreationOptions { - boolean exclusive = false; + boolean immersive = false; XRPresentationContext outputContext; }; [SecureContext, Exposed=Window] interface XRSession : EventTarget { // Attributes readonly attribute XRDevice device; - readonly attribute boolean exclusive; + readonly attribute boolean immersive; readonly attribute XRPresentationContext outputContext; attribute double depthNear; diff --git a/tests/wpt/web-platform-tests/interfaces/worklets.idl b/tests/wpt/web-platform-tests/interfaces/worklets.idl new file mode 100644 index 00000000000..1c93fe53e31 --- /dev/null +++ b/tests/wpt/web-platform-tests/interfaces/worklets.idl @@ -0,0 +1,16 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Worklets Level 1" spec. +// See: https://drafts.css-houdini.org/worklets/ + +[Exposed=Worklet] +interface WorkletGlobalScope { +}; + +interface Worklet { + [NewObject] Promise addModule(USVString moduleURL, optional WorkletOptions options); +}; + +dictionary WorkletOptions { + RequestCredentials credentials = "same-origin"; +}; diff --git a/tests/wpt/web-platform-tests/intersection-observer/META.yml b/tests/wpt/web-platform-tests/intersection-observer/META.yml index c73a32d2b7a..31dddab561e 100644 --- a/tests/wpt/web-platform-tests/intersection-observer/META.yml +++ b/tests/wpt/web-platform-tests/intersection-observer/META.yml @@ -1,3 +1,3 @@ +spec: https://w3c.github.io/IntersectionObserver/ suggested_reviewers: - - scottlow - szager-chromium diff --git a/tests/wpt/web-platform-tests/intersection-observer/client-rect.html b/tests/wpt/web-platform-tests/intersection-observer/client-rect.html index 913e0d9f12c..6c50fdb14ac 100644 --- a/tests/wpt/web-platform-tests/intersection-observer/client-rect.html +++ b/tests/wpt/web-platform-tests/intersection-observer/client-rect.html @@ -15,7 +15,7 @@ iframe { } - + + + + + + +
+
+
+ + diff --git a/tests/wpt/web-platform-tests/js/META.yml b/tests/wpt/web-platform-tests/js/META.yml index dbb02a654f4..d4cbc628516 100644 --- a/tests/wpt/web-platform-tests/js/META.yml +++ b/tests/wpt/web-platform-tests/js/META.yml @@ -1,2 +1,3 @@ +spec: https://tc39.github.io/ecma262/ suggested_reviewers: - Ms2ger diff --git a/tests/wpt/web-platform-tests/keyboard-lock/META.yml b/tests/wpt/web-platform-tests/keyboard-lock/META.yml index 3f3a82d740a..e805a9d6658 100644 --- a/tests/wpt/web-platform-tests/keyboard-lock/META.yml +++ b/tests/wpt/web-platform-tests/keyboard-lock/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/keyboard-lock/ suggested_reviewers: - garykac - joedow-42 diff --git a/tests/wpt/web-platform-tests/keyboard-map/META.yml b/tests/wpt/web-platform-tests/keyboard-map/META.yml index 063cdb8393d..4efb479ffed 100644 --- a/tests/wpt/web-platform-tests/keyboard-map/META.yml +++ b/tests/wpt/web-platform-tests/keyboard-map/META.yml @@ -1,2 +1,3 @@ +spec: https://wicg.github.io/keyboard-map/ suggested_reviewers: - garykac diff --git a/tests/wpt/web-platform-tests/keyboard-map/keyboard-map-two-parallel-requests.https.html b/tests/wpt/web-platform-tests/keyboard-map/keyboard-map-two-parallel-requests.https.html deleted file mode 100644 index 875b9cc51ed..00000000000 --- a/tests/wpt/web-platform-tests/keyboard-map/keyboard-map-two-parallel-requests.https.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - diff --git a/tests/wpt/web-platform-tests/lifecycle/META.yml b/tests/wpt/web-platform-tests/lifecycle/META.yml index 3f09265b002..c1fcbca4c1f 100644 --- a/tests/wpt/web-platform-tests/lifecycle/META.yml +++ b/tests/wpt/web-platform-tests/lifecycle/META.yml @@ -1,2 +1,3 @@ +spec: https://wicg.github.io/page-lifecycle/spec.html suggested_reviewers: - fmeawad diff --git a/tests/wpt/web-platform-tests/lint.whitelist b/tests/wpt/web-platform-tests/lint.whitelist index 7c9a703cc23..de9e36cf12f 100644 --- a/tests/wpt/web-platform-tests/lint.whitelist +++ b/tests/wpt/web-platform-tests/lint.whitelist @@ -156,11 +156,11 @@ SET TIMEOUT: html/browsers/history/the-location-interface/* SET TIMEOUT: html/browsers/history/the-session-history-of-browsing-contexts/* SET TIMEOUT: html/browsers/offline/* SET TIMEOUT: html/browsers/the-window-object/* -SET TIMEOUT: html/dom/dynamic-markup-insertion/opening-the-input-stream/* SET TIMEOUT: html/editing/dnd/* SET TIMEOUT: html/semantics/embedded-content/the-iframe-element/* SET TIMEOUT: html/semantics/embedded-content/the-img-element/* SET TIMEOUT: html/semantics/scripting-1/the-script-element/* +SET TIMEOUT: html/webappapis/dynamic-markup-insertion/opening-the-input-stream/0* SET TIMEOUT: html/webappapis/scripting/event-loops/* SET TIMEOUT: html/webappapis/scripting/events/event-handler-processing-algorithm-error/* SET TIMEOUT: html/webappapis/scripting/processing-model-2/* @@ -638,6 +638,8 @@ CSS-COLLIDING-REF-NAME: css/css-transforms/individual-transform/individual-trans CSS-COLLIDING-REF-NAME: css/vendor-imports/mozilla/mozilla-central-reftests/transforms/individual-transform-1-ref.html CSS-COLLIDING-REF-NAME: css/css-flexbox/reference/percentage-size-subitems-001-ref.html CSS-COLLIDING-REF-NAME: css/css-grid/grid-items/percentage-size-subitems-001-ref.html +CSS-COLLIDING-REF-NAME: css/css-contain/reference/contain-size-button-001-ref.html +CSS-COLLIDING-REF-NAME: css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-button-001-ref.html CSS-COLLIDING-SUPPORT-NAME: css/css-backgrounds/support/red.png CSS-COLLIDING-SUPPORT-NAME: css/compositing/mix-blend-mode/support/red.png CSS-COLLIDING-SUPPORT-NAME: css/compositing/background-blending/support/red.png diff --git a/tests/wpt/web-platform-tests/longtask-timing/META.yml b/tests/wpt/web-platform-tests/longtask-timing/META.yml index 3e28b80608f..91c07f9fd3f 100644 --- a/tests/wpt/web-platform-tests/longtask-timing/META.yml +++ b/tests/wpt/web-platform-tests/longtask-timing/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/longtasks/ suggested_reviewers: - spanicker - npm1 diff --git a/tests/wpt/web-platform-tests/longtask-timing/idlharness.window.js b/tests/wpt/web-platform-tests/longtask-timing/idlharness.window.js new file mode 100644 index 00000000000..96d939f04e7 --- /dev/null +++ b/tests/wpt/web-platform-tests/longtask-timing/idlharness.window.js @@ -0,0 +1,51 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://w3c.github.io/longtask-timing/ + +'use strict'; + +promise_test(async t => { + const srcs = ['longtasks', 'performance-timeline']; + const [idl, perf] = await Promise.all( + srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); + + const idl_array = new IdlArray(); + idl_array.add_idls(idl); + idl_array.add_dependency_idls(perf); + + const testIdls = new Promise(resolve => { + try { + const observer = new PerformanceObserver(entryList => { + const entries = Array.from(entryList.getEntries()); + const attribution = entries.reduce( + (sum, e) => sum.concat(e.attribution || []), []); + idl_array.add_objects({ + PerformanceLongTaskTiming: entries, + TaskAttributionTiming: attribution, + }); + idl_array.test(); + resolve(); + }); + observer.observe({entryTypes: ['longtask']}); + } catch (e) { + // Will be surfaces in idlharness.js's test_object below. + } + }); + + const longTask = () => { + var begin = self.performance.now(); + while (self.performance.now() < begin + 100); + } + t.step_timeout(longTask, 0); + + const timeout = new Promise( + (_, reject) => t.step_timeout(reject, 1000)); + return Promise.race([testIdls, timeout]) + .then( + t.step_func_done(), + () => { + idl_array.test(); // Rejected, but test what we can. + return Promise.reject('LongTask was not observed'); + }); +}, 'longtasks interfaces'); diff --git a/tests/wpt/web-platform-tests/longtask-timing/longtask-attributes.html b/tests/wpt/web-platform-tests/longtask-timing/longtask-attributes.html index 6e86fc6f673..6af90cd9eef 100644 --- a/tests/wpt/web-platform-tests/longtask-timing/longtask-attributes.html +++ b/tests/wpt/web-platform-tests/longtask-timing/longtask-attributes.html @@ -10,6 +10,10 @@
diff --git a/tests/wpt/web-platform-tests/longtask-timing/longtask-in-childiframe-crossorigin.html b/tests/wpt/web-platform-tests/longtask-timing/longtask-in-childiframe-crossorigin.html index 2fa0f780cf6..17b0fd2412b 100644 --- a/tests/wpt/web-platform-tests/longtask-timing/longtask-in-childiframe-crossorigin.html +++ b/tests/wpt/web-platform-tests/longtask-timing/longtask-in-childiframe-crossorigin.html @@ -10,6 +10,10 @@
diff --git a/tests/wpt/web-platform-tests/longtask-timing/longtask-in-childiframe.html b/tests/wpt/web-platform-tests/longtask-timing/longtask-in-childiframe.html index 46aca3051e2..b7137043ad0 100644 --- a/tests/wpt/web-platform-tests/longtask-timing/longtask-in-childiframe.html +++ b/tests/wpt/web-platform-tests/longtask-timing/longtask-in-childiframe.html @@ -11,6 +11,10 @@ diff --git a/tests/wpt/web-platform-tests/longtask-timing/longtask-in-externalscript.html b/tests/wpt/web-platform-tests/longtask-timing/longtask-in-externalscript.html index 54d40737e52..51c58afff05 100644 --- a/tests/wpt/web-platform-tests/longtask-timing/longtask-in-externalscript.html +++ b/tests/wpt/web-platform-tests/longtask-timing/longtask-in-externalscript.html @@ -5,12 +5,15 @@ -

Long Task: External Script

- \ No newline at end of file diff --git a/tests/wpt/web-platform-tests/longtask-timing/longtask-in-parentiframe.html b/tests/wpt/web-platform-tests/longtask-timing/longtask-in-parentiframe.html index be29b6c3287..2e7a9990dd0 100644 --- a/tests/wpt/web-platform-tests/longtask-timing/longtask-in-parentiframe.html +++ b/tests/wpt/web-platform-tests/longtask-timing/longtask-in-parentiframe.html @@ -8,6 +8,10 @@ diff --git a/tests/wpt/web-platform-tests/longtask-timing/longtask-in-raf.html b/tests/wpt/web-platform-tests/longtask-timing/longtask-in-raf.html index 5407f53b438..8a5a7290ac9 100644 --- a/tests/wpt/web-platform-tests/longtask-timing/longtask-in-raf.html +++ b/tests/wpt/web-platform-tests/longtask-timing/longtask-in-raf.html @@ -5,12 +5,15 @@ -

Long Task: requestAnimationFrame

- diff --git a/tests/wpt/web-platform-tests/longtask-timing/longtask-in-sibling-iframe-crossorigin.html b/tests/wpt/web-platform-tests/longtask-timing/longtask-in-sibling-iframe-crossorigin.html index 8e922847c25..cfcc1895a19 100644 --- a/tests/wpt/web-platform-tests/longtask-timing/longtask-in-sibling-iframe-crossorigin.html +++ b/tests/wpt/web-platform-tests/longtask-timing/longtask-in-sibling-iframe-crossorigin.html @@ -8,6 +8,10 @@ diff --git a/tests/wpt/web-platform-tests/longtask-timing/longtask-in-sibling-iframe.html b/tests/wpt/web-platform-tests/longtask-timing/longtask-in-sibling-iframe.html index d463810964b..e6041e48a66 100644 --- a/tests/wpt/web-platform-tests/longtask-timing/longtask-in-sibling-iframe.html +++ b/tests/wpt/web-platform-tests/longtask-timing/longtask-in-sibling-iframe.html @@ -8,6 +8,10 @@ diff --git a/tests/wpt/web-platform-tests/longtask-timing/longtask-tojson.html b/tests/wpt/web-platform-tests/longtask-timing/longtask-tojson.html index bbe0d662c42..20a97a16b04 100644 --- a/tests/wpt/web-platform-tests/longtask-timing/longtask-tojson.html +++ b/tests/wpt/web-platform-tests/longtask-timing/longtask-tojson.html @@ -7,6 +7,10 @@ diff --git a/tests/wpt/web-platform-tests/longtask-timing/resources/makelongtask.js b/tests/wpt/web-platform-tests/longtask-timing/resources/makelongtask.js index d58b4f975d4..75de5453b58 100644 --- a/tests/wpt/web-platform-tests/longtask-timing/resources/makelongtask.js +++ b/tests/wpt/web-platform-tests/longtask-timing/resources/makelongtask.js @@ -1,3 +1,3 @@ /* Generate a slow task. */ const begin = window.performance.now(); -while (window.performance.now() < begin + 51); +while (window.performance.now() < begin + 60); diff --git a/tests/wpt/web-platform-tests/longtask-timing/resources/raflongtask.js b/tests/wpt/web-platform-tests/longtask-timing/resources/raflongtask.js index 95bfce17917..ec39cb896ee 100644 --- a/tests/wpt/web-platform-tests/longtask-timing/resources/raflongtask.js +++ b/tests/wpt/web-platform-tests/longtask-timing/resources/raflongtask.js @@ -1,5 +1,5 @@ window.requestAnimationFrame(function() { /* Generate a slow task. */ const begin = window.performance.now(); - while (window.performance.now() < begin + 51); + while (window.performance.now() < begin + 60); }); diff --git a/tests/wpt/web-platform-tests/longtask-timing/resources/subframe-with-longtask.html b/tests/wpt/web-platform-tests/longtask-timing/resources/subframe-with-longtask.html index 957d11452f5..298b252d187 100644 --- a/tests/wpt/web-platform-tests/longtask-timing/resources/subframe-with-longtask.html +++ b/tests/wpt/web-platform-tests/longtask-timing/resources/subframe-with-longtask.html @@ -7,5 +7,5 @@ diff --git a/tests/wpt/web-platform-tests/longtask-timing/shared-renderer/longtask-in-new-window.html b/tests/wpt/web-platform-tests/longtask-timing/shared-renderer/longtask-in-new-window.html index ebe9cdcb727..3a68d1451a5 100644 --- a/tests/wpt/web-platform-tests/longtask-timing/shared-renderer/longtask-in-new-window.html +++ b/tests/wpt/web-platform-tests/longtask-timing/shared-renderer/longtask-in-new-window.html @@ -11,6 +11,10 @@ This window opens a new window which contains a longtask. We test that the longtask from the new window is not observed by the observer of this window. */ async_test(t => { + if (typeof PerformanceLongTaskTiming === 'undefined') { + assert_unreached("Longtasks are not supported."); + t.done(); + } const observer = new PerformanceObserver( t.step_func(function (entryList) { const entries = entryList.getEntries(); @@ -34,12 +38,14 @@ async_test(t => { ); observer.observe({entryTypes: ['mark', 'longtask']}); - // Open a window with a longtask. - const other_window = window.open('resources/frame-with-longtask.html'); - window.addEventListener('message', t.step_func(e => { - // Do a mark (after the other window's longtask) to fire the callback. - self.performance.mark('mark1'); - })); + window.onload = () => { + // Open a window with a longtask. + const other_window = window.open('resources/frame-with-longtask.html'); + window.addEventListener('message', t.step_func(e => { + // Do a mark (after the other window's longtask) to fire the callback. + self.performance.mark('mark1'); + })); + }; }, 'A longtask in a frame from window.open is not reported in original frame'); diff --git a/tests/wpt/web-platform-tests/longtask-timing/shared-renderer/resources/frame-with-longtask.html b/tests/wpt/web-platform-tests/longtask-timing/shared-renderer/resources/frame-with-longtask.html index 72e525f04d1..9d0273e1926 100644 --- a/tests/wpt/web-platform-tests/longtask-timing/shared-renderer/resources/frame-with-longtask.html +++ b/tests/wpt/web-platform-tests/longtask-timing/shared-renderer/resources/frame-with-longtask.html @@ -8,7 +8,7 @@ diff --git a/tests/wpt/web-platform-tests/magnetometer/META.yml b/tests/wpt/web-platform-tests/magnetometer/META.yml index 2eeea5b1e99..46d83d3f08f 100644 --- a/tests/wpt/web-platform-tests/magnetometer/META.yml +++ b/tests/wpt/web-platform-tests/magnetometer/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/magnetometer/ suggested_reviewers: - zqzhang - dontcallmedom diff --git a/tests/wpt/web-platform-tests/mathml/META.yml b/tests/wpt/web-platform-tests/mathml/META.yml index c71c1559794..6b347c12d89 100644 --- a/tests/wpt/web-platform-tests/mathml/META.yml +++ b/tests/wpt/web-platform-tests/mathml/META.yml @@ -1,2 +1,3 @@ +spec: https://w3c.github.io/mathml/ suggested_reviewers: - fred-wang diff --git a/tests/wpt/web-platform-tests/media-capabilities/META.yml b/tests/wpt/web-platform-tests/media-capabilities/META.yml index be6ef8b2910..fc70ffb1853 100644 --- a/tests/wpt/web-platform-tests/media-capabilities/META.yml +++ b/tests/wpt/web-platform-tests/media-capabilities/META.yml @@ -1,2 +1,3 @@ +spec: https://wicg.github.io/media-capabilities/ suggested_reviewers: - mounirlamouri diff --git a/tests/wpt/web-platform-tests/media-source/META.yml b/tests/wpt/web-platform-tests/media-source/META.yml index 6e16b7366f8..d1252f5af1b 100644 --- a/tests/wpt/web-platform-tests/media-source/META.yml +++ b/tests/wpt/web-platform-tests/media-source/META.yml @@ -1,3 +1,3 @@ +spec: https://w3c.github.io/media-source/ suggested_reviewers: - - shishimaru - wolenetz diff --git a/tests/wpt/web-platform-tests/media/2x2-green.mp4 b/tests/wpt/web-platform-tests/media/2x2-green.mp4 new file mode 100644 index 00000000000..157361c2ddc Binary files /dev/null and b/tests/wpt/web-platform-tests/media/2x2-green.mp4 differ diff --git a/tests/wpt/web-platform-tests/media/2x2-green.ogv b/tests/wpt/web-platform-tests/media/2x2-green.ogv new file mode 100644 index 00000000000..29903c0a817 Binary files /dev/null and b/tests/wpt/web-platform-tests/media/2x2-green.ogv differ diff --git a/tests/wpt/web-platform-tests/media/sound_0.mp3 b/tests/wpt/web-platform-tests/media/sound_0.mp3 new file mode 100644 index 00000000000..a15d1de328f Binary files /dev/null and b/tests/wpt/web-platform-tests/media/sound_0.mp3 differ diff --git a/tests/wpt/web-platform-tests/media/sound_0.oga b/tests/wpt/web-platform-tests/media/sound_0.oga new file mode 100644 index 00000000000..c6f5fcb82d0 Binary files /dev/null and b/tests/wpt/web-platform-tests/media/sound_0.oga differ diff --git a/tests/wpt/web-platform-tests/mediacapture-depth/META.yml b/tests/wpt/web-platform-tests/mediacapture-depth/META.yml index 6799cdfa1ae..434612091df 100644 --- a/tests/wpt/web-platform-tests/mediacapture-depth/META.yml +++ b/tests/wpt/web-platform-tests/mediacapture-depth/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/mediacapture-depth/ suggested_reviewers: - anssiko - Honry diff --git a/tests/wpt/web-platform-tests/mediacapture-depth/idlharness.html b/tests/wpt/web-platform-tests/mediacapture-depth/idlharness.html index 29e3aa580dc..1afc6e5a05b 100644 --- a/tests/wpt/web-platform-tests/mediacapture-depth/idlharness.html +++ b/tests/wpt/web-platform-tests/mediacapture-depth/idlharness.html @@ -17,7 +17,7 @@ promise_test(async () => { const idl = await fetch('/interfaces/mediacapture-depth.idl').then(r => r.text()); - const main = await fetch('/interfaces/mediacapture-main.idl').then(r => r.text()); + const main = await fetch('/interfaces/mediacapture-streams.idl').then(r => r.text()); var idl_array = new IdlArray(); idl_array.add_idls(idl); diff --git a/tests/wpt/web-platform-tests/mediacapture-fromelement/META.yml b/tests/wpt/web-platform-tests/mediacapture-fromelement/META.yml index bac29ef9852..17195009fa1 100644 --- a/tests/wpt/web-platform-tests/mediacapture-fromelement/META.yml +++ b/tests/wpt/web-platform-tests/mediacapture-fromelement/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/mediacapture-fromelement/ suggested_reviewers: - yellowdoge - martinthomson diff --git a/tests/wpt/web-platform-tests/mediacapture-fromelement/idlharness.html b/tests/wpt/web-platform-tests/mediacapture-fromelement/idlharness.html deleted file mode 100644 index 2403d8aca4a..00000000000 --- a/tests/wpt/web-platform-tests/mediacapture-fromelement/idlharness.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - Media Capture from DOM Elements IDL test - - - - - - - - - - - -
- - diff --git a/tests/wpt/web-platform-tests/mediacapture-fromelement/idlharness.window.js b/tests/wpt/web-platform-tests/mediacapture-fromelement/idlharness.window.js new file mode 100644 index 00000000000..25c8233f14b --- /dev/null +++ b/tests/wpt/web-platform-tests/mediacapture-fromelement/idlharness.window.js @@ -0,0 +1,33 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://w3c.github.io/mediacapture-fromelement/ + +'use strict'; + +idl_test( + ['mediacapture-fromelement'], + ['mediacapture-streams', 'html', 'dom'], + idl_array => { + // Ignored errors will be surfaced when media/canvas undefined below. + try { + self.media = document.createElement('media'); + media.width = media.height = 10; + document.body.appendChild(media); + } catch (e) { } + + try { + self.canvas = document.createElement('canvas'); + document.body.appendChild(canvas); + canvas.width = canvas.height = 10; + self.track = canvas.captureStream().getTracks()[0]; + } catch (e) { } + + idl_array.add_objects({ + HTMLMediaElement: ['media'], + HTMLCanvasElement: ['canvas'], + CanvasCaptureMediaStreamTrack: ['track'], + }); + }, + 'Test mediacapture-fromelement IDL interfaces' +); diff --git a/tests/wpt/web-platform-tests/mediacapture-image/META.yml b/tests/wpt/web-platform-tests/mediacapture-image/META.yml index 70e88296232..1b4fef5e5a1 100644 --- a/tests/wpt/web-platform-tests/mediacapture-image/META.yml +++ b/tests/wpt/web-platform-tests/mediacapture-image/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/mediacapture-image/ suggested_reviewers: - yellowdoge - reillyeon diff --git a/tests/wpt/web-platform-tests/mediacapture-image/idlharness.html b/tests/wpt/web-platform-tests/mediacapture-image/idlharness.html index 252281eefa6..40888f0b59e 100644 --- a/tests/wpt/web-platform-tests/mediacapture-image/idlharness.html +++ b/tests/wpt/web-platform-tests/mediacapture-image/idlharness.html @@ -17,7 +17,7 @@ 'use strict'; promise_test(async () => { - const srcs = ['image-capture', 'mediacapture-main', 'html', 'dom']; + const srcs = ['image-capture', 'mediacapture-streams', 'html', 'dom']; const [idl, main, html, dom] = await Promise.all( srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); diff --git a/tests/wpt/web-platform-tests/mediacapture-record/META.yml b/tests/wpt/web-platform-tests/mediacapture-record/META.yml index 95fdd2ba4f3..d59e5e30845 100644 --- a/tests/wpt/web-platform-tests/mediacapture-record/META.yml +++ b/tests/wpt/web-platform-tests/mediacapture-record/META.yml @@ -1,2 +1,3 @@ +spec: https://w3c.github.io/mediacapture-record/ suggested_reviewers: - yellowdoge diff --git a/tests/wpt/web-platform-tests/mediacapture-record/idlharness.html b/tests/wpt/web-platform-tests/mediacapture-record/idlharness.html deleted file mode 100644 index 8e4ba3c3eba..00000000000 --- a/tests/wpt/web-platform-tests/mediacapture-record/idlharness.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - Media Recorder IDL test - - - - - - - - - - -
- - diff --git a/tests/wpt/web-platform-tests/mediacapture-record/idlharness.window.js b/tests/wpt/web-platform-tests/mediacapture-record/idlharness.window.js new file mode 100644 index 00000000000..d367064b2a5 --- /dev/null +++ b/tests/wpt/web-platform-tests/mediacapture-record/idlharness.window.js @@ -0,0 +1,39 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +// https://w3c.github.io/mediacapture-record/ + +idl_test( + ['mediastream-recording'], + ['mediacapture-main', 'html', 'dom', 'FileAPI'], + idl_array => { + // Ignored errors will be surfaced in idlharness.js's test_object below. + let recorder, blob, error; + try { + const canvas = document.createElement('canvas'); + document.body.appendChild(canvas); + const context = canvas.getContext("2d"); + context.fillStyle = "red"; + context.fillRect(0, 0, 10, 10); + const stream = canvas.captureStream(); + recorder = new MediaRecorder(stream); + } catch(e) {} + idl_array.add_objects({ MediaRecorder: [recorder] }); + + try { + blob = new BlobEvent("type", { + data: new Blob(), + timecode: performance.now(), + }); + } catch(e) {} + idl_array.add_objects({ BlobEvent: [blob] }); + + try { + error = new MediaRecorderErrorEvent("type", {}); + } catch(e) {} + idl_array.add_objects({ MediaRecorderErrorEvent: [error] }); + }, + 'mediastream-recording interfaces' +); diff --git a/tests/wpt/web-platform-tests/mediacapture-streams/META.yml b/tests/wpt/web-platform-tests/mediacapture-streams/META.yml index 7bea004843b..9e8b0f46f9b 100644 --- a/tests/wpt/web-platform-tests/mediacapture-streams/META.yml +++ b/tests/wpt/web-platform-tests/mediacapture-streams/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/mediacapture-main/ suggested_reviewers: - agouaillard - alvestrand diff --git a/tests/wpt/web-platform-tests/mediacapture-streams/MediaDevices-IDL-all.html b/tests/wpt/web-platform-tests/mediacapture-streams/MediaDevices-IDL-all.html deleted file mode 100644 index e398c8b1e19..00000000000 --- a/tests/wpt/web-platform-tests/mediacapture-streams/MediaDevices-IDL-all.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - getUserMedia: Non-Interactive test for mediaDevices APIs - - - - - - -

Description

-

This test checks for the presence of the - navigator.mediaDevices.getUserMedia method.

-
- - - - - - - diff --git a/tests/wpt/web-platform-tests/mediacapture-streams/MediaDevices-IDL-enumerateDevices.html b/tests/wpt/web-platform-tests/mediacapture-streams/MediaDevices-IDL-enumerateDevices.html deleted file mode 100644 index 446ee15459d..00000000000 --- a/tests/wpt/web-platform-tests/mediacapture-streams/MediaDevices-IDL-enumerateDevices.html +++ /dev/null @@ -1,64 +0,0 @@ - - - -enumerateDevices: test that enumerateDevices is present - - - - - - - -

Description

-

This test checks for the presence of the -navigator.mediaDevices.enumerateDevices() method.

-
- - - - - - - diff --git a/tests/wpt/web-platform-tests/mediacapture-streams/MediaStreamTrack-idl.https.html b/tests/wpt/web-platform-tests/mediacapture-streams/MediaStreamTrack-idl.https.html deleted file mode 100644 index 5164d997284..00000000000 --- a/tests/wpt/web-platform-tests/mediacapture-streams/MediaStreamTrack-idl.https.html +++ /dev/null @@ -1,52 +0,0 @@ - -MediaStreamTrack IDL tests - - - - - - - - diff --git a/tests/wpt/web-platform-tests/mediacapture-streams/idlharness.https.window.js b/tests/wpt/web-platform-tests/mediacapture-streams/idlharness.https.window.js new file mode 100644 index 00000000000..8c49d92fb0d --- /dev/null +++ b/tests/wpt/web-platform-tests/mediacapture-streams/idlharness.https.window.js @@ -0,0 +1,60 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +// https://w3c.github.io/mediacapture-main/ + + +promise_test(async () => { + const srcs = ['mediacapture-streams','dom','html']; + const [idl, dom, html] = await Promise.all( + srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); + + const idl_array = new IdlArray(); + idl_array.add_idls(idl); + idl_array.add_dependency_idls(html); + idl_array.add_dependency_idls(dom); + + let input, media; + // Errors will be surfaced in idlharness.js's test_object below. + try { + const list = await navigator.mediaDevices.enumerateDevices(); + for (const item of list) { + switch (item.kind) { + case 'audioinput': + case 'videoinput': + input = item; + case 'audiooutput': + media = item; + default: + assert_unreached( + 'media.kind should be one of "audioinput", "videoinput", or "audiooutput".'); + } + } + } catch (e) {} + + let track, trackEvent; + try { + const stream = await navigator.mediaDevices.getUserMedia({audio: true}); + track = stream.getTracks()[0]; + trackEvent = new MediaStreamTrackEvent("type", { + track: track, + }); + } catch (e) { throw e} + + if (input) { + idl_array.add_objects({ InputDeviceInfo: [input] }); + } else { + idl_array.add_objects({ MediaDeviceInfo: [media] }); + } + idl_array.add_objects({ + MediaStream: ['new MediaStream()'], + Navigator: ['navigator'], + MediaDevices: ['navigator.mediaDevices'], + MediaStreamTrack: [track], + MediaStreamTrackEvent: [trackEvent], + OverconstrainedErrorEvent: ['new OverconstrainedErrorEvent("type", {})'], + }); + idl_array.test(); +}, 'mediacapture-streams interfaces.'); diff --git a/tests/wpt/web-platform-tests/mediasession/META.yml b/tests/wpt/web-platform-tests/mediasession/META.yml index be6ef8b2910..bca9602ca31 100644 --- a/tests/wpt/web-platform-tests/mediasession/META.yml +++ b/tests/wpt/web-platform-tests/mediasession/META.yml @@ -1,2 +1,3 @@ +spec: https://wicg.github.io/mediasession/ suggested_reviewers: - mounirlamouri diff --git a/tests/wpt/web-platform-tests/mimesniff/META.yml b/tests/wpt/web-platform-tests/mimesniff/META.yml index b2167370d14..fd41c87fad8 100644 --- a/tests/wpt/web-platform-tests/mimesniff/META.yml +++ b/tests/wpt/web-platform-tests/mimesniff/META.yml @@ -1,2 +1,3 @@ +spec: https://mimesniff.spec.whatwg.org/ suggested_reviewers: - annevk diff --git a/tests/wpt/web-platform-tests/mixed-content/META.yml b/tests/wpt/web-platform-tests/mixed-content/META.yml index 6323e4cb1f1..a2889eb6c7a 100644 --- a/tests/wpt/web-platform-tests/mixed-content/META.yml +++ b/tests/wpt/web-platform-tests/mixed-content/META.yml @@ -1,2 +1,3 @@ +spec: https://w3c.github.io/webappsec-mixed-content/ suggested_reviewers: - - kristijanburnik + - andypaicu diff --git a/tests/wpt/web-platform-tests/navigation-timing/META.yml b/tests/wpt/web-platform-tests/navigation-timing/META.yml index dd37073bd55..c09a6e03fd1 100644 --- a/tests/wpt/web-platform-tests/navigation-timing/META.yml +++ b/tests/wpt/web-platform-tests/navigation-timing/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/navigation-timing/ suggested_reviewers: - plehegar - igrigorik diff --git a/tests/wpt/web-platform-tests/navigation-timing/idlharness.html b/tests/wpt/web-platform-tests/navigation-timing/idlharness.html deleted file mode 100644 index 6c2d488ddc0..00000000000 --- a/tests/wpt/web-platform-tests/navigation-timing/idlharness.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - -Navigation Timing IDL tests - - - - - - - - - - -

Navigation Timing IDL tests

-
- - - -
-
-[Exposed=Window]
-interface PerformanceNavigationTiming : PerformanceResourceTiming {
-        readonly        attribute DOMHighResTimeStamp unloadEventStart;
-        readonly        attribute DOMHighResTimeStamp unloadEventEnd;
-        readonly        attribute DOMHighResTimeStamp domInteractive;
-        readonly        attribute DOMHighResTimeStamp domContentLoadedEventStart;
-        readonly        attribute DOMHighResTimeStamp domContentLoadedEventEnd;
-        readonly        attribute DOMHighResTimeStamp domComplete;
-        readonly        attribute DOMHighResTimeStamp loadEventStart;
-        readonly        attribute DOMHighResTimeStamp loadEventEnd;
-        readonly        attribute NavigationType      type;
-        readonly        attribute unsigned short      redirectCount;
-        [Default] object toJSON();
-};
-
-enum NavigationType {
-  "navigate",
-  "reload",
-  "back_forward",
-  "prerender"
-};
-
-
-[Exposed=Window]
-interface PerformanceTiming {
-  readonly attribute unsigned long long navigationStart;
-  readonly attribute unsigned long long unloadEventStart;
-  readonly attribute unsigned long long unloadEventEnd;
-  readonly attribute unsigned long long redirectStart;
-  readonly attribute unsigned long long redirectEnd;
-  readonly attribute unsigned long long fetchStart;
-  readonly attribute unsigned long long domainLookupStart;
-  readonly attribute unsigned long long domainLookupEnd;
-  readonly attribute unsigned long long connectStart;
-  readonly attribute unsigned long long connectEnd;
-  readonly attribute unsigned long long secureConnectionStart;
-  readonly attribute unsigned long long requestStart;
-  readonly attribute unsigned long long responseStart;
-  readonly attribute unsigned long long responseEnd;
-  readonly attribute unsigned long long domLoading;
-  readonly attribute unsigned long long domInteractive;
-  readonly attribute unsigned long long domContentLoadedEventStart;
-  readonly attribute unsigned long long domContentLoadedEventEnd;
-  readonly attribute unsigned long long domComplete;
-  readonly attribute unsigned long long loadEventStart;
-  readonly attribute unsigned long long loadEventEnd;
-  [Default] object toJSON();
-};
-
-
-[Exposed=Window]
-interface PerformanceNavigation {
-  const unsigned short TYPE_NAVIGATE = 0;
-  const unsigned short TYPE_RELOAD = 1;
-  const unsigned short TYPE_BACK_FORWARD = 2;
-  const unsigned short TYPE_RESERVED = 255;
-  readonly attribute unsigned short type;
-  readonly attribute unsigned short redirectCount;
-  [Default] object toJSON();
-};
-
-
-// [Exposed=Window]
-partial interface Performance {
-  [SameObject]
-  readonly attribute PerformanceTiming timing;
-  [SameObject]
-  readonly attribute PerformanceNavigation navigation;
-};
-
- - - - diff --git a/tests/wpt/web-platform-tests/navigation-timing/idlharness.window.js b/tests/wpt/web-platform-tests/navigation-timing/idlharness.window.js new file mode 100644 index 00000000000..a782773e59f --- /dev/null +++ b/tests/wpt/web-platform-tests/navigation-timing/idlharness.window.js @@ -0,0 +1,22 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +// http://www.w3.org/TR/navigation-timing/ + +idl_test( + ['navigation-timing'], + ['resource-timing', 'performance-timeline', 'hr-time', 'dom'], + idl_array => { + idl_array.add_objects({ + Performance: ['performance'], + PerformanceNavigation: ['performance.navigation'], + PerformanceTiming: ['performance.timing'], + PerformanceNavigationTiming: [ + 'performance.getEntriesByType("navigation")[0]' + ] + }); + }, + 'navigation-timing interfaces' +); diff --git a/tests/wpt/web-platform-tests/netinfo/META.yml b/tests/wpt/web-platform-tests/netinfo/META.yml index a635532a22a..220c5d6d32b 100644 --- a/tests/wpt/web-platform-tests/netinfo/META.yml +++ b/tests/wpt/web-platform-tests/netinfo/META.yml @@ -1,3 +1,4 @@ +spec: https://wicg.github.io/netinfo/ suggested_reviewers: - jkarlin - igrigorik diff --git a/tests/wpt/web-platform-tests/netinfo/idlharness.any.js b/tests/wpt/web-platform-tests/netinfo/idlharness.any.js new file mode 100644 index 00000000000..d8e15610815 --- /dev/null +++ b/tests/wpt/web-platform-tests/netinfo/idlharness.any.js @@ -0,0 +1,19 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +// https://wicg.github.io/netinfo/ + +idl_test( + ['netinfo'], + ['html', 'dom'], + idl_array => { + idl_array.add_objects({ NetworkInformation: ['navigator.connection'] }); + if (self.isWorker) { + idl_array.add_objects({ WorkerNavigator: ['navigator'] }); + } else { + idl_array.add_objects({ Navigator: ['navigator'] }); + } + }, + 'netinfo interfaces.'); diff --git a/tests/wpt/web-platform-tests/notifications/META.yml b/tests/wpt/web-platform-tests/notifications/META.yml index 4ec46d4bd18..2cb7972705c 100644 --- a/tests/wpt/web-platform-tests/notifications/META.yml +++ b/tests/wpt/web-platform-tests/notifications/META.yml @@ -1,5 +1,4 @@ +spec: https://notifications.spec.whatwg.org/ suggested_reviewers: - - chunywang - sideshowbarker - - xinliux - ibelem diff --git a/tests/wpt/web-platform-tests/offscreen-canvas/META.yml b/tests/wpt/web-platform-tests/offscreen-canvas/META.yml index 3c0af55426e..bcb30ed2766 100644 --- a/tests/wpt/web-platform-tests/offscreen-canvas/META.yml +++ b/tests/wpt/web-platform-tests/offscreen-canvas/META.yml @@ -1,3 +1,4 @@ +spec: https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface suggested_reviewers: - AmeliaBR - annevk diff --git a/tests/wpt/web-platform-tests/orientation-event/META.yml b/tests/wpt/web-platform-tests/orientation-event/META.yml index 39f7b2639cd..ba1811f6742 100644 --- a/tests/wpt/web-platform-tests/orientation-event/META.yml +++ b/tests/wpt/web-platform-tests/orientation-event/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/deviceorientation/spec-source-orientation.html suggested_reviewers: - reillyeon - timvolodine diff --git a/tests/wpt/web-platform-tests/orientation-sensor/META.yml b/tests/wpt/web-platform-tests/orientation-sensor/META.yml index 2eeea5b1e99..5f2d45bfb3c 100644 --- a/tests/wpt/web-platform-tests/orientation-sensor/META.yml +++ b/tests/wpt/web-platform-tests/orientation-sensor/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/orientation-sensor/ suggested_reviewers: - zqzhang - dontcallmedom diff --git a/tests/wpt/web-platform-tests/page-visibility/META.yml b/tests/wpt/web-platform-tests/page-visibility/META.yml index ee0e032763c..509936c371b 100644 --- a/tests/wpt/web-platform-tests/page-visibility/META.yml +++ b/tests/wpt/web-platform-tests/page-visibility/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/page-visibility/ suggested_reviewers: - plehegar - igrigorik diff --git a/tests/wpt/web-platform-tests/page-visibility/idlharness.html b/tests/wpt/web-platform-tests/page-visibility/idlharness.html deleted file mode 100644 index 50d580934cd..00000000000 --- a/tests/wpt/web-platform-tests/page-visibility/idlharness.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - -Page Visibility IDL tests - - - - - - - - -

Page Visibility IDL tests

- - - -
-enum VisibilityState {
-    "hidden",
-    "visible",
-    "prerender"
-};
-
-partial interface Document {
-    readonly attribute boolean         hidden;
-    readonly attribute VisibilityState visibilityState;
-             attribute EventHandler    onvisibilitychange;
-};
-
- - - -
- - - diff --git a/tests/wpt/web-platform-tests/page-visibility/idlharness.window.js b/tests/wpt/web-platform-tests/page-visibility/idlharness.window.js new file mode 100644 index 00000000000..8ef2561b9f8 --- /dev/null +++ b/tests/wpt/web-platform-tests/page-visibility/idlharness.window.js @@ -0,0 +1,17 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +// https://w3c.github.io/page-visibility/ + +idl_test( + ['page-visibility'], + ['dom', 'html'], + idl_array => { + idl_array.add_objects({ + Document: ['document'], + }); + }, + 'page-visibility interfaces' +); diff --git a/tests/wpt/web-platform-tests/paint-timing/META.yml b/tests/wpt/web-platform-tests/paint-timing/META.yml index 3cc0b7946bd..24acb2587d1 100644 --- a/tests/wpt/web-platform-tests/paint-timing/META.yml +++ b/tests/wpt/web-platform-tests/paint-timing/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/paint-timing/ suggested_reviewers: - spanicker - tdresser diff --git a/tests/wpt/web-platform-tests/payment-handler/META.yml b/tests/wpt/web-platform-tests/payment-handler/META.yml index 2297652f873..eff7624d054 100644 --- a/tests/wpt/web-platform-tests/payment-handler/META.yml +++ b/tests/wpt/web-platform-tests/payment-handler/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/payment-handler/ suggested_reviewers: - marcoscaceres - rsolomakhin diff --git a/tests/wpt/web-platform-tests/payment-handler/idlharness.https.any.js b/tests/wpt/web-platform-tests/payment-handler/idlharness.https.any.js new file mode 100644 index 00000000000..d039f66001f --- /dev/null +++ b/tests/wpt/web-platform-tests/payment-handler/idlharness.https.any.js @@ -0,0 +1,24 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +// https://w3c.github.io/payment-handler/ + +promise_test(async () => { + const srcs = [ + 'payment-handler', + 'service-workers', + 'dedicated-workers', + 'dom' + ]; + const [idl, sw, dw, dom] = await Promise.all( + srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); + + const idlArray = new IdlArray(); + idlArray.add_idls(idl); + idlArray.add_dependency_idls(sw); + idlArray.add_dependency_idls(dw); + idlArray.add_dependency_idls(dom); + idlArray.test(); +}, 'payment-handler interfaces.'); diff --git a/tests/wpt/web-platform-tests/payment-method-basic-card/META.yml b/tests/wpt/web-platform-tests/payment-method-basic-card/META.yml index 65b782e361e..b1d851431cb 100644 --- a/tests/wpt/web-platform-tests/payment-method-basic-card/META.yml +++ b/tests/wpt/web-platform-tests/payment-method-basic-card/META.yml @@ -1,5 +1,5 @@ +spec: https://w3c.github.io/payment-method-basic-card/ suggested_reviewers: - - edenchuang - mnoorenberghe - marcoscaceres - rsolomakhin diff --git a/tests/wpt/web-platform-tests/payment-method-basic-card/idlharness.window.js b/tests/wpt/web-platform-tests/payment-method-basic-card/idlharness.window.js new file mode 100644 index 00000000000..a1078c642e1 --- /dev/null +++ b/tests/wpt/web-platform-tests/payment-method-basic-card/idlharness.window.js @@ -0,0 +1,12 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +// https://w3c.github.io/payment-method-basic-card/ + +idl_test( + ['payment-method-basic-card'], + [], // No deps + null, // No objects + 'payment-method-basic-card interfaces.'); diff --git a/tests/wpt/web-platform-tests/payment-method-id/META.yml b/tests/wpt/web-platform-tests/payment-method-id/META.yml index 648541b73da..e0931f4f8f5 100644 --- a/tests/wpt/web-platform-tests/payment-method-id/META.yml +++ b/tests/wpt/web-platform-tests/payment-method-id/META.yml @@ -1,4 +1,4 @@ +spec: https://w3c.github.io/payment-method-id/ suggested_reviewers: - - edenchuang - alphan102 - marcoscaceres diff --git a/tests/wpt/web-platform-tests/payment-request/META.yml b/tests/wpt/web-platform-tests/payment-request/META.yml index c06dec90efd..74a165b1392 100644 --- a/tests/wpt/web-platform-tests/payment-request/META.yml +++ b/tests/wpt/web-platform-tests/payment-request/META.yml @@ -1,7 +1,7 @@ +spec: https://w3c.github.io/payment-request/ suggested_reviewers: - marcoscaceres - rsolomakhin - domenic - MSFTkihans - mnoorenberghe - - edenchuang diff --git a/tests/wpt/web-platform-tests/payment-request/idlharness.https.window.js b/tests/wpt/web-platform-tests/payment-request/idlharness.https.window.js new file mode 100644 index 00000000000..57a2c942fbf --- /dev/null +++ b/tests/wpt/web-platform-tests/payment-request/idlharness.https.window.js @@ -0,0 +1,31 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +// https://w3c.github.io/payment-request/ + +idl_test( + ['payment-request'], + ['dom', 'html'], + idlArray => { + try { + const methods = [ + {supportedMethods: 'basic-card'}, + {supportedMethods: 'https://apple.com/apple-pay'}, + ]; + const amount = {currency: 'USD', value: '0'}; + const details = {total: {label: 'label', amount: amount} }; + window.paymentRequest = new PaymentRequest(methods, details); + } catch (e) { + // Surfaced below when paymentRequest is undefined. + } + + idlArray.add_objects({ + PaymentRequest: ['paymentRequest'], + PaymentMethodChangeEvent: ['new PaymentMethodChangeEvent("paymentmethodchange")'], + PaymentRequestUpdateEvent: ['new PaymentRequestUpdateEvent("paymentrequestupdate")'], + }); + }, + 'Setup for Payment Request API IDL tests.' +); diff --git a/tests/wpt/web-platform-tests/payment-request/interfaces.https.html b/tests/wpt/web-platform-tests/payment-request/interfaces.https.html deleted file mode 100644 index a7ec323f0cd..00000000000 --- a/tests/wpt/web-platform-tests/payment-request/interfaces.https.html +++ /dev/null @@ -1,32 +0,0 @@ - - -Payment Request interface IDL tests - - - - - diff --git a/tests/wpt/web-platform-tests/performance-timeline/META.yml b/tests/wpt/web-platform-tests/performance-timeline/META.yml index ee0e032763c..46f16ae5f31 100644 --- a/tests/wpt/web-platform-tests/performance-timeline/META.yml +++ b/tests/wpt/web-platform-tests/performance-timeline/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/performance-timeline/ suggested_reviewers: - plehegar - igrigorik diff --git a/tests/wpt/web-platform-tests/performance-timeline/get-invalid-entries.html b/tests/wpt/web-platform-tests/performance-timeline/get-invalid-entries.html new file mode 100644 index 00000000000..33d6589e275 --- /dev/null +++ b/tests/wpt/web-platform-tests/performance-timeline/get-invalid-entries.html @@ -0,0 +1,27 @@ + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/performance-timeline/idlharness.any.js b/tests/wpt/web-platform-tests/performance-timeline/idlharness.any.js index b15a667b256..a1a6343b4c1 100644 --- a/tests/wpt/web-platform-tests/performance-timeline/idlharness.any.js +++ b/tests/wpt/web-platform-tests/performance-timeline/idlharness.any.js @@ -6,21 +6,47 @@ 'use strict'; -promise_test(async () => { - const idl_array = new IdlArray(); - const idl = await fetch("/interfaces/performance-timeline.idl").then(r => r.text()); - const dom = await fetch("/interfaces/dom.idl").then(r => r.text()); - const hrtime = await fetch("/interfaces/hr-time.idl").then(r => r.text()); - - // create first mark - self.performance.mark("mark"); - - idl_array.add_idls(idl); - idl_array.add_dependency_idls(hrtime); - idl_array.add_dependency_idls(dom); - idl_array.add_objects({ - Performance: ["performance"], - PerformanceMark: [self.performance.getEntriesByName("mark")[0]], +promise_test(async t => { + const observe = new Promise((resolve, reject) => { + try { + self.observer = new PerformanceObserver((entries, observer) => { + self.entryList = entries; + self.mark = entries.getEntries()[0]; + resolve(); + }); + observer.observe({ entryTypes: ['mark'] }); + performance.mark('test'); + } catch (e) { + reject(e); + } }); - idl_array.test(); -}, "Test IDL implementation of performance-timeline API"); + const timeout = new Promise((_, reject) => { + t.step_timeout(() => reject('Timed out waiting for observation'), 3000); + }); + const user = await fetch('/interfaces/user-timing.idl').then(r => r.text()); + const execute_test = () => { + idl_test( + ['performance-timeline'], + ['hr-time', 'dom'], + idl_array => { + idl_array.add_idls(user, {only: ['PerformanceMark']}); + idl_array.add_objects({ + Performance: ['performance'], + // NOTE: PerformanceMark cascadingly tests PerformanceEntry + PerformanceMark: ['mark'], + PerformanceObserver: ['observer'], + PerformanceObserverEntryList: ['entryList'], + }); + }, + 'Test IDL implementation of performance-timeline API' + ); + }; + + return Promise.race([observe, timeout]).then( + execute_test, + reason => { + execute_test(); + return Promise.reject(reason); + } + ); +}) diff --git a/tests/wpt/web-platform-tests/performance-timeline/resources/worker-invalid-entries.js b/tests/wpt/web-platform-tests/performance-timeline/resources/worker-invalid-entries.js new file mode 100644 index 00000000000..bd7fba2ccf4 --- /dev/null +++ b/tests/wpt/web-platform-tests/performance-timeline/resources/worker-invalid-entries.js @@ -0,0 +1,6 @@ +performance.mark('workerMark'); +postMessage({ + 'invalid' : performance.getEntriesByType('invalid').length, + 'mark' : performance.getEntriesByType('mark').length, + 'measure' : performance.getEntriesByType('measure').length +}); diff --git a/tests/wpt/web-platform-tests/permissions/META.yml b/tests/wpt/web-platform-tests/permissions/META.yml index cf7504920a4..b055f50f636 100644 --- a/tests/wpt/web-platform-tests/permissions/META.yml +++ b/tests/wpt/web-platform-tests/permissions/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/permissions/ suggested_reviewers: - jyasskin - mounirlamouri diff --git a/tests/wpt/web-platform-tests/picture-in-picture/META.yml b/tests/wpt/web-platform-tests/picture-in-picture/META.yml index 412f6d7397d..b878dd547b8 100644 --- a/tests/wpt/web-platform-tests/picture-in-picture/META.yml +++ b/tests/wpt/web-platform-tests/picture-in-picture/META.yml @@ -1,3 +1,4 @@ +spec: https://wicg.github.io/picture-in-picture/ suggested_reviewers: - beaufortfrancois - mounirlamouri diff --git a/tests/wpt/web-platform-tests/picture-in-picture/idlharness.window.js b/tests/wpt/web-platform-tests/picture-in-picture/idlharness.window.js new file mode 100644 index 00000000000..6ada0fe7bfd --- /dev/null +++ b/tests/wpt/web-platform-tests/picture-in-picture/idlharness.window.js @@ -0,0 +1,31 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=resources/picture-in-picture-helpers.js + +'use strict'; + +// https://wicg.github.io/picture-in-picture/ + +promise_test(async () => { + try { + self.video = await loadVideo(); + self.pipw = await requestPictureInPictureWithTrustedClick(video); + } catch (e) { + // Will be surfaced when video/pipw are undefined below. + } + + idl_test( + ['picture-in-picture'], + ['html', 'dom'], + idl_array => { + idl_array.add_objects({ + Document: ['document'], + DocumentOrShadowRoot: ['document'], + HTMLVideoElement: ['video'], + PictureInPictureWindow: ['pipw'], + }); + }, + 'picture-in-picture interfaces.'); +}) diff --git a/tests/wpt/web-platform-tests/pointerevents/META.yml b/tests/wpt/web-platform-tests/pointerevents/META.yml index 27d8c44dd0e..ef94157ef9a 100644 --- a/tests/wpt/web-platform-tests/pointerevents/META.yml +++ b/tests/wpt/web-platform-tests/pointerevents/META.yml @@ -1,7 +1,6 @@ +spec: https://w3c.github.io/pointerevents/ suggested_reviewers: - - bethge - Steditor - - EvgenyAgafonchikov - jacobrossi - plehegar - scottgonzalez diff --git a/tests/wpt/web-platform-tests/pointerevents/pointerevent_attributes_hoverable_pointers-manual.html b/tests/wpt/web-platform-tests/pointerevents/pointerevent_attributes_hoverable_pointers-manual.html index 0922ae7448e..e7471451076 100644 --- a/tests/wpt/web-platform-tests/pointerevents/pointerevent_attributes_hoverable_pointers-manual.html +++ b/tests/wpt/web-platform-tests/pointerevents/pointerevent_attributes_hoverable_pointers-manual.html @@ -60,11 +60,14 @@ // Test clientX and clientY if (event.type != 'pointerout' && event.type != 'pointerleave' ) { test(function () { - assert_true(event.clientX >= targetBoundingClientRect.left && event.clientX < targetBoundingClientRect.right && event.clientY >= targetBoundingClientRect.top && event.clientY < targetBoundingClientRect.bottom, "ClientX/Y should be in the boundaries of the box"); + assert_greater_than_equal(event.clientX, targetBoundingClientRect.left, "clientX should be greater or equal than left of the box"); + assert_greater_than_equal(event.clientY, targetBoundingClientRect.top, "clientY should be greater or equal than top of the box"); + assert_less_than_equal(event.clientX, targetBoundingClientRect.right, "clientX should be less or equal than right of the box"); + assert_less_than_equal(event.clientY, targetBoundingClientRect.bottom, "clientY should be less or equal than bottom of the box"); }, pointerTestName + "'s ClientX and ClientY attributes are correct."); } else { test(function () { - assert_true(event.clientX < targetBoundingClientRect.left || event.clientX > targetBoundingClientRect.right - 1 || event.clientY < targetBoundingClientRect.top || event.clientY > targetBoundingClientRect.bottom - 1, "ClientX/Y should be out of the boundaries of the box"); + assert_true(event.clientX < targetBoundingClientRect.left || event.clientX >= targetBoundingClientRect.right || event.clientY < targetBoundingClientRect.top || event.clientY >= targetBoundingClientRect.bottom, "ClientX/Y should be out of the boundaries of the box"); }, pointerTestName + "'s ClientX and ClientY attributes are correct."); } diff --git a/tests/wpt/web-platform-tests/pointerlock/META.yml b/tests/wpt/web-platform-tests/pointerlock/META.yml index fc0bf6652a1..bb639b4417e 100644 --- a/tests/wpt/web-platform-tests/pointerlock/META.yml +++ b/tests/wpt/web-platform-tests/pointerlock/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/pointerlock/ suggested_reviewers: - scheib - siusin diff --git a/tests/wpt/web-platform-tests/pointerlock/interfaces.window.js b/tests/wpt/web-platform-tests/pointerlock/interfaces.window.js index 2aa5a01a877..99e2b44327f 100644 --- a/tests/wpt/web-platform-tests/pointerlock/interfaces.window.js +++ b/tests/wpt/web-platform-tests/pointerlock/interfaces.window.js @@ -5,22 +5,14 @@ // https://w3c.github.io/pointerlock/ -promise_test(async () => { - const html = await fetch('/interfaces/html.idl').then(r => r.text()); - const dom = await fetch('/interfaces/dom.idl').then(r => r.text()); - const uievents = await fetch('/interfaces/uievents.idl').then(r => r.text()); - const idl = await fetch('/interfaces/pointerlock.idl').then(r => r.text()); - - const idl_array = new IdlArray(); - idl_array.add_idls(idl); - idl_array.add_dependency_idls(uievents); - idl_array.add_dependency_idls(dom); - idl_array.add_dependency_idls(html); - - idl_array.add_objects({ - Document: ["window.document"], - Element: ["window.document.documentElement"], - MouseEvent: ["new MouseEvent('foo')"] - }); - idl_array.test(); -}, 'pointerlock interfaces.'); +idl_test( + ['pointerlock'], + ['uievents', 'html', 'dom'], + idl_array => { + idl_array.add_objects({ + Document: ["window.document"], + Element: ["window.document.documentElement"], + MouseEvent: ["new MouseEvent('foo')"] + }); + }, + 'pointerlock interfaces.'); diff --git a/tests/wpt/web-platform-tests/preload/META.yml b/tests/wpt/web-platform-tests/preload/META.yml index 62029af569a..fd10e7d15ab 100644 --- a/tests/wpt/web-platform-tests/preload/META.yml +++ b/tests/wpt/web-platform-tests/preload/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/preload/ suggested_reviewers: - snuggs - yoavweiss diff --git a/tests/wpt/web-platform-tests/preload/preload-strict-dynamic.html b/tests/wpt/web-platform-tests/preload/preload-strict-dynamic.html new file mode 100644 index 00000000000..5e473a1c894 --- /dev/null +++ b/tests/wpt/web-platform-tests/preload/preload-strict-dynamic.html @@ -0,0 +1,54 @@ + + + + +CSP strict-dynamic + preload + + + + + + + + diff --git a/tests/wpt/web-platform-tests/presentation-api/META.yml b/tests/wpt/web-platform-tests/presentation-api/META.yml index a4a7bf3408c..beba8906215 100644 --- a/tests/wpt/web-platform-tests/presentation-api/META.yml +++ b/tests/wpt/web-platform-tests/presentation-api/META.yml @@ -1,4 +1,4 @@ +spec: https://w3c.github.io/presentation-api/ suggested_reviewers: - - louaybassbouss - tidoust - zqzhang diff --git a/tests/wpt/web-platform-tests/priority-hints/META.yml b/tests/wpt/web-platform-tests/priority-hints/META.yml index 9be346b975b..22a350d70de 100644 --- a/tests/wpt/web-platform-tests/priority-hints/META.yml +++ b/tests/wpt/web-platform-tests/priority-hints/META.yml @@ -1,2 +1,3 @@ +spec: https://wicg.github.io/priority-hints/ suggested_reviewers: - domfarolino diff --git a/tests/wpt/web-platform-tests/proximity/META.yml b/tests/wpt/web-platform-tests/proximity/META.yml index 057020d72d1..9b5ffbc27e6 100644 --- a/tests/wpt/web-platform-tests/proximity/META.yml +++ b/tests/wpt/web-platform-tests/proximity/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/proximity/ suggested_reviewers: - zqzhang - dontcallmedom diff --git a/tests/wpt/web-platform-tests/proximity/ProximitySensor-iframe-access.https.html b/tests/wpt/web-platform-tests/proximity/ProximitySensor-iframe-access.https.html new file mode 100644 index 00000000000..016ae48eb98 --- /dev/null +++ b/tests/wpt/web-platform-tests/proximity/ProximitySensor-iframe-access.https.html @@ -0,0 +1,14 @@ + + +ProximitySensor iframe test + + + + + + + +
+ diff --git a/tests/wpt/web-platform-tests/push-api/META.yml b/tests/wpt/web-platform-tests/push-api/META.yml index fe808bc6151..2f5a866d940 100644 --- a/tests/wpt/web-platform-tests/push-api/META.yml +++ b/tests/wpt/web-platform-tests/push-api/META.yml @@ -1,2 +1,3 @@ +spec: https://w3c.github.io/push-api/ suggested_reviewers: - beverloo diff --git a/tests/wpt/web-platform-tests/push-api/idlharness.https.any.js b/tests/wpt/web-platform-tests/push-api/idlharness.https.any.js index 17eb6101164..65f933d724e 100644 --- a/tests/wpt/web-platform-tests/push-api/idlharness.https.any.js +++ b/tests/wpt/web-platform-tests/push-api/idlharness.https.any.js @@ -5,13 +5,19 @@ // https://w3c.github.io/push-api/ promise_test(async () => { - const idl = await fetch('/interfaces/push-api.idl').then(r => r.text()); - const worker = await fetch('/interfaces/ServiceWorker.idl').then(r => r.text()); - const dom = await fetch('/interfaces/dom.idl').then(r => r.text()); + const srcs = [ + 'push-api', + 'service-workers', + 'dom', + 'html' + ]; + const [idl, worker, dom, html] = await Promise.all( + srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); const idl_array = new IdlArray(); idl_array.add_idls(idl); idl_array.add_dependency_idls(worker); idl_array.add_dependency_idls(dom); + idl_array.add_dependency_idls(html); idl_array.test(); }, 'push-api interfaces'); diff --git a/tests/wpt/web-platform-tests/quirks/META.yml b/tests/wpt/web-platform-tests/quirks/META.yml index d6731152017..29f19c5c6af 100644 --- a/tests/wpt/web-platform-tests/quirks/META.yml +++ b/tests/wpt/web-platform-tests/quirks/META.yml @@ -1,2 +1,3 @@ +spec: https://quirks.spec.whatwg.org/ suggested_reviewers: - zcorpan diff --git a/tests/wpt/web-platform-tests/referrer-policy/META.yml b/tests/wpt/web-platform-tests/referrer-policy/META.yml index 7e9d06b3449..a622289c056 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/META.yml +++ b/tests/wpt/web-platform-tests/referrer-policy/META.yml @@ -1,5 +1,5 @@ +spec: https://w3c.github.io/webappsec-referrer-policy/ suggested_reviewers: - estark37 - jeisinger - - kristijanburnik - domfarolino diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/referrer-policy-test-case.js b/tests/wpt/web-platform-tests/referrer-policy/generic/referrer-policy-test-case.js index 7c8cba41f4c..14ccd4e2de1 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/generic/referrer-policy-test-case.js +++ b/tests/wpt/web-platform-tests/referrer-policy/generic/referrer-policy-test-case.js @@ -72,7 +72,6 @@ function ReferrerPolicyTestCase(scenario, testDescription, sanityChecker) { _invokeSubresource: function(callback, test) { var invoker = subresourceInvoker[t._scenario.subresource]; - // Depending on the delivery method, extend the subresource element with // these attributes. var elementAttributesForDeliveryMethod = { diff --git a/tests/wpt/web-platform-tests/remote-playback/META.yml b/tests/wpt/web-platform-tests/remote-playback/META.yml index be6ef8b2910..c23f3bd9b8f 100644 --- a/tests/wpt/web-platform-tests/remote-playback/META.yml +++ b/tests/wpt/web-platform-tests/remote-playback/META.yml @@ -1,2 +1,3 @@ +spec: https://w3c.github.io/remote-playback/ suggested_reviewers: - mounirlamouri diff --git a/tests/wpt/web-platform-tests/remote-playback/idlharness.html b/tests/wpt/web-platform-tests/remote-playback/idlharness.html deleted file mode 100644 index 7220b156160..00000000000 --- a/tests/wpt/web-platform-tests/remote-playback/idlharness.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - -Remote Playback API IDL tests - - - - - - - -

Remote Playback API IDL tests

- - - -
- - diff --git a/tests/wpt/web-platform-tests/remote-playback/idlharness.window.js b/tests/wpt/web-platform-tests/remote-playback/idlharness.window.js new file mode 100644 index 00000000000..7309f8cc47a --- /dev/null +++ b/tests/wpt/web-platform-tests/remote-playback/idlharness.window.js @@ -0,0 +1,29 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js +// META: script=/common/media.js + +'use strict'; + +// https://w3c.github.io/remoteplayback/ + +idl_test( + ['remote-playback'], + ['html', 'dom'], + idl_array => { + try { + const media = document.createElement('video'); + media.src = getVideoURI('movie_5'); + media.width = media.height = 10; + document.body.appendChild(media); + self.media = media; + } catch (e) { + // Will be surfaced when media is undefined below. + } + + idl_array.add_objects({ + HTMLVideoElement: ['media'], + RemotePlayback: ['media.remote'] + }); + }, + 'remote-playback interfaces' +); diff --git a/tests/wpt/web-platform-tests/requestidlecallback/META.yml b/tests/wpt/web-platform-tests/requestidlecallback/META.yml index fa309e5e26e..9c829d3c888 100644 --- a/tests/wpt/web-platform-tests/requestidlecallback/META.yml +++ b/tests/wpt/web-platform-tests/requestidlecallback/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/requestidlecallback/ suggested_reviewers: - farre - rmcilroy diff --git a/tests/wpt/web-platform-tests/requestidlecallback/idlharness.html b/tests/wpt/web-platform-tests/requestidlecallback/idlharness.html deleted file mode 100644 index 459ce36ebb7..00000000000 --- a/tests/wpt/web-platform-tests/requestidlecallback/idlharness.html +++ /dev/null @@ -1,53 +0,0 @@ - - -idlharness test - - - - - - - -
-partial interface Window {
-  unsigned long requestIdleCallback(IdleRequestCallback callback,
-                                    optional IdleRequestOptions options);
-  void          cancelIdleCallback(unsigned long handle);
-};
-
-dictionary IdleRequestOptions {
-  unsigned long timeout;
-};
-
-[Exposed=Window] interface IdleDeadline {
-  DOMHighResTimeStamp timeRemaining();
-  readonly attribute boolean didTimeout;
-};
-
-callback IdleRequestCallback = void (IdleDeadline deadline);
-
- diff --git a/tests/wpt/web-platform-tests/requestidlecallback/idlharness.window.js b/tests/wpt/web-platform-tests/requestidlecallback/idlharness.window.js new file mode 100644 index 00000000000..2c9f6593208 --- /dev/null +++ b/tests/wpt/web-platform-tests/requestidlecallback/idlharness.window.js @@ -0,0 +1,30 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +async_test(function() { + const srcs = ['requestidlecallback', 'html', 'dom']; + Promise.all(srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))) + .then(([idl, html, dom]) => { + var idl_array = new IdlArray(); + idl_array.add_idls(idl); + idl_array.add_dependency_idls(html); + idl_array.add_dependency_idls(dom); + idl_array.add_objects({Window: ['window']}); + + let deadline; + const execIDLTest = this.step_func_done(function() { + idl_array.add_objects({IdleDeadline: [deadline]}); + idl_array.test(); + }); + + if (!window.requestIdleCallback) { + execIDLTest(); + } else { + const callback = this.step_func(d => { + deadline = d; + execIDLTest(); + }); + requestIdleCallback(callback, { timeout: 100 }); + } + }); +}, 'IdleDeadline object setup'); diff --git a/tests/wpt/web-platform-tests/resize-observer/META.yml b/tests/wpt/web-platform-tests/resize-observer/META.yml index 66193ed1a42..ef6685622b2 100644 --- a/tests/wpt/web-platform-tests/resize-observer/META.yml +++ b/tests/wpt/web-platform-tests/resize-observer/META.yml @@ -1,3 +1,4 @@ +spec: https://wicg.github.io/ResizeObserver/ suggested_reviewers: - atotic - dholbert diff --git a/tests/wpt/web-platform-tests/resource-timing/META.yml b/tests/wpt/web-platform-tests/resource-timing/META.yml index a78999baa62..a2ce7c48f50 100644 --- a/tests/wpt/web-platform-tests/resource-timing/META.yml +++ b/tests/wpt/web-platform-tests/resource-timing/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/resource-timing/ suggested_reviewers: - haoxli - plehegar diff --git a/tests/wpt/web-platform-tests/resources/META.yml b/tests/wpt/web-platform-tests/resources/META.yml index 32d71a45974..8f988f99a82 100644 --- a/tests/wpt/web-platform-tests/resources/META.yml +++ b/tests/wpt/web-platform-tests/resources/META.yml @@ -1,4 +1,3 @@ suggested_reviewers: - jgraham - gsnedders - - ayg diff --git a/tests/wpt/web-platform-tests/resources/idlharness.js b/tests/wpt/web-platform-tests/resources/idlharness.js index 773d55282c4..c20755fdb16 100644 --- a/tests/wpt/web-platform-tests/resources/idlharness.js +++ b/tests/wpt/web-platform-tests/resources/idlharness.js @@ -70,6 +70,11 @@ function constValue (cnt) function minOverloadLength(overloads) //@{ { + // "The value of the Function object’s “length” property is + // a Number determined as follows: + // ". . . + // "Return the length of the shortest argument list of the + // entries in S." if (!overloads.length) { return 0; } @@ -365,7 +370,8 @@ IdlArray.prototype.internal_add_idls = function(parsed_idls, options) parsed_idls.forEach(function(parsed_idl) { - if (parsed_idl.partial && ["interface", "dictionary"].includes(parsed_idl.type)) + if (parsed_idl.partial + && ["interface", "dictionary", "namespace"].includes(parsed_idl.type)) { if (should_skip(parsed_idl.name)) { @@ -459,6 +465,10 @@ IdlArray.prototype.internal_add_idls = function(parsed_idls, options) new IdlInterface(parsed_idl, /* is_callback = */ true, /* is_mixin = */ false); break; + case "namespace": + this.members[parsed_idl.name] = new IdlNamespace(parsed_idl); + break; + default: throw parsed_idl.name + ": " + parsed_idl.type + " not yet supported"; } @@ -845,7 +855,8 @@ IdlArray.prototype.collapse_partials = function() { const originalExists = parsed_idl.name in this.members && (this.members[parsed_idl.name] instanceof IdlInterface - || this.members[parsed_idl.name] instanceof IdlDictionary); + || this.members[parsed_idl.name] instanceof IdlDictionary + || this.members[parsed_idl.name] instanceof IdlNamespace); let partialTestName = parsed_idl.name; if (!parsed_idl.untested) { @@ -2255,15 +2266,13 @@ IdlInterface.prototype.do_member_operation_asserts = function(memberHolderObject // behavior is as follows . . ." assert_equals(typeof memberHolderObject[member.name], "function", "property must be a function"); - // "The value of the Function object’s “length” property is - // a Number determined as follows: - // ". . . - // "Return the length of the shortest argument list of the - // entries in S." - assert_equals(memberHolderObject[member.name].length, - minOverloadLength(this.members.filter(function(m) { - return m.type == "operation" && m.name == member.name; - })), + + const ctors = this.members.filter(function(m) { + return m.type == "operation" && m.name == member.name; + }); + assert_equals( + memberHolderObject[member.name].length, + minOverloadLength(ctors), "property has wrong .length"); // Make some suitable arguments @@ -3012,5 +3021,174 @@ function IdlTypedef(obj) IdlTypedef.prototype = Object.create(IdlObject.prototype); +/// IdlNamespace /// +function IdlNamespace(obj) +//@{ +{ + this.name = obj.name; + this.extAttrs = obj.extAttrs; + this.untested = obj.untested; + /** A back-reference to our IdlArray. */ + this.array = obj.array; + + /** An array of IdlInterfaceMembers. */ + this.members = obj.members.map(m => new IdlInterfaceMember(m)); +} +//@} + +IdlNamespace.prototype = Object.create(IdlObject.prototype); + +IdlNamespace.prototype.do_member_operation_asserts = function (memberHolderObject, member, a_test) +//@{ +{ + var desc = Object.getOwnPropertyDescriptor(memberHolderObject, member.name); + + assert_false("get" in desc, "property should not have a getter"); + assert_false("set" in desc, "property should not have a setter"); + assert_equals( + desc.writable, + !member.isUnforgeable, + "property should be writable if and only if not unforgeable"); + assert_true(desc.enumerable, "property should be enumerable"); + assert_equals( + desc.configurable, + !member.isUnforgeable, + "property should be configurable if and only if not unforgeable"); + + assert_equals( + typeof memberHolderObject[member.name], + "function", + "property must be a function"); + + assert_equals( + memberHolderObject[member.name].length, + minOverloadLength(this.members.filter(function(m) { + return m.type == "operation" && m.name == member.name; + })), + "operation has wrong .length"); + a_test.done(); +} +//@} + +IdlNamespace.prototype.test_member_operation = function(member) +//@{ +{ + if (!shouldRunSubTest(this.name)) { + return; + } + var args = member.arguments.map(function(a) { + var s = a.idlType.idlType; + if (a.variadic) { + s += '...'; + } + return s; + }).join(", "); + var a_test = subsetTestByKey( + this.name, + async_test, + this.name + ' namespace: operation ' + member.name + '(' + args + ')'); + a_test.step(function() { + assert_own_property( + self[this.name], + member.name, + 'namespace object missing operation ' + format_value(member.name)); + + this.do_member_operation_asserts(self[this.name], member, a_test); + }.bind(this)); +}; +//@} + +IdlNamespace.prototype.test_member_attribute = function (member) +//@{ +{ + if (!shouldRunSubTest(this.name)) { + return; + } + var a_test = subsetTestByKey( + this.name, + async_test, + this.name + ' namespace: attribute ' + member.name); + a_test.step(function() + { + assert_own_property( + self[this.name], + member.name, + this.name + ' does not have property ' + format_value(member.name)); + + var desc = Object.getOwnPropertyDescriptor(self[this.name], member.name); + assert_equals(desc.set, undefined, "setter must be undefined for namespace members"); + a_test.done(); + }.bind(this)); +}; +//@} + +IdlNamespace.prototype.test = function () +//@{ +{ + /** + * TODO(lukebjerring): Assert: + * - "Note that unlike interfaces or dictionaries, namespaces do not create types." + * - "Of the extended attributes defined in this specification, only the + * [Exposed] and [SecureContext] extended attributes are applicable to namespaces." + * - "Namespaces must be annotated with the [Exposed] extended attribute." + */ + + for (const v of Object.values(this.members)) { + switch (v.type) { + + case 'operation': + this.test_member_operation(v); + break; + + case 'attribute': + this.test_member_attribute(v); + break; + + default: + throw 'Invalid namespace member ' + v.name + ': ' + v.type + ' not supported'; + } + }; +}; +//@} + }()); + +/** + * idl_test is a promise_test wrapper that handles the fetching of the IDL, + * avoiding repetitive boilerplate. + * + * @param {String|String[]} srcs Spec name(s) for source idl files (fetched from + * /interfaces/{name}.idl). + * @param {String|String[]} deps Spec name(s) for dependency idl files (fetched + * from /interfaces/{name}.idl). Order is important - dependencies from + * each source will only be included if they're already know to be a + * dependency (i.e. have already been seen). + * @param {Function} setup_func Function for extra setup of the idl_array, such + * as adding objects. Do not call idl_array.test() in the setup; it is + * called by this function (idl_test). + */ +function idl_test(srcs, deps, setup_func, test_name) { + return promise_test(function (t) { + var idl_array = new IdlArray(); + srcs = (srcs instanceof Array) ? srcs : [srcs] || []; + deps = (deps instanceof Array) ? deps : [deps] || []; + return Promise.all( + srcs.concat(deps).map(function(i) { + return fetch('/interfaces/' + i + '.idl').then(function(r) { + return r.text(); + }); + })).then(function(idls) { + for (var i = 0; i < srcs.length; i++) { + idl_array.add_idls(idls[i]); + } + for (var i = srcs.length; i < srcs.length + deps.length; i++) { + idl_array.add_dependency_idls(idls[i]); + } + if (setup_func) { + setup_func(idl_array) + }; + idl_array.test(); + }); + }, test_name); +} // vim: set expandtab shiftwidth=4 tabstop=4 foldmarker=@{,@} foldmethod=marker: diff --git a/tests/wpt/web-platform-tests/resources/test/tests/functional/idlharness/IdlNamespace/test_attribute.html b/tests/wpt/web-platform-tests/resources/test/tests/functional/idlharness/IdlNamespace/test_attribute.html new file mode 100644 index 00000000000..8c1f5172165 --- /dev/null +++ b/tests/wpt/web-platform-tests/resources/test/tests/functional/idlharness/IdlNamespace/test_attribute.html @@ -0,0 +1,55 @@ + + + + + + + idlharness: namespace attribute + + + + + + + +

Verify the series of sub-tests that are executed for namespace attributes.

+ + + + diff --git a/tests/wpt/web-platform-tests/resources/test/tests/functional/idlharness/IdlNamespace/test_operation.html b/tests/wpt/web-platform-tests/resources/test/tests/functional/idlharness/IdlNamespace/test_operation.html new file mode 100644 index 00000000000..671cd9e09f5 --- /dev/null +++ b/tests/wpt/web-platform-tests/resources/test/tests/functional/idlharness/IdlNamespace/test_operation.html @@ -0,0 +1,99 @@ + + + + + + + idlharness: namespace operation + + + + + + + +

Verify the series of sub-tests that are executed for namespace operations.

+ + + + diff --git a/tests/wpt/web-platform-tests/resources/test/tests/functional/idlharness/IdlNamespace/test_partial_namespace.html b/tests/wpt/web-platform-tests/resources/test/tests/functional/idlharness/IdlNamespace/test_partial_namespace.html new file mode 100644 index 00000000000..0420db161d1 --- /dev/null +++ b/tests/wpt/web-platform-tests/resources/test/tests/functional/idlharness/IdlNamespace/test_partial_namespace.html @@ -0,0 +1,113 @@ + + + + + + + + idlharness: Partial namespace + + + + + + + + +

Verify the series of sub-tests that are executed for "partial" namespace objects.

+ + + + + diff --git a/tests/wpt/web-platform-tests/resources/test/tests/functional/worker-dedicated-uncaught-single.html b/tests/wpt/web-platform-tests/resources/test/tests/functional/worker-dedicated-uncaught-single.html new file mode 100644 index 00000000000..760151832e8 --- /dev/null +++ b/tests/wpt/web-platform-tests/resources/test/tests/functional/worker-dedicated-uncaught-single.html @@ -0,0 +1,59 @@ + + + + + +Dedicated Worker Tests - Uncaught Exception in Single-Page Test + + + + + +

Dedicated Web Worker Tests - Uncaught Exception in Single-Page Test

+

Demonstrates running testharness based tests inside a dedicated web worker. +

The test harness is expected to pass despite an uncaught exception in a worker because that worker is a single-page test.

+
+ + + + diff --git a/tests/wpt/web-platform-tests/resources/test/tests/functional/worker-dedicated.html b/tests/wpt/web-platform-tests/resources/test/tests/functional/worker-dedicated.html index 2edb60b4507..a790a1520ce 100644 --- a/tests/wpt/web-platform-tests/resources/test/tests/functional/worker-dedicated.html +++ b/tests/wpt/web-platform-tests/resources/test/tests/functional/worker-dedicated.html @@ -48,12 +48,6 @@ test(function(t) { "properties": {}, "message": null }, - { - "status_string": "FAIL", - "name": "worker-error", - "properties": {}, - "message": "Error: This failure is expected." - }, { "status_string": "PASS", "name": "Worker async_test that completes successfully", @@ -66,6 +60,12 @@ test(function(t) { "properties": {}, "message": null }, + { + "status_string": "PASS", + "name": "worker test that completes successfully before exception", + "properties": {}, + "message": null + }, { "status_string": "NOTRUN", "name": "Worker test that doesn't run ('NOT RUN')", diff --git a/tests/wpt/web-platform-tests/resources/test/tests/functional/worker-error.js b/tests/wpt/web-platform-tests/resources/test/tests/functional/worker-error.js index 8ef2d22d241..7b89602f04b 100644 --- a/tests/wpt/web-platform-tests/resources/test/tests/functional/worker-error.js +++ b/tests/wpt/web-platform-tests/resources/test/tests/functional/worker-error.js @@ -1,3 +1,8 @@ importScripts("/resources/testharness.js"); +// The following sub-test ensures that the worker is not interpreted as a +// single-page test. The subsequent uncaught exception should therefore be +// interpreted as a harness error rather than a single-page test failure. +test(function() {}, "worker test that completes successfully before exception"); + throw new Error("This failure is expected."); diff --git a/tests/wpt/web-platform-tests/resources/test/tests/functional/worker-uncaught-single.js b/tests/wpt/web-platform-tests/resources/test/tests/functional/worker-uncaught-single.js new file mode 100644 index 00000000000..d7f00382c0b --- /dev/null +++ b/tests/wpt/web-platform-tests/resources/test/tests/functional/worker-uncaught-single.js @@ -0,0 +1,6 @@ +importScripts("/resources/testharness.js"); + +// Because this script does not define any sub-tests, it should be interpreted +// as a single-page test, and the uncaught exception should be reported as a +// test failure (harness status: OK). +throw new Error("This failure is expected."); diff --git a/tests/wpt/web-platform-tests/resources/testdriver.js b/tests/wpt/web-platform-tests/resources/testdriver.js index bc866368bef..c9231d9e313 100644 --- a/tests/wpt/web-platform-tests/resources/testdriver.js +++ b/tests/wpt/web-platform-tests/resources/testdriver.js @@ -1,5 +1,6 @@ (function() { "use strict"; + var idCounter = 0; function getInViewCenterPoint(rect) { var left = Math.max(0, rect.left); @@ -46,6 +47,41 @@ * @namespace */ window.test_driver = { + /** + * Trigger user interaction in order to grant additional privileges to + * a provided function. + * + * https://html.spec.whatwg.org/#triggered-by-user-activation + * + * @param {String} intent - a description of the action which much be + * triggered by user interaction + * @param {Function} action - code requiring escalated privileges + * + * @returns {Promise} fulfilled following user interaction and + * execution of the provided `action` function; + * rejected if interaction fails or the provided + * function throws an error + */ + bless: function(intent, action) { + var button = document.createElement("button"); + button.innerHTML = "This test requires user interaction.
" + + "Please click here to allow " + intent + "."; + button.id = "wpt-test-driver-bless-" + (idCounter += 1); + document.body.appendChild(button); + + return new Promise(function(resolve, reject) { + button.addEventListener("click", resolve); + + test_driver.click(button).catch(reject); + }).then(function() { + button.remove(); + + if (typeof action === "function") { + return action(); + } + }); + }, + /** * Triggers a user-initiated click * diff --git a/tests/wpt/web-platform-tests/resources/testharness.js b/tests/wpt/web-platform-tests/resources/testharness.js index 54379c665a8..fdd9820b2a3 100644 --- a/tests/wpt/web-platform-tests/resources/testharness.js +++ b/tests/wpt/web-platform-tests/resources/testharness.js @@ -1833,6 +1833,15 @@ policies and contribution forms [3]. } this.message_target.removeEventListener("message", this.message_handler); this.running = false; + + // If remote context is cross origin assigning to onerror is not + // possible, so silently catch those errors. + try { + this.remote.onerror = null; + } catch (e) { + // Ignore. + } + this.remote = null; this.message_target = null; if (this.doneResolve) { diff --git a/tests/wpt/web-platform-tests/screen-orientation/META.yml b/tests/wpt/web-platform-tests/screen-orientation/META.yml index 9104650127a..dc3f290196f 100644 --- a/tests/wpt/web-platform-tests/screen-orientation/META.yml +++ b/tests/wpt/web-platform-tests/screen-orientation/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/screen-orientation/ suggested_reviewers: - haoxli - marcoscaceres diff --git a/tests/wpt/web-platform-tests/screen-orientation/idlharness.window.js b/tests/wpt/web-platform-tests/screen-orientation/idlharness.window.js new file mode 100644 index 00000000000..d4b80de3b2d --- /dev/null +++ b/tests/wpt/web-platform-tests/screen-orientation/idlharness.window.js @@ -0,0 +1,18 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +// https://w3c.github.io/screen-orientation/ + +idl_test( + ['screen-orientation'], + ['dom', 'cssom-view', 'html'], + idl_array => { + idl_array.add_objects({ + Screen: ['screen'], + ScreenOrientation: ['screen.orientation'] + }); + }, + 'Test IDL implementation of Screen Orientation API' +); diff --git a/tests/wpt/web-platform-tests/screen-orientation/interfaces.html b/tests/wpt/web-platform-tests/screen-orientation/interfaces.html deleted file mode 100644 index 26d46ae537b..00000000000 --- a/tests/wpt/web-platform-tests/screen-orientation/interfaces.html +++ /dev/null @@ -1,28 +0,0 @@ - - -Screen Orientation API IDL tests - - - - - - diff --git a/tests/wpt/web-platform-tests/scroll-animations/META.yml b/tests/wpt/web-platform-tests/scroll-animations/META.yml index 1ab5f042814..0123b6b0e33 100644 --- a/tests/wpt/web-platform-tests/scroll-animations/META.yml +++ b/tests/wpt/web-platform-tests/scroll-animations/META.yml @@ -1,3 +1,4 @@ +spec: https://wicg.github.io/scroll-animations/ suggested_reviewers: - birtles - theres-waldo diff --git a/tests/wpt/web-platform-tests/secure-contexts/META.yml b/tests/wpt/web-platform-tests/secure-contexts/META.yml index d0743949b6a..e6537166280 100644 --- a/tests/wpt/web-platform-tests/secure-contexts/META.yml +++ b/tests/wpt/web-platform-tests/secure-contexts/META.yml @@ -1,2 +1,3 @@ +spec: https://w3c.github.io/webappsec-secure-contexts/ suggested_reviewers: - mikewest diff --git a/tests/wpt/web-platform-tests/selection/META.yml b/tests/wpt/web-platform-tests/selection/META.yml index a70815bb400..efe4ede48fe 100644 --- a/tests/wpt/web-platform-tests/selection/META.yml +++ b/tests/wpt/web-platform-tests/selection/META.yml @@ -1,2 +1,3 @@ +spec: https://w3c.github.io/selection-api/ suggested_reviewers: - - ayg + - rniwa diff --git a/tests/wpt/web-platform-tests/server-timing/META.yml b/tests/wpt/web-platform-tests/server-timing/META.yml index 64c8cfa90dc..ca2c218d8de 100644 --- a/tests/wpt/web-platform-tests/server-timing/META.yml +++ b/tests/wpt/web-platform-tests/server-timing/META.yml @@ -1,2 +1,3 @@ +spec: https://w3c.github.io/server-timing/ suggested_reviewers: - igrigorik diff --git a/tests/wpt/web-platform-tests/service-workers/META.yml b/tests/wpt/web-platform-tests/service-workers/META.yml index 0796e14ccd1..03a0dd0fe16 100644 --- a/tests/wpt/web-platform-tests/service-workers/META.yml +++ b/tests/wpt/web-platform-tests/service-workers/META.yml @@ -1,6 +1,6 @@ +spec: https://w3c.github.io/ServiceWorker/ suggested_reviewers: - asutherland - - beidson - mkruisselbrink - mattto - wanderview diff --git a/tests/wpt/web-platform-tests/service-workers/cache-storage/script-tests/cache-storage-match.js b/tests/wpt/web-platform-tests/service-workers/cache-storage/script-tests/cache-storage-match.js index 35465204864..54be7e7b5d7 100644 --- a/tests/wpt/web-platform-tests/service-workers/cache-storage/script-tests/cache-storage-match.js +++ b/tests/wpt/web-platform-tests/service-workers/cache-storage/script-tests/cache-storage-match.js @@ -117,7 +117,10 @@ promise_test(function(test) { promise_test(function(test) { var transaction = create_unique_transaction(); - return self.caches.has('foo') + return self.caches.delete('foo') + .then(function() { + return self.caches.has('foo'); + }) .then(function(has_foo) { assert_false(has_foo, "The cache should not exist."); return self.caches.match(transaction.request, {cacheName: 'foo'}); diff --git a/tests/wpt/web-platform-tests/service-workers/service-worker/claim-worker-fetch.https.html b/tests/wpt/web-platform-tests/service-workers/service-worker/claim-worker-fetch.https.html index 2bc65368e8f..c2c254ca65c 100644 --- a/tests/wpt/web-platform-tests/service-workers/service-worker/claim-worker-fetch.https.html +++ b/tests/wpt/web-platform-tests/service-workers/service-worker/claim-worker-fetch.https.html @@ -8,16 +8,26 @@ diff --git a/tests/wpt/web-platform-tests/service-workers/service-worker/fetch-event.https.html b/tests/wpt/web-platform-tests/service-workers/service-worker/fetch-event.https.html index ecb1c142231..78e099b8b55 100644 --- a/tests/wpt/web-platform-tests/service-workers/service-worker/fetch-event.https.html +++ b/tests/wpt/web-platform-tests/service-workers/service-worker/fetch-event.https.html @@ -1,4 +1,5 @@ + diff --git a/tests/wpt/web-platform-tests/service-workers/service-worker/interfaces-window.https.html b/tests/wpt/web-platform-tests/service-workers/service-worker/interfaces-window.https.html index 54f83f202c3..8786b29d77e 100644 --- a/tests/wpt/web-platform-tests/service-workers/service-worker/interfaces-window.https.html +++ b/tests/wpt/web-platform-tests/service-workers/service-worker/interfaces-window.https.html @@ -10,12 +10,12 @@ 'use strict'; promise_test(async (t) => { - var idlArray = new IdlArray(); - const dom = await fetch('/interfaces/dom.idl').then(r => r.text()); - const serviceWorkerIdl = await fetch('/interfaces/ServiceWorker.idl').then(r => r.text()); + const srcs = ['dom', 'service-workers']; + const [dom, serviceWorkerIdl] = await Promise.all( + srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); + var idlArray = new IdlArray(); idlArray.add_untested_idls(idls.untested); - idlArray.add_untested_idls(dom, { only: ['EventTarget'] }); idlArray.add_idls(serviceWorkerIdl, { only: [ 'ServiceWorkerGlobalScope', 'Client', @@ -30,6 +30,7 @@ promise_test(async (t) => { 'Cache', 'CacheStorage', ]}); + idlArray.add_dependency_idls(dom); idlArray.add_objects({ ServiceWorkerContainer: ['navigator.serviceWorker'] }); diff --git a/tests/wpt/web-platform-tests/service-workers/service-worker/resources/claim-nested-worker-fetch-iframe.html b/tests/wpt/web-platform-tests/service-workers/service-worker/resources/claim-nested-worker-fetch-iframe.html new file mode 100644 index 00000000000..2fa15db61d9 --- /dev/null +++ b/tests/wpt/web-platform-tests/service-workers/service-worker/resources/claim-nested-worker-fetch-iframe.html @@ -0,0 +1,16 @@ + + diff --git a/tests/wpt/web-platform-tests/service-workers/service-worker/resources/claim-nested-worker-fetch-parent-worker.js b/tests/wpt/web-platform-tests/service-workers/service-worker/resources/claim-nested-worker-fetch-parent-worker.js new file mode 100644 index 00000000000..f5ff7c234b4 --- /dev/null +++ b/tests/wpt/web-platform-tests/service-workers/service-worker/resources/claim-nested-worker-fetch-parent-worker.js @@ -0,0 +1,12 @@ +try { + var worker = new Worker('./claim-worker-fetch-worker.js'); + + self.onmessage = (event) => { + worker.postMessage(event.data); + } + worker.onmessage = (event) => { + self.postMessage(event.data); + }; +} catch (e) { + self.postMessage("Fail: " + e.data); +} diff --git a/tests/wpt/web-platform-tests/service-workers/service-worker/resources/interfaces-worker.sub.js b/tests/wpt/web-platform-tests/service-workers/service-worker/resources/interfaces-worker.sub.js index 29c859bb914..606ec072d36 100644 --- a/tests/wpt/web-platform-tests/service-workers/service-worker/resources/interfaces-worker.sub.js +++ b/tests/wpt/web-platform-tests/service-workers/service-worker/resources/interfaces-worker.sub.js @@ -6,12 +6,12 @@ importScripts('/resources/WebIDLParser.js'); importScripts('/resources/idlharness.js'); promise_test(async (t) => { - var idlArray = new IdlArray(); - const dom = await fetch('/interfaces/dom.idl').then(r => r.text()); - const serviceWorkerIdl = await fetch('/interfaces/ServiceWorker.idl').then(r => r.text()); + const srcs = ['dom', 'service-workers']; + const [dom, serviceWorkerIdl] = await Promise.all( + srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); + var idlArray = new IdlArray(); idlArray.add_untested_idls(idls.untested); - idlArray.add_untested_idls(dom, { only: ['EventTarget'] }); idlArray.add_idls(serviceWorkerIdl, { only: [ 'ServiceWorkerGlobalScope', 'Client', @@ -26,6 +26,7 @@ promise_test(async (t) => { 'Cache', 'CacheStorage', ]}); + idlArray.add_dependency_idls(dom); idlArray.add_objects({ ServiceWorkerGlobalScope: ['self'], Clients: ['self.clients'], diff --git a/tests/wpt/web-platform-tests/service-workers/service-worker/resources/nested_load_worker.js b/tests/wpt/web-platform-tests/service-workers/service-worker/resources/nested_load_worker.js new file mode 100644 index 00000000000..6e2e9edc4d8 --- /dev/null +++ b/tests/wpt/web-platform-tests/service-workers/service-worker/resources/nested_load_worker.js @@ -0,0 +1,9 @@ +var worker = new Worker("load_worker.js"); + +self.onmessage = function (evt) { + worker.postMessage(evt.data); +}; + +worker.onmessage = function (evt) { + self.postMessage(evt.data); +} diff --git a/tests/wpt/web-platform-tests/service-workers/service-worker/resources/worker-interception-iframe.https.html b/tests/wpt/web-platform-tests/service-workers/service-worker/resources/worker-interception-iframe.https.html index e89b38691cd..ab10a078f3d 100644 --- a/tests/wpt/web-platform-tests/service-workers/service-worker/resources/worker-interception-iframe.https.html +++ b/tests/wpt/web-platform-tests/service-workers/service-worker/resources/worker-interception-iframe.https.html @@ -3,9 +3,9 @@ diff --git a/tests/wpt/web-platform-tests/shadow-dom/META.yml b/tests/wpt/web-platform-tests/shadow-dom/META.yml index 77213876cba..8fb0a9b995d 100644 --- a/tests/wpt/web-platform-tests/shadow-dom/META.yml +++ b/tests/wpt/web-platform-tests/shadow-dom/META.yml @@ -1,3 +1,4 @@ +spec: https://dom.spec.whatwg.org/#shadow-trees suggested_reviewers: - kojiishi - rniwa diff --git a/tests/wpt/web-platform-tests/shadow-dom/getElementById-dynamic-001.html b/tests/wpt/web-platform-tests/shadow-dom/getElementById-dynamic-001.html new file mode 100644 index 00000000000..c2acda2a9c7 --- /dev/null +++ b/tests/wpt/web-platform-tests/shadow-dom/getElementById-dynamic-001.html @@ -0,0 +1,23 @@ + +Shadow DOM: ShadowRoot.getElementById in shadow trees keeps working after host is removed from tree + + + + + +
+ diff --git a/tests/wpt/web-platform-tests/shadow-dom/untriaged/events/event-dispatch/test-003.html b/tests/wpt/web-platform-tests/shadow-dom/untriaged/events/event-dispatch/test-003.html index 78b76de7dd0..20c00318c23 100644 --- a/tests/wpt/web-platform-tests/shadow-dom/untriaged/events/event-dispatch/test-003.html +++ b/tests/wpt/web-platform-tests/shadow-dom/untriaged/events/event-dispatch/test-003.html @@ -45,6 +45,7 @@ A_05_05_03_T01.step(unit(function (ctx) { s.appendChild(input2); input1.addEventListener('focusin', A_05_05_03_T01.step_func(function(event) { + assert_equals(event.composed, true); assert_equals(event.composedPath().length, 7); assert_equals(event.composedPath()[0].id, 'input1'); assert_equals(event.composedPath()[1].id, 'shadow'); @@ -55,6 +56,10 @@ A_05_05_03_T01.step(unit(function (ctx) { assert_equals(event.composedPath()[6], ctx.iframes[0].contentWindow); }), false); + input1.addEventListener('focusout', A_05_05_03_T01.step_func(function(event) { + assert_equals(event.composed, true); + }), false); + input2.addEventListener('focusin', A_05_05_03_T01.step_func(function(event) { assert_equals(event.composedPath().length, 2); assert_equals(event.composedPath()[0].id, 'input2'); diff --git a/tests/wpt/web-platform-tests/shape-detection/META.yml b/tests/wpt/web-platform-tests/shape-detection/META.yml index 95fdd2ba4f3..77546240476 100644 --- a/tests/wpt/web-platform-tests/shape-detection/META.yml +++ b/tests/wpt/web-platform-tests/shape-detection/META.yml @@ -1,2 +1,3 @@ +spec: https://wicg.github.io/shape-detection-api/ suggested_reviewers: - yellowdoge diff --git a/tests/wpt/web-platform-tests/speech-api/META.yml b/tests/wpt/web-platform-tests/speech-api/META.yml index 6855735c828..17263d91d36 100644 --- a/tests/wpt/web-platform-tests/speech-api/META.yml +++ b/tests/wpt/web-platform-tests/speech-api/META.yml @@ -1,5 +1,4 @@ +spec: https://w3c.github.io/speech-api/ suggested_reviewers: - andrenatal - - fleizach - gshires - - jdsmith3000 diff --git a/tests/wpt/web-platform-tests/storage/META.yml b/tests/wpt/web-platform-tests/storage/META.yml index 2e9eba95d7d..2aad1fb5137 100644 --- a/tests/wpt/web-platform-tests/storage/META.yml +++ b/tests/wpt/web-platform-tests/storage/META.yml @@ -1,3 +1,4 @@ +spec: https://storage.spec.whatwg.org/ suggested_reviewers: - annevk - inexorabletash diff --git a/tests/wpt/web-platform-tests/streams/META.yml b/tests/wpt/web-platform-tests/streams/META.yml index 1c2f3e0134f..108c774fae6 100644 --- a/tests/wpt/web-platform-tests/streams/META.yml +++ b/tests/wpt/web-platform-tests/streams/META.yml @@ -1,6 +1,6 @@ +spec: https://streams.spec.whatwg.org/ suggested_reviewers: - domenic - - tyoshino - yutakahirano - youennf - calvaris diff --git a/tests/wpt/web-platform-tests/streams/piping/close-propagation-forward.js b/tests/wpt/web-platform-tests/streams/piping/close-propagation-forward.js index 0f0b7bb1a35..9b1546d80c5 100644 --- a/tests/wpt/web-platform-tests/streams/piping/close-propagation-forward.js +++ b/tests/wpt/web-platform-tests/streams/piping/close-propagation-forward.js @@ -559,4 +559,36 @@ promise_test(() => { }, 'Closing must be propagated forward: shutdown must not occur until the final write completes; becomes closed after first write; preventClose = true'); + +promise_test(t => { + const rs = recordingReadableStream({ + start(c) { + c.enqueue('a'); + c.enqueue('b'); + c.close(); + } + }); + let rejectWritePromise; + const ws = recordingWritableStream({ + write() { + return new Promise((resolve, reject) => { + rejectWritePromise = reject; + }); + } + }, { highWaterMark: 3 }); + const pipeToPromise = rs.pipeTo(ws); + return delay(0).then(() => { + rejectWritePromise(error1); + return promise_rejects(t, error1, pipeToPromise, 'pipeTo should reject'); + }).then(() => { + assert_array_equals(rs.events, []); + assert_array_equals(ws.events, ['write', 'a']); + + return Promise.all([ + rs.getReader().closed, + promise_rejects(t, error1, ws.getWriter().closed, 'ws should be errored') + ]); + }); +}, 'Closing must be propagated forward: erroring the writable while flushing pending writes should error pipeTo'); + done(); diff --git a/tests/wpt/web-platform-tests/streams/piping/then-interception.dedicatedworker.html b/tests/wpt/web-platform-tests/streams/piping/then-interception.dedicatedworker.html new file mode 100644 index 00000000000..88590761641 --- /dev/null +++ b/tests/wpt/web-platform-tests/streams/piping/then-interception.dedicatedworker.html @@ -0,0 +1,11 @@ + + +then-interception.js dedicated worker wrapper file + + + + + diff --git a/tests/wpt/web-platform-tests/streams/piping/then-interception.html b/tests/wpt/web-platform-tests/streams/piping/then-interception.html new file mode 100644 index 00000000000..156d3a49f7b --- /dev/null +++ b/tests/wpt/web-platform-tests/streams/piping/then-interception.html @@ -0,0 +1,11 @@ + + +then-interception.js browser context wrapper file + + + + + + + + diff --git a/tests/wpt/web-platform-tests/streams/piping/then-interception.js b/tests/wpt/web-platform-tests/streams/piping/then-interception.js new file mode 100644 index 00000000000..2c4fd54b91d --- /dev/null +++ b/tests/wpt/web-platform-tests/streams/piping/then-interception.js @@ -0,0 +1,64 @@ +'use strict'; + +if (self.importScripts) { + self.importScripts('/resources/testharness.js'); + self.importScripts('../resources/test-utils.js'); + self.importScripts('../resources/recording-streams.js'); +} + +function interceptThen() { + const intercepted = []; + const callCount = 0; + Object.prototype.then = function(resolver) { + if (!this.done) { + intercepted.push(this.value); + } + const retval = Object.create(null); + retval.done = ++callCount === 3; + retval.value = callCount; + resolver(retval); + if (retval.done) { + delete Object.prototype.then; + } + } + return intercepted; +} + +promise_test(async () => { + const rs = new ReadableStream({ + start(controller) { + controller.enqueue('a'); + controller.close(); + } + }); + const ws = recordingWritableStream(); + + const intercepted = interceptThen(); + + await rs.pipeTo(ws); + + assert_array_equals(intercepted, [], 'nothing should have been intercepted'); + assert_array_equals(ws.events, ['write', 'a', 'close'], 'written chunk should be "a"'); +}, 'piping should not be observable'); + +promise_test(async () => { + const rs = new ReadableStream({ + start(controller) { + controller.enqueue('a'); + controller.close(); + } + }); + const ws = recordingWritableStream(); + + const [ branch1, branch2 ] = rs.tee(); + + const intercepted = interceptThen(); + + await branch1.pipeTo(ws); + branch2.cancel(); + + assert_array_equals(intercepted, [], 'nothing should have been intercepted'); + assert_array_equals(ws.events, ['write', 'a', 'close'], 'written chunk should be "a"'); +}, 'tee should not be observable'); + +done(); diff --git a/tests/wpt/web-platform-tests/streams/piping/then-interception.serviceworker.https.html b/tests/wpt/web-platform-tests/streams/piping/then-interception.serviceworker.https.html new file mode 100644 index 00000000000..d12f6e16081 --- /dev/null +++ b/tests/wpt/web-platform-tests/streams/piping/then-interception.serviceworker.https.html @@ -0,0 +1,12 @@ + + +then-interception.js service worker wrapper file + + + + + + diff --git a/tests/wpt/web-platform-tests/streams/piping/then-interception.sharedworker.html b/tests/wpt/web-platform-tests/streams/piping/then-interception.sharedworker.html new file mode 100644 index 00000000000..bc28427450d --- /dev/null +++ b/tests/wpt/web-platform-tests/streams/piping/then-interception.sharedworker.html @@ -0,0 +1,11 @@ + + +then-interception.js shared worker wrapper file + + + + + diff --git a/tests/wpt/web-platform-tests/subresource-integrity/META.yml b/tests/wpt/web-platform-tests/subresource-integrity/META.yml index a2b76edeba7..740ad1412f6 100644 --- a/tests/wpt/web-platform-tests/subresource-integrity/META.yml +++ b/tests/wpt/web-platform-tests/subresource-integrity/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/webappsec-subresource-integrity/ suggested_reviewers: - metromoxie - fmarier diff --git a/tests/wpt/web-platform-tests/subresource-integrity/idlharness.window.js b/tests/wpt/web-platform-tests/subresource-integrity/idlharness.window.js index a1ea4097557..d4a6efda476 100644 --- a/tests/wpt/web-platform-tests/subresource-integrity/idlharness.window.js +++ b/tests/wpt/web-platform-tests/subresource-integrity/idlharness.window.js @@ -5,19 +5,13 @@ 'use strict'; -promise_test(async () => { - const srcs = ['webappsec-subresource-integrity', 'html', 'dom', 'cssom']; - const [idl, html, dom, cssom] = await Promise.all( - srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); - - const idl_array = new IdlArray(); - idl_array.add_idls(idl); - idl_array.add_dependency_idls(html); - idl_array.add_dependency_idls(dom); - idl_array.add_dependency_idls(cssom); - idl_array.add_objects({ - HTMLScriptElement: ['document.createElement("script")'], - HTMLLinkElement: ['document.createElement("link")'], - }); - idl_array.test(); -}, 'webappsec-subresource-integrity interfaces'); +idl_test( + ['SRI'], + ['html', 'dom', 'cssom'], + idl_array => { + idl_array.add_objects({ + HTMLScriptElement: ['document.createElement("script")'], + HTMLLinkElement: ['document.createElement("link")'], + }); + }, + 'webappsec-subresource-integrity interfaces'); diff --git a/tests/wpt/web-platform-tests/svg-aam/META.yml b/tests/wpt/web-platform-tests/svg-aam/META.yml index a157432430e..3fe0e0e9045 100644 --- a/tests/wpt/web-platform-tests/svg-aam/META.yml +++ b/tests/wpt/web-platform-tests/svg-aam/META.yml @@ -1,2 +1,3 @@ +spec: https://w3c.github.io/svg-aam/ suggested_reviewers: - halindrome diff --git a/tests/wpt/web-platform-tests/svg/META.yml b/tests/wpt/web-platform-tests/svg/META.yml index cc6bf2dcef1..09ef583b72d 100644 --- a/tests/wpt/web-platform-tests/svg/META.yml +++ b/tests/wpt/web-platform-tests/svg/META.yml @@ -1,3 +1,4 @@ +spec: https://svgwg.org/svg2-draft/ suggested_reviewers: - heycam - nikosandronikos diff --git a/tests/wpt/web-platform-tests/svg/extensibility/foreignObject/foreign-object-margin-collapsing.html b/tests/wpt/web-platform-tests/svg/extensibility/foreignObject/foreign-object-margin-collapsing.html new file mode 100644 index 00000000000..49320f95731 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/extensibility/foreignObject/foreign-object-margin-collapsing.html @@ -0,0 +1,16 @@ + + + + + + + +
+
+
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/svg/historical.html b/tests/wpt/web-platform-tests/svg/historical.html index 4b8686bd2a9..1b73ca8d223 100644 --- a/tests/wpt/web-platform-tests/svg/historical.html +++ b/tests/wpt/web-platform-tests/svg/historical.html @@ -12,6 +12,7 @@ var removedInterfaces = [ "SVGICCColor", "SVGLangSpace", "SVGLocatable", + "SVGTransformable", "SVGPaint", "SVGPathSeg", "SVGStylable", diff --git a/tests/wpt/web-platform-tests/svg/painting/OWNERS b/tests/wpt/web-platform-tests/svg/painting/OWNERS new file mode 100644 index 00000000000..47be782163f --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/painting/OWNERS @@ -0,0 +1 @@ +@kamidphish \ No newline at end of file diff --git a/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-fallback-ref.svg b/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-fallback-ref.svg new file mode 100644 index 00000000000..c4d946beb6e --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-fallback-ref.svg @@ -0,0 +1,4 @@ + + + + diff --git a/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-fallback.svg b/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-fallback.svg new file mode 100644 index 00000000000..49d7fea59ca --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-fallback.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-fill-ref.svg b/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-fill-ref.svg new file mode 100644 index 00000000000..c86b77931b4 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-fill-ref.svg @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-fill.svg b/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-fill.svg new file mode 100644 index 00000000000..0e3d9ff1169 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-fill.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-stroke-ref.svg b/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-stroke-ref.svg new file mode 100644 index 00000000000..0b7a5f8ec9f --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-stroke-ref.svg @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-stroke.svg b/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-stroke.svg new file mode 100644 index 00000000000..bff502c22ba --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/painting/currentColor-override-pserver-stroke.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/rendering/order/z-index-ref.svg b/tests/wpt/web-platform-tests/svg/rendering/order/z-index-ref.svg new file mode 100644 index 00000000000..ff7f9156682 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/rendering/order/z-index-ref.svg @@ -0,0 +1,9 @@ + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/rendering/order/z-index.svg b/tests/wpt/web-platform-tests/svg/rendering/order/z-index.svg new file mode 100644 index 00000000000..786290a158b --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/rendering/order/z-index.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/ellipse-01-ref.svg b/tests/wpt/web-platform-tests/svg/shapes/ellipse-01-ref.svg new file mode 100644 index 00000000000..c4ab1bd0391 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/ellipse-01-ref.svg @@ -0,0 +1,4 @@ + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/ellipse-01.svg b/tests/wpt/web-platform-tests/svg/shapes/ellipse-01.svg new file mode 100644 index 00000000000..1b1124e4c5b --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/ellipse-01.svg @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/ellipse-02-ref.svg b/tests/wpt/web-platform-tests/svg/shapes/ellipse-02-ref.svg new file mode 100644 index 00000000000..1a4b455d03d --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/ellipse-02-ref.svg @@ -0,0 +1,4 @@ + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/ellipse-02.svg b/tests/wpt/web-platform-tests/svg/shapes/ellipse-02.svg new file mode 100644 index 00000000000..c4727b84b2e --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/ellipse-02.svg @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/ellipse-03-ref.svg b/tests/wpt/web-platform-tests/svg/shapes/ellipse-03-ref.svg new file mode 100644 index 00000000000..15fae5e8445 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/ellipse-03-ref.svg @@ -0,0 +1,4 @@ + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/ellipse-03.svg b/tests/wpt/web-platform-tests/svg/shapes/ellipse-03.svg new file mode 100644 index 00000000000..e0aacefd702 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/ellipse-03.svg @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/ellipse-04-ref.svg b/tests/wpt/web-platform-tests/svg/shapes/ellipse-04-ref.svg new file mode 100644 index 00000000000..1d62e8e2af8 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/ellipse-04-ref.svg @@ -0,0 +1,3 @@ + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/ellipse-04.svg b/tests/wpt/web-platform-tests/svg/shapes/ellipse-04.svg new file mode 100644 index 00000000000..79e6d0674ab --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/ellipse-04.svg @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/ellipse-05.svg b/tests/wpt/web-platform-tests/svg/shapes/ellipse-05.svg new file mode 100644 index 00000000000..e86f1052ddf --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/ellipse-05.svg @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/ellipse-06.svg b/tests/wpt/web-platform-tests/svg/shapes/ellipse-06.svg new file mode 100644 index 00000000000..80f36a9adc9 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/ellipse-06.svg @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/ellipse-07-ref.svg b/tests/wpt/web-platform-tests/svg/shapes/ellipse-07-ref.svg new file mode 100644 index 00000000000..bd84518021f --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/ellipse-07-ref.svg @@ -0,0 +1,4 @@ + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/ellipse-07.svg b/tests/wpt/web-platform-tests/svg/shapes/ellipse-07.svg new file mode 100644 index 00000000000..396e5f3f625 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/ellipse-07.svg @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/ellipse-08.svg b/tests/wpt/web-platform-tests/svg/shapes/ellipse-08.svg new file mode 100644 index 00000000000..1ff393beb0e --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/ellipse-08.svg @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-001-ref.svg b/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-001-ref.svg new file mode 100644 index 00000000000..0ec9e0353ae --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-001-ref.svg @@ -0,0 +1,18 @@ + + + Test of 'pathLength' on shapes. + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-001.svg b/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-001.svg new file mode 100644 index 00000000000..cd60c052393 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-001.svg @@ -0,0 +1,21 @@ + + + Test of 'pathLength' on shapes. + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-002-ref.svg b/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-002-ref.svg new file mode 100644 index 00000000000..21ec28a244e --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-002-ref.svg @@ -0,0 +1,18 @@ + + + Test of 'pathLength' on shapes. + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-002.svg b/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-002.svg new file mode 100644 index 00000000000..bdae7e75f2d --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-002.svg @@ -0,0 +1,21 @@ + + + Test of 'pathLength' on shapes. + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-003-ref.svg b/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-003-ref.svg new file mode 100644 index 00000000000..8d6f43f9d87 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-003-ref.svg @@ -0,0 +1,40 @@ + + + Test of 'pathLength' on shapes. + + + + + + + + + + Some text on a circle! + Some text on a circle! + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-003.svg b/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-003.svg new file mode 100644 index 00000000000..506952f54b4 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/reftests/pathlength-003.svg @@ -0,0 +1,43 @@ + + + Test of 'pathLength' on shapes. + + + + + + + + + + + + Some text on a circle! + Some text on a circle! + + + diff --git a/tests/wpt/web-platform-tests/svg/shapes/rx-ry-not-inherited.svg b/tests/wpt/web-platform-tests/svg/shapes/rx-ry-not-inherited.svg new file mode 100644 index 00000000000..ff943e8b5c4 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/shapes/rx-ry-not-inherited.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/styling/render/transform-box-ref.svg b/tests/wpt/web-platform-tests/svg/styling/render/transform-box-ref.svg new file mode 100644 index 00000000000..b41f8bb2a7b --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/styling/render/transform-box-ref.svg @@ -0,0 +1,15 @@ + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/styling/render/transform-box.svg b/tests/wpt/web-platform-tests/svg/styling/render/transform-box.svg new file mode 100644 index 00000000000..99a273c176d --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/styling/render/transform-box.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/styling/render/transform-origin-ref.svg b/tests/wpt/web-platform-tests/svg/styling/render/transform-origin-ref.svg new file mode 100644 index 00000000000..b0e3b47e0d4 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/styling/render/transform-origin-ref.svg @@ -0,0 +1,13 @@ + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/styling/render/transform-origin.svg b/tests/wpt/web-platform-tests/svg/styling/render/transform-origin.svg new file mode 100644 index 00000000000..07e7dd7ee23 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/styling/render/transform-origin.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/styling/render/transform-ref.svg b/tests/wpt/web-platform-tests/svg/styling/render/transform-ref.svg new file mode 100644 index 00000000000..02f49c6da3a --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/styling/render/transform-ref.svg @@ -0,0 +1,11 @@ + + + + diff --git a/tests/wpt/web-platform-tests/svg/styling/render/transform.svg b/tests/wpt/web-platform-tests/svg/styling/render/transform.svg new file mode 100644 index 00000000000..1924026f98b --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/styling/render/transform.svg @@ -0,0 +1,18 @@ + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/svg/text/reftests/textpath-shape-001-ref.svg b/tests/wpt/web-platform-tests/svg/text/reftests/textpath-shape-001-ref.svg new file mode 100644 index 00000000000..10827c85810 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/text/reftests/textpath-shape-001-ref.svg @@ -0,0 +1,52 @@ + + + + TextPath Shape — 001 + + + + + + + + + + + + + + + + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + + + + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + + + + + diff --git a/tests/wpt/web-platform-tests/svg/text/reftests/textpath-shape-001.svg b/tests/wpt/web-platform-tests/svg/text/reftests/textpath-shape-001.svg new file mode 100644 index 00000000000..cd4d384d9dd --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/text/reftests/textpath-shape-001.svg @@ -0,0 +1,50 @@ + + + + TextPath Shape — 001 + + + + + + + + + + + + + + + + + + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + + + + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + + + + diff --git a/tests/wpt/web-platform-tests/svg/text/reftests/textpath-side-001-ref.svg b/tests/wpt/web-platform-tests/svg/text/reftests/textpath-side-001-ref.svg new file mode 100644 index 00000000000..0e2008c328a --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/text/reftests/textpath-side-001-ref.svg @@ -0,0 +1,55 @@ + + + + TextPath Side — 001 + + + + + + + + + + + + + + + + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + + + + + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + + + + + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + + + + + diff --git a/tests/wpt/web-platform-tests/svg/text/reftests/textpath-side-001.svg b/tests/wpt/web-platform-tests/svg/text/reftests/textpath-side-001.svg new file mode 100644 index 00000000000..a4b6bf52bd2 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/text/reftests/textpath-side-001.svg @@ -0,0 +1,57 @@ + + + + TextPath Side — 001 + + + + + + + + + + + + + + + + + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + + + + + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + + + + + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + + + + + diff --git a/tests/wpt/web-platform-tests/svg/types/elements/SVGGeometryElement-rect.svg b/tests/wpt/web-platform-tests/svg/types/elements/SVGGeometryElement-rect.svg index 5391d91ad5a..d4b278f2836 100644 --- a/tests/wpt/web-platform-tests/svg/types/elements/SVGGeometryElement-rect.svg +++ b/tests/wpt/web-platform-tests/svg/types/elements/SVGGeometryElement-rect.svg @@ -14,9 +14,9 @@ diff --git a/tests/wpt/web-platform-tests/svg/types/scripted/SVGAnimatedRect.html b/tests/wpt/web-platform-tests/svg/types/scripted/SVGAnimatedRect.html index 011f44eee81..eb5bb1db166 100644 --- a/tests/wpt/web-platform-tests/svg/types/scripted/SVGAnimatedRect.html +++ b/tests/wpt/web-platform-tests/svg/types/scripted/SVGAnimatedRect.html @@ -10,8 +10,9 @@ test(function() { // Check initial viewBox value. assert_true(svgElement.viewBox instanceof SVGAnimatedRect); - assert_true(svgElement.viewBox.baseVal instanceof SVGRect); + assert_true(svgElement.viewBox.baseVal instanceof DOMRect); assert_equals(svgElement.viewBox.baseVal.x, 0); + assert_true(svgElement.viewBox.animVal instanceof DOMRectReadOnly); // Check that rects are dynamic, caching value in a local variable and modifying it, should take effect. var numRef = svgElement.viewBox.baseVal; @@ -28,6 +29,6 @@ test(function() { assert_equals(svgElement.viewBox.baseVal.x, 100); // Check that the viewBox baseVal type has not been changed. - assert_true(svgElement.viewBox.baseVal instanceof SVGRect); + assert_true(svgElement.viewBox.baseVal instanceof DOMRect); }); diff --git a/tests/wpt/web-platform-tests/svg/types/scripted/SVGGraphicsElement.svg b/tests/wpt/web-platform-tests/svg/types/scripted/SVGGraphicsElement.svg new file mode 100644 index 00000000000..8d5808f0db7 --- /dev/null +++ b/tests/wpt/web-platform-tests/svg/types/scripted/SVGGraphicsElement.svg @@ -0,0 +1,25 @@ + + + SVGGraphicsElement + + + + + + + diff --git a/tests/wpt/web-platform-tests/tools/flake8.ini b/tests/wpt/web-platform-tests/tools/flake8.ini new file mode 100644 index 00000000000..85e2308aabb --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/flake8.ini @@ -0,0 +1,21 @@ +[flake8] +# flake8 config used in tools/tox.ini, tools/wpt/tox.ini, and tools/wptrunner/tox.ini +select = E,W,F,N +# E128: continuation line under-indented for visual indent +# E129: visually indented line with same indent as next logical line +# E221: multiple spaces before operator +# E226: missing whitespace around arithmetic operator +# E231: missing whitespace after ‘,’, ‘;’, or ‘:’ +# E251: unexpected spaces around keyword / parameter equals +# E265: block comment should start with ‘# ‘ +# E302: expected 2 blank lines, found 0 +# E303: too many blank lines (3) +# E305: expected 2 blank lines after end of function or class +# E402: module level import not at top of file +# E731: do not assign a lambda expression, use a def +# E901: SyntaxError or IndentationError +# W601: .has_key() is deprecated, use ‘in’ +# N801: class names should use CapWords convention +# N802: function name should be lowercase +ignore = E128,E129,E221,E226,E231,E251,E265,E302,E303,E305,E402,E731,E901,W601,N801,N802 +max-line-length = 141 diff --git a/tests/wpt/web-platform-tests/tools/localpaths.py b/tests/wpt/web-platform-tests/tools/localpaths.py index 0c4f018ae68..7eb487e8a57 100644 --- a/tests/wpt/web-platform-tests/tools/localpaths.py +++ b/tests/wpt/web-platform-tests/tools/localpaths.py @@ -7,12 +7,15 @@ repo_root = os.path.abspath(os.path.join(here, os.pardir)) sys.path.insert(0, os.path.join(here)) sys.path.insert(0, os.path.join(here, "wptserve")) sys.path.insert(0, os.path.join(here, "pywebsocket")) +sys.path.insert(0, os.path.join(here, "third_party", "atomicwrites")) sys.path.insert(0, os.path.join(here, "third_party", "attrs", "src")) sys.path.insert(0, os.path.join(here, "third_party", "funcsigs")) sys.path.insert(0, os.path.join(here, "third_party", "html5lib")) +sys.path.insert(0, os.path.join(here, "third_party", "more-itertools")) sys.path.insert(0, os.path.join(here, "third_party", "pluggy")) sys.path.insert(0, os.path.join(here, "third_party", "py")) sys.path.insert(0, os.path.join(here, "third_party", "pytest")) +sys.path.insert(0, os.path.join(here, "third_party", "pytest", "src")) sys.path.insert(0, os.path.join(here, "third_party", "six")) sys.path.insert(0, os.path.join(here, "third_party", "webencodings")) sys.path.insert(0, os.path.join(here, "webdriver")) diff --git a/tests/wpt/web-platform-tests/tools/serve/__init__.py b/tests/wpt/web-platform-tests/tools/serve/__init__.py index 948482f1a7b..40da7e9fd39 100644 --- a/tests/wpt/web-platform-tests/tools/serve/__init__.py +++ b/tests/wpt/web-platform-tests/tools/serve/__init__.py @@ -1 +1 @@ -import serve # noqa: F401 +from . import serve # noqa: F401 diff --git a/tests/wpt/web-platform-tests/tools/serve/serve.py b/tests/wpt/web-platform-tests/tools/serve/serve.py index 7e645b0fcaf..41561f7e94f 100644 --- a/tests/wpt/web-platform-tests/tools/serve/serve.py +++ b/tests/wpt/web-platform-tests/tools/serve/serve.py @@ -352,7 +352,7 @@ class RoutesBuilder(object): for (method, suffix, handler_cls) in routes: self.mountpoint_routes[url_base].append( (method, - b"%s%s" % (str(url_base) if url_base != "/" else "", str(suffix)), + "%s%s" % (url_base if url_base != "/" else "", suffix), handler_cls(base_path=path, url_base=url_base))) def add_file_mount_point(self, file_url, base_path): @@ -434,7 +434,7 @@ def check_subdomains(config): aliases = config.aliases host = config.server_host - port = get_port(host) + port = get_port() logger.debug("Going to use port %d to check subdomains" % port) wrapper = ServerProc() @@ -492,7 +492,7 @@ def make_hosts_file(config, host): def start_servers(host, ports, paths, routes, bind_address, config, ssl_config, **kwargs): servers = defaultdict(list) - for scheme, ports in ports.iteritems(): + for scheme, ports in ports.items(): assert len(ports) == {"http":2}.get(scheme, 1) for port in ports: @@ -789,7 +789,7 @@ def run(**kwargs): stash_address = None if bind_address: - stash_address = (config.server_host, get_port(config.server_host)) + stash_address = (config.server_host, get_port()) logger.debug("Going to use port %d for stash" % stash_address[1]) with stash.StashServer(stash_address, authkey=str(uuid.uuid4())): diff --git a/tests/wpt/web-platform-tests/tools/serve/test_serve.py b/tests/wpt/web-platform-tests/tools/serve/test_serve.py index 803a30e72d6..b517e64ad1c 100644 --- a/tests/wpt/web-platform-tests/tools/serve/test_serve.py +++ b/tests/wpt/web-platform-tests/tools/serve/test_serve.py @@ -1,7 +1,6 @@ import pickle import platform import os -import sys import pytest @@ -12,7 +11,6 @@ from .serve import Config @pytest.mark.skipif(platform.uname()[0] == "Windows", reason="Expected contents are platform-dependent") -@pytest.mark.xfail(sys.version_info >= (3,), reason="serve only works on Py2") def test_make_hosts_file_nix(): c = Config(browser_host="foo.bar", alternate_hosts={"alt": "foo2.bar"}) hosts = serve.make_hosts_file(c, "192.168.42.42") @@ -34,7 +32,6 @@ def test_make_hosts_file_nix(): @pytest.mark.skipif(platform.uname()[0] != "Windows", reason="Expected contents are platform-dependent") -@pytest.mark.xfail(sys.version_info >= (3,), reason="serve only works on Py2") def test_make_hosts_file_windows(): c = Config(browser_host="foo.bar", alternate_hosts={"alt": "foo2.bar"}) hosts = serve.make_hosts_file(c, "192.168.42.42") diff --git a/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/.gitignore b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/.gitignore new file mode 100644 index 00000000000..2b2d3128753 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/.gitignore @@ -0,0 +1,9 @@ +.tox +*.pyc +*.pyo +__pycache__ +*.egg-info +docs/_build +build +dist +.cache diff --git a/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/.travis.yml b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/.travis.yml new file mode 100644 index 00000000000..e9779018ad3 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/.travis.yml @@ -0,0 +1,35 @@ +sudo: false +os: linux +language: python + +matrix: + include: + - os: osx + language: generic + env: TOXENV_SUFFIX=test + +python: + - "2.6" + - "2.7" + - "pypy" + - "3.3" + - "3.4" + +install: + - # The OS X VM doesn't have any Python support at all + # See https://github.com/travis-ci/travis-ci/issues/2312 + if [ "$TRAVIS_OS_NAME" = "osx" ]; then + brew update; + brew install python3; + virtualenv -p python3 $HOME/osx-py3; + . $HOME/osx-py3/bin/activate; + export TRAVIS_PYTHON_VERSION="$(python --version | cut -d ' ' -f 2 | cut -d . -f -2)"; + fi + - pip install tox + +script: + - export TOX_PY="$(echo py$TRAVIS_PYTHON_VERSION | tr -d . | sed -e 's/pypypy/pypy/')" + - tox -e $TOX_PY-test + - if [ "$TRAVIS_PYTHON_VERSION" = "2.7" ] || [ "$TRAVIS_PYTHON_VERSION" = ".3.5" ]; then + tox -e $TOX_PY-stylecheck; + fi diff --git a/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/CONTRIBUTING.rst b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/CONTRIBUTING.rst new file mode 100644 index 00000000000..86d3e4a65e7 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/CONTRIBUTING.rst @@ -0,0 +1,11 @@ +Thanks for contributing to python-atomicwrites! This document is a +work-in-progress. Below are a few notes that are useful for writing patches. + +Running the tests +================= + +:: + + pip install tox + tox -e py-test + tox -e py-stylecheck diff --git a/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/LICENSE b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/LICENSE new file mode 100644 index 00000000000..3bbadc3af2c --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015-2016 Markus Unterwaditzer + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/MANIFEST.in b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/MANIFEST.in new file mode 100644 index 00000000000..1b28469174f --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/MANIFEST.in @@ -0,0 +1,6 @@ +include LICENSE +include README.rst + +recursive-include docs * +recursive-include tests * +prune docs/_build diff --git a/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/Makefile b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/Makefile new file mode 100644 index 00000000000..d257e7b6731 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/Makefile @@ -0,0 +1,2 @@ +release: + python setup.py sdist bdist_wheel upload diff --git a/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/README.rst b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/README.rst new file mode 100644 index 00000000000..3a5658cbd8f --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/README.rst @@ -0,0 +1,102 @@ +=================== +python-atomicwrites +=================== + +.. image:: https://travis-ci.org/untitaker/python-atomicwrites.svg?branch=master + :target: https://travis-ci.org/untitaker/python-atomicwrites + +.. image:: https://ci.appveyor.com/api/projects/status/vadc4le3c27to59x/branch/master?svg=true + :target: https://ci.appveyor.com/project/untitaker/python-atomicwrites/branch/master + +Atomic file writes. + +.. code-block:: python + + from atomicwrites import atomic_write + + with atomic_write('foo.txt', overwrite=True) as f: + f.write('Hello world.') + # "foo.txt" doesn't exist yet. + + # Now it does. + + +Features that distinguish it from other similar libraries (see `Alternatives and Credit`_): + +- Race-free assertion that the target file doesn't yet exist. This can be + controlled with the ``overwrite`` parameter. + +- Windows support, although not well-tested. The MSDN resources are not very + explicit about which operations are atomic. + +- Simple high-level API that wraps a very flexible class-based API. + +- Consistent error handling across platforms. + + +How it works +============ + +It uses a temporary file in the same directory as the given path. This ensures +that the temporary file resides on the same filesystem. + +The temporary file will then be atomically moved to the target location: On +POSIX, it will use ``rename`` if files should be overwritten, otherwise a +combination of ``link`` and ``unlink``. On Windows, it uses MoveFileEx_ through +stdlib's ``ctypes`` with the appropriate flags. + +Note that with ``link`` and ``unlink``, there's a timewindow where the file +might be available under two entries in the filesystem: The name of the +temporary file, and the name of the target file. + +Also note that the permissions of the target file may change this way. In some +situations a ``chmod`` can be issued without any concurrency problems, but +since that is not always the case, this library doesn't do it by itself. + +.. _MoveFileEx: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365240%28v=vs.85%29.aspx + +fsync +----- + +On POSIX, ``fsync`` is invoked on the temporary file after it is written (to +flush file content and metadata), and on the parent directory after the file is +moved (to flush filename). + +``fsync`` does not take care of disks' internal buffers, but there don't seem +to be any standard POSIX APIs for that. On OS X, ``fcntl`` is used with +``F_FULLFSYNC`` instead of ``fsync`` for that reason. + +On Windows, `_commit `_ +is used, but there are no guarantees about disk internal buffers. + +Alternatives and Credit +======================= + +Atomicwrites is directly inspired by the following libraries (and shares a +minimal amount of code): + +- The Trac project's `utility functions + `_, + also used in `Werkzeug `_ and + `mitsuhiko/python-atomicfile + `_. The idea to use + ``ctypes`` instead of ``PyWin32`` originated there. + +- `abarnert/fatomic `_. Windows support + (based on ``PyWin32``) was originally taken from there. + +Other alternatives to atomicwrites include: + +- `sashka/atomicfile `_. Originally I + considered using that, but at the time it was lacking a lot of features I + needed (Windows support, overwrite-parameter, overriding behavior through + subclassing). + +- The `Boltons library collection `_ + features a class for atomic file writes, which seems to have a very similar + ``overwrite`` parameter. It is lacking Windows support though. + +License +======= + +Licensed under the MIT, see ``LICENSE``. diff --git a/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/appveyor.yml b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/appveyor.yml new file mode 100644 index 00000000000..a5d47a07681 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/appveyor.yml @@ -0,0 +1,18 @@ +build: false # Not a C# project, build stuff at the test step instead. +environment: + matrix: + - PYTHON: "C:/Python27" + - PYTHON: "C:/Python33" + - PYTHON: "C:/Python34" + +init: + - "ECHO %PYTHON%" + - ps: "ls C:/Python*" + +install: + - ps: (new-object net.webclient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', 'C:/get-pip.py') + - "%PYTHON%/python.exe C:/get-pip.py" + - "%PYTHON%/Scripts/pip.exe install tox" + +test_script: + - "%PYTHON%/Scripts/tox.exe -e py-test" diff --git a/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/atomicwrites/__init__.py b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/atomicwrites/__init__.py new file mode 100644 index 00000000000..a182c07afd9 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/atomicwrites/__init__.py @@ -0,0 +1,201 @@ +import contextlib +import os +import sys +import tempfile + +try: + import fcntl +except ImportError: + fcntl = None + +__version__ = '1.1.5' + + +PY2 = sys.version_info[0] == 2 + +text_type = unicode if PY2 else str # noqa + + +def _path_to_unicode(x): + if not isinstance(x, text_type): + return x.decode(sys.getfilesystemencoding()) + return x + + +_proper_fsync = os.fsync + + +if sys.platform != 'win32': + if hasattr(fcntl, 'F_FULLFSYNC'): + def _proper_fsync(fd): + # https://lists.apple.com/archives/darwin-dev/2005/Feb/msg00072.html + # https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/fsync.2.html + # https://github.com/untitaker/python-atomicwrites/issues/6 + fcntl.fcntl(fd, fcntl.F_FULLFSYNC) + + def _sync_directory(directory): + # Ensure that filenames are written to disk + fd = os.open(directory, 0) + try: + _proper_fsync(fd) + finally: + os.close(fd) + + def _replace_atomic(src, dst): + os.rename(src, dst) + _sync_directory(os.path.normpath(os.path.dirname(dst))) + + def _move_atomic(src, dst): + os.link(src, dst) + os.unlink(src) + + src_dir = os.path.normpath(os.path.dirname(src)) + dst_dir = os.path.normpath(os.path.dirname(dst)) + _sync_directory(dst_dir) + if src_dir != dst_dir: + _sync_directory(src_dir) +else: + from ctypes import windll, WinError + + _MOVEFILE_REPLACE_EXISTING = 0x1 + _MOVEFILE_WRITE_THROUGH = 0x8 + _windows_default_flags = _MOVEFILE_WRITE_THROUGH + + def _handle_errors(rv): + if not rv: + raise WinError() + + def _replace_atomic(src, dst): + _handle_errors(windll.kernel32.MoveFileExW( + _path_to_unicode(src), _path_to_unicode(dst), + _windows_default_flags | _MOVEFILE_REPLACE_EXISTING + )) + + def _move_atomic(src, dst): + _handle_errors(windll.kernel32.MoveFileExW( + _path_to_unicode(src), _path_to_unicode(dst), + _windows_default_flags + )) + + +def replace_atomic(src, dst): + ''' + Move ``src`` to ``dst``. If ``dst`` exists, it will be silently + overwritten. + + Both paths must reside on the same filesystem for the operation to be + atomic. + ''' + return _replace_atomic(src, dst) + + +def move_atomic(src, dst): + ''' + Move ``src`` to ``dst``. There might a timewindow where both filesystem + entries exist. If ``dst`` already exists, :py:exc:`FileExistsError` will be + raised. + + Both paths must reside on the same filesystem for the operation to be + atomic. + ''' + return _move_atomic(src, dst) + + +class AtomicWriter(object): + ''' + A helper class for performing atomic writes. Usage:: + + with AtomicWriter(path).open() as f: + f.write(...) + + :param path: The destination filepath. May or may not exist. + :param mode: The filemode for the temporary file. + :param overwrite: If set to false, an error is raised if ``path`` exists. + Errors are only raised after the file has been written to. Either way, + the operation is atomic. + + If you need further control over the exact behavior, you are encouraged to + subclass. + ''' + + def __init__(self, path, mode='w', overwrite=False): + if 'a' in mode: + raise ValueError( + 'Appending to an existing file is not supported, because that ' + 'would involve an expensive `copy`-operation to a temporary ' + 'file. Open the file in normal `w`-mode and copy explicitly ' + 'if that\'s what you\'re after.' + ) + if 'x' in mode: + raise ValueError('Use the `overwrite`-parameter instead.') + if 'w' not in mode: + raise ValueError('AtomicWriters can only be written to.') + + self._path = path + self._mode = mode + self._overwrite = overwrite + + def open(self): + ''' + Open the temporary file. + ''' + return self._open(self.get_fileobject) + + @contextlib.contextmanager + def _open(self, get_fileobject): + f = None # make sure f exists even if get_fileobject() fails + try: + success = False + with get_fileobject() as f: + yield f + self.sync(f) + self.commit(f) + success = True + finally: + if not success: + try: + self.rollback(f) + except Exception: + pass + + def get_fileobject(self, dir=None, **kwargs): + '''Return the temporary file to use.''' + if dir is None: + dir = os.path.normpath(os.path.dirname(self._path)) + return tempfile.NamedTemporaryFile(mode=self._mode, dir=dir, + delete=False, **kwargs) + + def sync(self, f): + '''responsible for clearing as many file caches as possible before + commit''' + f.flush() + _proper_fsync(f.fileno()) + + def commit(self, f): + '''Move the temporary file to the target location.''' + if self._overwrite: + replace_atomic(f.name, self._path) + else: + move_atomic(f.name, self._path) + + def rollback(self, f): + '''Clean up all temporary resources.''' + os.unlink(f.name) + + +def atomic_write(path, writer_cls=AtomicWriter, **cls_kwargs): + ''' + Simple atomic writes. This wraps :py:class:`AtomicWriter`:: + + with atomic_write(path) as f: + f.write(...) + + :param path: The target path to write to. + :param writer_cls: The writer class to use. This parameter is useful if you + subclassed :py:class:`AtomicWriter` to change some behavior and want to + use that new subclass. + + Additional keyword arguments are passed to the writer class. See + :py:class:`AtomicWriter`. + ''' + return writer_cls(path, **cls_kwargs).open() diff --git a/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/docs/Makefile b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/docs/Makefile new file mode 100644 index 00000000000..af5f9d9aa53 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/docs/Makefile @@ -0,0 +1,177 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/atomicwrites.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/atomicwrites.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/atomicwrites" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/atomicwrites" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/docs/conf.py b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/docs/conf.py new file mode 100644 index 00000000000..b7c7b59c4dd --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/docs/conf.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python + +import os +import sys +import pkg_resources + +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.intersphinx', + 'sphinx.ext.viewcode', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = 'atomicwrites' +copyright = '2015, Markus Unterwaditzer' + +try: + # The full version, including alpha/beta/rc tags. + release = pkg_resources.require('atomicwrites')[0].version +except pkg_resources.DistributionNotFound: + print('To build the documentation, the distribution information of ' + 'atomicwrites has to be available. Run "setup.py develop" to do ' + 'this.') + sys.exit(1) + +version = '.'.join(release.split('.')[:2]) # The short X.Y version. + +on_rtd = os.environ.get('READTHEDOCS', None) == 'True' + +try: + import sphinx_rtd_theme + html_theme = 'sphinx_rtd_theme' + html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] +except ImportError: + html_theme = 'default' + if not on_rtd: + print('-' * 74) + print('Warning: sphinx-rtd-theme not installed, building with default ' + 'theme.') + print('-' * 74) + + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + + +# Output file base name for HTML help builder. +htmlhelp_basename = 'atomicwritesdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = {} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ('index', 'atomicwrites.tex', 'atomicwrites Documentation', + 'Markus Unterwaditzer', 'manual'), +] + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'atomicwrites', 'atomicwrites Documentation', + ['Markus Unterwaditzer'], 1) +] + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ('index', 'atomicwrites', 'atomicwrites Documentation', + 'Markus Unterwaditzer', 'atomicwrites', 'One line description of project.', + 'Miscellaneous'), +] + +# Bibliographic Dublin Core info. +epub_title = 'atomicwrites' +epub_author = 'Markus Unterwaditzer' +epub_publisher = 'Markus Unterwaditzer' +epub_copyright = '2015, Markus Unterwaditzer' + +# A list of files that should not be packed into the epub file. +epub_exclude_files = ['search.html'] + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/docs/index.rst b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/docs/index.rst new file mode 100644 index 00000000000..0391c044771 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/docs/index.rst @@ -0,0 +1,35 @@ +.. include:: ../README.rst + +.. module:: atomicwrites + +API +=== + +.. autofunction:: atomic_write + + +Errorhandling +------------- + +All filesystem errors are subclasses of :py:exc:`OSError`. + +- On UNIX systems, errors from the Python stdlib calls are thrown. +- On Windows systems, errors from Python's ``ctypes`` are thrown. + +In either case, the ``errno`` attribute on the thrown exception maps to an +errorcode in the ``errno`` module. + +Low-level API +------------- + +.. autofunction:: replace_atomic + +.. autofunction:: move_atomic + +.. autoclass:: AtomicWriter + :members: + +License +======= + +.. include:: ../LICENSE diff --git a/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/docs/make.bat b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/docs/make.bat new file mode 100644 index 00000000000..36fd3f6baf5 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/docs/make.bat @@ -0,0 +1,242 @@ +@ECHO OFF + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set BUILDDIR=_build +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . +set I18NSPHINXOPTS=%SPHINXOPTS% . +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% + set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% +) + +if "%1" == "" goto help + +if "%1" == "help" ( + :help + echo.Please use `make ^` where ^ is one of + echo. html to make standalone HTML files + echo. dirhtml to make HTML files named index.html in directories + echo. singlehtml to make a single large HTML file + echo. pickle to make pickle files + echo. json to make JSON files + echo. htmlhelp to make HTML files and a HTML help project + echo. qthelp to make HTML files and a qthelp project + echo. devhelp to make HTML files and a Devhelp project + echo. epub to make an epub + echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter + echo. text to make text files + echo. man to make manual pages + echo. texinfo to make Texinfo files + echo. gettext to make PO message catalogs + echo. changes to make an overview over all changed/added/deprecated items + echo. xml to make Docutils-native XML files + echo. pseudoxml to make pseudoxml-XML files for display purposes + echo. linkcheck to check all external links for integrity + echo. doctest to run all doctests embedded in the documentation if enabled + goto end +) + +if "%1" == "clean" ( + for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i + del /q /s %BUILDDIR%\* + goto end +) + + +%SPHINXBUILD% 2> nul +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "html" ( + %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/html. + goto end +) + +if "%1" == "dirhtml" ( + %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. + goto end +) + +if "%1" == "singlehtml" ( + %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. + goto end +) + +if "%1" == "pickle" ( + %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the pickle files. + goto end +) + +if "%1" == "json" ( + %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the JSON files. + goto end +) + +if "%1" == "htmlhelp" ( + %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run HTML Help Workshop with the ^ +.hhp project file in %BUILDDIR%/htmlhelp. + goto end +) + +if "%1" == "qthelp" ( + %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run "qcollectiongenerator" with the ^ +.qhcp project file in %BUILDDIR%/qthelp, like this: + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\atomicwrites.qhcp + echo.To view the help file: + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\atomicwrites.ghc + goto end +) + +if "%1" == "devhelp" ( + %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. + goto end +) + +if "%1" == "epub" ( + %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The epub file is in %BUILDDIR%/epub. + goto end +) + +if "%1" == "latex" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdf" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf + cd %BUILDDIR%/.. + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdfja" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf-ja + cd %BUILDDIR%/.. + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "text" ( + %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The text files are in %BUILDDIR%/text. + goto end +) + +if "%1" == "man" ( + %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The manual pages are in %BUILDDIR%/man. + goto end +) + +if "%1" == "texinfo" ( + %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. + goto end +) + +if "%1" == "gettext" ( + %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The message catalogs are in %BUILDDIR%/locale. + goto end +) + +if "%1" == "changes" ( + %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes + if errorlevel 1 exit /b 1 + echo. + echo.The overview file is in %BUILDDIR%/changes. + goto end +) + +if "%1" == "linkcheck" ( + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + if errorlevel 1 exit /b 1 + echo. + echo.Link check complete; look for any errors in the above output ^ +or in %BUILDDIR%/linkcheck/output.txt. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest + if errorlevel 1 exit /b 1 + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in %BUILDDIR%/doctest/output.txt. + goto end +) + +if "%1" == "xml" ( + %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The XML files are in %BUILDDIR%/xml. + goto end +) + +if "%1" == "pseudoxml" ( + %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. + goto end +) + +:end diff --git a/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/setup.cfg b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/setup.cfg new file mode 100644 index 00000000000..5e4090017a9 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/setup.cfg @@ -0,0 +1,2 @@ +[wheel] +universal = 1 diff --git a/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/setup.py b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/setup.py new file mode 100644 index 00000000000..98488e9b983 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/setup.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +import ast +import re + +from setuptools import find_packages, setup + + +_version_re = re.compile(r'__version__\s+=\s+(.*)') + + +with open('atomicwrites/__init__.py', 'rb') as f: + version = str(ast.literal_eval(_version_re.search( + f.read().decode('utf-8')).group(1))) + +setup( + name='atomicwrites', + version=version, + author='Markus Unterwaditzer', + author_email='markus@unterwaditzer.net', + url='https://github.com/untitaker/python-atomicwrites', + description='Atomic file writes.', + license='MIT', + long_description=open('README.rst').read(), + packages=find_packages(exclude=['tests.*', 'tests']), + include_package_data=True, +) diff --git a/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/tox.ini b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/tox.ini new file mode 100644 index 00000000000..dfadf03336e --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/atomicwrites/tox.ini @@ -0,0 +1,11 @@ +[tox] +envlist = py{26,27,py,33,34,35}-{test,stylecheck} + +[testenv] +deps = + test: pytest + stylecheck: flake8 + stylecheck: flake8-import-order +commands = + test: py.test [] + stylecheck: flake8 [] diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/CODE_OF_CONDUCT.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/.github/CODE_OF_CONDUCT.rst similarity index 95% rename from tests/wpt/web-platform-tests/tools/third_party/attrs/CODE_OF_CONDUCT.rst rename to tests/wpt/web-platform-tests/tools/third_party/attrs/.github/CODE_OF_CONDUCT.rst index 4f4b8ee9cd9..56e8914ce2b 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/CODE_OF_CONDUCT.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/.github/CODE_OF_CONDUCT.rst @@ -52,4 +52,4 @@ Project maintainers who do not follow or enforce the Code of Conduct in good fai Attribution ----------- -This Code of Conduct is adapted from the `Contributor Covenant `_, version 1.4, available at http://contributor-covenant.org/version/1/4. +This Code of Conduct is adapted from the `Contributor Covenant `_, version 1.4, available at . diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/CONTRIBUTING.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/.github/CONTRIBUTING.rst similarity index 76% rename from tests/wpt/web-platform-tests/tools/third_party/attrs/CONTRIBUTING.rst rename to tests/wpt/web-platform-tests/tools/third_party/attrs/.github/CONTRIBUTING.rst index 9822f8926a8..fc6cc7e96f6 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/CONTRIBUTING.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/.github/CONTRIBUTING.rst @@ -2,10 +2,10 @@ How To Contribute ================= First off, thank you for considering contributing to ``attrs``! -It's people like *you* who make it is such a great tool for everyone. +It's people like *you* who make it such a great tool for everyone. -This document is mainly to help you to get started by codifying tribal knowledge and expectations and make it more accessible to everyone. -But don't be afraid to open half-finished PRs and ask questions if something is unclear! +This document intends to make contribution more accessible by codifying tribal knowledge and expectations. +Don't be afraid to open half-finished PRs, and ask questions if something is unclear! Support @@ -14,7 +14,7 @@ Support In case you'd like to help out but don't want to deal with GitHub, there's a great opportunity: help your fellow developers on `StackOverflow `_! -The offical tag is ``python-attrs`` and helping out in support frees us up for improving ``attrs`` instead! +The offical tag is ``python-attrs`` and helping out in support frees us up to improve ``attrs`` instead! Workflow @@ -67,7 +67,7 @@ Tests It will ensure the test suite runs with all dependencies against all Python versions just as it will on Travis CI. If you lack some Python versions, you can can always limit the environments like ``tox -e py27,py35`` (in that case you may want to look into pyenv_, which makes it very easy to install many different Python versions in parallel). - Write `good test docstrings`_. -- To ensure new features work well with the rest of the system, they should be also added to our `Hypothesis`_ testing strategy which you find in ``tests/util.py``. +- To ensure new features work well with the rest of the system, they should be also added to our `Hypothesis`_ testing strategy, which is found in ``tests/strategies.py``. Documentation @@ -80,7 +80,7 @@ Documentation This is a sentence. This is another sentence. -- If you start a new section, add two blank lines before and one blank line after the header except if two headers follow immediately after each other: +- If you start a new section, add two blank lines before and one blank line after the header, except if two headers follow immediately after each other: .. code-block:: rst @@ -94,27 +94,28 @@ Documentation ^^^^^^^^^^^^^^^^^^^^^ First line of new section. -- If you add a new feature, demonstrate its awesomeness in the `examples page`_! + +- If you add a new feature, demonstrate its awesomeness on the `examples page`_! Changelog ^^^^^^^^^ -If your change is noteworthy, there needs to be a changelog entry, so our users can learn about it! +If your change is noteworthy, there needs to be a changelog entry so our users can learn about it! To avoid merge conflicts, we use the towncrier_ package to manage our changelog. ``towncrier`` uses independent files for each pull request -- so called *news fragments* -- instead of one monolithic changelog file. -On release those news fragments are compiled into our ``CHANGELOG.rst``. +On release, those news fragments are compiled into our ``CHANGELOG.rst``. -You don't need to install ``towncrier`` yourself, you just have to abide to a few simple rules: +You don't need to install ``towncrier`` yourself, you just have to abide by a few simple rules: - For each pull request, add a new file into ``changelog.d`` with a filename adhering to the ``pr#.(change|deprecation|breaking).rst`` schema: - For example ``changelog.d/42.change.rst`` for a non-breaking change, that is proposed in pull request number 42. + For example, ``changelog.d/42.change.rst`` for a non-breaking change that is proposed in pull request #42. - As with other docs, please use `semantic newlines`_ within news fragments. -- Wrap symbols like modules, functions, or classes into double backticks so they are rendered in a monospaced font. -- If you mention functions or other callables, add parantheses at the end of their names: ``attr.func()`` or ``attr.Class.method()``. +- Wrap symbols like modules, functions, or classes into double backticks so they are rendered in a monospace font. +- If you mention functions or other callables, add parentheses at the end of their names: ``attr.func()`` or ``attr.Class.method()``. This makes the changelog a lot more readable. -- Prefer simple past or constructions with "now". +- Prefer simple past tense or constructions with "now". For example: + Added ``attr.validators.func()``. @@ -145,46 +146,45 @@ Local Development Environment ----------------------------- You can (and should) run our test suite using tox_. -However you’ll probably want a more traditional environment too. +However, you’ll probably want a more traditional environment as well. We highly recommend to develop using the latest Python 3 release because ``attrs`` tries to take advantage of modern features whenever possible. First create a `virtual environment `_. -It’s out of scope for this document to list all the ways to manage virtual environments in Python but if you don’t have already a pet way, take some time to look at tools like `pew `_, `virtualfish `_, and `virtualenvwrapper `_. +It’s out of scope for this document to list all the ways to manage virtual environments in Python, but if you don’t already have a pet way, take some time to look at tools like `pew `_, `virtualfish `_, and `virtualenvwrapper `_. -Next get an up to date checkout of the ``attrs`` repository: +Next, get an up to date checkout of the ``attrs`` repository: .. code-block:: bash - git checkout git@github.com:python-attrs/attrs.git + $ git checkout git@github.com:python-attrs/attrs.git -Change into the newly created directory and **after activating your virtual environment** install an editable version of ``attrs``: +Change into the newly created directory and **after activating your virtual environment** install an editable version of ``attrs`` along with its tests and docs requirements: .. code-block:: bash - cd attrs - pip install -e . + $ cd attrs + $ pip install -e .[dev] -If you run the virtual environment’s Python and try to ``import attr`` it should work! - -To run the test suite, you'll need our development dependencies which can be installed using +At this point, .. code-block:: bash - pip install -r dev-requirements.txt + $ python -m pytest -At this point +should work and pass, as should: .. code-block:: bash - python -m pytest + $ cd docs + $ make html -should work and pass! +The built documentation can then be found in ``docs/_build/html/``. Governance ---------- -``attrs`` is maintained by `team of volunteers`_ that is always open for new members that share our vision of a fast, lean, and magic-free library that empowers programmers to write better code with less effort. +``attrs`` is maintained by `team of volunteers`_ that is always open to new members that share our vision of a fast, lean, and magic-free library that empowers programmers to write better code with less effort. If you'd like to join, just get a pull request merged and ask to be added in the very same pull request! **The simple rule is that everyone is welcome to review/merge pull requests of others but nobody is allowed to merge their own code.** @@ -205,7 +205,7 @@ Thank you for considering contributing to ``attrs``! .. _`PEP 8`: https://www.python.org/dev/peps/pep-0008/ .. _`PEP 257`: https://www.python.org/dev/peps/pep-0257/ .. _`good test docstrings`: https://jml.io/pages/test-docstrings.html -.. _`Code of Conduct`: https://github.com/python-attrs/attrs/blob/master/CODE_OF_CONDUCT.rst +.. _`Code of Conduct`: https://github.com/python-attrs/attrs/blob/master/.github/CODE_OF_CONDUCT.rst .. _changelog: https://github.com/python-attrs/attrs/blob/master/CHANGELOG.rst .. _`backward compatibility`: http://www.attrs.org/en/latest/backward-compatibility.html .. _tox: https://tox.readthedocs.io/ diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/PULL_REQUEST_TEMPLATE.md b/tests/wpt/web-platform-tests/tools/third_party/attrs/.github/PULL_REQUEST_TEMPLATE.md similarity index 98% rename from tests/wpt/web-platform-tests/tools/third_party/attrs/PULL_REQUEST_TEMPLATE.md rename to tests/wpt/web-platform-tests/tools/third_party/attrs/.github/PULL_REQUEST_TEMPLATE.md index 34c468e6ae5..83456591a4d 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/PULL_REQUEST_TEMPLATE.md +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/.github/PULL_REQUEST_TEMPLATE.md @@ -3,7 +3,7 @@ This is just a reminder about the most common mistakes. Please make sure that you tick all *appropriate* boxes. But please read our [contribution guide](http://www.attrs.org/en/latest/contributing.html) at least once, it will save you unnecessary review cycles! - [ ] Added **tests** for changed code. -- [ ] New features have been added to our [Hypothesis testing strategy](https://github.com/python-attrs/attrs/blob/master/tests/utils.py). +- [ ] New features have been added to our [Hypothesis testing strategy](https://github.com/python-attrs/attrs/blob/master/tests/strategies.py). - [ ] Updated **documentation** for changed code. - [ ] Documentation in `.rst` files is written using [semantic newlines](http://rhodesmill.org/brandon/2012/one-sentence-per-line/). - [ ] Changed/added classes/methods/functions have appropriate `versionadded`, `versionchanged`, or `deprecated` [directives](http://www.sphinx-doc.org/en/stable/markup/para.html#directive-versionadded). diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/.gitignore b/tests/wpt/web-platform-tests/tools/third_party/attrs/.gitignore index a4ca3f8cef7..6c895ee1db7 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/.gitignore +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/.gitignore @@ -1,9 +1,11 @@ -.tox -.coverage* *.pyc *.egg-info +.cache +.coverage* +.hypothesis +.pytest_cache +.tox +build +dist docs/_build/ htmlcov -dist -.cache -.hypothesis \ No newline at end of file diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/.readthedocs.yml b/tests/wpt/web-platform-tests/tools/third_party/attrs/.readthedocs.yml new file mode 100644 index 00000000000..a4b6f431066 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/.readthedocs.yml @@ -0,0 +1,6 @@ +--- +python: + version: 3 + pip_install: true + extra_requirements: + - docs diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/.travis.yml b/tests/wpt/web-platform-tests/tools/third_party/attrs/.travis.yml index 4f1cf2f60b0..7c98b21a637 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/.travis.yml +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/.travis.yml @@ -1,4 +1,5 @@ dist: trusty +group: travis_latest sudo: false cache: directories: @@ -8,6 +9,8 @@ language: python matrix: + fast_finish: true + include: - python: "2.7" env: TOXENV=py27 @@ -17,11 +20,17 @@ matrix: env: TOXENV=py35 - python: "3.6" env: TOXENV=py36 - - python: "pypy2.7-5.8.0" + - python: "pypy" env: TOXENV=pypy - - python: "pypy3.5-5.8.0" + - python: "pypy3" env: TOXENV=pypy3 + # Prevent breakage by a new releases + - python: "3.6-dev" + env: TOXENV=py36 + - python: "3.7-dev" + env: TOXENV=py37 + # Meta - python: "3.6" env: TOXENV=flake8 @@ -34,6 +43,10 @@ matrix: - python: "3.6" env: TOXENV=changelog + allow_failures: + - python: "3.6-dev" + - python: "3.7-dev" + install: - pip install tox diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/CHANGELOG.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/CHANGELOG.rst index 55cd4591357..8679c56ae59 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/CHANGELOG.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/CHANGELOG.rst @@ -4,17 +4,162 @@ Changelog Versions follow `CalVer `_ with a strict backwards compatibility policy. The third digit is only for regressions. -Changes for the upcoming release can be found in the `"changelog.d" directory `_ in our repository. - -.. - Do *NOT* add changelog entries here! - - This changelog is managed by towncrier and is compiled at release time. - - See http://www.attrs.org/en/latest/contributing.html#changelog for details.""" # noqa - .. towncrier release notes start +18.1.0 (2018-05-03) +------------------- + +Changes +^^^^^^^ + +- ``x=X(); x.cycle = x; repr(x)`` will no longer raise a ``RecursionError``, and will instead show as ``X(x=...)``. + + `#95 `_ +- ``attr.ib(factory=f)`` is now syntactic sugar for the common case of ``attr.ib(default=attr.Factory(f))``. + + `#178 `_, + `#356 `_ +- Added ``attr.field_dict()`` to return an ordered dictionary of ``attrs`` attributes for a class, whose keys are the attribute names. + + `#290 `_, + `#349 `_ +- The order of attributes that are passed into ``attr.make_class()`` or the ``these`` argument of ``@attr.s()`` is now retained if the dictionary is ordered (i.e. ``dict`` on Python 3.6 and later, ``collections.OrderedDict`` otherwise). + + Before, the order was always determined by the order in which the attributes have been defined which may not be desirable when creating classes programatically. + + `#300 `_, + `#339 `_, + `#343 `_ +- In slotted classes, ``__getstate__`` and ``__setstate__`` now ignore the ``__weakref__`` attribute. + + `#311 `_, + `#326 `_ +- Setting the cell type is now completely best effort. + This fixes ``attrs`` on Jython. + + We cannot make any guarantees regarding Jython though, because our test suite cannot run due to dependency incompatabilities. + + `#321 `_, + `#334 `_ +- If ``attr.s`` is passed a *these* argument, it will not attempt to remove attributes with the same name from the class body anymore. + + `#322 `_, + `#323 `_ +- The hash of ``attr.NOTHING`` is now vegan and faster on 32bit Python builds. + + `#331 `_, + `#332 `_ +- The overhead of instantiating frozen dict classes is virtually eliminated. + `#336 `_ +- Generated ``__init__`` methods now have an ``__annotations__`` attribute derived from the types of the fields. + + `#363 `_ +- We have restructured the documentation a bit to account for ``attrs``' growth in scope. + Instead of putting everything into the `examples `_ page, we have started to extract narrative chapters. + + So far, we've added chapters on `initialization `_ and `hashing `_. + + Expect more to come! + + `#369 `_, + `#370 `_ + + +---- + + +17.4.0 (2017-12-30) +------------------- + +Backward-incompatible Changes +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +- The traversal of MROs when using multiple inheritance was backward: + If you defined a class ``C`` that subclasses ``A`` and ``B`` like ``C(A, B)``, ``attrs`` would have collected the attributes from ``B`` *before* those of ``A``. + + This is now fixed and means that in classes that employ multiple inheritance, the output of ``__repr__`` and the order of positional arguments in ``__init__`` changes. + Due to the nature of this bug, a proper deprecation cycle was unfortunately impossible. + + Generally speaking, it's advisable to prefer ``kwargs``-based initialization anyways – *especially* if you employ multiple inheritance and diamond-shaped hierarchies. + + `#298 `_, + `#299 `_, + `#304 `_ +- The ``__repr__`` set by ``attrs`` + no longer produces an ``AttributeError`` + when the instance is missing some of the specified attributes + (either through deleting + or after using ``init=False`` on some attributes). + + This can break code + that relied on ``repr(attr_cls_instance)`` raising ``AttributeError`` + to check if any attr-specified members were unset. + + If you were using this, + you can implement a custom method for checking this:: + + def has_unset_members(self): + for field in attr.fields(type(self)): + try: + getattr(self, field.name) + except AttributeError: + return True + return False + + `#308 `_ + + +Deprecations +^^^^^^^^^^^^ + +- The ``attr.ib(convert=callable)`` option is now deprecated in favor of ``attr.ib(converter=callable)``. + + This is done to achieve consistency with other noun-based arguments like *validator*. + + *convert* will keep working until at least January 2019 while raising a ``DeprecationWarning``. + + `#307 `_ + + +Changes +^^^^^^^ + +- Generated ``__hash__`` methods now hash the class type along with the attribute values. + Until now the hashes of two classes with the same values were identical which was a bug. + + The generated method is also *much* faster now. + + `#261 `_, + `#295 `_, + `#296 `_ +- ``attr.ib``\ ’s ``metadata`` argument now defaults to a unique empty ``dict`` instance instead of sharing a common empty ``dict`` for all. + The singleton empty ``dict`` is still enforced. + + `#280 `_ +- ``ctypes`` is optional now however if it's missing, a bare ``super()`` will not work in slotted classes. + This should only happen in special environments like Google App Engine. + + `#284 `_, + `#286 `_ +- The attribute redefinition feature introduced in 17.3.0 now takes into account if an attribute is redefined via multiple inheritance. + In that case, the definition that is closer to the base of the class hierarchy wins. + + `#285 `_, + `#287 `_ +- Subclasses of ``auto_attribs=True`` can be empty now. + + `#291 `_, + `#292 `_ +- Equality tests are *much* faster now. + + `#306 `_ +- All generated methods now have correct ``__module__``, ``__name__``, and (on Python 3) ``__qualname__`` attributes. + + `#309 `_ + + +---- + 17.3.0 (2017-11-08) ------------------- @@ -33,7 +178,7 @@ Backward-incompatible Changes Changes ^^^^^^^ -- ``super()`` and ``__class__`` now work on Python 3 when ``slots=True``. +- ``super()`` and ``__class__`` now work with slotted classes on Python 3. (`#102 `_, `#226 `_, `#269 `_, `#270 `_, `#272 `_) - Added ``type`` argument to ``attr.ib()`` and corresponding ``type`` attribute to ``attr.Attribute``. @@ -196,13 +341,13 @@ Changes: `#76 `_ - Instantiation of ``attrs`` classes with converters is now significantly faster. `#80 `_ -- Pickling now works with ``__slots__`` classes. +- Pickling now works with slotted classes. `#81 `_ -- ``attr.assoc()`` now works with ``__slots__`` classes. +- ``attr.assoc()`` now works with slotted classes. `#84 `_ - The tuple returned by ``attr.fields()`` now also allows to access the ``Attribute`` instances by name. Yes, we've subclassed ``tuple`` so you don't have to! - Therefore ``attr.fields(C).x`` is equivalent to the deprecated ``C.x`` and works with ``__slots__`` classes. + Therefore ``attr.fields(C).x`` is equivalent to the deprecated ``C.x`` and works with slotted classes. `#88 `_ @@ -271,7 +416,7 @@ Changes: ^^^^^^^^ - ``__slots__`` have arrived! - Classes now can automatically be `slots `_-style (and save your precious memory) just by passing ``slots=True``. + Classes now can automatically be `slotted `_-style (and save your precious memory) just by passing ``slots=True``. `#35 `_ - Allow the case of initializing attributes that are set to ``init=False``. This allows for clean initializer parameter lists while being able to initialize attributes to default values. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/MANIFEST.in b/tests/wpt/web-platform-tests/tools/third_party/attrs/MANIFEST.in index 03a948ef2c4..663c4ea21e2 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/MANIFEST.in +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/MANIFEST.in @@ -1,11 +1,12 @@ -include LICENSE *.rst *.toml +include LICENSE *.rst *.toml .readthedocs.yml # Don't package GitHub-specific files. -exclude *.md .travis.yml +exclude .github/*.md .travis.yml # Tests -include tox.ini .coveragerc conftest.py dev-requirements.txt docs-requirements.txt +include tox.ini .coveragerc conftest.py recursive-include tests *.py +recursive-include .github *.rst # Documentation include docs/Makefile docs/docutils.conf @@ -15,5 +16,7 @@ recursive-include docs *.py recursive-include docs *.rst prune docs/_build -# Changelog news fragments -- is empty on releases. -prune changelog.d +# Just to keep check-manifest happy; on releases those files are gone. +# Last rule wins! +exclude changelog.d/*.rst +include changelog.d/towncrier_template.rst diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/README.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/README.rst index 84d6aa76531..b46a33cf5c8 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/README.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/README.rst @@ -32,7 +32,7 @@ For that, it gives you a class decorator and a way to declaratively define the a .. code-block:: pycon >>> import attr - + >>> @attr.s ... class SomeClass(object): ... a_number = attr.ib(default=42) @@ -40,25 +40,25 @@ For that, it gives you a class decorator and a way to declaratively define the a ... ... def hard_math(self, another_number): ... return self.a_number + sum(self.list_of_numbers) * another_number - - + + >>> sc = SomeClass(1, [1, 2, 3]) >>> sc SomeClass(a_number=1, list_of_numbers=[1, 2, 3]) - + >>> sc.hard_math(3) 19 >>> sc == SomeClass(1, [1, 2, 3]) True >>> sc != SomeClass(2, [3, 2, 1]) True - + >>> attr.asdict(sc) {'a_number': 1, 'list_of_numbers': [1, 2, 3]} - + >>> SomeClass() SomeClass(a_number=42, list_of_numbers=[]) - + >>> C = attr.make_class("C", ["a", "b"]) >>> C("foo", "bar") C(a='foo', b='bar') @@ -126,4 +126,7 @@ the code on `GitHub `_, and the latest release on `PyPI `_. It’s rigorously tested on Python 2.7, 3.4+, and PyPy. -If you'd like to contribute you're most welcome and we've written `a little guide `_ to get you started! +We collect information on **third-party extensions** in our `wiki `_. +Feel free to browse and add your own! + +If you'd like to contribute to ``attrs`` you're most welcome and we've written `a little guide `_ to get you started! diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/178.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/178.change.rst new file mode 100644 index 00000000000..283f81aa5b8 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/178.change.rst @@ -0,0 +1 @@ +``attr.ib(factory=f)`` is now syntactic sugar for the common case of ``attr.ib(default=attr.Factory(f))``. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/261.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/261.change.rst deleted file mode 100644 index 6867f66dd23..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/261.change.rst +++ /dev/null @@ -1,4 +0,0 @@ -Generated ``__hash__`` methods now hash the class type along with the attribute values. -Until now the hashes of two classes with the same values were identical which was a bug. - -The generated method is also *much* faster now. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/284.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/284.change.rst deleted file mode 100644 index 266599daabe..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/284.change.rst +++ /dev/null @@ -1,2 +0,0 @@ -``ctypes`` is optional now however if it's missing, a bare ``super()`` will not work in slots classes. -This should only happen in special environments like Google App Engine. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/285.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/285.change.rst deleted file mode 100644 index c3fbb797d4f..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/285.change.rst +++ /dev/null @@ -1,2 +0,0 @@ -The attribute redefinition feature introduced in 17.3.0 now takes into account if an attribute is redefined via multiple inheritance. -In that case, the definition that is closer to the base of the class hierarchy wins. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/286.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/286.change.rst deleted file mode 100644 index 266599daabe..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/286.change.rst +++ /dev/null @@ -1,2 +0,0 @@ -``ctypes`` is optional now however if it's missing, a bare ``super()`` will not work in slots classes. -This should only happen in special environments like Google App Engine. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/287.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/287.change.rst deleted file mode 100644 index c3fbb797d4f..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/287.change.rst +++ /dev/null @@ -1,2 +0,0 @@ -The attribute redefinition feature introduced in 17.3.0 now takes into account if an attribute is redefined via multiple inheritance. -In that case, the definition that is closer to the base of the class hierarchy wins. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/290.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/290.change.rst new file mode 100644 index 00000000000..a4155e5e39a --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/290.change.rst @@ -0,0 +1 @@ +Added ``attr.field_dict()`` to return an ordered dictionary of ``attrs`` attributes for a class, whose keys are the attribute names. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/291.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/291.change.rst deleted file mode 100644 index 0d5438f1dbe..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/291.change.rst +++ /dev/null @@ -1 +0,0 @@ -Subclasses of ``auto_attribs=True`` can be empty now. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/292.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/292.change.rst deleted file mode 100644 index 0d5438f1dbe..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/292.change.rst +++ /dev/null @@ -1 +0,0 @@ -Subclasses of ``auto_attribs=True`` can be empty now. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/295.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/295.change.rst deleted file mode 100644 index 6867f66dd23..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/295.change.rst +++ /dev/null @@ -1,4 +0,0 @@ -Generated ``__hash__`` methods now hash the class type along with the attribute values. -Until now the hashes of two classes with the same values were identical which was a bug. - -The generated method is also *much* faster now. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/296.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/296.change.rst deleted file mode 100644 index 6867f66dd23..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/296.change.rst +++ /dev/null @@ -1,4 +0,0 @@ -Generated ``__hash__`` methods now hash the class type along with the attribute values. -Until now the hashes of two classes with the same values were identical which was a bug. - -The generated method is also *much* faster now. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/300.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/300.change.rst new file mode 100644 index 00000000000..6a090ac2094 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/300.change.rst @@ -0,0 +1,3 @@ +The order of attributes that are passed into ``attr.make_class()`` or the ``these`` argument of ``@attr.s()`` is now retained if the dictionary is ordered (i.e. ``dict`` on Python 3.6 and later, ``collections.OrderedDict`` otherwise). + +Before, the order was always determined by the order in which the attributes have been defined which may not be desirable when creating classes programatically. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/311.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/311.change.rst new file mode 100644 index 00000000000..4f7ce70767e --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/311.change.rst @@ -0,0 +1 @@ +In slotted classes, ``__getstate__`` and ``__setstate__`` now ignore the ``__weakref__`` attribute. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/321.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/321.change.rst new file mode 100644 index 00000000000..a10a22c4c75 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/321.change.rst @@ -0,0 +1,4 @@ +Setting the cell type is now completely best effort. +This fixes ``attrs`` on Jython. + +We cannot make any guarantees regarding Jython though, because our test suite cannot run due to dependency incompatabilities. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/322.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/322.change.rst new file mode 100644 index 00000000000..874a0ceccdc --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/322.change.rst @@ -0,0 +1 @@ +If ``attr.s`` is passed a *these* argument, it will not attempt to remove attributes with the same name from the class body anymore. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/323.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/323.change.rst new file mode 100644 index 00000000000..874a0ceccdc --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/323.change.rst @@ -0,0 +1 @@ +If ``attr.s`` is passed a *these* argument, it will not attempt to remove attributes with the same name from the class body anymore. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/326.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/326.change.rst new file mode 100644 index 00000000000..4f7ce70767e --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/326.change.rst @@ -0,0 +1 @@ +In slotted classes, ``__getstate__`` and ``__setstate__`` now ignore the ``__weakref__`` attribute. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/331.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/331.change.rst new file mode 100644 index 00000000000..5db960fd8ca --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/331.change.rst @@ -0,0 +1 @@ +The hash of ``attr.NOTHING`` is now vegan and faster on 32bit Python builds. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/332.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/332.change.rst new file mode 100644 index 00000000000..5db960fd8ca --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/332.change.rst @@ -0,0 +1 @@ +The hash of ``attr.NOTHING`` is now vegan and faster on 32bit Python builds. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/334.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/334.change.rst new file mode 100644 index 00000000000..a10a22c4c75 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/334.change.rst @@ -0,0 +1,4 @@ +Setting the cell type is now completely best effort. +This fixes ``attrs`` on Jython. + +We cannot make any guarantees regarding Jython though, because our test suite cannot run due to dependency incompatabilities. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/336.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/336.change.rst new file mode 100644 index 00000000000..5609bcad192 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/336.change.rst @@ -0,0 +1 @@ +The overhead of instantiating frozen dict classes is virtually eliminated. \ No newline at end of file diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/339.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/339.change.rst new file mode 100644 index 00000000000..6a090ac2094 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/339.change.rst @@ -0,0 +1,3 @@ +The order of attributes that are passed into ``attr.make_class()`` or the ``these`` argument of ``@attr.s()`` is now retained if the dictionary is ordered (i.e. ``dict`` on Python 3.6 and later, ``collections.OrderedDict`` otherwise). + +Before, the order was always determined by the order in which the attributes have been defined which may not be desirable when creating classes programatically. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/343.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/343.change.rst new file mode 100644 index 00000000000..6a090ac2094 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/343.change.rst @@ -0,0 +1,3 @@ +The order of attributes that are passed into ``attr.make_class()`` or the ``these`` argument of ``@attr.s()`` is now retained if the dictionary is ordered (i.e. ``dict`` on Python 3.6 and later, ``collections.OrderedDict`` otherwise). + +Before, the order was always determined by the order in which the attributes have been defined which may not be desirable when creating classes programatically. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/349.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/349.change.rst new file mode 100644 index 00000000000..a4155e5e39a --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/349.change.rst @@ -0,0 +1 @@ +Added ``attr.field_dict()`` to return an ordered dictionary of ``attrs`` attributes for a class, whose keys are the attribute names. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/356.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/356.change.rst new file mode 100644 index 00000000000..283f81aa5b8 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/356.change.rst @@ -0,0 +1 @@ +``attr.ib(factory=f)`` is now syntactic sugar for the common case of ``attr.ib(default=attr.Factory(f))``. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/363.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/363.change.rst new file mode 100644 index 00000000000..b0f2c31d7de --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/363.change.rst @@ -0,0 +1 @@ +Generated ``__init__`` methods now have an ``__annotations__`` attribute derived from the types of the fields. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/369.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/369.change.rst new file mode 100644 index 00000000000..ee40a6fa322 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/369.change.rst @@ -0,0 +1,6 @@ +We have restructured the documentation a bit to account for ``attrs``' growth in scope. +Instead of putting everything into the `examples `_ page, we have started to extract narrative chapters. + +So far, we've added chapters on `initialization `_ and `hashing `_. + +Expect more to come! diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/370.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/370.change.rst new file mode 100644 index 00000000000..ee40a6fa322 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/370.change.rst @@ -0,0 +1,6 @@ +We have restructured the documentation a bit to account for ``attrs``' growth in scope. +Instead of putting everything into the `examples `_ page, we have started to extract narrative chapters. + +So far, we've added chapters on `initialization `_ and `hashing `_. + +Expect more to come! diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/95.change.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/95.change.rst new file mode 100644 index 00000000000..dc965173569 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/95.change.rst @@ -0,0 +1 @@ +``x=X(); x.cycle = x; repr(x)`` will no longer raise a ``RecursionError``, and will instead show as ``X(x=...)``. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/towncrier_template.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/towncrier_template.rst new file mode 100644 index 00000000000..29ca74c4e8f --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/changelog.d/towncrier_template.rst @@ -0,0 +1,35 @@ +{% for section, _ in sections.items() %} +{% set underline = underlines[0] %}{% if section %}{{section}} +{{ underline * section|length }}{% set underline = underlines[1] %} + +{% endif %} + +{% if sections[section] %} +{% for category, val in definitions.items() if category in sections[section]%} +{{ definitions[category]['name'] }} +{{ underline * definitions[category]['name']|length }} + +{% if definitions[category]['showcontent'] %} +{% for text, values in sections[section][category].items() %} +- {{ text }} + {{ values|join(',\n ') }} +{% endfor %} + +{% else %} +- {{ sections[section][category]['']|join(', ') }} + +{% endif %} +{% if sections[section][category]|length == 0 %} +No significant changes. + +{% else %} +{% endif %} + +{% endfor %} +{% else %} +No significant changes. + + +{% endif %} +{% endfor %} +---- diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/dev-requirements.txt b/tests/wpt/web-platform-tests/tools/third_party/attrs/dev-requirements.txt deleted file mode 100644 index bbd6b9201e0..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/dev-requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -coverage -hypothesis -pympler -pytest -six -zope.interface diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs-requirements.txt b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs-requirements.txt deleted file mode 100644 index c473e1e4324..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs-requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ --e . -sphinx -zope.interface diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/api.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/api.rst index e2acb7400f4..3ba23603ec5 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/api.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/api.rst @@ -18,7 +18,7 @@ What follows is the API explanation, if you'd like a more hands-on introduction, Core ---- -.. autofunction:: attr.s(these=None, repr_ns=None, repr=True, cmp=True, hash=None, init=True, slots=False, frozen=False, str=False) +.. autofunction:: attr.s(these=None, repr_ns=None, repr=True, cmp=True, hash=None, init=True, slots=False, frozen=False, str=False, auto_attribs=False) .. note:: @@ -90,7 +90,7 @@ Core ... class C(object): ... x = attr.ib() >>> attr.fields(C).x - Attribute(name='x', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, convert=None, metadata=mappingproxy({}), type=None) + Attribute(name='x', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None) .. autofunction:: attr.make_class @@ -140,56 +140,7 @@ Core @attr.s(auto_attribs=True) class C: x: int - y = attr.ib() - - -Influencing Initialization -++++++++++++++++++++++++++ - -Generally speaking, it's best to keep logic out of your ``__init__``. -The moment you need a finer control over how your class is instantiated, it's usually best to use a classmethod factory or to apply the `builder pattern `_. - -However, sometimes you need to do that one quick thing after your class is initialized. -And for that ``attrs`` offers the ``__attrs_post_init__`` hook that is automatically detected and run after ``attrs`` is done initializing your instance: - -.. doctest:: - - >>> @attr.s - ... class C(object): - ... x = attr.ib() - ... y = attr.ib(init=False) - ... def __attrs_post_init__(self): - ... self.y = self.x + 1 - >>> C(1) - C(x=1, y=2) - -Please note that you can't directly set attributes on frozen classes: - -.. doctest:: - - >>> @attr.s(frozen=True) - ... class FrozenBroken(object): - ... x = attr.ib() - ... y = attr.ib(init=False) - ... def __attrs_post_init__(self): - ... self.y = self.x + 1 - >>> FrozenBroken(1) - Traceback (most recent call last): - ... - attr.exceptions.FrozenInstanceError: can't set attribute - -If you need to set attributes on a frozen class, you'll have to resort to the :ref:`same trick ` as ``attrs`` and use :meth:`object.__setattr__`: - -.. doctest:: - - >>> @attr.s(frozen=True) - ... class Frozen(object): - ... x = attr.ib() - ... y = attr.ib(init=False) - ... def __attrs_post_init__(self): - ... object.__setattr__(self, "y", self.x + 1) - >>> Frozen(1) - Frozen(x=1, y=2) + y = attr.ib() # <- ERROR! .. _helpers: @@ -210,12 +161,29 @@ Helpers ... x = attr.ib() ... y = attr.ib() >>> attr.fields(C) - (Attribute(name='x', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, convert=None, metadata=mappingproxy({}), type=None), Attribute(name='y', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, convert=None, metadata=mappingproxy({}), type=None)) + (Attribute(name='x', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None), Attribute(name='y', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None)) >>> attr.fields(C)[1] - Attribute(name='y', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, convert=None, metadata=mappingproxy({}), type=None) + Attribute(name='y', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None) >>> attr.fields(C).y is attr.fields(C)[1] True +.. autofunction:: attr.fields_dict + + For example: + + .. doctest:: + + >>> @attr.s + ... class C(object): + ... x = attr.ib() + ... y = attr.ib() + >>> attr.fields_dict(C) + {'x': Attribute(name='x', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None), 'y': Attribute(name='y', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None)} + >>> attr.fields_dict(C)['y'] + Attribute(name='y', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None) + >>> attr.fields_dict(C)['y'] is attr.fields(C).y + True + .. autofunction:: attr.has @@ -412,7 +380,7 @@ Converters >>> @attr.s ... class C(object): - ... x = attr.ib(convert=attr.converters.optional(int)) + ... x = attr.ib(converter=attr.converters.optional(int)) >>> C(None) C(x=None) >>> C(42) diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/contributing.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/contributing.rst index 1d519c38151..acb527b2308 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/contributing.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/contributing.rst @@ -1,5 +1,5 @@ .. _contributing: -.. include:: ../CONTRIBUTING.rst +.. include:: ../.github/CONTRIBUTING.rst -.. include:: ../CODE_OF_CONDUCT.rst +.. include:: ../.github/CODE_OF_CONDUCT.rst diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/examples.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/examples.rst index 4432e8fcb53..e8014188be3 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/examples.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/examples.rst @@ -115,7 +115,7 @@ This is useful in times when you want to enhance classes that are not yours (nic ... class B(object): ... b = attr.ib() >>> @attr.s - ... class C(B, A): + ... class C(A, B): ... c = attr.ib() >>> i = C(1, 2, 3) >>> i @@ -218,8 +218,6 @@ Other times, all you want is a tuple and ``attrs`` won't let you down: True - - Defaults -------- @@ -282,6 +280,16 @@ The method receives the partially initialized instance which enables you to base C(x=1, y=2) +And since the case of ``attr.ib(default=attr.Factory(f))`` is so common, ``attrs`` also comes with syntactic sugar for it: + +.. doctest:: + + >>> @attr.s + ... class C(object): + ... x = attr.ib(factory=list) + >>> C() + C(x=[]) + .. _examples_validators: Validators @@ -291,18 +299,7 @@ Although your initializers should do as little as possible (ideally: just initia ``attrs`` offers two ways to define validators for each attribute and it's up to you to choose which one suites better your style and project. - -Decorator -~~~~~~~~~ - -The more straightforward way is by using the attribute's ``validator`` method as a decorator. -The method has to accept three arguments: - -#. the *instance* that's being validated (aka ``self``), -#. the *attribute* that it's validating, and finally -#. the *value* that is passed for it. - -If the value does not pass the validator's standards, it just raises an appropriate exception. +You can use a decorator: .. doctest:: @@ -320,15 +317,7 @@ If the value does not pass the validator's standards, it just raises an appropri ... ValueError: x must be smaller or equal to 42 - -Callables -~~~~~~~~~ - -If you want to re-use your validators, you should have a look at the ``validator`` argument to :func:`attr.ib()`. - -It takes either a callable or a list of callables (usually functions) and treats them as validators that receive the same arguments as with the decorator approach. - -Since the validators runs *after* the instance is initialized, you can refer to other attributes while validating: + ...or a callable... .. doctest:: @@ -347,18 +336,28 @@ Since the validators runs *after* the instance is initialized, you can refer to ... ValueError: 'x' has to be smaller than 'y'! -This example also shows of some syntactic sugar for using the :func:`attr.validators.and_` validator: if you pass a list, all validators have to pass. - -``attrs`` won't intercept your changes to those attributes but you can always call :func:`attr.validate` on any instance to verify that it's still valid: +...or both at once: .. doctest:: - >>> i = C(4, 5) - >>> i.x = 5 # works, no magic here - >>> attr.validate(i) + >>> @attr.s + ... class C(object): + ... x = attr.ib(validator=attr.validators.instance_of(int)) + ... @x.validator + ... def fits_byte(self, attribute, value): + ... if not 0 <= value < 256: + ... raise ValueError("value out of bounds") + >>> C(128) + C(x=128) + >>> C("128") Traceback (most recent call last): ... - ValueError: 'x' has to be smaller than 'y'! + TypeError: ("'x' must be (got '128' that is a ).", Attribute(name='x', default=NOTHING, validator=[>, ], repr=True, cmp=True, hash=True, init=True, metadata=mappingproxy({}), type=None, converter=one), , '128') + >>> C(256) + Traceback (most recent call last): + ... + ValueError: value out of bounds + ``attrs`` ships with a bunch of validators, make sure to :ref:`check them out ` before writing your own: @@ -374,72 +373,25 @@ This example also shows of some syntactic sugar for using the :func:`attr.valida ... TypeError: ("'x' must be (got '42' that is a ).", Attribute(name='x', default=NOTHING, factory=NOTHING, validator=>, type=None), , '42') -Of course you can mix and match the two approaches at your convenience: - -.. doctest:: - - >>> @attr.s - ... class C(object): - ... x = attr.ib(validator=attr.validators.instance_of(int)) - ... @x.validator - ... def fits_byte(self, attribute, value): - ... if not 0 < value < 256: - ... raise ValueError("value out of bounds") - >>> C(128) - C(x=128) - >>> C("128") - Traceback (most recent call last): - ... - TypeError: ("'x' must be (got '128' that is a ).", Attribute(name='x', default=NOTHING, validator=[>, ], repr=True, cmp=True, hash=True, init=True, convert=None, metadata=mappingproxy({}), type=None), , '128') - >>> C(256) - Traceback (most recent call last): - ... - ValueError: value out of bounds - -And finally you can disable validators globally: - - >>> attr.set_run_validators(False) - >>> C("128") - C(x='128') - >>> attr.set_run_validators(True) - >>> C("128") - Traceback (most recent call last): - ... - TypeError: ("'x' must be (got '128' that is a ).", Attribute(name='x', default=NOTHING, validator=[>, ], repr=True, cmp=True, hash=True, init=True, convert=None, metadata=mappingproxy({}), type=None), , '128') +Check out :ref:`validators` for more details. Conversion ---------- -Attributes can have a ``convert`` function specified, which will be called with the attribute's passed-in value to get a new value to use. +Attributes can have a ``converter`` function specified, which will be called with the attribute's passed-in value to get a new value to use. This can be useful for doing type-conversions on values that you don't want to force your callers to do. .. doctest:: >>> @attr.s ... class C(object): - ... x = attr.ib(convert=int) + ... x = attr.ib(converter=int) >>> o = C("1") >>> o.x 1 -Converters are run *before* validators, so you can use validators to check the final form of the value. - -.. doctest:: - - >>> def validate_x(instance, attribute, value): - ... if value < 0: - ... raise ValueError("x must be be at least 0.") - >>> @attr.s - ... class C(object): - ... x = attr.ib(convert=int, validator=validate_x) - >>> o = C("0") - >>> o.x - 0 - >>> C("-1") - Traceback (most recent call last): - ... - ValueError: x must be be at least 0. +Check out :ref:`converters` for more details. .. _metadata: @@ -509,6 +461,7 @@ If you don't mind annotating *all* attributes, you can even drop the :func:`attr >>> AutoC.cls_var 5 +The generated ``__init__`` method will have an attribute called ``__annotations__`` that contains this type information. .. warning:: @@ -521,12 +474,8 @@ If you don't mind annotating *all* attributes, you can even drop the :func:`attr Slots ----- -By default, instances of classes have a dictionary for attribute storage. -This wastes space for objects having very few data attributes. -The space consumption can become significant when creating large numbers of instances. - -Normal Python classes can avoid using a separate dictionary for each instance of a class by `defining `_ ``__slots__``. -For ``attrs`` classes it's enough to set ``slots=True``: +:term:`Slotted classes` have a bunch of advantages on CPython. +Defining ``__slots__`` by hand is tedious, in ``attrs`` it's just a matter of passing ``slots=True``: .. doctest:: @@ -536,59 +485,6 @@ For ``attrs`` classes it's enough to set ``slots=True``: ... y = attr.ib() -.. note:: - - ``attrs`` slot classes can inherit from other classes just like non-slot classes, but some of the benefits of slot classes are lost if you do that. - If you must inherit from other classes, try to inherit only from other slot classes. - -Slot classes are a little different than ordinary, dictionary-backed classes: - -- Assigning to a non-existent attribute of an instance will result in an ``AttributeError`` being raised. - Depending on your needs, this might be a good thing since it will let you catch typos early. - This is not the case if your class inherits from any non-slot classes. - - .. doctest:: - - >>> @attr.s(slots=True) - ... class Coordinates(object): - ... x = attr.ib() - ... y = attr.ib() - ... - >>> c = Coordinates(x=1, y=2) - >>> c.z = 3 - Traceback (most recent call last): - ... - AttributeError: 'Coordinates' object has no attribute 'z' - -- Since non-slot classes cannot be turned into slot classes after they have been created, ``attr.s(slots=True)`` will *replace* the class it is applied to with a copy. - In almost all cases this isn't a problem, but we mention it for the sake of completeness. - - * One notable problem is that certain metaclass features like ``__init_subclass__`` do not work with slot classes. - -- Using :mod:`pickle` with slot classes requires pickle protocol 2 or greater. - Python 2 uses protocol 0 by default so the protocol needs to be specified. - Python 3 uses protocol 3 by default. - You can support protocol 0 and 1 by implementing :meth:`__getstate__ ` and :meth:`__setstate__ ` methods yourself. - Those methods are created for frozen slot classes because they won't pickle otherwise. - `Think twice `_ before using :mod:`pickle` though. - -- As always with slot classes, you must specify a ``__weakref__`` slot if you wish for the class to be weak-referenceable. - Here's how it looks using ``attrs``: - - .. doctest:: - - >>> import weakref - >>> @attr.s(slots=True) - ... class C(object): - ... __weakref__ = attr.ib(init=False, hash=False, repr=False, cmp=False) - ... x = attr.ib() - >>> c = C(1) - >>> weakref.ref(c) - - -All in all, setting ``slots=True`` is usually a very good idea. - - Immutability ------------ diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/extending.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/extending.rst index d460ee9b8c0..77f3f64472c 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/extending.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/extending.rst @@ -17,7 +17,7 @@ So it is fairly simple to build your own decorators on top of ``attrs``: ... @attr.s ... class C(object): ... a = attr.ib() - (Attribute(name='a', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, convert=None, metadata=mappingproxy({}), type=None),) + (Attribute(name='a', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None),) .. warning:: diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/glossary.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/glossary.rst new file mode 100644 index 00000000000..2fdf80627a4 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/glossary.rst @@ -0,0 +1,63 @@ +Glossary +======== + +.. glossary:: + + dict classes + A regular class whose attributes are stored in the ``__dict__`` attribute of every single instance. + This is quite wasteful especially for objects with very few data attributes and the space consumption can become significant when creating large numbers of instances. + + This is the type of class you get by default both with and without ``attrs``. + + slotted classes + A class that has no ``__dict__`` attribute and `defines `_ its attributes in a ``__slots__`` attribute instead. + In ``attrs``, they are created by passing ``slots=True`` to ``@attr.s``. + + Their main advantage is that they use less memory on CPython [#pypy]_. + + However they also come with a bunch of possibly surprising gotchas: + + - Slotted classes don't allow for any other attribute to be set except for those defined in one of the class' hierarchies ``__slots__``: + + .. doctest:: + + >>> import attr + >>> @attr.s(slots=True) + ... class Coordinates(object): + ... x = attr.ib() + ... y = attr.ib() + ... + >>> c = Coordinates(x=1, y=2) + >>> c.z = 3 + Traceback (most recent call last): + ... + AttributeError: 'Coordinates' object has no attribute 'z' + + - Slotted classes can inherit from other classes just like non-slotted classes, but some of the benefits of slotted classes are lost if you do that. + If you must inherit from other classes, try to inherit only from other slot classes. + + - Using :mod:`pickle` with slotted classes requires pickle protocol 2 or greater. + Python 2 uses protocol 0 by default so the protocol needs to be specified. + Python 3 uses protocol 3 by default. + You can support protocol 0 and 1 by implementing :meth:`__getstate__ ` and :meth:`__setstate__ ` methods yourself. + Those methods are created for frozen slotted classes because they won't pickle otherwise. + `Think twice `_ before using :mod:`pickle` though. + + - As always with slotted classes, you must specify a ``__weakref__`` slot if you wish for the class to be weak-referenceable. + Here's how it looks using ``attrs``: + + .. doctest:: + + >>> import weakref + >>> @attr.s(slots=True) + ... class C(object): + ... __weakref__ = attr.ib(init=False, hash=False, repr=False, cmp=False) + ... x = attr.ib() + >>> c = C(1) + >>> weakref.ref(c) + + - Since it's currently impossible to make a class slotted after it's created, ``attrs`` has to replace your class with a new one. + While it tries to do that as graciously as possible, certain metaclass features like ``__init_subclass__`` do not work with slotted classes. + + +.. [#pypy] On PyPy, there is no memory advantage in using slotted classes. diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/hashing.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/hashing.rst new file mode 100644 index 00000000000..8bfd0413f64 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/hashing.rst @@ -0,0 +1,56 @@ +Hashing +======= + +.. warning:: + + The overarching theme is to never set the ``@attr.s(hash=X)`` parameter yourself. + Leave it at ``None`` which means that ``attrs`` will do the right thing for you, depending on the other parameters: + + - If you want to make objects hashable by value: use ``@attr.s(frozen=True)``. + - If you want hashing and comparison by object identity: use ``@attr.s(cmp=False)`` + + Setting ``hash`` yourself can have unexpected consequences so we recommend to tinker with it only if you know exactly what you're doing. + +Under certain circumstances, it's necessary for objects to be *hashable*. +For example if you want to put them into a :class:`set` or if you want to use them as keys in a :class:`dict`. + +The *hash* of an object is an integer that represents the contents of an object. +It can be obtained by calling :func:`hash` on an object and is implemented by writing a ``__hash__`` method for your class. + +``attrs`` will happily write a ``__hash__`` method you [#fn1]_, however it will *not* do so by default. +Because according to the definition_ from the official Python docs, the returned hash has to fullfil certain constraints: + +#. Two objects that are equal, **must** have the same hash. + This means that if ``x == y``, it *must* follow that ``hash(x) == hash(y)``. + + By default, Python classes are compared *and* hashed by their :func:`id`. + That means that every instance of a class has a different hash, no matter what attributes it carries. + + It follows that the moment you (or ``attrs``) change the way equality is handled by implementing ``__eq__`` which is based on attribute values, this constraint is broken. + For that reason Python 3 will make a class that has customized equality unhashable. + Python 2 on the other hand will happily let you shoot your foot off. + Unfortunately ``attrs`` currently mimics Python 2's behavior for backward compatibility reasons if you set ``hash=False``. + + The *correct way* to achieve hashing by id is to set ``@attr.s(cmp=False)``. + Setting ``@attr.s(hash=False)`` (that implies ``cmp=True``) is almost certainly a *bug*. + +#. If two object are not equal, their hash **should** be different. + + While this isn't a requirement from a standpoint of correctness, sets and dicts become less effective if there are a lot of identical hashes. + The worst case is when all objects have the same hash which turns a set into a list. + +#. The hash of an object **must not** change. + + If you create a class with ``@attr.s(frozen=True)`` this is fullfilled by definition, therefore ``attrs`` will write a ``__hash__`` function for you automatically. + You can also force it to write one with ``hash=True`` but then it's *your* responsibility to make sure that the object is not mutated. + + This point is the reason why mutable structures like lists, dictionaries, or sets aren't hashable while immutable ones like tuples or frozensets are: + point 1 and 2 require that the hash changes with the contents but point 3 forbids it. + +For a more thorough explanation of this topic, please refer to this blog post: `Python Hashes and Equality`_. + + +.. [#fn1] The hash is computed by hashing a tuple that consists of an unique id for the class plus all attribute values. + +.. _definition: https://docs.python.org/3/glossary.html#term-hashable +.. _`Python Hashes and Equality`: https://hynek.me/articles/hashes-and-equality/ diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/how-does-it-work.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/how-does-it-work.rst index c20becd1f78..f76e6f56abf 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/how-does-it-work.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/how-does-it-work.rst @@ -17,7 +17,7 @@ In order to ensure that sub-classing works as you'd expect it to work, ``attrs`` Please note that ``attrs`` does *not* call ``super()`` *ever*. It will write dunder methods to work on *all* of those attributes which also has performance benefits due to fewer function calls. -Once ``attrs`` knows what attributes it has to work on, it writes the requested dunder methods and -- depending on whether you wish to have ``__slots__`` -- creates a new class for you (``slots=True``) or attaches them to the original class (``slots=False``). +Once ``attrs`` knows what attributes it has to work on, it writes the requested dunder methods and -- depending on whether you wish to have a :term:`dict ` or :term:`slotted ` class -- creates a new class for you (``slots=True``) or attaches them to the original class (``slots=False``). While creating new classes is more elegant, we've run into several edge cases surrounding metaclasses that make it impossible to go this route unconditionally. To be very clear: if you define a class with a single attribute without a default value, the generated ``__init__`` will look *exactly* how you'd expect: @@ -53,7 +53,24 @@ Immutability In order to give you immutability, ``attrs`` will attach a ``__setattr__`` method to your class that raises a :exc:`attr.exceptions.FrozenInstanceError` whenever anyone tries to set an attribute. -To circumvent that ourselves in ``__init__``, ``attrs`` uses (an aggressively cached) :meth:`object.__setattr__` to set your attributes. +Depending on whether of not a class is a dict class or a slots class, ``attrs`` uses a different technique to circumvent that limitation in the ``__init__`` method. + +Once constructed, frozen instances don't differ in any way from regular ones except that you cannot change its attributes. + + +Dict Classes +++++++++++++ + +Dict classes -- i.e. regular classes -- simply assign the value directly into the class' eponymous ``__dict__`` (and there's nothing we can do to stop the user to do the same). + +The performance impact is negligible. + + +Slots Classes ++++++++++++++ + +Slots classes are more complicated. +Here it uses (an aggressively cached) :meth:`object.__setattr__` to set your attributes. This is (still) slower than a plain assignment: .. code-block:: none @@ -74,6 +91,10 @@ So on a standard notebook the difference is about 300 nanoseconds (1 second is 1 It's certainly something you'll feel in a hot loop but shouldn't matter in normal code. Pick what's more important to you. -**** -Once constructed, frozen instances don't differ in any way from regular ones except that you cannot change its attributes. +Summary ++++++++ + +You should avoid to instantiate lots of frozen slotted classes (i.e. ``@attr.s(slots=True, frozen=True)``) in performance-critical code. + +Frozen dict classes have barely a performance impact, unfrozen slotted classes are even *faster* than unfrozen dict classes (i.e. regular classes). diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/index.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/index.rst index bb24cd773fb..8544f19b6da 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/index.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/index.rst @@ -27,6 +27,7 @@ The next three steps should bring you up and running in no time: After reading, you will know about our advanced features and how to use them. - Finally :doc:`why` gives you a rundown of potential alternatives and why we think ``attrs`` is superior. Yes, we've heard about ``namedtuple``\ s! +- If at any point you get confused by some terminology, please check out our :doc:`glossary`. If you need any help while getting started, feel free to use the ``python-attrs`` tag on `StackOverflow `_ and someone will surely help you out! @@ -36,6 +37,11 @@ Day-to-Day Usage ================ - Once you're comfortable with the concepts, our :doc:`api` contains all information you need to use ``attrs`` to its fullest. +- Instance initialization is one of ``attrs`` key feature areas. + Our goal is to relieve you from writing as much code as possible. + :doc:`init` gives you an overview what ``attrs`` has to offer and explains some related philosophies we believe in. +- If you want to put objects into sets or use them as keys in dictionaries, they have to be hashable. + The simplest way to do that is to use frozen classes, but the topic is more complex than it seems and :doc:`hashing` will give you a primer on what to look out for. - ``attrs`` is built for extension from the ground up. :doc:`extending` will show you the affordances it offers and how to make it a building block of your own projects. @@ -68,9 +74,12 @@ Full Table of Contents overview why examples + init + hashing api extending how-does-it-work + glossary Indices and tables diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/init.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/init.rst new file mode 100644 index 00000000000..e2cdd03922e --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/init.rst @@ -0,0 +1,354 @@ +Initialization +============== + +In Python, instance intialization happens in the ``__init__`` method. +Generally speaking, you should keep as little logic as possible in it, and you should think about what the class needs and not how it is going to be instantiated. + +Passing complex objects into ``__init__`` and then using them to derive data for the class unnecessarily couples your new class with the old class which makes it harder to test and also will cause problems later. + +So assuming you use an ORM and want to extract 2D points from a row object, do not write code like this:: + + class Point(object): + def __init__(self, database_row): + self.x = database_row.x + self.y = database_row.y + + pt = Point(row) + +Instead, write a :func:`classmethod` that will extract it for you:: + + @attr.s + class Point(object): + x = attr.ib() + y = attr.ib() + + @classmethod + def from_row(cls, row): + return cls(row.x, row.y) + + pt = Point.from_row(row) + +Now you can instantiate ``Point``\ s without creating fake row objects in your tests and you can have as many smart creation helpers as you want, in case more data sources appear. + +For similar reasons, we strongly discourage from patterns like:: + + pt = Point(**row.attributes) + +which couples your classes to the data model. +Try to design your classes in a way that is clean and convenient to use -- not based on your database format. +The database format can change anytime and you're stuck with a bad class design that is hard to change. +Embrace classmethods as a filter between reality and what's best for you to work with. + +If you look for object serialization, there's a bunch of projects listed on our ``attrs`` extensions `Wiki page`_. +Some of them even support nested schemas. + + +Private Attributes +------------------ + +One thing people tend to find confusing is the treatment of private attributes that start with an underscore. +``attrs`` follows the doctrine that `there is no such thing as a private argument`_ and strips the underscores from the name when writing the ``__init__`` method signature: + +.. doctest:: + + >>> import inspect, attr + >>> @attr.s + ... class C(object): + ... _x = attr.ib() + >>> inspect.signature(C.__init__) + None> + +There really isn't a right or wrong, it's a matter of taste. +But it's important to be aware of it because it can lead to surprising syntax errors: + +.. doctest:: + + >>> @attr.s + ... class C(object): + ... _1 = attr.ib() + Traceback (most recent call last): + ... + SyntaxError: invalid syntax + +In this case a valid attribute name ``_1`` got transformed into an invalid argument name ``1``. + + +Defaults +-------- + +Sometimes you don't want to pass all attribute values to a class. +And sometimes, certain attributes aren't even intended to be passed but you want to allow for customization anyways for easier testing. + +This is when default values come into play: + +.. doctest:: + + >>> import attr + >>> @attr.s + ... class C(object): + ... a = attr.ib(default=42) + ... b = attr.ib(default=attr.Factory(list)) + ... c = attr.ib(factory=list) # syntactic sugar for above + ... d = attr.ib() + ... @d.default + ... def _any_name_except_a_name_of_an_attribute(self): + ... return {} + >>> C() + C(a=42, b=[], c=[], d={}) + +It's important that the decorated method -- or any other method or property! -- doesn't have the same name as the attribute, otherwise it would overwrite the attribute definition. + + +Please note that as with function and method signatures, ``default=[]`` will *not* do what you may think it might do: + +.. doctest:: + + >>> @attr.s + ... class C(object): + ... x = attr.ib(default=[]) + >>> i = C() + >>> j = C() + >>> i.x.append(42) + >>> j.x + [42] + + +This is why ``attrs`` comes with factory options. + +.. warning:: + + Please note that the decorator based defaults have one gotcha: + they are executed when the attribute is set, that means depending on the order of attributes, the ``self`` object may not be fully initialized when they're called. + + Therefore you should use ``self`` as little as possible. + + Even the smartest of us can `get confused`_ by what happens if you pass partially initialized objects around. + + + .. _validators: + +Validators +---------- + +Another thing that definitely *does* belong into ``__init__`` is checking the resulting instance for invariants. +This is why ``attrs`` has the concept of validators. + + +Decorator +~~~~~~~~~ + +The most straightforward way is using the attribute's ``validator`` method as a decorator. + +The method has to accept three arguments: + +#. the *instance* that's being validated (aka ``self``), +#. the *attribute* that it's validating, and finally +#. the *value* that is passed for it. + +If the value does not pass the validator's standards, it just raises an appropriate exception. + + >>> @attr.s + ... class C(object): + ... x = attr.ib() + ... @x.validator + ... def _check_x(self, attribute, value): + ... if value > 42: + ... raise ValueError("x must be smaller or equal to 42") + >>> C(42) + C(x=42) + >>> C(43) + Traceback (most recent call last): + ... + ValueError: x must be smaller or equal to 42 + +Again, it's important that the decorated method doesn't have the same name as the attribute. + + +Callables +~~~~~~~~~ + +If you want to re-use your validators, you should have a look at the ``validator`` argument to :func:`attr.ib()`. + +It takes either a callable or a list of callables (usually functions) and treats them as validators that receive the same arguments as with the decorator approach. + +Since the validators runs *after* the instance is initialized, you can refer to other attributes while validating: + +.. doctest:: + + >>> def x_smaller_than_y(instance, attribute, value): + ... if value >= instance.y: + ... raise ValueError("'x' has to be smaller than 'y'!") + >>> @attr.s + ... class C(object): + ... x = attr.ib(validator=[attr.validators.instance_of(int), + ... x_smaller_than_y]) + ... y = attr.ib() + >>> C(x=3, y=4) + C(x=3, y=4) + >>> C(x=4, y=3) + Traceback (most recent call last): + ... + ValueError: 'x' has to be smaller than 'y'! + +This example also shows of some syntactic sugar for using the :func:`attr.validators.and_` validator: if you pass a list, all validators have to pass. + +``attrs`` won't intercept your changes to those attributes but you can always call :func:`attr.validate` on any instance to verify that it's still valid: + +.. doctest:: + + >>> i = C(4, 5) + >>> i.x = 5 # works, no magic here + >>> attr.validate(i) + Traceback (most recent call last): + ... + ValueError: 'x' has to be smaller than 'y'! + +``attrs`` ships with a bunch of validators, make sure to :ref:`check them out ` before writing your own: + +.. doctest:: + + >>> @attr.s + ... class C(object): + ... x = attr.ib(validator=attr.validators.instance_of(int)) + >>> C(42) + C(x=42) + >>> C("42") + Traceback (most recent call last): + ... + TypeError: ("'x' must be (got '42' that is a ).", Attribute(name='x', default=NOTHING, factory=NOTHING, validator=>, type=None), , '42') + +Of course you can mix and match the two approaches at your convenience. +If you define validators both ways for an attribute, they are both ran: + +.. doctest:: + + >>> @attr.s + ... class C(object): + ... x = attr.ib(validator=attr.validators.instance_of(int)) + ... @x.validator + ... def fits_byte(self, attribute, value): + ... if not 0 <= value < 256: + ... raise ValueError("value out of bounds") + >>> C(128) + C(x=128) + >>> C("128") + Traceback (most recent call last): + ... + TypeError: ("'x' must be (got '128' that is a ).", Attribute(name='x', default=NOTHING, validator=[>, ], repr=True, cmp=True, hash=True, init=True, metadata=mappingproxy({}), type=None, converter=one), , '128') + >>> C(256) + Traceback (most recent call last): + ... + ValueError: value out of bounds + +And finally you can disable validators globally: + + >>> attr.set_run_validators(False) + >>> C("128") + C(x='128') + >>> attr.set_run_validators(True) + >>> C("128") + Traceback (most recent call last): + ... + TypeError: ("'x' must be (got '128' that is a ).", Attribute(name='x', default=NOTHING, validator=[>, ], repr=True, cmp=True, hash=True, init=True, metadata=mappingproxy({}), type=None, converter=None), , '128') + + +.. _converters: + +Converters +---------- + +Finally, sometimes you may want to normalize the values coming in. +For that ``attrs`` comes with converters. + +Attributes can have a ``converter`` function specified, which will be called with the attribute's passed-in value to get a new value to use. +This can be useful for doing type-conversions on values that you don't want to force your callers to do. + +.. doctest:: + + >>> @attr.s + ... class C(object): + ... x = attr.ib(converter=int) + >>> o = C("1") + >>> o.x + 1 + +Converters are run *before* validators, so you can use validators to check the final form of the value. + +.. doctest:: + + >>> def validate_x(instance, attribute, value): + ... if value < 0: + ... raise ValueError("x must be at least 0.") + >>> @attr.s + ... class C(object): + ... x = attr.ib(converter=int, validator=validate_x) + >>> o = C("0") + >>> o.x + 0 + >>> C("-1") + Traceback (most recent call last): + ... + ValueError: x must be at least 0. + + +Arguably, you can abuse converters as one-argument validators: + +.. doctest:: + + >>> C("x") + Traceback (most recent call last): + ... + ValueError: invalid literal for int() with base 10: 'x' + + +Post-Init Hook +-------------- + +Generally speaking, the moment you think that you need finer control over how your class is instantiated than what ``attrs`` offers, it's usually best to use a classmethod factory or to apply the `builder pattern `_. + +However, sometimes you need to do that one quick thing after your class is initialized. +And for that ``attrs`` offers the ``__attrs_post_init__`` hook that is automatically detected and run after ``attrs`` is done initializing your instance: + +.. doctest:: + + >>> @attr.s + ... class C(object): + ... x = attr.ib() + ... y = attr.ib(init=False) + ... def __attrs_post_init__(self): + ... self.y = self.x + 1 + >>> C(1) + C(x=1, y=2) + +Please note that you can't directly set attributes on frozen classes: + +.. doctest:: + + >>> @attr.s(frozen=True) + ... class FrozenBroken(object): + ... x = attr.ib() + ... y = attr.ib(init=False) + ... def __attrs_post_init__(self): + ... self.y = self.x + 1 + >>> FrozenBroken(1) + Traceback (most recent call last): + ... + attr.exceptions.FrozenInstanceError: can't set attribute + +If you need to set attributes on a frozen class, you'll have to resort to the :ref:`same trick ` as ``attrs`` and use :meth:`object.__setattr__`: + +.. doctest:: + + >>> @attr.s(frozen=True) + ... class Frozen(object): + ... x = attr.ib() + ... y = attr.ib(init=False) + ... def __attrs_post_init__(self): + ... object.__setattr__(self, "y", self.x + 1) + >>> Frozen(1) + Frozen(x=1, y=2) + + +.. _`Wiki page`: https://github.com/python-attrs/attrs/wiki/Extensions-to-attrs +.. _`get confused`: https://github.com/python-attrs/attrs/issues/289 +.. _`there is no such thing as a private argument`: https://github.com/hynek/characteristic/issues/6 diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/why.rst b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/why.rst index 9c64cb93c57..0a8409c85ee 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/why.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/docs/why.rst @@ -135,6 +135,28 @@ With ``attrs`` your users won't notice a difference because it creates regular, .. _behaving like a tuple: https://docs.python.org/3/tutorial/datastructures.html#tuples-and-sequences +…Data Classes? +-------------- + +`PEP 557 `_ added Data Classes to `Python 3.7 `_ that resemble ``attrs`` in many ways. + +They are the result of the Python community's `wish `_ to have an easier way to write classes in the standard library that doesn't carry the problems of ``namedtuple``\ s. +To that end, ``attrs`` and its developers were involved in the PEP process and while we may disagree with some minor decisions that have been made, it's a fine library and if it stops you from abusing ``namedtuple``\ s, they are a huge win. + +Nevertheless, there are still reasons to prefer ``attrs`` over Data Classes whose relevancy depends on your circumstances: + +- ``attrs`` supports all maintream Python versions, including CPython 2.7 and PyPy. +- Data Classes are intentionally less powerful than ``attrs``. + There is a long list of features that were sacrificed for the sake of simplicity and while the most obvious ones are validators, converters, and ``__slots__``, it permeates throughout all APIs. + + On the other hand, Data Classes currently do not offer any significant feature that ``attrs`` doesn't already have. +- ``attrs`` can and will move faster. + We are not bound to any release schedules and we have a clear deprecation policy. + + One of the `reasons `_ to not vendor ``attrs`` in the standard library was to not impede ``attrs``'s future developement. + + + …dicts? ------- @@ -143,8 +165,6 @@ Dictionaries are not for fixed fields. If you have a dict, it maps something to something else. You should be able to add and remove values. - - ``attrs`` lets you be specific about those expectations; a dictionary does not. It gives you a named entity (the class) in your code, which lets you explain in other places whether you take a parameter of that class or return a value of that class. @@ -155,7 +175,7 @@ So if you never iterate over the keys of a dict, you should use a proper class. …hand-written classes? ---------------------- -While we're fans of all things artisanal, writing the same nine methods all over again doesn't qualify for me. +While we're fans of all things artisanal, writing the same nine methods again and again doesn't qualify. I usually manage to get some typos inside and there's simply more code that can break and thus has to be tested. To bring it into perspective, the equivalent of @@ -169,7 +189,7 @@ To bring it into perspective, the equivalent of >>> SmartClass(1, 2) SmartClass(a=1, b=2) -is +is roughly .. doctest:: @@ -219,7 +239,7 @@ is ... return NotImplemented ... ... def __hash__(self): - ... return hash((self.a, self.b)) + ... return hash((self.__class__, self.a, self.b)) >>> ArtisanalClass(a=1, b=2) ArtisanalClass(a=1, b=2) diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/pyproject.toml b/tests/wpt/web-platform-tests/tools/third_party/attrs/pyproject.toml index 0f68a7cb0fc..94c2b496347 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/pyproject.toml +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/pyproject.toml @@ -2,6 +2,7 @@ package = "attr" package_dir = "src" filename = "CHANGELOG.rst" + template = "changelog.d/towncrier_template.rst" issue_format = "`#{issue} `_" directory = "changelog.d" title_format = "{version} ({project_date})" diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/setup.py b/tests/wpt/web-platform-tests/tools/third_party/attrs/setup.py index 232d3f5eaaa..7436bea5c68 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/setup.py +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/setup.py @@ -24,11 +24,27 @@ CLASSIFIERS = [ "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules", ] INSTALL_REQUIRES = [] +EXTRAS_REQUIRE = { + "docs": [ + "sphinx", + "zope.interface", + ], + "tests": [ + "coverage", + "hypothesis", + "pympler", + "pytest", + "six", + "zope.interface", + ], +} +EXTRAS_REQUIRE["dev"] = EXTRAS_REQUIRE["tests"] + EXTRAS_REQUIRE["docs"] ############################################################################### @@ -92,4 +108,5 @@ if __name__ == "__main__": zip_safe=False, classifiers=CLASSIFIERS, install_requires=INSTALL_REQUIRES, + extras_require=EXTRAS_REQUIRE, ) diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/src/attr/__init__.py b/tests/wpt/web-platform-tests/tools/third_party/attrs/src/attr/__init__.py index 929b1721ff1..13cb6298dad 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/src/attr/__init__.py +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/src/attr/__init__.py @@ -6,11 +6,12 @@ from . import converters, exceptions, filters, validators from ._config import get_run_validators, set_run_validators from ._funcs import asdict, assoc, astuple, evolve, has from ._make import ( - NOTHING, Attribute, Factory, attrib, attrs, fields, make_class, validate + NOTHING, Attribute, Factory, attrib, attrs, fields, fields_dict, + make_class, validate ) -__version__ = "17.4.0.dev0" +__version__ = "18.1.0" __title__ = "attrs" __description__ = "Classes Without Boilerplate" @@ -43,6 +44,7 @@ __all__ = [ "evolve", "exceptions", "fields", + "fields_dict", "filters", "get_run_validators", "has", diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/src/attr/_compat.py b/tests/wpt/web-platform-tests/tools/third_party/attrs/src/attr/_compat.py index 8a49341b25f..42a91ee5dc4 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/src/attr/_compat.py +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/src/attr/_compat.py @@ -10,6 +10,13 @@ PY2 = sys.version_info[0] == 2 PYPY = platform.python_implementation() == "PyPy" +if PYPY or sys.version_info[:2] >= (3, 6): + ordered_dict = dict +else: + from collections import OrderedDict + ordered_dict = OrderedDict + + if PY2: from UserDict import IterableUserDict @@ -87,15 +94,12 @@ else: return types.MappingProxyType(dict(d)) -def import_ctypes(): # pragma: nocover +def import_ctypes(): """ Moved into a function for testability. """ - try: - import ctypes - return ctypes - except ImportError: - return None + import ctypes + return ctypes if not PY2: @@ -126,12 +130,15 @@ def make_set_closure_cell(): def set_closure_cell(cell, value): cell.__setstate__((value,)) else: - ctypes = import_ctypes() - if ctypes is not None: + try: + ctypes = import_ctypes() + set_closure_cell = ctypes.pythonapi.PyCell_Set set_closure_cell.argtypes = (ctypes.py_object, ctypes.py_object) set_closure_cell.restype = ctypes.c_int - else: + except Exception: + # We try best effort to set the cell, but sometimes it's not + # possible. For example on Jython or on GAE. set_closure_cell = just_warn return set_closure_cell diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/src/attr/_make.py b/tests/wpt/web-platform-tests/tools/third_party/attrs/src/attr/_make.py index 31c5f94ce38..fc446115c9d 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/src/attr/_make.py +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/src/attr/_make.py @@ -3,11 +3,15 @@ from __future__ import absolute_import, division, print_function import hashlib import linecache import sys +import threading +import warnings from operator import itemgetter from . import _config -from ._compat import PY2, isclass, iteritems, metadata_proxy, set_closure_cell +from ._compat import ( + PY2, isclass, iteritems, metadata_proxy, ordered_dict, set_closure_cell +) from .exceptions import ( DefaultAlreadySetError, FrozenInstanceError, NotAnAttrsClassError, UnannotatedAttributeError @@ -16,9 +20,11 @@ from .exceptions import ( # This is used at least twice, so cache it here. _obj_setattr = object.__setattr__ -_init_convert_pat = "__attr_convert_{}" +_init_converter_pat = "__attr_converter_{}" _init_factory_pat = "__attr_factory_{}" _tuple_property_pat = " {attr_name} = property(itemgetter({index}))" +_classvar_prefixes = ("typing.ClassVar", "t.ClassVar", "ClassVar") + _empty_metadata_singleton = metadata_proxy({}) @@ -44,7 +50,7 @@ class _Nothing(object): return "NOTHING" def __hash__(self): - return 0xdeadbeef + return 0xc0ffee NOTHING = _Nothing() @@ -55,7 +61,8 @@ Sentinel to indicate the lack of a value when ``None`` is ambiguous. def attrib(default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, - convert=None, metadata={}, type=None): + convert=None, metadata=None, type=None, converter=None, + factory=None): """ Create a new attribute on a class. @@ -80,6 +87,9 @@ def attrib(default=NOTHING, validator=None, :type default: Any value. + :param callable factory: Syntactic sugar for + ``default=attr.Factory(callable)``. + :param validator: :func:`callable` that is called by ``attrs``-generated ``__init__`` methods after the instance has been initialized. They receive the initialized instance, the :class:`Attribute`, and the @@ -96,7 +106,7 @@ def attrib(default=NOTHING, validator=None, The validator can also be set using decorator notation as shown below. - :type validator: ``callable`` or a ``list`` of ``callable``\ s. + :type validator: ``callable`` or a ``list`` of ``callable``\\ s. :param bool repr: Include this attribute in the generated ``__repr__`` method. @@ -111,8 +121,8 @@ def attrib(default=NOTHING, validator=None, method. It is possible to set this to ``False`` and set a default value. In that case this attributed is unconditionally initialized with the specified default value or factory. - :param callable convert: :func:`callable` that is called by - ``attrs``-generated ``__init__`` methods to convert attribute's value + :param callable converter: :func:`callable` that is called by + ``attrs``-generated ``__init__`` methods to converter attribute's value to the desired format. It is given the passed-in value, and the returned value will be used as the new value of the attribute. The value is converted before being passed to the validator, if any. @@ -125,15 +135,51 @@ def attrib(default=NOTHING, validator=None, Regardless of the approach used, the type will be stored on ``Attribute.type``. - .. versionchanged:: 17.1.0 *validator* can be a ``list`` now. - .. versionchanged:: 17.1.0 - *hash* is ``None`` and therefore mirrors *cmp* by default. - .. versionadded:: 17.3.0 *type* + .. versionadded:: 15.2.0 *convert* + .. versionadded:: 16.3.0 *metadata* + .. versionchanged:: 17.1.0 *validator* can be a ``list`` now. + .. versionchanged:: 17.1.0 + *hash* is ``None`` and therefore mirrors *cmp* by default. + .. versionadded:: 17.3.0 *type* + .. deprecated:: 17.4.0 *convert* + .. versionadded:: 17.4.0 *converter* as a replacement for the deprecated + *convert* to achieve consistency with other noun-based arguments. + .. versionadded:: 18.1.0 + ``factory=f`` is syntactic sugar for ``default=attr.Factory(f)``. """ if hash is not None and hash is not True and hash is not False: raise TypeError( "Invalid value for hash. Must be True, False, or None." ) + + if convert is not None: + if converter is not None: + raise RuntimeError( + "Can't pass both `convert` and `converter`. " + "Please use `converter` only." + ) + warnings.warn( + "The `convert` argument is deprecated in favor of `converter`. " + "It will be removed after 2019/01.", + DeprecationWarning, stacklevel=2 + ) + converter = convert + + if factory is not None: + if default is not NOTHING: + raise ValueError( + "The `default` and `factory` arguments are mutually " + "exclusive." + ) + if not callable(factory): + raise ValueError( + "The `factory` argument must be a callable." + ) + default = Factory(factory) + + if metadata is None: + metadata = {} + return _CountingAttr( default=default, validator=validator, @@ -141,7 +187,7 @@ def attrib(default=NOTHING, validator=None, cmp=cmp, hash=hash, init=init, - convert=convert, + converter=converter, metadata=metadata, type=type, ) @@ -178,8 +224,9 @@ def _make_attr_tuple_class(cls_name, attr_names): # Tuple class for extracted attributes from a class definition. # `super_attrs` is a subset of `attrs`. _Attributes = _make_attr_tuple_class("_Attributes", [ - "attrs", # all attributes to build dunder methods for - "super_attrs", # attributes that have been inherited from super classes + "attrs", # all attributes to build dunder methods for + "super_attrs", # attributes that have been inherited + "super_attrs_map", # map inherited attributes to their originating classes ]) @@ -187,10 +234,11 @@ def _is_class_var(annot): """ Check whether *annot* is a typing.ClassVar. - The implementation is gross but importing `typing` is slow and there are - discussions to remove it from the stdlib alltogether. + The string comparison hack is used to avoid evaluating all string + annotations which would put attrs-based classes at a performance + disadvantage compared to plain old classes. """ - return str(annot).startswith("typing.ClassVar") + return str(annot).startswith(_classvar_prefixes) def _get_annotations(cls): @@ -209,6 +257,13 @@ def _get_annotations(cls): return anns +def _counter_getter(e): + """ + Key function for sorting to avoid re-creating a lambda for every class. + """ + return e[1].counter + + def _transform_attrs(cls, these, auto_attribs): """ Transform all `_CountingAttr`s on a class into `Attribute`s. @@ -221,11 +276,14 @@ def _transform_attrs(cls, these, auto_attribs): anns = _get_annotations(cls) if these is not None: - ca_list = sorted(( + ca_list = [ (name, ca) for name, ca in iteritems(these) - ), key=lambda e: e[1].counter) + ] + + if not isinstance(these, ordered_dict): + ca_list.sort(key=_counter_getter) elif auto_attribs is True: ca_names = { name @@ -264,7 +322,7 @@ def _transform_attrs(cls, these, auto_attribs): if isinstance(attr, _CountingAttr) ), key=lambda e: e[1].counter) - non_super_attrs = [ + own_attrs = [ Attribute.from_counting_attr( name=attr_name, ca=ca, @@ -274,34 +332,24 @@ def _transform_attrs(cls, these, auto_attribs): in ca_list ] - # Walk *down* the MRO for attributes. While doing so, we collect the names - # of attributes we've seen in `take_attr_names` and ignore their - # redefinitions deeper in the hierarchy. super_attrs = [] - taken_attr_names = {a.name: a for a in non_super_attrs} + super_attr_map = {} # A dictionary of superattrs to their classes. + taken_attr_names = {a.name: a for a in own_attrs} + + # Traverse the MRO and collect attributes. for super_cls in cls.__mro__[1:-1]: sub_attrs = getattr(super_cls, "__attrs_attrs__", None) if sub_attrs is not None: - # We iterate over sub_attrs backwards so we can reverse the whole - # list in the end and get all attributes in the order they have - # been defined. - for a in reversed(sub_attrs): + for a in sub_attrs: prev_a = taken_attr_names.get(a.name) + # Only add an attribute if it hasn't been defined before. This + # allows for overwriting attribute definitions by subclassing. if prev_a is None: super_attrs.append(a) taken_attr_names[a.name] = a - elif prev_a == a: - # This happens thru multiple inheritance. We don't want - # to favor attributes that are further down in the tree - # so we move them to the back. - super_attrs.remove(a) - super_attrs.append(a) + super_attr_map[a.name] = super_cls - # Now reverse the list, such that the attributes are sorted by *descending* - # age. IOW: the oldest attribute definition is at the head of the list. - super_attrs.reverse() - - attr_names = [a.name for a in super_attrs + non_super_attrs] + attr_names = [a.name for a in super_attrs + own_attrs] AttrsClass = _make_attr_tuple_class(cls.__name__, attr_names) @@ -330,7 +378,7 @@ def _transform_attrs(cls, these, auto_attribs): a.init is not False: had_default = True - return _Attributes((attrs, super_attrs)) + return _Attributes((attrs, super_attrs, super_attr_map)) def _frozen_setattrs(self, name, value): @@ -353,20 +401,24 @@ class _ClassBuilder(object): """ __slots__ = ( "_cls", "_cls_dict", "_attrs", "_super_names", "_attr_names", "_slots", - "_frozen", "_has_post_init", + "_frozen", "_has_post_init", "_delete_attribs", "_super_attr_map", ) def __init__(self, cls, these, slots, frozen, auto_attribs): - attrs, super_attrs = _transform_attrs(cls, these, auto_attribs) + attrs, super_attrs, super_map = _transform_attrs( + cls, these, auto_attribs + ) self._cls = cls self._cls_dict = dict(cls.__dict__) if slots else {} self._attrs = attrs self._super_names = set(a.name for a in super_attrs) + self._super_attr_map = super_map self._attr_names = tuple(a.name for a in attrs) self._slots = slots self._frozen = frozen or _has_frozen_superclass(cls) self._has_post_init = bool(getattr(cls, "__attrs_post_init__", False)) + self._delete_attribs = not bool(these) self._cls_dict["__attrs_attrs__"] = self._attrs @@ -396,10 +448,11 @@ class _ClassBuilder(object): super_names = self._super_names # Clean class of attribute definitions (`attr.ib()`s). - for name in self._attr_names: - if name not in super_names and \ - getattr(cls, name, None) is not None: - delattr(cls, name) + if self._delete_attribs: + for name in self._attr_names: + if name not in super_names and \ + getattr(cls, name, None) is not None: + delattr(cls, name) # Attach our dunder methods. for name, value in self._cls_dict.items(): @@ -430,20 +483,26 @@ class _ClassBuilder(object): if qualname is not None: cd["__qualname__"] = qualname - attr_names = tuple(self._attr_names) + # __weakref__ is not writable. + state_attr_names = tuple( + an for an in self._attr_names if an != "__weakref__" + ) def slots_getstate(self): """ Automatically created by attrs. """ - return tuple(getattr(self, name) for name in attr_names) + return tuple( + getattr(self, name) + for name in state_attr_names + ) def slots_setstate(self, state): """ Automatically created by attrs. """ __bound_setattr = _obj_setattr.__get__(self, Attribute) - for name, value in zip(attr_names, state): + for name, value in zip(state_attr_names, state): __bound_setattr(name, value) # slots and frozen require __getstate__/__setstate__ to work @@ -480,17 +539,22 @@ class _ClassBuilder(object): return cls def add_repr(self, ns): - self._cls_dict["__repr__"] = _make_repr(self._attrs, ns=ns) + self._cls_dict["__repr__"] = self._add_method_dunders( + _make_repr(self._attrs, ns=ns) + ) return self def add_str(self): - repr_ = self._cls_dict.get("__repr__") - if repr_ is None: + repr = self._cls_dict.get("__repr__") + if repr is None: raise ValueError( "__str__ can only be generated if a __repr__ exists." ) - self._cls_dict["__str__"] = repr_ + def __str__(self): + return self.__repr__() + + self._cls_dict["__str__"] = self._add_method_dunders(__str__) return self def make_unhashable(self): @@ -498,25 +562,54 @@ class _ClassBuilder(object): return self def add_hash(self): - self._cls_dict["__hash__"] = _make_hash(self._attrs) + self._cls_dict["__hash__"] = self._add_method_dunders( + _make_hash(self._attrs) + ) + return self def add_init(self): - self._cls_dict["__init__"] = _make_init( - self._attrs, - self._has_post_init, - self._frozen, + self._cls_dict["__init__"] = self._add_method_dunders( + _make_init( + self._attrs, + self._has_post_init, + self._frozen, + self._slots, + self._super_attr_map, + ) ) + return self def add_cmp(self): cd = self._cls_dict cd["__eq__"], cd["__ne__"], cd["__lt__"], cd["__le__"], cd["__gt__"], \ - cd["__ge__"] = _make_cmp(self._attrs) + cd["__ge__"] = ( + self._add_method_dunders(meth) + for meth in _make_cmp(self._attrs) + ) return self + def _add_method_dunders(self, method): + """ + Add __module__ and __qualname__ to a *method* if possible. + """ + try: + method.__module__ = self._cls.__module__ + except AttributeError: + pass + + try: + method.__qualname__ = ".".join( + (self._cls.__qualname__, method.__name__,) + ) + except AttributeError: + pass + + return method + def attrs(maybe_cls=None, these=None, repr_ns=None, repr=True, cmp=True, hash=None, init=True, @@ -532,7 +625,12 @@ def attrs(maybe_cls=None, these=None, repr_ns=None, Django models) or don't want to. If *these* is not ``None``, ``attrs`` will *not* search the class body - for attributes. + for attributes and will *not* remove any attributes from it. + + If *these* is an ordered dict (:class:`dict` on Python 3.6+, + :class:`collections.OrderedDict` otherwise), the order is deduced from + the order of the attributes inside *these*. Otherwise the order + of the definition of the attributes is used. :type these: :class:`dict` of :class:`str` to :func:`attr.ib` @@ -613,13 +711,16 @@ def attrs(maybe_cls=None, these=None, repr_ns=None, .. _`PEP 526`: https://www.python.org/dev/peps/pep-0526/ - .. versionadded:: 16.0.0 *slots* - .. versionadded:: 16.1.0 *frozen* - .. versionadded:: 16.3.0 *str*, and support for ``__attrs_post_init__``. - .. versionchanged:: - 17.1.0 *hash* supports ``None`` as value which is also the default - now. + .. versionadded:: 16.0.0 *slots* + .. versionadded:: 16.1.0 *frozen* + .. versionadded:: 16.3.0 *str* + .. versionadded:: 16.3.0 Support for ``__attrs_post_init__``. + .. versionchanged:: 17.1.0 + *hash* supports ``None`` as value which is also the default now. .. versionadded:: 17.3.0 *auto_attribs* + .. versionchanged:: 18.1.0 + If *these* is passed, no attributes are deleted from the class body. + .. versionchanged:: 18.1.0 If *these* is ordered, the order is retained. """ def wrap(cls): if getattr(cls, "__class__", None) is None: @@ -701,7 +802,7 @@ def _make_hash(attrs): if a.hash is True or (a.hash is None and a.cmp is True) ) - # We cache the generated init methods for the same kinds of attributes. + # We cache the generated hash methods for the same kinds of attributes. sha1 = hashlib.sha1() sha1.update(repr(attrs).encode("utf-8")) unique_filename = "" % (sha1.hexdigest(),) @@ -742,35 +843,69 @@ def _add_hash(cls, attrs): return cls +def __ne__(self, other): + """ + Check equality and either forward a NotImplemented or return the result + negated. + """ + result = self.__eq__(other) + if result is NotImplemented: + return NotImplemented + + return not result + + def _make_cmp(attrs): attrs = [a for a in attrs if a.cmp] + # We cache the generated eq methods for the same kinds of attributes. + sha1 = hashlib.sha1() + sha1.update(repr(attrs).encode("utf-8")) + unique_filename = "" % (sha1.hexdigest(),) + lines = [ + "def __eq__(self, other):", + " if other.__class__ is not self.__class__:", + " return NotImplemented", + ] + # We can't just do a big self.x = other.x and... clause due to + # irregularities like nan == nan is false but (nan,) == (nan,) is true. + if attrs: + lines.append(" return (") + others = [ + " ) == (", + ] + for a in attrs: + lines.append(" self.%s," % (a.name,)) + others.append(" other.%s," % (a.name,)) + + lines += others + [" )"] + else: + lines.append(" return True") + + script = "\n".join(lines) + globs = {} + locs = {} + bytecode = compile(script, unique_filename, "exec") + eval(bytecode, globs, locs) + + # In order of debuggers like PDB being able to step through the code, + # we add a fake linecache entry. + linecache.cache[unique_filename] = ( + len(script), + None, + script.splitlines(True), + unique_filename, + ) + eq = locs["__eq__"] + ne = __ne__ + def attrs_to_tuple(obj): """ Save us some typing. """ return _attrs_to_tuple(obj, attrs) - def eq(self, other): - """ - Automatically created by attrs. - """ - if other.__class__ is self.__class__: - return attrs_to_tuple(self) == attrs_to_tuple(other) - else: - return NotImplemented - - def ne(self, other): - """ - Automatically created by attrs. - """ - result = eq(self, other) - if result is NotImplemented: - return NotImplemented - else: - return not result - - def lt(self, other): + def __lt__(self, other): """ Automatically created by attrs. """ @@ -779,7 +914,7 @@ def _make_cmp(attrs): else: return NotImplemented - def le(self, other): + def __le__(self, other): """ Automatically created by attrs. """ @@ -788,7 +923,7 @@ def _make_cmp(attrs): else: return NotImplemented - def gt(self, other): + def __gt__(self, other): """ Automatically created by attrs. """ @@ -797,7 +932,7 @@ def _make_cmp(attrs): else: return NotImplemented - def ge(self, other): + def __ge__(self, other): """ Automatically created by attrs. """ @@ -806,7 +941,7 @@ def _make_cmp(attrs): else: return NotImplemented - return eq, ne, lt, le, gt, ge + return eq, ne, __lt__, __le__, __gt__, __ge__ def _add_cmp(cls, attrs=None): @@ -822,6 +957,9 @@ def _add_cmp(cls, attrs=None): return cls +_already_repring = threading.local() + + def _make_repr(attrs, ns): """ Make a repr method for *attr_names* adding *ns* to the full name. @@ -832,10 +970,18 @@ def _make_repr(attrs, ns): if a.repr ) - def repr_(self): + def __repr__(self): """ Automatically created by attrs. """ + try: + working_set = _already_repring.working_set + except AttributeError: + working_set = set() + _already_repring.working_set = working_set + + if id(self) in working_set: + return "..." real_cls = self.__class__ if ns is None: qualname = getattr(real_cls, "__qualname__", None) @@ -846,14 +992,24 @@ def _make_repr(attrs, ns): else: class_name = ns + "." + real_cls.__name__ - return "{0}({1})".format( - class_name, - ", ".join( - name + "=" + repr(getattr(self, name)) - for name in attr_names - ) - ) - return repr_ + # Since 'self' remains on the stack (i.e.: strongly referenced) for the + # duration of this call, it's safe to depend on id(...) stability, and + # not need to track the instance and therefore worry about properties + # like weakref- or hash-ability. + working_set.add(id(self)) + try: + result = [class_name, "("] + first = True + for name in attr_names: + if first: + first = False + else: + result.append(", ") + result.extend((name, "=", repr(getattr(self, name, NOTHING)))) + return "".join(result) + ")" + finally: + working_set.remove(id(self)) + return __repr__ def _add_repr(cls, ns=None, attrs=None): @@ -863,12 +1019,11 @@ def _add_repr(cls, ns=None, attrs=None): if attrs is None: attrs = cls.__attrs_attrs__ - repr_ = _make_repr(attrs, ns) - cls.__repr__ = repr_ + cls.__repr__ = _make_repr(attrs, ns) return cls -def _make_init(attrs, post_init, frozen): +def _make_init(attrs, post_init, frozen, slots, super_attr_map): attrs = [ a for a in attrs @@ -882,10 +1037,12 @@ def _make_init(attrs, post_init, frozen): sha1.hexdigest() ) - script, globs = _attrs_to_init_script( + script, globs, annotations = _attrs_to_init_script( attrs, frozen, + slots, post_init, + super_attr_map, ) locs = {} bytecode = compile(script, unique_filename, "exec") @@ -909,7 +1066,9 @@ def _make_init(attrs, post_init, frozen): unique_filename, ) - return locs["__init__"] + __init__ = locs["__init__"] + __init__.__annotations__ = annotations + return __init__ def _add_init(cls, frozen): @@ -920,13 +1079,15 @@ def _add_init(cls, frozen): cls.__attrs_attrs__, getattr(cls, "__attrs_post_init__", False), frozen, + _is_slot_cls(cls), + {}, ) return cls def fields(cls): """ - Returns the tuple of ``attrs`` attributes for a class. + Return the tuple of ``attrs`` attributes for a class. The tuple also allows accessing the fields by their names (see below for examples). @@ -952,6 +1113,34 @@ def fields(cls): return attrs +def fields_dict(cls): + """ + Return an ordered dictionary of ``attrs`` attributes for a class, whose + keys are the attribute names. + + :param type cls: Class to introspect. + + :raise TypeError: If *cls* is not a class. + :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs`` + class. + + :rtype: an ordered dict where keys are attribute names and values are + :class:`attr.Attribute`\\ s. This will be a :class:`dict` if it's + naturally ordered like on Python 3.6+ or an + :class:`~collections.OrderedDict` otherwise. + + .. versionadded:: 18.1.0 + """ + if not isclass(cls): + raise TypeError("Passed object must be a class.") + attrs = getattr(cls, "__attrs_attrs__", None) + if attrs is None: + raise NotAnAttrsClassError( + "{cls!r} is not an attrs-decorated class.".format(cls=cls) + ) + return ordered_dict(((a.name, a) for a in attrs)) + + def validate(inst): """ Validate all attributes on *inst* that have a validator. @@ -969,37 +1158,92 @@ def validate(inst): v(inst, a, getattr(inst, a.name)) -def _attrs_to_init_script(attrs, frozen, post_init): +def _is_slot_cls(cls): + return "__slots__" in cls.__dict__ + + +def _is_slot_attr(a_name, super_attr_map): + """ + Check if the attribute name comes from a slot class. + """ + return a_name in super_attr_map and _is_slot_cls(super_attr_map[a_name]) + + +def _attrs_to_init_script(attrs, frozen, slots, post_init, super_attr_map): """ Return a script of an initializer for *attrs* and a dict of globals. The globals are expected by the generated script. - If *frozen* is True, we cannot set the attributes directly so we use + If *frozen* is True, we cannot set the attributes directly so we use a cached ``object.__setattr__``. """ lines = [] + any_slot_ancestors = any( + _is_slot_attr(a.name, super_attr_map) + for a in attrs + ) if frozen is True: - lines.append( - # Circumvent the __setattr__ descriptor to save one lookup per - # assignment. - "_setattr = _cached_setattr.__get__(self, self.__class__)" - ) + if slots is True: + lines.append( + # Circumvent the __setattr__ descriptor to save one lookup per + # assignment. + "_setattr = _cached_setattr.__get__(self, self.__class__)" + ) - def fmt_setter(attr_name, value_var): - return "_setattr('%(attr_name)s', %(value_var)s)" % { - "attr_name": attr_name, - "value_var": value_var, - } + def fmt_setter(attr_name, value_var): + return "_setattr('%(attr_name)s', %(value_var)s)" % { + "attr_name": attr_name, + "value_var": value_var, + } - def fmt_setter_with_converter(attr_name, value_var): - conv_name = _init_convert_pat.format(attr_name) - return "_setattr('%(attr_name)s', %(conv)s(%(value_var)s))" % { - "attr_name": attr_name, - "value_var": value_var, - "conv": conv_name, - } + def fmt_setter_with_converter(attr_name, value_var): + conv_name = _init_converter_pat.format(attr_name) + return "_setattr('%(attr_name)s', %(conv)s(%(value_var)s))" % { + "attr_name": attr_name, + "value_var": value_var, + "conv": conv_name, + } + else: + # Dict frozen classes assign directly to __dict__. + # But only if the attribute doesn't come from an ancestor slot + # class. + lines.append( + "_inst_dict = self.__dict__" + ) + if any_slot_ancestors: + lines.append( + # Circumvent the __setattr__ descriptor to save one lookup + # per assignment. + "_setattr = _cached_setattr.__get__(self, self.__class__)" + ) + + def fmt_setter(attr_name, value_var): + if _is_slot_attr(attr_name, super_attr_map): + res = "_setattr('%(attr_name)s', %(value_var)s)" % { + "attr_name": attr_name, + "value_var": value_var, + } + else: + res = "_inst_dict['%(attr_name)s'] = %(value_var)s" % { + "attr_name": attr_name, + "value_var": value_var, + } + return res + + def fmt_setter_with_converter(attr_name, value_var): + conv_name = _init_converter_pat.format(attr_name) + if _is_slot_attr(attr_name, super_attr_map): + tmpl = "_setattr('%(attr_name)s', %(c)s(%(value_var)s))" + else: + tmpl = "_inst_dict['%(attr_name)s'] = %(c)s(%(value_var)s)" + return tmpl % { + "attr_name": attr_name, + "value_var": value_var, + "c": conv_name, + } else: + # Not frozen. def fmt_setter(attr_name, value): return "self.%(attr_name)s = %(value)s" % { "attr_name": attr_name, @@ -1007,7 +1251,7 @@ def _attrs_to_init_script(attrs, frozen, post_init): } def fmt_setter_with_converter(attr_name, value_var): - conv_name = _init_convert_pat.format(attr_name) + conv_name = _init_converter_pat.format(attr_name) return "self.%(attr_name)s = %(conv)s(%(value_var)s)" % { "attr_name": attr_name, "value_var": value_var, @@ -1020,6 +1264,7 @@ def _attrs_to_init_script(attrs, frozen, post_init): # This is a dictionary of names to validator and converter callables. # Injecting this into __init__ globals lets us avoid lookups. names_for_globals = {} + annotations = {'return': None} for a in attrs: if a.validator: @@ -1034,12 +1279,12 @@ def _attrs_to_init_script(attrs, frozen, post_init): if a.init is False: if has_factory: init_factory_name = _init_factory_pat.format(a.name) - if a.convert is not None: + if a.converter is not None: lines.append(fmt_setter_with_converter( attr_name, init_factory_name + "({0})".format(maybe_self))) - conv_name = _init_convert_pat.format(a.name) - names_for_globals[conv_name] = a.convert + conv_name = _init_converter_pat.format(a.name) + names_for_globals[conv_name] = a.converter else: lines.append(fmt_setter( attr_name, @@ -1047,14 +1292,14 @@ def _attrs_to_init_script(attrs, frozen, post_init): )) names_for_globals[init_factory_name] = a.default.factory else: - if a.convert is not None: + if a.converter is not None: lines.append(fmt_setter_with_converter( attr_name, "attr_dict['{attr_name}'].default" .format(attr_name=attr_name) )) - conv_name = _init_convert_pat.format(a.name) - names_for_globals[conv_name] = a.convert + conv_name = _init_converter_pat.format(a.name) + names_for_globals[conv_name] = a.converter else: lines.append(fmt_setter( attr_name, @@ -1068,9 +1313,11 @@ def _attrs_to_init_script(attrs, frozen, post_init): attr_name=attr_name, ) ) - if a.convert is not None: + if a.converter is not None: lines.append(fmt_setter_with_converter(attr_name, arg_name)) - names_for_globals[_init_convert_pat.format(a.name)] = a.convert + names_for_globals[_init_converter_pat.format(a.name)] = ( + a.converter + ) else: lines.append(fmt_setter(attr_name, arg_name)) elif has_factory: @@ -1078,15 +1325,18 @@ def _attrs_to_init_script(attrs, frozen, post_init): lines.append("if {arg_name} is not NOTHING:" .format(arg_name=arg_name)) init_factory_name = _init_factory_pat.format(a.name) - if a.convert is not None: - lines.append(" " + fmt_setter_with_converter(attr_name, - arg_name)) + if a.converter is not None: + lines.append(" " + fmt_setter_with_converter( + attr_name, arg_name + )) lines.append("else:") lines.append(" " + fmt_setter_with_converter( attr_name, init_factory_name + "({0})".format(maybe_self) )) - names_for_globals[_init_convert_pat.format(a.name)] = a.convert + names_for_globals[_init_converter_pat.format(a.name)] = ( + a.converter + ) else: lines.append(" " + fmt_setter(attr_name, arg_name)) lines.append("else:") @@ -1097,12 +1347,17 @@ def _attrs_to_init_script(attrs, frozen, post_init): names_for_globals[init_factory_name] = a.default.factory else: args.append(arg_name) - if a.convert is not None: + if a.converter is not None: lines.append(fmt_setter_with_converter(attr_name, arg_name)) - names_for_globals[_init_convert_pat.format(a.name)] = a.convert + names_for_globals[_init_converter_pat.format(a.name)] = ( + a.converter + ) else: lines.append(fmt_setter(attr_name, arg_name)) + if a.init is True and a.converter is None and a.type is not None: + annotations[arg_name] = a.type + if attrs_to_validate: # we can skip this if there are no validators. names_for_globals["_config"] = _config lines.append("if _config._run_validators is True:") @@ -1122,7 +1377,7 @@ def __init__(self, {args}): """.format( args=", ".join(args), lines="\n ".join(lines) if lines else "pass", - ), names_for_globals + ), names_for_globals, annotations class Attribute(object): @@ -1132,17 +1387,34 @@ class Attribute(object): :attribute name: The name of the attribute. Plus *all* arguments of :func:`attr.ib`. + + For the version history of the fields, see :func:`attr.ib`. """ __slots__ = ( "name", "default", "validator", "repr", "cmp", "hash", "init", - "convert", "metadata", "type" + "metadata", "type", "converter", ) def __init__(self, name, default, validator, repr, cmp, hash, init, - convert=None, metadata=None, type=None): + convert=None, metadata=None, type=None, converter=None): # Cache this descriptor here to speed things up later. bound_setattr = _obj_setattr.__get__(self, Attribute) + # Despite the big red warning, people *do* instantiate `Attribute` + # themselves. + if convert is not None: + if converter is not None: + raise RuntimeError( + "Can't pass both `convert` and `converter`. " + "Please use `converter` only." + ) + warnings.warn( + "The `convert` argument is deprecated in favor of `converter`." + " It will be removed after 2019/01.", + DeprecationWarning, stacklevel=2 + ) + converter = convert + bound_setattr("name", name) bound_setattr("default", default) bound_setattr("validator", validator) @@ -1150,14 +1422,25 @@ class Attribute(object): bound_setattr("cmp", cmp) bound_setattr("hash", hash) bound_setattr("init", init) - bound_setattr("convert", convert) - bound_setattr("metadata", (metadata_proxy(metadata) if metadata - else _empty_metadata_singleton)) + bound_setattr("converter", converter) + bound_setattr("metadata", ( + metadata_proxy(metadata) if metadata + else _empty_metadata_singleton + )) bound_setattr("type", type) def __setattr__(self, name, value): raise FrozenInstanceError() + @property + def convert(self): + warnings.warn( + "The `convert` attribute is deprecated in favor of `converter`. " + "It will be removed after 2019/01.", + DeprecationWarning, stacklevel=2, + ) + return self.converter + @classmethod def from_counting_attr(cls, name, ca, type=None): # type holds the annotated value. deal with conflicts: @@ -1172,11 +1455,13 @@ class Attribute(object): for k in Attribute.__slots__ if k not in ( - "name", "validator", "default", "type" - ) # exclude methods + "name", "validator", "default", "type", "convert", + ) # exclude methods and deprecated alias } - return cls(name=name, validator=ca._validator, default=ca._default, - type=type, **inst_dict) + return cls( + name=name, validator=ca._validator, default=ca._default, type=type, + **inst_dict + ) # Don't use _add_pickle since fields(Attribute) doesn't work def __getstate__(self): @@ -1200,9 +1485,12 @@ class Attribute(object): _empty_metadata_singleton) -_a = [Attribute(name=name, default=NOTHING, validator=None, - repr=True, cmp=True, hash=(name != "metadata"), init=True) - for name in Attribute.__slots__] +_a = [ + Attribute(name=name, default=NOTHING, validator=None, + repr=True, cmp=True, hash=(name != "metadata"), init=True) + for name in Attribute.__slots__ + if name != "convert" # XXX: remove once `convert` is gone +] Attribute = _add_hash( _add_cmp(_add_repr(Attribute, attrs=_a), attrs=_a), @@ -1219,7 +1507,7 @@ class _CountingAttr(object): likely the result of a bug like a forgotten `@attr.s` decorator. """ __slots__ = ("counter", "_default", "repr", "cmp", "hash", "init", - "metadata", "_validator", "convert", "type") + "metadata", "_validator", "converter", "type") __attrs_attrs__ = tuple( Attribute(name=name, default=NOTHING, validator=None, repr=True, cmp=True, hash=True, init=True) @@ -1231,7 +1519,7 @@ class _CountingAttr(object): ) cls_counter = 0 - def __init__(self, default, validator, repr, cmp, hash, init, convert, + def __init__(self, default, validator, repr, cmp, hash, init, converter, metadata, type): _CountingAttr.cls_counter += 1 self.counter = _CountingAttr.cls_counter @@ -1245,7 +1533,7 @@ class _CountingAttr(object): self.cmp = cmp self.hash = hash self.init = init - self.convert = convert + self.converter = converter self.metadata = metadata self.type = type @@ -1320,6 +1608,11 @@ def make_class(name, attrs, bases=(object,), **attributes_arguments): :param attrs: A list of names or a dictionary of mappings of names to attributes. + + If *attrs* is a list or an ordered dict (:class:`dict` on Python 3.6+, + :class:`collections.OrderedDict` otherwise), the order is deduced from + the order of the names or attributes inside *attrs*. Otherwise the + order of the definition of the attributes is used. :type attrs: :class:`list` or :class:`dict` :param tuple bases: Classes that the new class will subclass. @@ -1329,7 +1622,8 @@ def make_class(name, attrs, bases=(object,), **attributes_arguments): :return: A new class with *attrs*. :rtype: type - .. versionadded:: 17.1.0 *bases* + .. versionadded:: 17.1.0 *bases* + .. versionchanged:: 18.1.0 If *attrs* is ordered, the order is retained. """ if isinstance(attrs, dict): cls_dict = attrs diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/src/attr/filters.py b/tests/wpt/web-platform-tests/tools/third_party/attrs/src/attr/filters.py index d1bad35e363..f1c69b8bac5 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/src/attr/filters.py +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/src/attr/filters.py @@ -23,7 +23,7 @@ def include(*what): Whitelist *what*. :param what: What to whitelist. - :type what: :class:`list` of :class:`type` or :class:`attr.Attribute`\ s + :type what: :class:`list` of :class:`type` or :class:`attr.Attribute`\\ s :rtype: :class:`callable` """ @@ -40,7 +40,7 @@ def exclude(*what): Blacklist *what*. :param what: What to blacklist. - :type what: :class:`list` of classes or :class:`attr.Attribute`\ s. + :type what: :class:`list` of classes or :class:`attr.Attribute`\\ s. :rtype: :class:`callable` """ diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/strategies.py b/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/strategies.py new file mode 100644 index 00000000000..99d9bb09144 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/strategies.py @@ -0,0 +1,203 @@ +""" +Testing strategies for Hypothesis-based tests. +""" + +import keyword +import string + +from collections import OrderedDict + +from hypothesis import strategies as st + +import attr + +from .utils import make_class + + +def gen_attr_names(): + """ + Generate names for attributes, 'a'...'z', then 'aa'...'zz'. + + ~702 different attribute names should be enough in practice. + + Some short strings (such as 'as') are keywords, so we skip them. + """ + lc = string.ascii_lowercase + for c in lc: + yield c + for outer in lc: + for inner in lc: + res = outer + inner + if keyword.iskeyword(res): + continue + yield outer + inner + + +def maybe_underscore_prefix(source): + """ + A generator to sometimes prepend an underscore. + """ + to_underscore = False + for val in source: + yield val if not to_underscore else '_' + val + to_underscore = not to_underscore + + +def _create_hyp_class(attrs): + """ + A helper function for Hypothesis to generate attrs classes. + """ + return make_class( + "HypClass", dict(zip(gen_attr_names(), attrs)) + ) + + +def _create_hyp_nested_strategy(simple_class_strategy): + """ + Create a recursive attrs class. + + Given a strategy for building (simpler) classes, create and return + a strategy for building classes that have as an attribute: either just + the simpler class, a list of simpler classes, a tuple of simpler classes, + an ordered dict or a dict mapping the string "cls" to a simpler class. + """ + # Use a tuple strategy to combine simple attributes and an attr class. + def just_class(tup): + combined_attrs = list(tup[0]) + combined_attrs.append(attr.ib(default=attr.Factory(tup[1]))) + return _create_hyp_class(combined_attrs) + + def list_of_class(tup): + default = attr.Factory(lambda: [tup[1]()]) + combined_attrs = list(tup[0]) + combined_attrs.append(attr.ib(default=default)) + return _create_hyp_class(combined_attrs) + + def tuple_of_class(tup): + default = attr.Factory(lambda: (tup[1](),)) + combined_attrs = list(tup[0]) + combined_attrs.append(attr.ib(default=default)) + return _create_hyp_class(combined_attrs) + + def dict_of_class(tup): + default = attr.Factory(lambda: {"cls": tup[1]()}) + combined_attrs = list(tup[0]) + combined_attrs.append(attr.ib(default=default)) + return _create_hyp_class(combined_attrs) + + def ordereddict_of_class(tup): + default = attr.Factory(lambda: OrderedDict([("cls", tup[1]())])) + combined_attrs = list(tup[0]) + combined_attrs.append(attr.ib(default=default)) + return _create_hyp_class(combined_attrs) + + # A strategy producing tuples of the form ([list of attributes], ). + attrs_and_classes = st.tuples(list_of_attrs, simple_class_strategy) + + return st.one_of(attrs_and_classes.map(just_class), + attrs_and_classes.map(list_of_class), + attrs_and_classes.map(tuple_of_class), + attrs_and_classes.map(dict_of_class), + attrs_and_classes.map(ordereddict_of_class)) + + +bare_attrs = st.builds(attr.ib, default=st.none()) +int_attrs = st.integers().map(lambda i: attr.ib(default=i)) +str_attrs = st.text().map(lambda s: attr.ib(default=s)) +float_attrs = st.floats().map(lambda f: attr.ib(default=f)) +dict_attrs = (st.dictionaries(keys=st.text(), values=st.integers()) + .map(lambda d: attr.ib(default=d))) + +simple_attrs_without_metadata = (bare_attrs | int_attrs | str_attrs | + float_attrs | dict_attrs) + + +@st.composite +def simple_attrs_with_metadata(draw): + """ + Create a simple attribute with arbitrary metadata. + """ + c_attr = draw(simple_attrs) + keys = st.booleans() | st.binary() | st.integers() | st.text() + vals = st.booleans() | st.binary() | st.integers() | st.text() + metadata = draw(st.dictionaries( + keys=keys, values=vals, min_size=1, max_size=5)) + + return attr.ib( + default=c_attr._default, + validator=c_attr._validator, + repr=c_attr.repr, + cmp=c_attr.cmp, + hash=c_attr.hash, + init=c_attr.init, + metadata=metadata, + type=None, + converter=c_attr.converter, + ) + + +simple_attrs = simple_attrs_without_metadata | simple_attrs_with_metadata() + +# Python functions support up to 255 arguments. +list_of_attrs = st.lists(simple_attrs, max_size=9) + + +@st.composite +def simple_classes(draw, slots=None, frozen=None, private_attrs=None): + """ + A strategy that generates classes with default non-attr attributes. + + For example, this strategy might generate a class such as: + + @attr.s(slots=True, frozen=True) + class HypClass: + a = attr.ib(default=1) + _b = attr.ib(default=None) + c = attr.ib(default='text') + _d = attr.ib(default=1.0) + c = attr.ib(default={'t': 1}) + + By default, all combinations of slots and frozen classes will be generated. + If `slots=True` is passed in, only slots classes will be generated, and + if `slots=False` is passed in, no slot classes will be generated. The same + applies to `frozen`. + + By default, some attributes will be private (i.e. prefixed with an + underscore). If `private_attrs=True` is passed in, all attributes will be + private, and if `private_attrs=False`, no attributes will be private. + """ + attrs = draw(list_of_attrs) + frozen_flag = draw(st.booleans()) if frozen is None else frozen + slots_flag = draw(st.booleans()) if slots is None else slots + + if private_attrs is None: + attr_names = maybe_underscore_prefix(gen_attr_names()) + elif private_attrs is True: + attr_names = ('_' + n for n in gen_attr_names()) + elif private_attrs is False: + attr_names = gen_attr_names() + + cls_dict = dict(zip(attr_names, attrs)) + post_init_flag = draw(st.booleans()) + if post_init_flag: + def post_init(self): + pass + cls_dict["__attrs_post_init__"] = post_init + + return make_class( + "HypClass", + cls_dict, + slots=slots_flag, + frozen=frozen_flag, + ) + + +# st.recursive works by taking a base strategy (in this case, simple_classes) +# and a special function. This function receives a strategy, and returns +# another strategy (building on top of the base strategy). +nested_classes = st.recursive( + simple_classes(), + _create_hyp_nested_strategy, + max_leaves=10 +) diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_annotations.py b/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_annotations.py index 602f21bd5e6..f56424cfc21 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_annotations.py +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_annotations.py @@ -11,6 +11,7 @@ import pytest import attr +from attr._make import _classvar_prefixes from attr.exceptions import UnannotatedAttributeError @@ -32,6 +33,11 @@ class TestAnnotations: assert int is attr.fields(C).x.type assert str is attr.fields(C).y.type assert None is attr.fields(C).z.type + assert C.__init__.__annotations__ == { + 'x': int, + 'y': str, + 'return': None, + } def test_catches_basic_type_conflict(self): """ @@ -57,6 +63,11 @@ class TestAnnotations: assert typing.List[int] is attr.fields(C).x.type assert typing.Optional[str] is attr.fields(C).y.type + assert C.__init__.__annotations__ == { + 'x': typing.List[int], + 'y': typing.Optional[str], + 'return': None, + } def test_only_attrs_annotations_collected(self): """ @@ -68,6 +79,10 @@ class TestAnnotations: y: int assert 1 == len(attr.fields(C)) + assert C.__init__.__annotations__ == { + 'x': typing.List[int], + 'return': None, + } @pytest.mark.parametrize("slots", [True, False]) def test_auto_attribs(self, slots): @@ -115,6 +130,15 @@ class TestAnnotations: i.y = 23 assert 23 == i.y + assert C.__init__.__annotations__ == { + 'a': int, + 'x': typing.List[int], + 'y': int, + 'z': int, + 'foo': typing.Any, + 'return': None, + } + @pytest.mark.parametrize("slots", [True, False]) def test_auto_attribs_unannotated(self, slots): """ @@ -154,3 +178,52 @@ class TestAnnotations: assert "B(a=1, b=2)" == repr(B()) assert "C(a=1)" == repr(C()) + + assert A.__init__.__annotations__ == { + 'a': int, + 'return': None, + } + assert B.__init__.__annotations__ == { + 'a': int, + 'b': int, + 'return': None, + } + assert C.__init__.__annotations__ == { + 'a': int, + 'return': None, + } + + def test_converter_annotations(self): + """ + Attributes with converters don't have annotations. + """ + + @attr.s(auto_attribs=True) + class A: + a: int = attr.ib(converter=int) + + assert A.__init__.__annotations__ == {'return': None} + + @pytest.mark.parametrize("slots", [True, False]) + @pytest.mark.parametrize("classvar", _classvar_prefixes) + def test_annotations_strings(self, slots, classvar): + """ + String annotations are passed into __init__ as is. + """ + @attr.s(auto_attribs=True, slots=slots) + class C: + cls_var: classvar + '[int]' = 23 + a: 'int' + x: 'typing.List[int]' = attr.Factory(list) + y: 'int' = 2 + z: 'int' = attr.ib(default=3) + foo: 'typing.Any' = None + + assert C.__init__.__annotations__ == { + 'a': 'int', + 'x': 'typing.List[int]', + 'y': 'int', + 'z': 'int', + 'foo': 'typing.Any', + 'return': None, + } diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_dark_magic.py b/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_dark_magic.py index bc6665cf5fe..ca4c1c92048 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_dark_magic.py +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_dark_magic.py @@ -380,3 +380,36 @@ class TestDarkMagic(object): z = attr.ib(default=4) assert "E(c=100, b=23, a=42, x=2, d=3.14, y=3, z=4)" == repr(E()) + + @pytest.mark.parametrize("base_slots", [True, False]) + @pytest.mark.parametrize("sub_slots", [True, False]) + @pytest.mark.parametrize("base_frozen", [True, False]) + @pytest.mark.parametrize("sub_frozen", [True, False]) + @pytest.mark.parametrize("base_converter", [True, False]) + @pytest.mark.parametrize("sub_converter", [True, False]) + def test_frozen_slots_combo(self, base_slots, sub_slots, base_frozen, + sub_frozen, base_converter, sub_converter): + """ + A class with a single attribute, inheriting from another class + with a single attribute. + """ + + @attr.s(frozen=base_frozen, slots=base_slots) + class Base(object): + a = attr.ib(converter=int if base_converter else None) + + @attr.s(frozen=sub_frozen, slots=sub_slots) + class Sub(Base): + b = attr.ib(converter=int if sub_converter else None) + + i = Sub("1", "2") + + assert i.a == (1 if base_converter else "1") + assert i.b == (2 if sub_converter else "2") + + if base_frozen or sub_frozen: + with pytest.raises(FrozenInstanceError): + i.a = "2" + + with pytest.raises(FrozenInstanceError): + i.b = "3" diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_dunders.py b/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_dunders.py index 951faba2ffc..43a793f4e0b 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_dunders.py +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_dunders.py @@ -187,6 +187,20 @@ class TestAddRepr(object): """ assert "C(a=1, b=2)" == repr(cls(1, 2)) + def test_infinite_recursion(self): + """ + In the presence of a cyclic graph, repr will emit an ellipsis and not + raise an exception. + """ + @attr.s + class Cycle(object): + value = attr.ib(default=7) + cycle = attr.ib(default=None) + + cycle = Cycle() + cycle.cycle = cycle + assert "Cycle(value=7, cycle=...)" == repr(cycle) + def test_underscores(self): """ repr does not strip underscores. @@ -200,6 +214,16 @@ class TestAddRepr(object): assert "C(_x=42)" == repr(i) + def test_repr_uninitialized_member(self): + """ + repr signals unset attributes + """ + C = make_class("C", { + "a": attr.ib(init=False), + }) + + assert "C(a=NOTHING)" == repr(C()) + @given(add_str=booleans(), slots=booleans()) def test_str(self, add_str, slots): """ diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_funcs.py b/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_funcs.py index 0167823818e..9c6e5e532f8 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_funcs.py +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_funcs.py @@ -8,8 +8,8 @@ from collections import Mapping, OrderedDict, Sequence import pytest -from hypothesis import strategies as st from hypothesis import HealthCheck, assume, given, settings +from hypothesis import strategies as st import attr @@ -18,7 +18,7 @@ from attr._compat import TYPE from attr.exceptions import AttrsAttributeNotFoundError from attr.validators import instance_of -from .utils import nested_classes, simple_classes +from .strategies import nested_classes, simple_classes MAPPING_TYPES = (dict, OrderedDict) diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_make.py b/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_make.py index f8c80228ae8..9e256f2096d 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_make.py +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_make.py @@ -4,7 +4,9 @@ Tests for `attr._make`. from __future__ import absolute_import, division, print_function +import copy import inspect +import itertools import sys from operator import attrgetter @@ -17,17 +19,19 @@ from hypothesis.strategies import booleans, integers, lists, sampled_from, text import attr from attr import _config -from attr._compat import PY2 +from attr._compat import PY2, ordered_dict from attr._make import ( Attribute, Factory, _AndValidator, _Attributes, _ClassBuilder, - _CountingAttr, _transform_attrs, and_, fields, make_class, validate + _CountingAttr, _transform_attrs, and_, fields, fields_dict, make_class, + validate ) from attr.exceptions import DefaultAlreadySetError, NotAnAttrsClassError -from .utils import ( - gen_attr_names, list_of_attrs, simple_attr, simple_attrs, +from .strategies import ( + gen_attr_names, list_of_attrs, simple_attrs, simple_attrs_with_metadata, simple_attrs_without_metadata, simple_classes ) +from .utils import simple_attr attrs_st = simple_attrs.map(lambda c: Attribute.from_counting_attr("name", c)) @@ -120,6 +124,66 @@ class TestCountingAttr(object): assert Factory(f, True) == a._default +class TestAttribute(object): + """ + Tests for `attr.Attribute`. + """ + def test_deprecated_convert_argument(self): + """ + Using *convert* raises a DeprecationWarning and sets the converter + field. + """ + def conv(v): + return v + + with pytest.warns(DeprecationWarning) as wi: + a = Attribute( + "a", True, True, True, True, True, True, convert=conv + ) + w = wi.pop() + + assert conv == a.converter + assert ( + "The `convert` argument is deprecated in favor of `converter`. " + "It will be removed after 2019/01.", + ) == w.message.args + assert __file__ == w.filename + + def test_deprecated_convert_attribute(self): + """ + If Attribute.convert is accessed, a DeprecationWarning is raised. + """ + def conv(v): + return v + + a = simple_attr("a", converter=conv) + with pytest.warns(DeprecationWarning) as wi: + convert = a.convert + w = wi.pop() + + assert conv is convert is a.converter + assert ( + "The `convert` attribute is deprecated in favor of `converter`. " + "It will be removed after 2019/01.", + ) == w.message.args + assert __file__ == w.filename + + def test_convert_converter(self): + """ + A TypeError is raised if both *convert* and *converter* are passed. + """ + with pytest.raises(RuntimeError) as ei: + Attribute( + "a", True, True, True, True, True, True, + convert=lambda v: v, converter=lambda v: v, + ) + + assert ( + "Can't pass both `convert` and `converter`. " + "Please use `converter` only.", + ) == ei.value.args + + def make_tc(): class TransformC(object): z = attr.ib() @@ -147,7 +211,7 @@ class TestTransformAttrs(object): Transforms every `_CountingAttr` and leaves others (a) be. """ C = make_tc() - attrs, _, = _transform_attrs(C, None, False) + attrs, _, _ = _transform_attrs(C, None, False) assert ["z", "y", "x"] == [a.name for a in attrs] @@ -159,14 +223,14 @@ class TestTransformAttrs(object): class C(object): pass - assert _Attributes(((), [])) == _transform_attrs(C, None, False) + assert _Attributes(((), [], {})) == _transform_attrs(C, None, False) def test_transforms_to_attribute(self): """ All `_CountingAttr`s are transformed into `Attribute`s. """ C = make_tc() - attrs, super_attrs = _transform_attrs(C, None, False) + attrs, super_attrs, _ = _transform_attrs(C, None, False) assert [] == super_attrs assert 3 == len(attrs) @@ -187,8 +251,8 @@ class TestTransformAttrs(object): "No mandatory attributes allowed after an attribute with a " "default value or factory. Attribute in question: Attribute" "(name='y', default=NOTHING, validator=None, repr=True, " - "cmp=True, hash=None, init=True, convert=None, " - "metadata=mappingproxy({}), type=None)", + "cmp=True, hash=None, init=True, metadata=mappingproxy({}), " + "type=None, converter=None)", ) == e.value.args def test_these(self): @@ -201,13 +265,38 @@ class TestTransformAttrs(object): class C(Base): y = attr.ib() - attrs, super_attrs = _transform_attrs(C, {"x": attr.ib()}, False) + attrs, super_attrs, _ = _transform_attrs(C, {"x": attr.ib()}, False) assert [] == super_attrs assert ( simple_attr("x"), ) == attrs + def test_these_leave_body(self): + """ + If these is passed, no attributes are removed from the body. + """ + @attr.s(init=False, these={"x": attr.ib()}) + class C(object): + x = 5 + + assert 5 == C().x + assert "C(x=5)" == repr(C()) + + def test_these_ordered(self): + """ + If these is passed ordered attrs, their order respect instead of the + counter. + """ + b = attr.ib(default=2) + a = attr.ib(default=1) + + @attr.s(these=ordered_dict([("a", a), ("b", b)])) + class C(object): + pass + + assert "C(a=1, b=2)" == repr(C()) + def test_multiple_inheritance(self): """ Order of attributes doesn't get mixed up by multiple inheritance. @@ -235,7 +324,7 @@ class TestTransformAttrs(object): d2 = attr.ib(default="d2") @attr.s - class E(D, C): + class E(C, D): e1 = attr.ib(default="e1") e2 = attr.ib(default="e2") @@ -437,6 +526,35 @@ class TestAttributes(object): assert not isinstance(x, _CountingAttr) + def test_factory_sugar(self): + """ + Passing factory=f is syntactic sugar for passing default=Factory(f). + """ + @attr.s + class C(object): + x = attr.ib(factory=list) + + assert Factory(list) == attr.fields(C).x.default + + def test_sugar_factory_mutex(self): + """ + Passing both default and factory raises ValueError. + """ + with pytest.raises(ValueError, match="mutually exclusive"): + @attr.s + class C(object): + x = attr.ib(factory=list, default=Factory(list)) + + def test_sugar_callable(self): + """ + Factory has to be a callable to prevent people from passing Factory + into it. + """ + with pytest.raises(ValueError, match="must be a callable"): + @attr.s + class C(object): + x = attr.ib(factory=Factory(list)) + @attr.s class GC(object): @@ -537,6 +655,18 @@ class TestMakeClass(object): assert 1 == len(C.__attrs_attrs__) + def test_make_class_ordered(self): + """ + If `make_class()` is passed ordered attrs, their order is respected + instead of the counter. + """ + b = attr.ib(default=2) + a = attr.ib(default=1) + + C = attr.make_class("C", ordered_dict([("a", a), ("b", b)])) + + assert "C(a=1, b=2)" == repr(C()) + class TestFields(object): """ @@ -557,6 +687,7 @@ class TestFields(object): """ with pytest.raises(NotAnAttrsClassError) as e: fields(object) + assert ( "{o!r} is not an attrs-decorated class.".format(o=object) ) == e.value.args[0] @@ -577,16 +708,52 @@ class TestFields(object): assert getattr(fields(C), attribute.name) is attribute -class TestConvert(object): +class TestFieldsDict(object): + """ + Tests for `fields_dict`. + """ + def test_instance(self, C): + """ + Raises `TypeError` on non-classes. + """ + with pytest.raises(TypeError) as e: + fields_dict(C(1, 2)) + + assert "Passed object must be a class." == e.value.args[0] + + def test_handler_non_attrs_class(self, C): + """ + Raises `ValueError` if passed a non-``attrs`` instance. + """ + with pytest.raises(NotAnAttrsClassError) as e: + fields_dict(object) + + assert ( + "{o!r} is not an attrs-decorated class.".format(o=object) + ) == e.value.args[0] + + @given(simple_classes()) + def test_fields_dict(self, C): + """ + Returns an ordered dict of ``{attribute_name: Attribute}``. + """ + d = fields_dict(C) + + assert isinstance(d, ordered_dict) + assert list(fields(C)) == list(d.values()) + assert [a.name for a in fields(C)] == [field_name for field_name in d] + + +class TestConverter(object): """ Tests for attribute conversion. """ def test_convert(self): """ - Return value of convert is used as the attribute's value. + Return value of converter is used as the attribute's value. """ C = make_class("C", { - "x": attr.ib(convert=lambda v: v + 1), + "x": attr.ib(converter=lambda v: v + 1), "y": attr.ib(), }) c = C(1, 2) @@ -601,7 +768,7 @@ class TestConvert(object): """ C = make_class("C", { "y": attr.ib(), - "x": attr.ib(init=init, default=val, convert=lambda v: v + 1), + "x": attr.ib(init=init, default=val, converter=lambda v: v + 1), }) c = C(2) @@ -613,13 +780,14 @@ class TestConvert(object): """ Property tests for attributes with convert, and a factory default. """ - C = make_class("C", { - "y": attr.ib(), - "x": attr.ib( + C = make_class("C", ordered_dict([ + ("y", attr.ib()), + ("x", attr.ib( init=init, default=Factory(lambda: val), - convert=lambda v: v + 1), - }) + converter=lambda v: v + 1 + )), + ])) c = C(2) assert c.x == val + 1 @@ -653,7 +821,7 @@ class TestConvert(object): raise RuntimeError("foo") C = make_class( "C", { - "x": attr.ib(validator=validator, convert=lambda v: 1 / 0), + "x": attr.ib(validator=validator, converter=lambda v: 1 / 0), "y": attr.ib(), }) with pytest.raises(ZeroDivisionError): @@ -664,10 +832,49 @@ class TestConvert(object): Converters circumvent immutability. """ C = make_class("C", { - "x": attr.ib(convert=lambda v: int(v)), + "x": attr.ib(converter=lambda v: int(v)), }, frozen=True) C("1") + def test_deprecated_convert(self): + """ + Using *convert* raises a DeprecationWarning and sets the converter + field. + """ + def conv(v): + return v + + with pytest.warns(DeprecationWarning) as wi: + @attr.s + class C(object): + x = attr.ib(convert=conv) + + convert = fields(C).x.convert + + assert 2 == len(wi.list) + w = wi.pop() + + assert conv == fields(C).x.converter == convert + assert ( + "The `convert` argument is deprecated in favor of `converter`. " + "It will be removed after 2019/01.", + ) == w.message.args + assert __file__ == w.filename + + def test_convert_converter(self): + """ + A TypeError is raised if both *convert* and *converter* are passed. + """ + with pytest.raises(RuntimeError) as ei: + @attr.s + class C(object): + x = attr.ib(convert=lambda v: v, converter=lambda v: v) + + assert ( + "Can't pass both `convert` and `converter`. " + "Please use `converter` only.", + ) == ei.value.args + class TestValidate(object): """ @@ -823,6 +1030,39 @@ class TestMetadata(object): for a in fields(C)[1:]: assert a.metadata is fields(C)[0].metadata + @given(lists(simple_attrs_without_metadata, min_size=2, max_size=5)) + def test_empty_countingattr_metadata_independent(self, list_of_attrs): + """ + All empty metadata attributes are independent before ``@attr.s``. + """ + for x, y in itertools.combinations(list_of_attrs, 2): + assert x.metadata is not y.metadata + + @given(lists(simple_attrs_with_metadata(), min_size=2, max_size=5)) + def test_not_none_metadata(self, list_of_attrs): + """ + Non-empty metadata attributes exist as fields after ``@attr.s``. + """ + C = make_class("C", dict(zip(gen_attr_names(), list_of_attrs))) + + assert len(fields(C)) > 0 + + for cls_a, raw_a in zip(fields(C), list_of_attrs): + assert cls_a.metadata != {} + assert cls_a.metadata == raw_a.metadata + + def test_metadata(self): + """ + If metadata that is not None is passed, it is used. + + This is necessary for coverage because the previous test is + hypothesis-based. + """ + md = {} + a = attr.ib(metadata=md) + + assert md is a.metadata + class TestClassBuilder(object): """ @@ -864,3 +1104,62 @@ class TestClassBuilder(object): .build_class() assert "ns.C(x=1)" == repr(cls(1)) + + @pytest.mark.parametrize("meth_name", [ + "__init__", "__hash__", "__repr__", "__str__", + "__eq__", "__ne__", "__lt__", "__le__", "__gt__", "__ge__", + ]) + def test_attaches_meta_dunders(self, meth_name): + """ + Generated methods have correct __module__, __name__, and __qualname__ + attributes. + """ + @attr.s(hash=True, str=True) + class C(object): + def organic(self): + pass + + meth = getattr(C, meth_name) + + assert meth_name == meth.__name__ + assert C.organic.__module__ == meth.__module__ + if not PY2: + organic_prefix = C.organic.__qualname__.rsplit(".", 1)[0] + assert organic_prefix + "." + meth_name == meth.__qualname__ + + def test_handles_missing_meta_on_class(self): + """ + If the class hasn't a __module__ or __qualname__, the method hasn't + either. + """ + class C(object): + pass + + b = _ClassBuilder( + C, these=None, slots=False, frozen=False, auto_attribs=False, + ) + b._cls = {} # no __module__; no __qualname__ + + def fake_meth(self): + pass + + fake_meth.__module__ = "42" + fake_meth.__qualname__ = "23" + + rv = b._add_method_dunders(fake_meth) + + assert "42" == rv.__module__ == fake_meth.__module__ + assert "23" == rv.__qualname__ == fake_meth.__qualname__ + + def test_weakref_setstate(self): + """ + __weakref__ is not set on in setstate because it's not writable in + slots classes. + """ + @attr.s(slots=True) + class C(object): + __weakref__ = attr.ib( + init=False, hash=False, repr=False, cmp=False + ) + + assert C() == copy.deepcopy(C()) diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_validators.py b/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_validators.py index 9722da27fdb..0e67f991bf8 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_validators.py +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/test_validators.py @@ -9,8 +9,8 @@ import zope.interface import attr -from attr import validators as validator_module from attr import has +from attr import validators as validator_module from attr._compat import TYPE from attr.validators import and_, in_, instance_of, optional, provides diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/utils.py b/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/utils.py index 36b624981e9..e89803e4e05 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/utils.py +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/tests/utils.py @@ -4,15 +4,6 @@ Common helper functions for tests. from __future__ import absolute_import, division, print_function -import keyword -import string - -from collections import OrderedDict - -from hypothesis import strategies as st - -import attr - from attr import Attribute from attr._make import NOTHING, make_class @@ -30,13 +21,13 @@ def simple_class(cmp=False, repr=False, hash=False, str=False, slots=False, def simple_attr(name, default=NOTHING, validator=None, repr=True, - cmp=True, hash=None, init=True): + cmp=True, hash=None, init=True, converter=None): """ Return an attribute with a name and no other bells and whistles. """ return Attribute( name=name, default=default, validator=validator, repr=repr, - cmp=cmp, hash=hash, init=init + cmp=cmp, hash=hash, init=init, converter=converter, ) @@ -55,183 +46,3 @@ class TestSimpleClass(object): Each call returns a completely new class. """ assert simple_class() is not simple_class() - - -def gen_attr_names(): - """ - Generate names for attributes, 'a'...'z', then 'aa'...'zz'. - - ~702 different attribute names should be enough in practice. - - Some short strings (such as 'as') are keywords, so we skip them. - """ - lc = string.ascii_lowercase - for c in lc: - yield c - for outer in lc: - for inner in lc: - res = outer + inner - if keyword.iskeyword(res): - continue - yield outer + inner - - -def maybe_underscore_prefix(source): - """ - A generator to sometimes prepend an underscore. - """ - to_underscore = False - for val in source: - yield val if not to_underscore else '_' + val - to_underscore = not to_underscore - - -def _create_hyp_class(attrs): - """ - A helper function for Hypothesis to generate attrs classes. - """ - return make_class( - "HypClass", dict(zip(gen_attr_names(), attrs)) - ) - - -def _create_hyp_nested_strategy(simple_class_strategy): - """ - Create a recursive attrs class. - - Given a strategy for building (simpler) classes, create and return - a strategy for building classes that have as an attribute: either just - the simpler class, a list of simpler classes, a tuple of simpler classes, - an ordered dict or a dict mapping the string "cls" to a simpler class. - """ - # Use a tuple strategy to combine simple attributes and an attr class. - def just_class(tup): - combined_attrs = list(tup[0]) - combined_attrs.append(attr.ib(default=attr.Factory(tup[1]))) - return _create_hyp_class(combined_attrs) - - def list_of_class(tup): - default = attr.Factory(lambda: [tup[1]()]) - combined_attrs = list(tup[0]) - combined_attrs.append(attr.ib(default=default)) - return _create_hyp_class(combined_attrs) - - def tuple_of_class(tup): - default = attr.Factory(lambda: (tup[1](),)) - combined_attrs = list(tup[0]) - combined_attrs.append(attr.ib(default=default)) - return _create_hyp_class(combined_attrs) - - def dict_of_class(tup): - default = attr.Factory(lambda: {"cls": tup[1]()}) - combined_attrs = list(tup[0]) - combined_attrs.append(attr.ib(default=default)) - return _create_hyp_class(combined_attrs) - - def ordereddict_of_class(tup): - default = attr.Factory(lambda: OrderedDict([("cls", tup[1]())])) - combined_attrs = list(tup[0]) - combined_attrs.append(attr.ib(default=default)) - return _create_hyp_class(combined_attrs) - - # A strategy producing tuples of the form ([list of attributes], ). - attrs_and_classes = st.tuples(list_of_attrs, simple_class_strategy) - - return st.one_of(attrs_and_classes.map(just_class), - attrs_and_classes.map(list_of_class), - attrs_and_classes.map(tuple_of_class), - attrs_and_classes.map(dict_of_class), - attrs_and_classes.map(ordereddict_of_class)) - - -bare_attrs = st.just(attr.ib(default=None)) -int_attrs = st.integers().map(lambda i: attr.ib(default=i)) -str_attrs = st.text().map(lambda s: attr.ib(default=s)) -float_attrs = st.floats().map(lambda f: attr.ib(default=f)) -dict_attrs = (st.dictionaries(keys=st.text(), values=st.integers()) - .map(lambda d: attr.ib(default=d))) - -simple_attrs_without_metadata = (bare_attrs | int_attrs | str_attrs | - float_attrs | dict_attrs) - - -@st.composite -def simple_attrs_with_metadata(draw): - """ - Create a simple attribute with arbitrary metadata. - """ - c_attr = draw(simple_attrs) - keys = st.booleans() | st.binary() | st.integers() | st.text() - vals = st.booleans() | st.binary() | st.integers() | st.text() - metadata = draw(st.dictionaries(keys=keys, values=vals)) - - return attr.ib(c_attr._default, c_attr._validator, c_attr.repr, - c_attr.cmp, c_attr.hash, c_attr.init, c_attr.convert, - metadata) - - -simple_attrs = simple_attrs_without_metadata | simple_attrs_with_metadata() - -# Python functions support up to 255 arguments. -list_of_attrs = st.lists(simple_attrs, average_size=3, max_size=9) - - -@st.composite -def simple_classes(draw, slots=None, frozen=None, private_attrs=None): - """ - A strategy that generates classes with default non-attr attributes. - - For example, this strategy might generate a class such as: - - @attr.s(slots=True, frozen=True) - class HypClass: - a = attr.ib(default=1) - _b = attr.ib(default=None) - c = attr.ib(default='text') - _d = attr.ib(default=1.0) - c = attr.ib(default={'t': 1}) - - By default, all combinations of slots and frozen classes will be generated. - If `slots=True` is passed in, only slots classes will be generated, and - if `slots=False` is passed in, no slot classes will be generated. The same - applies to `frozen`. - - By default, some attributes will be private (i.e. prefixed with an - underscore). If `private_attrs=True` is passed in, all attributes will be - private, and if `private_attrs=False`, no attributes will be private. - """ - attrs = draw(list_of_attrs) - frozen_flag = draw(st.booleans()) if frozen is None else frozen - slots_flag = draw(st.booleans()) if slots is None else slots - - if private_attrs is None: - attr_names = maybe_underscore_prefix(gen_attr_names()) - elif private_attrs is True: - attr_names = ('_' + n for n in gen_attr_names()) - elif private_attrs is False: - attr_names = gen_attr_names() - - cls_dict = dict(zip(attr_names, attrs)) - post_init_flag = draw(st.booleans()) - if post_init_flag: - def post_init(self): - pass - cls_dict["__attrs_post_init__"] = post_init - - return make_class( - "HypClass", - cls_dict, - slots=slots_flag, - frozen=frozen_flag, - ) - - -# st.recursive works by taking a base strategy (in this case, simple_classes) -# and a special function. This function receives a strategy, and returns -# another strategy (building on top of the base strategy). -nested_classes = st.recursive( - simple_classes(), - _create_hyp_nested_strategy, - max_leaves=10 -) diff --git a/tests/wpt/web-platform-tests/tools/third_party/attrs/tox.ini b/tests/wpt/web-platform-tests/tools/third_party/attrs/tox.ini index e02c3301025..0ccb3b0d24f 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/attrs/tox.ini +++ b/tests/wpt/web-platform-tests/tools/third_party/attrs/tox.ini @@ -7,17 +7,22 @@ envlist = isort,py27,py34,py35,py36,pypy,pypy3,flake8,manifest,docs,readme,chang # https://github.com/pypa/setuptools/issues/1042 from breaking our builds. setenv = VIRTUALENV_NO_DOWNLOAD=1 -deps = -rdev-requirements.txt +extras = tests commands = python -m pytest {posargs} [testenv:py27] -deps = -rdev-requirements.txt +extras = tests commands = coverage run --parallel -m pytest {posargs} [testenv:py36] -deps = -rdev-requirements.txt +# Python 3.6+ has a number of compile-time warnings on invalid string escapes. +# PYTHONWARNINGS=d and --no-compile below make them visible during the Tox run. +install_command = pip install --no-compile {opts} {packages} +setenv = + PYTHONWARNINGS=d +extras = tests commands = coverage run --parallel -m pytest {posargs} @@ -33,9 +38,9 @@ commands = [testenv:flake8] basepython = python3.6 +extras = tests # Needs a full install so isort can determine own/foreign imports. deps = - -rdev-requirements.txt flake8 flake8-isort commands = flake8 src tests setup.py conftest.py docs/conf.py @@ -43,9 +48,9 @@ commands = flake8 src tests setup.py conftest.py docs/conf.py [testenv:isort] basepython = python3.6 +extras = tests # Needs a full install so isort can determine own/foreign imports. deps = - -rdev-requirements.txt isort commands = isort --recursive setup.py conftest.py src tests @@ -55,7 +60,7 @@ commands = basepython = python3.6 setenv = PYTHONHASHSEED = 0 -deps = -rdocs-requirements.txt +extras = docs commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html sphinx-build -W -b doctest -d {envtmpdir}/doctrees docs docs/_build/html diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/.gitattributes b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/.gitattributes new file mode 100644 index 00000000000..9aaba7a9fe8 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/.gitattributes @@ -0,0 +1,2 @@ +more_itertools/more.py merge=union +more_itertools/tests/test_more.py merge=union diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/.gitignore b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/.gitignore new file mode 100644 index 00000000000..229891fb436 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/.gitignore @@ -0,0 +1,34 @@ +*.py[co] + +# Packages +*.egg +*.eggs +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox +.noseids + +# Docs by Sphinx +_build + +# Environment +.env + +# IDE files +.idea +.vscode +.DS_Store diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/.travis.yml b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/.travis.yml new file mode 100644 index 00000000000..008fb0c67e8 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/.travis.yml @@ -0,0 +1,26 @@ +sudo: false + +language: "python" + +python: + - "2.7" + - "3.4" + - "3.5" + - "3.6" + - "3.7-dev" + - "pypy-5.4.1" + - "pypy3" + +install: + - "pip install ." + - "pip install -U coveralls flake8" + +script: + - "coverage run --include='more_itertools/*.py' --omit='more_itertools/tests/*' setup.py test" + - "flake8 ." + +notifications: + email: false + +after_success: + - "coveralls" diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/LICENSE b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/LICENSE new file mode 100644 index 00000000000..0a523bece3e --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2012 Erik Rose + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/MANIFEST.in b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/MANIFEST.in new file mode 100644 index 00000000000..ec800e3e02a --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/MANIFEST.in @@ -0,0 +1,8 @@ +include README.rst +include LICENSE +include docs/*.rst +include docs/Makefile +include docs/make.bat +include docs/conf.py +include fabfile.py +include tox.ini diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/README.rst b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/README.rst new file mode 100644 index 00000000000..252b394737a --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/README.rst @@ -0,0 +1,59 @@ +============== +More Itertools +============== + +.. image:: https://coveralls.io/repos/github/erikrose/more-itertools/badge.svg?branch=master + :target: https://coveralls.io/github/erikrose/more-itertools?branch=master + +Python's ``itertools`` library is a gem - you can compose elegant solutions +for a variety of problems with the functions it provides. In ``more-itertools`` +we collect additional building blocks, recipes, and routines for working with +Python iterables. + +Getting started +=============== + +To get started, install the library with `pip `_: + +.. code-block:: shell + + pip install more-itertools + +The recipes from the `itertools docs `_ +are included in the top-level package: + +.. code-block:: python + + >>> from more_itertools import flatten + >>> iterable = [(0, 1), (2, 3)] + >>> list(flatten(iterable)) + [0, 1, 2, 3] + +Several new recipes are available as well: + +.. code-block:: python + + >>> from more_itertools import chunked + >>> iterable = [0, 1, 2, 3, 4, 5, 6, 7, 8] + >>> list(chunked(iterable, 3)) + [[0, 1, 2], [3, 4, 5], [6, 7, 8]] + + >>> from more_itertools import spy + >>> iterable = (x * x for x in range(1, 6)) + >>> head, iterable = spy(iterable, n=3) + >>> list(head) + [1, 4, 9] + >>> list(iterable) + [1, 4, 9, 16, 25] + + + +For the full listing of functions, see the `API documentation `_. + +Development +=========== + +``more-itertools`` is maintained by `@erikrose `_ +and `@bbayles `_, with help from `many others `_. +If you have a problem or suggestion, please file a bug or pull request in this +repository. Thanks for contributing! diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/Makefile b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/Makefile new file mode 100644 index 00000000000..47888da7b72 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/Makefile @@ -0,0 +1,153 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + -rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/more-itertools.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/more-itertools.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/more-itertools" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/more-itertools" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/api.rst b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/api.rst new file mode 100644 index 00000000000..63e5d7f4500 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/api.rst @@ -0,0 +1,234 @@ +============= +API Reference +============= + +.. automodule:: more_itertools + +Grouping +======== + +These tools yield groups of items from a source iterable. + +---- + +**New itertools** + +.. autofunction:: chunked +.. autofunction:: sliced +.. autofunction:: distribute +.. autofunction:: divide +.. autofunction:: split_at +.. autofunction:: split_before +.. autofunction:: split_after +.. autofunction:: bucket + +---- + +**Itertools recipes** + +.. autofunction:: grouper +.. autofunction:: partition + + +Lookahead and lookback +====================== + +These tools peek at an iterable's values without advancing it. + +---- + +**New itertools** + + +.. autofunction:: spy +.. autoclass:: peekable +.. autoclass:: seekable + + +Windowing +========= + +These tools yield windows of items from an iterable. + +---- + +**New itertools** + +.. autofunction:: windowed +.. autofunction:: stagger + +---- + +**Itertools recipes** + +.. autofunction:: pairwise + + +Augmenting +========== + +These tools yield items from an iterable, plus additional data. + +---- + +**New itertools** + +.. autofunction:: count_cycle +.. autofunction:: intersperse +.. autofunction:: padded +.. autofunction:: adjacent +.. autofunction:: groupby_transform + +---- + +**Itertools recipes** + +.. autofunction:: padnone +.. autofunction:: ncycles + + +Combining +========= + +These tools combine multiple iterables. + +---- + +**New itertools** + +.. autofunction:: collapse +.. autofunction:: sort_together +.. autofunction:: interleave +.. autofunction:: interleave_longest +.. autofunction:: collate(*iterables, key=lambda a: a, reverse=False) +.. autofunction:: zip_offset(*iterables, offsets, longest=False, fillvalue=None) + +---- + +**Itertools recipes** + +.. autofunction:: dotproduct +.. autofunction:: flatten +.. autofunction:: roundrobin +.. autofunction:: prepend + + +Summarizing +=========== + +These tools return summarized or aggregated data from an iterable. + +---- + +**New itertools** + +.. autofunction:: ilen +.. autofunction:: first(iterable[, default]) +.. autofunction:: one +.. autofunction:: unique_to_each +.. autofunction:: locate(iterable, pred=bool) +.. autofunction:: consecutive_groups(iterable, ordering=lambda x: x) +.. autofunction:: exactly_n(iterable, n, predicate=bool) +.. autoclass:: run_length +.. autofunction:: map_reduce + +---- + +**Itertools recipes** + +.. autofunction:: all_equal +.. autofunction:: first_true +.. autofunction:: nth +.. autofunction:: quantify(iterable, pred=bool) + + +Selecting +========= + +These tools yield certain items from an iterable. + +---- + +**New itertools** + +.. autofunction:: islice_extended(start, stop, step) +.. autofunction:: strip +.. autofunction:: lstrip +.. autofunction:: rstrip + +---- + +**Itertools recipes** + +.. autofunction:: take +.. autofunction:: tail +.. autofunction:: unique_everseen +.. autofunction:: unique_justseen + + +Combinatorics +============= + +These tools yield combinatorial arrangements of items from iterables. + +---- + +**New itertools** + +.. autofunction:: distinct_permutations +.. autofunction:: circular_shifts + +---- + +**Itertools recipes** + +.. autofunction:: powerset +.. autofunction:: random_product +.. autofunction:: random_permutation +.. autofunction:: random_combination +.. autofunction:: random_combination_with_replacement +.. autofunction:: nth_combination + + +Wrapping +======== + +These tools provide wrappers to smooth working with objects that produce or +consume iterables. + +---- + +**New itertools** + +.. autofunction:: always_iterable +.. autofunction:: consumer +.. autofunction:: with_iter + +---- + +**Itertools recipes** + +.. autofunction:: iter_except + + +Others +====== + +**New itertools** + +.. autofunction:: numeric_range(start, stop, step) +.. autofunction:: always_reversible +.. autofunction:: side_effect +.. autofunction:: iterate +.. autofunction:: difference(iterable, func=operator.sub) +.. autofunction:: make_decorator +.. autoclass:: SequenceView + +---- + +**Itertools recipes** + +.. autofunction:: consume +.. autofunction:: accumulate(iterable, func=operator.add) +.. autofunction:: tabulate +.. autofunction:: repeatfunc diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/conf.py b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/conf.py new file mode 100644 index 00000000000..e38c71aeaac --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/conf.py @@ -0,0 +1,244 @@ +# -*- coding: utf-8 -*- +# +# more-itertools documentation build configuration file, created by +# sphinx-quickstart on Mon Jun 25 20:42:39 2012. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os + +import sphinx_rtd_theme + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +sys.path.insert(0, os.path.abspath('..')) + +# -- General configuration ----------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'more-itertools' +copyright = u'2012, Erik Rose' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '4.2.0' +# The full version, including alpha/beta/rc tags. +release = version + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'sphinx_rtd_theme' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'more-itertoolsdoc' + + +# -- Options for LaTeX output -------------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ('index', 'more-itertools.tex', u'more-itertools Documentation', + u'Erik Rose', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output -------------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'more-itertools', u'more-itertools Documentation', + [u'Erik Rose'], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------------ + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ('index', 'more-itertools', u'more-itertools Documentation', + u'Erik Rose', 'more-itertools', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/index.rst b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/index.rst new file mode 100644 index 00000000000..091461ff7d6 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/index.rst @@ -0,0 +1,16 @@ +.. include:: ../README.rst + +Contents +======== + +.. toctree:: + :maxdepth: 2 + + api + +.. toctree:: + :maxdepth: 1 + + license + testing + versions diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/license.rst b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/license.rst new file mode 100644 index 00000000000..123c0f54dca --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/license.rst @@ -0,0 +1,16 @@ +======= +License +======= + +more-itertools is under the MIT License. See the LICENSE file. + +Conditions for Contributors +=========================== + +By contributing to this software project, you are agreeing to the following +terms and conditions for your contributions: First, you agree your +contributions are submitted under the MIT license. Second, you represent you +are authorized to make the contributions and grant the license. If your +employer has rights to intellectual property that includes your contributions, +you represent that you have received permission to make contributions and grant +the required license on behalf of that employer. diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/make.bat b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/make.bat new file mode 100644 index 00000000000..8023c0aa674 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/make.bat @@ -0,0 +1,190 @@ +@ECHO OFF + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set BUILDDIR=_build +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . +set I18NSPHINXOPTS=%SPHINXOPTS% . +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% + set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% +) + +if "%1" == "" goto help + +if "%1" == "help" ( + :help + echo.Please use `make ^` where ^ is one of + echo. html to make standalone HTML files + echo. dirhtml to make HTML files named index.html in directories + echo. singlehtml to make a single large HTML file + echo. pickle to make pickle files + echo. json to make JSON files + echo. htmlhelp to make HTML files and a HTML help project + echo. qthelp to make HTML files and a qthelp project + echo. devhelp to make HTML files and a Devhelp project + echo. epub to make an epub + echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter + echo. text to make text files + echo. man to make manual pages + echo. texinfo to make Texinfo files + echo. gettext to make PO message catalogs + echo. changes to make an overview over all changed/added/deprecated items + echo. linkcheck to check all external links for integrity + echo. doctest to run all doctests embedded in the documentation if enabled + goto end +) + +if "%1" == "clean" ( + for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i + del /q /s %BUILDDIR%\* + goto end +) + +if "%1" == "html" ( + %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/html. + goto end +) + +if "%1" == "dirhtml" ( + %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. + goto end +) + +if "%1" == "singlehtml" ( + %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. + goto end +) + +if "%1" == "pickle" ( + %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the pickle files. + goto end +) + +if "%1" == "json" ( + %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the JSON files. + goto end +) + +if "%1" == "htmlhelp" ( + %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run HTML Help Workshop with the ^ +.hhp project file in %BUILDDIR%/htmlhelp. + goto end +) + +if "%1" == "qthelp" ( + %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run "qcollectiongenerator" with the ^ +.qhcp project file in %BUILDDIR%/qthelp, like this: + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\more-itertools.qhcp + echo.To view the help file: + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\more-itertools.ghc + goto end +) + +if "%1" == "devhelp" ( + %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. + goto end +) + +if "%1" == "epub" ( + %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The epub file is in %BUILDDIR%/epub. + goto end +) + +if "%1" == "latex" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "text" ( + %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The text files are in %BUILDDIR%/text. + goto end +) + +if "%1" == "man" ( + %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The manual pages are in %BUILDDIR%/man. + goto end +) + +if "%1" == "texinfo" ( + %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. + goto end +) + +if "%1" == "gettext" ( + %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The message catalogs are in %BUILDDIR%/locale. + goto end +) + +if "%1" == "changes" ( + %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes + if errorlevel 1 exit /b 1 + echo. + echo.The overview file is in %BUILDDIR%/changes. + goto end +) + +if "%1" == "linkcheck" ( + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + if errorlevel 1 exit /b 1 + echo. + echo.Link check complete; look for any errors in the above output ^ +or in %BUILDDIR%/linkcheck/output.txt. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest + if errorlevel 1 exit /b 1 + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in %BUILDDIR%/doctest/output.txt. + goto end +) + +:end diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/testing.rst b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/testing.rst new file mode 100644 index 00000000000..bdd42199517 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/testing.rst @@ -0,0 +1,19 @@ +======= +Testing +======= + +To run install dependencies and run tests, use this command:: + + python setup.py test + +Multiple Python Versions +======================== + +To run the tests on all the versions of Python more-itertools supports, install +tox:: + + pip install tox + +Then, run the tests:: + + tox diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/versions.rst b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/versions.rst new file mode 100644 index 00000000000..e50ac4393dd --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/docs/versions.rst @@ -0,0 +1,237 @@ +=============== +Version History +=============== + +.. automodule:: more_itertools + +4.2.0 +----- + +* New itertools: + * :func:`map_reduce` (thanks to pylang) + * :func:`prepend` (from the `Python 3.7 docs `_) + +* Improvements to existing itertools: + * :func:`bucket` now complies with PEP 479 (thanks to irmen) + +* Other changes: + * Python 3.7 is now supported (thanks to irmen) + * Python 3.3 is no longer supported + * The test suite no longer requires third-party modules to run + * The API docs now include links to source code + +4.1.0 +----- + +* New itertools: + * :func:`split_at` (thanks to michael-celani) + * :func:`circular_shifts` (thanks to hiqua) + * :func:`make_decorator` - see the blog post `Yo, I heard you like decorators `_ + for a tour (thanks to pylang) + * :func:`always_reversible` (thanks to michael-celani) + * :func:`nth_combination` (from the `Python 3.7 docs `_) + +* Improvements to existing itertools: + * :func:`seekable` now has an ``elements`` method to return cached items. + * The performance tradeoffs between :func:`roundrobin` and + :func:`interleave_longest` are now documented (thanks michael-celani, + pylang, and MSeifert04) + +4.0.1 +----- + +* No code changes - this release fixes how the docs display on PyPI. + +4.0.0 +----- + +* New itertools: + * :func:`consecutive_groups` (Based on the example in the `Python 2.4 docs `_) + * :func:`seekable` (If you're looking for how to "reset" an iterator, + you're in luck!) + * :func:`exactly_n` (thanks to michael-celani) + * :func:`run_length.encode` and :func:`run_length.decode` + * :func:`difference` + +* Improvements to existing itertools: + * The number of items between filler elements in :func:`intersperse` can + now be specified (thanks to pylang) + * :func:`distinct_permutations` and :func:`peekable` got some minor + adjustments (thanks to MSeifert04) + * :func:`always_iterable` now returns an iterator object. It also now + allows different types to be considered iterable (thanks to jaraco) + * :func:`bucket` can now limit the keys it stores in memory + * :func:`one` now allows for custom exceptions (thanks to kalekundert) + +* Other changes: + * A few typos were fixed (thanks to EdwardBetts) + * All tests can now be run with ``python setup.py test`` + +The major version update is due to the change in the return value of :func:`always_iterable`. +It now always returns iterator objects: + +.. code-block:: python + + >>> from more_itertools import always_iterable + # Non-iterable objects are wrapped with iter(tuple(obj)) + >>> always_iterable(12345) + + >>> list(always_iterable(12345)) + [12345] + # Iterable objects are wrapped with iter() + >>> always_iterable([1, 2, 3, 4, 5]) + + +3.2.0 +----- + +* New itertools: + * :func:`lstrip`, :func:`rstrip`, and :func:`strip` + (thanks to MSeifert04 and pylang) + * :func:`islice_extended` +* Improvements to existing itertools: + * Some bugs with slicing :func:`peekable`-wrapped iterables were fixed + +3.1.0 +----- + +* New itertools: + * :func:`numeric_range` (Thanks to BebeSparkelSparkel and MSeifert04) + * :func:`count_cycle` (Thanks to BebeSparkelSparkel) + * :func:`locate` (Thanks to pylang and MSeifert04) +* Improvements to existing itertools: + * A few itertools are now slightly faster due to some function + optimizations. (Thanks to MSeifert04) +* The docs have been substantially revised with installation notes, + categories for library functions, links, and more. (Thanks to pylang) + + +3.0.0 +----- + +* Removed itertools: + * ``context`` has been removed due to a design flaw - see below for + replacement options. (thanks to NeilGirdhar) +* Improvements to existing itertools: + * ``side_effect`` now supports ``before`` and ``after`` keyword + arguments. (Thanks to yardsale8) +* PyPy and PyPy3 are now supported. + +The major version change is due to the removal of the ``context`` function. +Replace it with standard ``with`` statement context management: + +.. code-block:: python + + # Don't use context() anymore + file_obj = StringIO() + consume(print(x, file=f) for f in context(file_obj) for x in u'123') + + # Use a with statement instead + file_obj = StringIO() + with file_obj as f: + consume(print(x, file=f) for x in u'123') + +2.6.0 +----- + +* New itertools: + * ``adjacent`` and ``groupby_transform`` (Thanks to diazona) + * ``always_iterable`` (Thanks to jaraco) + * (Removed in 3.0.0) ``context`` (Thanks to yardsale8) + * ``divide`` (Thanks to mozbhearsum) +* Improvements to existing itertools: + * ``ilen`` is now slightly faster. (Thanks to wbolster) + * ``peekable`` can now prepend items to an iterable. (Thanks to diazona) + +2.5.0 +----- + +* New itertools: + * ``distribute`` (Thanks to mozbhearsum and coady) + * ``sort_together`` (Thanks to clintval) + * ``stagger`` and ``zip_offset`` (Thanks to joshbode) + * ``padded`` +* Improvements to existing itertools: + * ``peekable`` now handles negative indexes and slices with negative + components properly. + * ``intersperse`` is now slightly faster. (Thanks to pylang) + * ``windowed`` now accepts a ``step`` keyword argument. + (Thanks to pylang) +* Python 3.6 is now supported. + +2.4.1 +----- + +* Move docs 100% to readthedocs.io. + +2.4 +----- + +* New itertools: + * ``accumulate``, ``all_equal``, ``first_true``, ``partition``, and + ``tail`` from the itertools documentation. + * ``bucket`` (Thanks to Rosuav and cvrebert) + * ``collapse`` (Thanks to abarnet) + * ``interleave`` and ``interleave_longest`` (Thanks to abarnet) + * ``side_effect`` (Thanks to nvie) + * ``sliced`` (Thanks to j4mie and coady) + * ``split_before`` and ``split_after`` (Thanks to astronouth7303) + * ``spy`` (Thanks to themiurgo and mathieulongtin) +* Improvements to existing itertools: + * ``chunked`` is now simpler and more friendly to garbage collection. + (Contributed by coady, with thanks to piskvorky) + * ``collate`` now delegates to ``heapq.merge`` when possible. + (Thanks to kmike and julianpistorius) + * ``peekable``-wrapped iterables are now indexable and sliceable. + Iterating through ``peekable``-wrapped iterables is also faster. + * ``one`` and ``unique_to_each`` have been simplified. + (Thanks to coady) + + +2.3 +----- + +* Added ``one`` from ``jaraco.util.itertools``. (Thanks, jaraco!) +* Added ``distinct_permutations`` and ``unique_to_each``. (Contributed by + bbayles) +* Added ``windowed``. (Contributed by bbayles, with thanks to buchanae, + jaraco, and abarnert) +* Simplified the implementation of ``chunked``. (Thanks, nvie!) +* Python 3.5 is now supported. Python 2.6 is no longer supported. +* Python 3 is now supported directly; there is no 2to3 step. + +2.2 +----- + +* Added ``iterate`` and ``with_iter``. (Thanks, abarnert!) + +2.1 +----- + +* Added (tested!) implementations of the recipes from the itertools + documentation. (Thanks, Chris Lonnen!) +* Added ``ilen``. (Thanks for the inspiration, Matt Basta!) + +2.0 +----- + +* ``chunked`` now returns lists rather than tuples. After all, they're + homogeneous. This slightly backward-incompatible change is the reason for + the major version bump. +* Added ``@consumer``. +* Improved test machinery. + +1.1 +----- + +* Added ``first`` function. +* Added Python 3 support. +* Added a default arg to ``peekable.peek()``. +* Noted how to easily test whether a peekable iterator is exhausted. +* Rewrote documentation. + +1.0 +----- + +* Initial release, with ``collate``, ``peekable``, and ``chunked``. Could + really use better docs. diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/__init__.py b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/__init__.py new file mode 100644 index 00000000000..bba462c3dbf --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/__init__.py @@ -0,0 +1,2 @@ +from more_itertools.more import * # noqa +from more_itertools.recipes import * # noqa diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/more.py b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/more.py new file mode 100644 index 00000000000..d517250242f --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/more.py @@ -0,0 +1,2068 @@ +from __future__ import print_function + +from collections import Counter, defaultdict, deque +from functools import partial, wraps +from heapq import merge +from itertools import ( + chain, + compress, + count, + cycle, + dropwhile, + groupby, + islice, + repeat, + takewhile, + tee +) +from operator import itemgetter, lt, gt, sub +from sys import maxsize, version_info +try: + from collections.abc import Sequence +except ImportError: + from collections import Sequence + +from six import binary_type, string_types, text_type +from six.moves import filter, map, range, zip, zip_longest + +from .recipes import consume, flatten, take + +__all__ = [ + 'adjacent', + 'always_iterable', + 'always_reversible', + 'bucket', + 'chunked', + 'circular_shifts', + 'collapse', + 'collate', + 'consecutive_groups', + 'consumer', + 'count_cycle', + 'difference', + 'distinct_permutations', + 'distribute', + 'divide', + 'exactly_n', + 'first', + 'groupby_transform', + 'ilen', + 'interleave_longest', + 'interleave', + 'intersperse', + 'islice_extended', + 'iterate', + 'locate', + 'lstrip', + 'make_decorator', + 'map_reduce', + 'numeric_range', + 'one', + 'padded', + 'peekable', + 'rstrip', + 'run_length', + 'seekable', + 'SequenceView', + 'side_effect', + 'sliced', + 'sort_together', + 'split_at', + 'split_after', + 'split_before', + 'spy', + 'stagger', + 'strip', + 'unique_to_each', + 'windowed', + 'with_iter', + 'zip_offset', +] + +_marker = object() + + +def chunked(iterable, n): + """Break *iterable* into lists of length *n*: + + >>> list(chunked([1, 2, 3, 4, 5, 6], 3)) + [[1, 2, 3], [4, 5, 6]] + + If the length of *iterable* is not evenly divisible by *n*, the last + returned list will be shorter: + + >>> list(chunked([1, 2, 3, 4, 5, 6, 7, 8], 3)) + [[1, 2, 3], [4, 5, 6], [7, 8]] + + To use a fill-in value instead, see the :func:`grouper` recipe. + + :func:`chunked` is useful for splitting up a computation on a large number + of keys into batches, to be pickled and sent off to worker processes. One + example is operations on rows in MySQL, which does not implement + server-side cursors properly and would otherwise load the entire dataset + into RAM on the client. + + """ + return iter(partial(take, n, iter(iterable)), []) + + +def first(iterable, default=_marker): + """Return the first item of *iterable*, or *default* if *iterable* is + empty. + + >>> first([0, 1, 2, 3]) + 0 + >>> first([], 'some default') + 'some default' + + If *default* is not provided and there are no items in the iterable, + raise ``ValueError``. + + :func:`first` is useful when you have a generator of expensive-to-retrieve + values and want any arbitrary one. It is marginally shorter than + ``next(iter(iterable), default)``. + + """ + try: + return next(iter(iterable)) + except StopIteration: + # I'm on the edge about raising ValueError instead of StopIteration. At + # the moment, ValueError wins, because the caller could conceivably + # want to do something different with flow control when I raise the + # exception, and it's weird to explicitly catch StopIteration. + if default is _marker: + raise ValueError('first() was called on an empty iterable, and no ' + 'default value was provided.') + return default + + +class peekable(object): + """Wrap an iterator to allow lookahead and prepending elements. + + Call :meth:`peek` on the result to get the value that will be returned + by :func:`next`. This won't advance the iterator: + + >>> p = peekable(['a', 'b']) + >>> p.peek() + 'a' + >>> next(p) + 'a' + + Pass :meth:`peek` a default value to return that instead of raising + ``StopIteration`` when the iterator is exhausted. + + >>> p = peekable([]) + >>> p.peek('hi') + 'hi' + + peekables also offer a :meth:`prepend` method, which "inserts" items + at the head of the iterable: + + >>> p = peekable([1, 2, 3]) + >>> p.prepend(10, 11, 12) + >>> next(p) + 10 + >>> p.peek() + 11 + >>> list(p) + [11, 12, 1, 2, 3] + + peekables can be indexed. Index 0 is the item that will be returned by + :func:`next`, index 1 is the item after that, and so on: + The values up to the given index will be cached. + + >>> p = peekable(['a', 'b', 'c', 'd']) + >>> p[0] + 'a' + >>> p[1] + 'b' + >>> next(p) + 'a' + + Negative indexes are supported, but be aware that they will cache the + remaining items in the source iterator, which may require significant + storage. + + To check whether a peekable is exhausted, check its truth value: + + >>> p = peekable(['a', 'b']) + >>> if p: # peekable has items + ... list(p) + ['a', 'b'] + >>> if not p: # peekable is exhaused + ... list(p) + [] + + """ + def __init__(self, iterable): + self._it = iter(iterable) + self._cache = deque() + + def __iter__(self): + return self + + def __bool__(self): + try: + self.peek() + except StopIteration: + return False + return True + + def __nonzero__(self): + # For Python 2 compatibility + return self.__bool__() + + def peek(self, default=_marker): + """Return the item that will be next returned from ``next()``. + + Return ``default`` if there are no items left. If ``default`` is not + provided, raise ``StopIteration``. + + """ + if not self._cache: + try: + self._cache.append(next(self._it)) + except StopIteration: + if default is _marker: + raise + return default + return self._cache[0] + + def prepend(self, *items): + """Stack up items to be the next ones returned from ``next()`` or + ``self.peek()``. The items will be returned in + first in, first out order:: + + >>> p = peekable([1, 2, 3]) + >>> p.prepend(10, 11, 12) + >>> next(p) + 10 + >>> list(p) + [11, 12, 1, 2, 3] + + It is possible, by prepending items, to "resurrect" a peekable that + previously raised ``StopIteration``. + + >>> p = peekable([]) + >>> next(p) + Traceback (most recent call last): + ... + StopIteration + >>> p.prepend(1) + >>> next(p) + 1 + >>> next(p) + Traceback (most recent call last): + ... + StopIteration + + """ + self._cache.extendleft(reversed(items)) + + def __next__(self): + if self._cache: + return self._cache.popleft() + + return next(self._it) + + next = __next__ # For Python 2 compatibility + + def _get_slice(self, index): + # Normalize the slice's arguments + step = 1 if (index.step is None) else index.step + if step > 0: + start = 0 if (index.start is None) else index.start + stop = maxsize if (index.stop is None) else index.stop + elif step < 0: + start = -1 if (index.start is None) else index.start + stop = (-maxsize - 1) if (index.stop is None) else index.stop + else: + raise ValueError('slice step cannot be zero') + + # If either the start or stop index is negative, we'll need to cache + # the rest of the iterable in order to slice from the right side. + if (start < 0) or (stop < 0): + self._cache.extend(self._it) + # Otherwise we'll need to find the rightmost index and cache to that + # point. + else: + n = min(max(start, stop) + 1, maxsize) + cache_len = len(self._cache) + if n >= cache_len: + self._cache.extend(islice(self._it, n - cache_len)) + + return list(self._cache)[index] + + def __getitem__(self, index): + if isinstance(index, slice): + return self._get_slice(index) + + cache_len = len(self._cache) + if index < 0: + self._cache.extend(self._it) + elif index >= cache_len: + self._cache.extend(islice(self._it, index + 1 - cache_len)) + + return self._cache[index] + + +def _collate(*iterables, **kwargs): + """Helper for ``collate()``, called when the user is using the ``reverse`` + or ``key`` keyword arguments on Python versions below 3.5. + + """ + key = kwargs.pop('key', lambda a: a) + reverse = kwargs.pop('reverse', False) + + min_or_max = partial(max if reverse else min, key=itemgetter(0)) + peekables = [peekable(it) for it in iterables] + peekables = [p for p in peekables if p] # Kill empties. + while peekables: + _, p = min_or_max((key(p.peek()), p) for p in peekables) + yield next(p) + peekables = [x for x in peekables if x] + + +def collate(*iterables, **kwargs): + """Return a sorted merge of the items from each of several already-sorted + *iterables*. + + >>> list(collate('ACDZ', 'AZ', 'JKL')) + ['A', 'A', 'C', 'D', 'J', 'K', 'L', 'Z', 'Z'] + + Works lazily, keeping only the next value from each iterable in memory. Use + :func:`collate` to, for example, perform a n-way mergesort of items that + don't fit in memory. + + If a *key* function is specified, the iterables will be sorted according + to its result: + + >>> key = lambda s: int(s) # Sort by numeric value, not by string + >>> list(collate(['1', '10'], ['2', '11'], key=key)) + ['1', '2', '10', '11'] + + + If the *iterables* are sorted in descending order, set *reverse* to + ``True``: + + >>> list(collate([5, 3, 1], [4, 2, 0], reverse=True)) + [5, 4, 3, 2, 1, 0] + + If the elements of the passed-in iterables are out of order, you might get + unexpected results. + + On Python 2.7, this function delegates to :func:`heapq.merge` if neither + of the keyword arguments are specified. On Python 3.5+, this function + is an alias for :func:`heapq.merge`. + + """ + if not kwargs: + return merge(*iterables) + + return _collate(*iterables, **kwargs) + + +# If using Python version 3.5 or greater, heapq.merge() will be faster than +# collate - use that instead. +if version_info >= (3, 5, 0): + _collate_docstring = collate.__doc__ + collate = partial(merge) + collate.__doc__ = _collate_docstring + + +def consumer(func): + """Decorator that automatically advances a PEP-342-style "reverse iterator" + to its first yield point so you don't have to call ``next()`` on it + manually. + + >>> @consumer + ... def tally(): + ... i = 0 + ... while True: + ... print('Thing number %s is %s.' % (i, (yield))) + ... i += 1 + ... + >>> t = tally() + >>> t.send('red') + Thing number 0 is red. + >>> t.send('fish') + Thing number 1 is fish. + + Without the decorator, you would have to call ``next(t)`` before + ``t.send()`` could be used. + + """ + @wraps(func) + def wrapper(*args, **kwargs): + gen = func(*args, **kwargs) + next(gen) + return gen + return wrapper + + +def ilen(iterable): + """Return the number of items in *iterable*. + + >>> ilen(x for x in range(1000000) if x % 3 == 0) + 333334 + + This consumes the iterable, so handle with care. + + """ + # maxlen=1 only stores the last item in the deque + d = deque(enumerate(iterable, 1), maxlen=1) + # since we started enumerate at 1, + # the first item of the last pair will be the length of the iterable + # (assuming there were items) + return d[0][0] if d else 0 + + +def iterate(func, start): + """Return ``start``, ``func(start)``, ``func(func(start))``, ... + + >>> from itertools import islice + >>> list(islice(iterate(lambda x: 2*x, 1), 10)) + [1, 2, 4, 8, 16, 32, 64, 128, 256, 512] + + """ + while True: + yield start + start = func(start) + + +def with_iter(context_manager): + """Wrap an iterable in a ``with`` statement, so it closes once exhausted. + + For example, this will close the file when the iterator is exhausted:: + + upper_lines = (line.upper() for line in with_iter(open('foo'))) + + Any context manager which returns an iterable is a candidate for + ``with_iter``. + + """ + with context_manager as iterable: + for item in iterable: + yield item + + +def one(iterable, too_short=None, too_long=None): + """Return the first item from *iterable*, which is expected to contain only + that item. Raise an exception if *iterable* is empty or has more than one + item. + + :func:`one` is useful for ensuring that an iterable contains only one item. + For example, it can be used to retrieve the result of a database query + that is expected to return a single row. + + If *iterable* is empty, ``ValueError`` will be raised. You may specify a + different exception with the *too_short* keyword: + + >>> it = [] + >>> one(it) # doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + ... + ValueError: too many items in iterable (expected 1)' + >>> too_short = IndexError('too few items') + >>> one(it, too_short=too_short) # doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + ... + IndexError: too few items + + Similarly, if *iterable* contains more than one item, ``ValueError`` will + be raised. You may specify a different exception with the *too_long* + keyword: + + >>> it = ['too', 'many'] + >>> one(it) # doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + ... + ValueError: too many items in iterable (expected 1)' + >>> too_long = RuntimeError + >>> one(it, too_long=too_long) # doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + ... + RuntimeError + + Note that :func:`one` attempts to advance *iterable* twice to ensure there + is only one item. If there is more than one, both items will be discarded. + See :func:`spy` or :func:`peekable` to check iterable contents less + destructively. + + """ + it = iter(iterable) + + try: + value = next(it) + except StopIteration: + raise too_short or ValueError('too few items in iterable (expected 1)') + + try: + next(it) + except StopIteration: + pass + else: + raise too_long or ValueError('too many items in iterable (expected 1)') + + return value + + +def distinct_permutations(iterable): + """Yield successive distinct permutations of the elements in *iterable*. + + >>> sorted(distinct_permutations([1, 0, 1])) + [(0, 1, 1), (1, 0, 1), (1, 1, 0)] + + Equivalent to ``set(permutations(iterable))``, except duplicates are not + generated and thrown away. For larger input sequences this is much more + efficient. + + Duplicate permutations arise when there are duplicated elements in the + input iterable. The number of items returned is + `n! / (x_1! * x_2! * ... * x_n!)`, where `n` is the total number of + items input, and each `x_i` is the count of a distinct item in the input + sequence. + + """ + def perm_unique_helper(item_counts, perm, i): + """Internal helper function + + :arg item_counts: Stores the unique items in ``iterable`` and how many + times they are repeated + :arg perm: The permutation that is being built for output + :arg i: The index of the permutation being modified + + The output permutations are built up recursively; the distinct items + are placed until their repetitions are exhausted. + """ + if i < 0: + yield tuple(perm) + else: + for item in item_counts: + if item_counts[item] <= 0: + continue + perm[i] = item + item_counts[item] -= 1 + for x in perm_unique_helper(item_counts, perm, i - 1): + yield x + item_counts[item] += 1 + + item_counts = Counter(iterable) + length = sum(item_counts.values()) + + return perm_unique_helper(item_counts, [None] * length, length - 1) + + +def intersperse(e, iterable, n=1): + """Intersperse filler element *e* among the items in *iterable*, leaving + *n* items between each filler element. + + >>> list(intersperse('!', [1, 2, 3, 4, 5])) + [1, '!', 2, '!', 3, '!', 4, '!', 5] + + >>> list(intersperse(None, [1, 2, 3, 4, 5], n=2)) + [1, 2, None, 3, 4, None, 5] + + """ + if n == 0: + raise ValueError('n must be > 0') + elif n == 1: + # interleave(repeat(e), iterable) -> e, x_0, e, e, x_1, e, x_2... + # islice(..., 1, None) -> x_0, e, e, x_1, e, x_2... + return islice(interleave(repeat(e), iterable), 1, None) + else: + # interleave(filler, chunks) -> [e], [x_0, x_1], [e], [x_2, x_3]... + # islice(..., 1, None) -> [x_0, x_1], [e], [x_2, x_3]... + # flatten(...) -> x_0, x_1, e, x_2, x_3... + filler = repeat([e]) + chunks = chunked(iterable, n) + return flatten(islice(interleave(filler, chunks), 1, None)) + + +def unique_to_each(*iterables): + """Return the elements from each of the input iterables that aren't in the + other input iterables. + + For example, suppose you have a set of packages, each with a set of + dependencies:: + + {'pkg_1': {'A', 'B'}, 'pkg_2': {'B', 'C'}, 'pkg_3': {'B', 'D'}} + + If you remove one package, which dependencies can also be removed? + + If ``pkg_1`` is removed, then ``A`` is no longer necessary - it is not + associated with ``pkg_2`` or ``pkg_3``. Similarly, ``C`` is only needed for + ``pkg_2``, and ``D`` is only needed for ``pkg_3``:: + + >>> unique_to_each({'A', 'B'}, {'B', 'C'}, {'B', 'D'}) + [['A'], ['C'], ['D']] + + If there are duplicates in one input iterable that aren't in the others + they will be duplicated in the output. Input order is preserved:: + + >>> unique_to_each("mississippi", "missouri") + [['p', 'p'], ['o', 'u', 'r']] + + It is assumed that the elements of each iterable are hashable. + + """ + pool = [list(it) for it in iterables] + counts = Counter(chain.from_iterable(map(set, pool))) + uniques = {element for element in counts if counts[element] == 1} + return [list(filter(uniques.__contains__, it)) for it in pool] + + +def windowed(seq, n, fillvalue=None, step=1): + """Return a sliding window of width *n* over the given iterable. + + >>> all_windows = windowed([1, 2, 3, 4, 5], 3) + >>> list(all_windows) + [(1, 2, 3), (2, 3, 4), (3, 4, 5)] + + When the window is larger than the iterable, *fillvalue* is used in place + of missing values:: + + >>> list(windowed([1, 2, 3], 4)) + [(1, 2, 3, None)] + + Each window will advance in increments of *step*: + + >>> list(windowed([1, 2, 3, 4, 5, 6], 3, fillvalue='!', step=2)) + [(1, 2, 3), (3, 4, 5), (5, 6, '!')] + + """ + if n < 0: + raise ValueError('n must be >= 0') + if n == 0: + yield tuple() + return + if step < 1: + raise ValueError('step must be >= 1') + + it = iter(seq) + window = deque([], n) + append = window.append + + # Initial deque fill + for _ in range(n): + append(next(it, fillvalue)) + yield tuple(window) + + # Appending new items to the right causes old items to fall off the left + i = 0 + for item in it: + append(item) + i = (i + 1) % step + if i % step == 0: + yield tuple(window) + + # If there are items from the iterable in the window, pad with the given + # value and emit them. + if (i % step) and (step - i < n): + for _ in range(step - i): + append(fillvalue) + yield tuple(window) + + +class bucket(object): + """Wrap *iterable* and return an object that buckets it iterable into + child iterables based on a *key* function. + + >>> iterable = ['a1', 'b1', 'c1', 'a2', 'b2', 'c2', 'b3'] + >>> s = bucket(iterable, key=lambda x: x[0]) + >>> a_iterable = s['a'] + >>> next(a_iterable) + 'a1' + >>> next(a_iterable) + 'a2' + >>> list(s['b']) + ['b1', 'b2', 'b3'] + + The original iterable will be advanced and its items will be cached until + they are used by the child iterables. This may require significant storage. + + By default, attempting to select a bucket to which no items belong will + exhaust the iterable and cache all values. + If you specify a *validator* function, selected buckets will instead be + checked against it. + + >>> from itertools import count + >>> it = count(1, 2) # Infinite sequence of odd numbers + >>> key = lambda x: x % 10 # Bucket by last digit + >>> validator = lambda x: x in {1, 3, 5, 7, 9} # Odd digits only + >>> s = bucket(it, key=key, validator=validator) + >>> 2 in s + False + >>> list(s[2]) + [] + + """ + def __init__(self, iterable, key, validator=None): + self._it = iter(iterable) + self._key = key + self._cache = defaultdict(deque) + self._validator = validator or (lambda x: True) + + def __contains__(self, value): + if not self._validator(value): + return False + + try: + item = next(self[value]) + except StopIteration: + return False + else: + self._cache[value].appendleft(item) + + return True + + def _get_values(self, value): + """ + Helper to yield items from the parent iterator that match *value*. + Items that don't match are stored in the local cache as they + are encountered. + """ + while True: + # If we've cached some items that match the target value, emit + # the first one and evict it from the cache. + if self._cache[value]: + yield self._cache[value].popleft() + # Otherwise we need to advance the parent iterator to search for + # a matching item, caching the rest. + else: + while True: + try: + item = next(self._it) + except StopIteration: + return + item_value = self._key(item) + if item_value == value: + yield item + break + elif self._validator(item_value): + self._cache[item_value].append(item) + + def __getitem__(self, value): + if not self._validator(value): + return iter(()) + + return self._get_values(value) + + +def spy(iterable, n=1): + """Return a 2-tuple with a list containing the first *n* elements of + *iterable*, and an iterator with the same items as *iterable*. + This allows you to "look ahead" at the items in the iterable without + advancing it. + + There is one item in the list by default: + + >>> iterable = 'abcdefg' + >>> head, iterable = spy(iterable) + >>> head + ['a'] + >>> list(iterable) + ['a', 'b', 'c', 'd', 'e', 'f', 'g'] + + You may use unpacking to retrieve items instead of lists: + + >>> (head,), iterable = spy('abcdefg') + >>> head + 'a' + >>> (first, second), iterable = spy('abcdefg', 2) + >>> first + 'a' + >>> second + 'b' + + The number of items requested can be larger than the number of items in + the iterable: + + >>> iterable = [1, 2, 3, 4, 5] + >>> head, iterable = spy(iterable, 10) + >>> head + [1, 2, 3, 4, 5] + >>> list(iterable) + [1, 2, 3, 4, 5] + + """ + it = iter(iterable) + head = take(n, it) + + return head, chain(head, it) + + +def interleave(*iterables): + """Return a new iterable yielding from each iterable in turn, + until the shortest is exhausted. + + >>> list(interleave([1, 2, 3], [4, 5], [6, 7, 8])) + [1, 4, 6, 2, 5, 7] + + For a version that doesn't terminate after the shortest iterable is + exhausted, see :func:`interleave_longest`. + + """ + return chain.from_iterable(zip(*iterables)) + + +def interleave_longest(*iterables): + """Return a new iterable yielding from each iterable in turn, + skipping any that are exhausted. + + >>> list(interleave_longest([1, 2, 3], [4, 5], [6, 7, 8])) + [1, 4, 6, 2, 5, 7, 3, 8] + + This function produces the same output as :func:`roundrobin`, but may + perform better for some inputs (in particular when the number of iterables + is large). + + """ + i = chain.from_iterable(zip_longest(*iterables, fillvalue=_marker)) + return (x for x in i if x is not _marker) + + +def collapse(iterable, base_type=None, levels=None): + """Flatten an iterable with multiple levels of nesting (e.g., a list of + lists of tuples) into non-iterable types. + + >>> iterable = [(1, 2), ([3, 4], [[5], [6]])] + >>> list(collapse(iterable)) + [1, 2, 3, 4, 5, 6] + + String types are not considered iterable and will not be collapsed. + To avoid collapsing other types, specify *base_type*: + + >>> iterable = ['ab', ('cd', 'ef'), ['gh', 'ij']] + >>> list(collapse(iterable, base_type=tuple)) + ['ab', ('cd', 'ef'), 'gh', 'ij'] + + Specify *levels* to stop flattening after a certain level: + + >>> iterable = [('a', ['b']), ('c', ['d'])] + >>> list(collapse(iterable)) # Fully flattened + ['a', 'b', 'c', 'd'] + >>> list(collapse(iterable, levels=1)) # Only one level flattened + ['a', ['b'], 'c', ['d']] + + """ + def walk(node, level): + if ( + ((levels is not None) and (level > levels)) or + isinstance(node, string_types) or + ((base_type is not None) and isinstance(node, base_type)) + ): + yield node + return + + try: + tree = iter(node) + except TypeError: + yield node + return + else: + for child in tree: + for x in walk(child, level + 1): + yield x + + for x in walk(iterable, 0): + yield x + + +def side_effect(func, iterable, chunk_size=None, before=None, after=None): + """Invoke *func* on each item in *iterable* (or on each *chunk_size* group + of items) before yielding the item. + + `func` must be a function that takes a single argument. Its return value + will be discarded. + + *before* and *after* are optional functions that take no arguments. They + will be executed before iteration starts and after it ends, respectively. + + `side_effect` can be used for logging, updating progress bars, or anything + that is not functionally "pure." + + Emitting a status message: + + >>> from more_itertools import consume + >>> func = lambda item: print('Received {}'.format(item)) + >>> consume(side_effect(func, range(2))) + Received 0 + Received 1 + + Operating on chunks of items: + + >>> pair_sums = [] + >>> func = lambda chunk: pair_sums.append(sum(chunk)) + >>> list(side_effect(func, [0, 1, 2, 3, 4, 5], 2)) + [0, 1, 2, 3, 4, 5] + >>> list(pair_sums) + [1, 5, 9] + + Writing to a file-like object: + + >>> from io import StringIO + >>> from more_itertools import consume + >>> f = StringIO() + >>> func = lambda x: print(x, file=f) + >>> before = lambda: print(u'HEADER', file=f) + >>> after = f.close + >>> it = [u'a', u'b', u'c'] + >>> consume(side_effect(func, it, before=before, after=after)) + >>> f.closed + True + + """ + try: + if before is not None: + before() + + if chunk_size is None: + for item in iterable: + func(item) + yield item + else: + for chunk in chunked(iterable, chunk_size): + func(chunk) + for item in chunk: + yield item + finally: + if after is not None: + after() + + +def sliced(seq, n): + """Yield slices of length *n* from the sequence *seq*. + + >>> list(sliced((1, 2, 3, 4, 5, 6), 3)) + [(1, 2, 3), (4, 5, 6)] + + If the length of the sequence is not divisible by the requested slice + length, the last slice will be shorter. + + >>> list(sliced((1, 2, 3, 4, 5, 6, 7, 8), 3)) + [(1, 2, 3), (4, 5, 6), (7, 8)] + + This function will only work for iterables that support slicing. + For non-sliceable iterables, see :func:`chunked`. + + """ + return takewhile(bool, (seq[i: i + n] for i in count(0, n))) + + +def split_at(iterable, pred): + """Yield lists of items from *iterable*, where each list is delimited by + an item where callable *pred* returns ``True``. The lists do not include + the delimiting items. + + >>> list(split_at('abcdcba', lambda x: x == 'b')) + [['a'], ['c', 'd', 'c'], ['a']] + + >>> list(split_at(range(10), lambda n: n % 2 == 1)) + [[0], [2], [4], [6], [8], []] + """ + buf = [] + for item in iterable: + if pred(item): + yield buf + buf = [] + else: + buf.append(item) + yield buf + + +def split_before(iterable, pred): + """Yield lists of items from *iterable*, where each list starts with an + item where callable *pred* returns ``True``: + + >>> list(split_before('OneTwo', lambda s: s.isupper())) + [['O', 'n', 'e'], ['T', 'w', 'o']] + + >>> list(split_before(range(10), lambda n: n % 3 == 0)) + [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]] + + """ + buf = [] + for item in iterable: + if pred(item) and buf: + yield buf + buf = [] + buf.append(item) + yield buf + + +def split_after(iterable, pred): + """Yield lists of items from *iterable*, where each list ends with an + item where callable *pred* returns ``True``: + + >>> list(split_after('one1two2', lambda s: s.isdigit())) + [['o', 'n', 'e', '1'], ['t', 'w', 'o', '2']] + + >>> list(split_after(range(10), lambda n: n % 3 == 0)) + [[0], [1, 2, 3], [4, 5, 6], [7, 8, 9]] + + """ + buf = [] + for item in iterable: + buf.append(item) + if pred(item) and buf: + yield buf + buf = [] + if buf: + yield buf + + +def padded(iterable, fillvalue=None, n=None, next_multiple=False): + """Yield the elements from *iterable*, followed by *fillvalue*, such that + at least *n* items are emitted. + + >>> list(padded([1, 2, 3], '?', 5)) + [1, 2, 3, '?', '?'] + + If *next_multiple* is ``True``, *fillvalue* will be emitted until the + number of items emitted is a multiple of *n*:: + + >>> list(padded([1, 2, 3, 4], n=3, next_multiple=True)) + [1, 2, 3, 4, None, None] + + If *n* is ``None``, *fillvalue* will be emitted indefinitely. + + """ + it = iter(iterable) + if n is None: + for item in chain(it, repeat(fillvalue)): + yield item + elif n < 1: + raise ValueError('n must be at least 1') + else: + item_count = 0 + for item in it: + yield item + item_count += 1 + + remaining = (n - item_count) % n if next_multiple else n - item_count + for _ in range(remaining): + yield fillvalue + + +def distribute(n, iterable): + """Distribute the items from *iterable* among *n* smaller iterables. + + >>> group_1, group_2 = distribute(2, [1, 2, 3, 4, 5, 6]) + >>> list(group_1) + [1, 3, 5] + >>> list(group_2) + [2, 4, 6] + + If the length of *iterable* is not evenly divisible by *n*, then the + length of the returned iterables will not be identical: + + >>> children = distribute(3, [1, 2, 3, 4, 5, 6, 7]) + >>> [list(c) for c in children] + [[1, 4, 7], [2, 5], [3, 6]] + + If the length of *iterable* is smaller than *n*, then the last returned + iterables will be empty: + + >>> children = distribute(5, [1, 2, 3]) + >>> [list(c) for c in children] + [[1], [2], [3], [], []] + + This function uses :func:`itertools.tee` and may require significant + storage. If you need the order items in the smaller iterables to match the + original iterable, see :func:`divide`. + + """ + if n < 1: + raise ValueError('n must be at least 1') + + children = tee(iterable, n) + return [islice(it, index, None, n) for index, it in enumerate(children)] + + +def stagger(iterable, offsets=(-1, 0, 1), longest=False, fillvalue=None): + """Yield tuples whose elements are offset from *iterable*. + The amount by which the `i`-th item in each tuple is offset is given by + the `i`-th item in *offsets*. + + >>> list(stagger([0, 1, 2, 3])) + [(None, 0, 1), (0, 1, 2), (1, 2, 3)] + >>> list(stagger(range(8), offsets=(0, 2, 4))) + [(0, 2, 4), (1, 3, 5), (2, 4, 6), (3, 5, 7)] + + By default, the sequence will end when the final element of a tuple is the + last item in the iterable. To continue until the first element of a tuple + is the last item in the iterable, set *longest* to ``True``:: + + >>> list(stagger([0, 1, 2, 3], longest=True)) + [(None, 0, 1), (0, 1, 2), (1, 2, 3), (2, 3, None), (3, None, None)] + + By default, ``None`` will be used to replace offsets beyond the end of the + sequence. Specify *fillvalue* to use some other value. + + """ + children = tee(iterable, len(offsets)) + + return zip_offset( + *children, offsets=offsets, longest=longest, fillvalue=fillvalue + ) + + +def zip_offset(*iterables, **kwargs): + """``zip`` the input *iterables* together, but offset the `i`-th iterable + by the `i`-th item in *offsets*. + + >>> list(zip_offset('0123', 'abcdef', offsets=(0, 1))) + [('0', 'b'), ('1', 'c'), ('2', 'd'), ('3', 'e')] + + This can be used as a lightweight alternative to SciPy or pandas to analyze + data sets in which somes series have a lead or lag relationship. + + By default, the sequence will end when the shortest iterable is exhausted. + To continue until the longest iterable is exhausted, set *longest* to + ``True``. + + >>> list(zip_offset('0123', 'abcdef', offsets=(0, 1), longest=True)) + [('0', 'b'), ('1', 'c'), ('2', 'd'), ('3', 'e'), (None, 'f')] + + By default, ``None`` will be used to replace offsets beyond the end of the + sequence. Specify *fillvalue* to use some other value. + + """ + offsets = kwargs['offsets'] + longest = kwargs.get('longest', False) + fillvalue = kwargs.get('fillvalue', None) + + if len(iterables) != len(offsets): + raise ValueError("Number of iterables and offsets didn't match") + + staggered = [] + for it, n in zip(iterables, offsets): + if n < 0: + staggered.append(chain(repeat(fillvalue, -n), it)) + elif n > 0: + staggered.append(islice(it, n, None)) + else: + staggered.append(it) + + if longest: + return zip_longest(*staggered, fillvalue=fillvalue) + + return zip(*staggered) + + +def sort_together(iterables, key_list=(0,), reverse=False): + """Return the input iterables sorted together, with *key_list* as the + priority for sorting. All iterables are trimmed to the length of the + shortest one. + + This can be used like the sorting function in a spreadsheet. If each + iterable represents a column of data, the key list determines which + columns are used for sorting. + + By default, all iterables are sorted using the ``0``-th iterable:: + + >>> iterables = [(4, 3, 2, 1), ('a', 'b', 'c', 'd')] + >>> sort_together(iterables) + [(1, 2, 3, 4), ('d', 'c', 'b', 'a')] + + Set a different key list to sort according to another iterable. + Specifying mutliple keys dictates how ties are broken:: + + >>> iterables = [(3, 1, 2), (0, 1, 0), ('c', 'b', 'a')] + >>> sort_together(iterables, key_list=(1, 2)) + [(2, 3, 1), (0, 0, 1), ('a', 'c', 'b')] + + Set *reverse* to ``True`` to sort in descending order. + + >>> sort_together([(1, 2, 3), ('c', 'b', 'a')], reverse=True) + [(3, 2, 1), ('a', 'b', 'c')] + + """ + return list(zip(*sorted(zip(*iterables), + key=itemgetter(*key_list), + reverse=reverse))) + + +def divide(n, iterable): + """Divide the elements from *iterable* into *n* parts, maintaining + order. + + >>> group_1, group_2 = divide(2, [1, 2, 3, 4, 5, 6]) + >>> list(group_1) + [1, 2, 3] + >>> list(group_2) + [4, 5, 6] + + If the length of *iterable* is not evenly divisible by *n*, then the + length of the returned iterables will not be identical: + + >>> children = divide(3, [1, 2, 3, 4, 5, 6, 7]) + >>> [list(c) for c in children] + [[1, 2, 3], [4, 5], [6, 7]] + + If the length of the iterable is smaller than n, then the last returned + iterables will be empty: + + >>> children = divide(5, [1, 2, 3]) + >>> [list(c) for c in children] + [[1], [2], [3], [], []] + + This function will exhaust the iterable before returning and may require + significant storage. If order is not important, see :func:`distribute`, + which does not first pull the iterable into memory. + + """ + if n < 1: + raise ValueError('n must be at least 1') + + seq = tuple(iterable) + q, r = divmod(len(seq), n) + + ret = [] + for i in range(n): + start = (i * q) + (i if i < r else r) + stop = ((i + 1) * q) + (i + 1 if i + 1 < r else r) + ret.append(iter(seq[start:stop])) + + return ret + + +def always_iterable(obj, base_type=(text_type, binary_type)): + """If *obj* is iterable, return an iterator over its items:: + + >>> obj = (1, 2, 3) + >>> list(always_iterable(obj)) + [1, 2, 3] + + If *obj* is not iterable, return a one-item iterable containing *obj*:: + + >>> obj = 1 + >>> list(always_iterable(obj)) + [1] + + If *obj* is ``None``, return an empty iterable: + + >>> obj = None + >>> list(always_iterable(None)) + [] + + By default, binary and text strings are not considered iterable:: + + >>> obj = 'foo' + >>> list(always_iterable(obj)) + ['foo'] + + If *base_type* is set, objects for which ``isinstance(obj, base_type)`` + returns ``True`` won't be considered iterable. + + >>> obj = {'a': 1} + >>> list(always_iterable(obj)) # Iterate over the dict's keys + ['a'] + >>> list(always_iterable(obj, base_type=dict)) # Treat dicts as a unit + [{'a': 1}] + + Set *base_type* to ``None`` to avoid any special handling and treat objects + Python considers iterable as iterable: + + >>> obj = 'foo' + >>> list(always_iterable(obj, base_type=None)) + ['f', 'o', 'o'] + """ + if obj is None: + return iter(()) + + if (base_type is not None) and isinstance(obj, base_type): + return iter((obj,)) + + try: + return iter(obj) + except TypeError: + return iter((obj,)) + + +def adjacent(predicate, iterable, distance=1): + """Return an iterable over `(bool, item)` tuples where the `item` is + drawn from *iterable* and the `bool` indicates whether + that item satisfies the *predicate* or is adjacent to an item that does. + + For example, to find whether items are adjacent to a ``3``:: + + >>> list(adjacent(lambda x: x == 3, range(6))) + [(False, 0), (False, 1), (True, 2), (True, 3), (True, 4), (False, 5)] + + Set *distance* to change what counts as adjacent. For example, to find + whether items are two places away from a ``3``: + + >>> list(adjacent(lambda x: x == 3, range(6), distance=2)) + [(False, 0), (True, 1), (True, 2), (True, 3), (True, 4), (True, 5)] + + This is useful for contextualizing the results of a search function. + For example, a code comparison tool might want to identify lines that + have changed, but also surrounding lines to give the viewer of the diff + context. + + The predicate function will only be called once for each item in the + iterable. + + See also :func:`groupby_transform`, which can be used with this function + to group ranges of items with the same `bool` value. + + """ + # Allow distance=0 mainly for testing that it reproduces results with map() + if distance < 0: + raise ValueError('distance must be at least 0') + + i1, i2 = tee(iterable) + padding = [False] * distance + selected = chain(padding, map(predicate, i1), padding) + adjacent_to_selected = map(any, windowed(selected, 2 * distance + 1)) + return zip(adjacent_to_selected, i2) + + +def groupby_transform(iterable, keyfunc=None, valuefunc=None): + """An extension of :func:`itertools.groupby` that transforms the values of + *iterable* after grouping them. + *keyfunc* is a function used to compute a grouping key for each item. + *valuefunc* is a function for transforming the items after grouping. + + >>> iterable = 'AaaABbBCcA' + >>> keyfunc = lambda x: x.upper() + >>> valuefunc = lambda x: x.lower() + >>> grouper = groupby_transform(iterable, keyfunc, valuefunc) + >>> [(k, ''.join(g)) for k, g in grouper] + [('A', 'aaaa'), ('B', 'bbb'), ('C', 'cc'), ('A', 'a')] + + *keyfunc* and *valuefunc* default to identity functions if they are not + specified. + + :func:`groupby_transform` is useful when grouping elements of an iterable + using a separate iterable as the key. To do this, :func:`zip` the iterables + and pass a *keyfunc* that extracts the first element and a *valuefunc* + that extracts the second element:: + + >>> from operator import itemgetter + >>> keys = [0, 0, 1, 1, 1, 2, 2, 2, 3] + >>> values = 'abcdefghi' + >>> iterable = zip(keys, values) + >>> grouper = groupby_transform(iterable, itemgetter(0), itemgetter(1)) + >>> [(k, ''.join(g)) for k, g in grouper] + [(0, 'ab'), (1, 'cde'), (2, 'fgh'), (3, 'i')] + + Note that the order of items in the iterable is significant. + Only adjacent items are grouped together, so if you don't want any + duplicate groups, you should sort the iterable by the key function. + + """ + valuefunc = (lambda x: x) if valuefunc is None else valuefunc + return ((k, map(valuefunc, g)) for k, g in groupby(iterable, keyfunc)) + + +def numeric_range(*args): + """An extension of the built-in ``range()`` function whose arguments can + be any orderable numeric type. + + With only *stop* specified, *start* defaults to ``0`` and *step* + defaults to ``1``. The output items will match the type of *stop*: + + >>> list(numeric_range(3.5)) + [0.0, 1.0, 2.0, 3.0] + + With only *start* and *stop* specified, *step* defaults to ``1``. The + output items will match the type of *start*: + + >>> from decimal import Decimal + >>> start = Decimal('2.1') + >>> stop = Decimal('5.1') + >>> list(numeric_range(start, stop)) + [Decimal('2.1'), Decimal('3.1'), Decimal('4.1')] + + With *start*, *stop*, and *step* specified the output items will match + the type of ``start + step``: + + >>> from fractions import Fraction + >>> start = Fraction(1, 2) # Start at 1/2 + >>> stop = Fraction(5, 2) # End at 5/2 + >>> step = Fraction(1, 2) # Count by 1/2 + >>> list(numeric_range(start, stop, step)) + [Fraction(1, 2), Fraction(1, 1), Fraction(3, 2), Fraction(2, 1)] + + If *step* is zero, ``ValueError`` is raised. Negative steps are supported: + + >>> list(numeric_range(3, -1, -1.0)) + [3.0, 2.0, 1.0, 0.0] + + Be aware of the limitations of floating point numbers; the representation + of the yielded numbers may be surprising. + + """ + argc = len(args) + if argc == 1: + stop, = args + start = type(stop)(0) + step = 1 + elif argc == 2: + start, stop = args + step = 1 + elif argc == 3: + start, stop, step = args + else: + err_msg = 'numeric_range takes at most 3 arguments, got {}' + raise TypeError(err_msg.format(argc)) + + values = (start + (step * n) for n in count()) + if step > 0: + return takewhile(partial(gt, stop), values) + elif step < 0: + return takewhile(partial(lt, stop), values) + else: + raise ValueError('numeric_range arg 3 must not be zero') + + +def count_cycle(iterable, n=None): + """Cycle through the items from *iterable* up to *n* times, yielding + the number of completed cycles along with each item. If *n* is omitted the + process repeats indefinitely. + + >>> list(count_cycle('AB', 3)) + [(0, 'A'), (0, 'B'), (1, 'A'), (1, 'B'), (2, 'A'), (2, 'B')] + + """ + iterable = tuple(iterable) + if not iterable: + return iter(()) + counter = count() if n is None else range(n) + return ((i, item) for i in counter for item in iterable) + + +def locate(iterable, pred=bool): + """Yield the index of each item in *iterable* for which *pred* returns + ``True``. + + *pred* defaults to :func:`bool`, which will select truthy items: + + >>> list(locate([0, 1, 1, 0, 1, 0, 0])) + [1, 2, 4] + + Set *pred* to a custom function to, e.g., find the indexes for a particular + item: + + >>> list(locate(['a', 'b', 'c', 'b'], lambda x: x == 'b')) + [1, 3] + + Use with :func:`windowed` to find the indexes of a sub-sequence: + + >>> from more_itertools import windowed + >>> iterable = [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3] + >>> sub = [1, 2, 3] + >>> pred = lambda w: w == tuple(sub) # windowed() returns tuples + >>> list(locate(windowed(iterable, len(sub)), pred=pred)) + [1, 5, 9] + + Use with :func:`seekable` to find indexes and then retrieve the associated + items: + + >>> from itertools import count + >>> from more_itertools import seekable + >>> source = (3 * n + 1 if (n % 2) else n // 2 for n in count()) + >>> it = seekable(source) + >>> pred = lambda x: x > 100 + >>> indexes = locate(it, pred=pred) + >>> i = next(indexes) + >>> it.seek(i) + >>> next(it) + 106 + + """ + return compress(count(), map(pred, iterable)) + + +def lstrip(iterable, pred): + """Yield the items from *iterable*, but strip any from the beginning + for which *pred* returns ``True``. + + For example, to remove a set of items from the start of an iterable: + + >>> iterable = (None, False, None, 1, 2, None, 3, False, None) + >>> pred = lambda x: x in {None, False, ''} + >>> list(lstrip(iterable, pred)) + [1, 2, None, 3, False, None] + + This function is analogous to to :func:`str.lstrip`, and is essentially + an wrapper for :func:`itertools.dropwhile`. + + """ + return dropwhile(pred, iterable) + + +def rstrip(iterable, pred): + """Yield the items from *iterable*, but strip any from the end + for which *pred* returns ``True``. + + For example, to remove a set of items from the end of an iterable: + + >>> iterable = (None, False, None, 1, 2, None, 3, False, None) + >>> pred = lambda x: x in {None, False, ''} + >>> list(rstrip(iterable, pred)) + [None, False, None, 1, 2, None, 3] + + This function is analogous to :func:`str.rstrip`. + + """ + cache = [] + cache_append = cache.append + for x in iterable: + if pred(x): + cache_append(x) + else: + for y in cache: + yield y + del cache[:] + yield x + + +def strip(iterable, pred): + """Yield the items from *iterable*, but strip any from the + beginning and end for which *pred* returns ``True``. + + For example, to remove a set of items from both ends of an iterable: + + >>> iterable = (None, False, None, 1, 2, None, 3, False, None) + >>> pred = lambda x: x in {None, False, ''} + >>> list(strip(iterable, pred)) + [1, 2, None, 3] + + This function is analogous to :func:`str.strip`. + + """ + return rstrip(lstrip(iterable, pred), pred) + + +def islice_extended(iterable, *args): + """An extension of :func:`itertools.islice` that supports negative values + for *stop*, *start*, and *step*. + + >>> iterable = iter('abcdefgh') + >>> list(islice_extended(iterable, -4, -1)) + ['e', 'f', 'g'] + + Slices with negative values require some caching of *iterable*, but this + function takes care to minimize the amount of memory required. + + For example, you can use a negative step with an infinite iterator: + + >>> from itertools import count + >>> list(islice_extended(count(), 110, 99, -2)) + [110, 108, 106, 104, 102, 100] + + """ + s = slice(*args) + start = s.start + stop = s.stop + if s.step == 0: + raise ValueError('step argument must be a non-zero integer or None.') + step = s.step or 1 + + it = iter(iterable) + + if step > 0: + start = 0 if (start is None) else start + + if (start < 0): + # Consume all but the last -start items + cache = deque(enumerate(it, 1), maxlen=-start) + len_iter = cache[-1][0] if cache else 0 + + # Adjust start to be positive + i = max(len_iter + start, 0) + + # Adjust stop to be positive + if stop is None: + j = len_iter + elif stop >= 0: + j = min(stop, len_iter) + else: + j = max(len_iter + stop, 0) + + # Slice the cache + n = j - i + if n <= 0: + return + + for index, item in islice(cache, 0, n, step): + yield item + elif (stop is not None) and (stop < 0): + # Advance to the start position + next(islice(it, start, start), None) + + # When stop is negative, we have to carry -stop items while + # iterating + cache = deque(islice(it, -stop), maxlen=-stop) + + for index, item in enumerate(it): + cached_item = cache.popleft() + if index % step == 0: + yield cached_item + cache.append(item) + else: + # When both start and stop are positive we have the normal case + for item in islice(it, start, stop, step): + yield item + else: + start = -1 if (start is None) else start + + if (stop is not None) and (stop < 0): + # Consume all but the last items + n = -stop - 1 + cache = deque(enumerate(it, 1), maxlen=n) + len_iter = cache[-1][0] if cache else 0 + + # If start and stop are both negative they are comparable and + # we can just slice. Otherwise we can adjust start to be negative + # and then slice. + if start < 0: + i, j = start, stop + else: + i, j = min(start - len_iter, -1), None + + for index, item in list(cache)[i:j:step]: + yield item + else: + # Advance to the stop position + if stop is not None: + m = stop + 1 + next(islice(it, m, m), None) + + # stop is positive, so if start is negative they are not comparable + # and we need the rest of the items. + if start < 0: + i = start + n = None + # stop is None and start is positive, so we just need items up to + # the start index. + elif stop is None: + i = None + n = start + 1 + # Both stop and start are positive, so they are comparable. + else: + i = None + n = start - stop + if n <= 0: + return + + cache = list(islice(it, n)) + + for item in cache[i::step]: + yield item + + +def always_reversible(iterable): + """An extension of :func:`reversed` that supports all iterables, not + just those which implement the ``Reversible`` or ``Sequence`` protocols. + + >>> print(*always_reversible(x for x in range(3))) + 2 1 0 + + If the iterable is already reversible, this function returns the + result of :func:`reversed()`. If the iterable is not reversible, + this function will cache the remaining items in the iterable and + yield them in reverse order, which may require significant storage. + """ + try: + return reversed(iterable) + except TypeError: + return reversed(list(iterable)) + + +def consecutive_groups(iterable, ordering=lambda x: x): + """Yield groups of consecutive items using :func:`itertools.groupby`. + The *ordering* function determines whether two items are adjacent by + returning their position. + + By default, the ordering function is the identity function. This is + suitable for finding runs of numbers: + + >>> iterable = [1, 10, 11, 12, 20, 30, 31, 32, 33, 40] + >>> for group in consecutive_groups(iterable): + ... print(list(group)) + [1] + [10, 11, 12] + [20] + [30, 31, 32, 33] + [40] + + For finding runs of adjacent letters, try using the :meth:`index` method + of a string of letters: + + >>> from string import ascii_lowercase + >>> iterable = 'abcdfgilmnop' + >>> ordering = ascii_lowercase.index + >>> for group in consecutive_groups(iterable, ordering): + ... print(list(group)) + ['a', 'b', 'c', 'd'] + ['f', 'g'] + ['i'] + ['l', 'm', 'n', 'o', 'p'] + + """ + for k, g in groupby( + enumerate(iterable), key=lambda x: x[0] - ordering(x[1]) + ): + yield map(itemgetter(1), g) + + +def difference(iterable, func=sub): + """By default, compute the first difference of *iterable* using + :func:`operator.sub`. + + >>> iterable = [0, 1, 3, 6, 10] + >>> list(difference(iterable)) + [0, 1, 2, 3, 4] + + This is the opposite of :func:`accumulate`'s default behavior: + + >>> from more_itertools import accumulate + >>> iterable = [0, 1, 2, 3, 4] + >>> list(accumulate(iterable)) + [0, 1, 3, 6, 10] + >>> list(difference(accumulate(iterable))) + [0, 1, 2, 3, 4] + + By default *func* is :func:`operator.sub`, but other functions can be + specified. They will be applied as follows:: + + A, B, C, D, ... --> A, func(B, A), func(C, B), func(D, C), ... + + For example, to do progressive division: + + >>> iterable = [1, 2, 6, 24, 120] # Factorial sequence + >>> func = lambda x, y: x // y + >>> list(difference(iterable, func)) + [1, 2, 3, 4, 5] + + """ + a, b = tee(iterable) + try: + item = next(b) + except StopIteration: + return iter([]) + return chain([item], map(lambda x: func(x[1], x[0]), zip(a, b))) + + +class SequenceView(Sequence): + """Return a read-only view of the sequence object *target*. + + :class:`SequenceView` objects are analagous to Python's built-in + "dictionary view" types. They provide a dynamic view of a sequence's items, + meaning that when the sequence updates, so does the view. + + >>> seq = ['0', '1', '2'] + >>> view = SequenceView(seq) + >>> view + SequenceView(['0', '1', '2']) + >>> seq.append('3') + >>> view + SequenceView(['0', '1', '2', '3']) + + Sequence views support indexing, slicing, and length queries. They act + like the underlying sequence, except they don't allow assignment: + + >>> view[1] + '1' + >>> view[1:-1] + ['1', '2'] + >>> len(view) + 4 + + Sequence views are useful as an alternative to copying, as they don't + require (much) extra storage. + + """ + def __init__(self, target): + if not isinstance(target, Sequence): + raise TypeError + self._target = target + + def __getitem__(self, index): + return self._target[index] + + def __len__(self): + return len(self._target) + + def __repr__(self): + return '{}({})'.format(self.__class__.__name__, repr(self._target)) + + +class seekable(object): + """Wrap an iterator to allow for seeking backward and forward. This + progressively caches the items in the source iterable so they can be + re-visited. + + Call :meth:`seek` with an index to seek to that position in the source + iterable. + + To "reset" an iterator, seek to ``0``: + + >>> from itertools import count + >>> it = seekable((str(n) for n in count())) + >>> next(it), next(it), next(it) + ('0', '1', '2') + >>> it.seek(0) + >>> next(it), next(it), next(it) + ('0', '1', '2') + >>> next(it) + '3' + + You can also seek forward: + + >>> it = seekable((str(n) for n in range(20))) + >>> it.seek(10) + >>> next(it) + '10' + >>> it.seek(20) # Seeking past the end of the source isn't a problem + >>> list(it) + [] + >>> it.seek(0) # Resetting works even after hitting the end + >>> next(it), next(it), next(it) + ('0', '1', '2') + + The cache grows as the source iterable progresses, so beware of wrapping + very large or infinite iterables. + + You may view the contents of the cache with the :meth:`elements` method. + That returns a :class:`SequenceView`, a view that updates automatically: + + >>> it = seekable((str(n) for n in range(10))) + >>> next(it), next(it), next(it) + ('0', '1', '2') + >>> elements = it.elements() + >>> elements + SequenceView(['0', '1', '2']) + >>> next(it) + '3' + >>> elements + SequenceView(['0', '1', '2', '3']) + + """ + + def __init__(self, iterable): + self._source = iter(iterable) + self._cache = [] + self._index = None + + def __iter__(self): + return self + + def __next__(self): + if self._index is not None: + try: + item = self._cache[self._index] + except IndexError: + self._index = None + else: + self._index += 1 + return item + + item = next(self._source) + self._cache.append(item) + return item + + next = __next__ + + def elements(self): + return SequenceView(self._cache) + + def seek(self, index): + self._index = index + remainder = index - len(self._cache) + if remainder > 0: + consume(self, remainder) + + +class run_length(object): + """ + :func:`run_length.encode` compresses an iterable with run-length encoding. + It yields groups of repeated items with the count of how many times they + were repeated: + + >>> uncompressed = 'abbcccdddd' + >>> list(run_length.encode(uncompressed)) + [('a', 1), ('b', 2), ('c', 3), ('d', 4)] + + :func:`run_length.decode` decompresses an iterable that was previously + compressed with run-length encoding. It yields the items of the + decompressed iterable: + + >>> compressed = [('a', 1), ('b', 2), ('c', 3), ('d', 4)] + >>> list(run_length.decode(compressed)) + ['a', 'b', 'b', 'c', 'c', 'c', 'd', 'd', 'd', 'd'] + + """ + + @staticmethod + def encode(iterable): + return ((k, ilen(g)) for k, g in groupby(iterable)) + + @staticmethod + def decode(iterable): + return chain.from_iterable(repeat(k, n) for k, n in iterable) + + +def exactly_n(iterable, n, predicate=bool): + """Return ``True`` if exactly ``n`` items in the iterable are ``True`` + according to the *predicate* function. + + >>> exactly_n([True, True, False], 2) + True + >>> exactly_n([True, True, False], 1) + False + >>> exactly_n([0, 1, 2, 3, 4, 5], 3, lambda x: x < 3) + True + + The iterable will be advanced until ``n + 1`` truthy items are encountered, + so avoid calling it on infinite iterables. + + """ + return len(take(n + 1, filter(predicate, iterable))) == n + + +def circular_shifts(iterable): + """Return a list of circular shifts of *iterable*. + + >>> circular_shifts(range(4)) + [(0, 1, 2, 3), (1, 2, 3, 0), (2, 3, 0, 1), (3, 0, 1, 2)] + """ + lst = list(iterable) + return take(len(lst), windowed(cycle(lst), len(lst))) + + +def make_decorator(wrapping_func, result_index=0): + """Return a decorator version of *wrapping_func*, which is a function that + modifies an iterable. *result_index* is the position in that function's + signature where the iterable goes. + + This lets you use itertools on the "production end," i.e. at function + definition. This can augment what the function returns without changing the + function's code. + + For example, to produce a decorator version of :func:`chunked`: + + >>> from more_itertools import chunked + >>> chunker = make_decorator(chunked, result_index=0) + >>> @chunker(3) + ... def iter_range(n): + ... return iter(range(n)) + ... + >>> list(iter_range(9)) + [[0, 1, 2], [3, 4, 5], [6, 7, 8]] + + To only allow truthy items to be returned: + + >>> truth_serum = make_decorator(filter, result_index=1) + >>> @truth_serum(bool) + ... def boolean_test(): + ... return [0, 1, '', ' ', False, True] + ... + >>> list(boolean_test()) + [1, ' ', True] + + The :func:`peekable` and :func:`seekable` wrappers make for practical + decorators: + + >>> from more_itertools import peekable + >>> peekable_function = make_decorator(peekable) + >>> @peekable_function() + ... def str_range(*args): + ... return (str(x) for x in range(*args)) + ... + >>> it = str_range(1, 20, 2) + >>> next(it), next(it), next(it) + ('1', '3', '5') + >>> it.peek() + '7' + >>> next(it) + '7' + + """ + # See https://sites.google.com/site/bbayles/index/decorator_factory for + # notes on how this works. + def decorator(*wrapping_args, **wrapping_kwargs): + def outer_wrapper(f): + def inner_wrapper(*args, **kwargs): + result = f(*args, **kwargs) + wrapping_args_ = list(wrapping_args) + wrapping_args_.insert(result_index, result) + return wrapping_func(*wrapping_args_, **wrapping_kwargs) + + return inner_wrapper + + return outer_wrapper + + return decorator + + +def map_reduce(iterable, keyfunc, valuefunc=None, reducefunc=None): + """Return a dictionary that maps the items in *iterable* to categories + defined by *keyfunc*, transforms them with *valuefunc*, and + then summarizes them by category with *reducefunc*. + + *valuefunc* defaults to the identity function if it is unspecified. + If *reducefunc* is unspecified, no summarization takes place: + + >>> keyfunc = lambda x: x.upper() + >>> result = map_reduce('abbccc', keyfunc) + >>> sorted(result.items()) + [('A', ['a']), ('B', ['b', 'b']), ('C', ['c', 'c', 'c'])] + + Specifying *valuefunc* transforms the categorized items: + + >>> keyfunc = lambda x: x.upper() + >>> valuefunc = lambda x: 1 + >>> result = map_reduce('abbccc', keyfunc, valuefunc) + >>> sorted(result.items()) + [('A', [1]), ('B', [1, 1]), ('C', [1, 1, 1])] + + Specifying *reducefunc* summarizes the categorized items: + + >>> keyfunc = lambda x: x.upper() + >>> valuefunc = lambda x: 1 + >>> reducefunc = sum + >>> result = map_reduce('abbccc', keyfunc, valuefunc, reducefunc) + >>> sorted(result.items()) + [('A', 1), ('B', 2), ('C', 3)] + + You may want to filter the input iterable before applying the map/reduce + proecdure: + + >>> all_items = range(30) + >>> items = [x for x in all_items if 10 <= x <= 20] # Filter + >>> keyfunc = lambda x: x % 2 # Evens map to 0; odds to 1 + >>> categories = map_reduce(items, keyfunc=keyfunc) + >>> sorted(categories.items()) + [(0, [10, 12, 14, 16, 18, 20]), (1, [11, 13, 15, 17, 19])] + >>> summaries = map_reduce(items, keyfunc=keyfunc, reducefunc=sum) + >>> sorted(summaries.items()) + [(0, 90), (1, 75)] + + Note that all items in the iterable are gathered into a list before the + summarization step, which may require significant storage. + + The returned object is a :obj:`collections.defaultdict` with the + ``default_factory`` set to ``None``, such that it behaves like a normal + dictionary. + + """ + valuefunc = (lambda x: x) if (valuefunc is None) else valuefunc + + ret = defaultdict(list) + for item in iterable: + key = keyfunc(item) + value = valuefunc(item) + ret[key].append(value) + + if reducefunc is not None: + for key, value_list in ret.items(): + ret[key] = reducefunc(value_list) + + ret.default_factory = None + return ret diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/recipes.py b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/recipes.py new file mode 100644 index 00000000000..3a7706cb91f --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/recipes.py @@ -0,0 +1,565 @@ +"""Imported from the recipes section of the itertools documentation. + +All functions taken from the recipes section of the itertools library docs +[1]_. +Some backward-compatible usability improvements have been made. + +.. [1] http://docs.python.org/library/itertools.html#recipes + +""" +from collections import deque +from itertools import ( + chain, combinations, count, cycle, groupby, islice, repeat, starmap, tee +) +import operator +from random import randrange, sample, choice + +from six import PY2 +from six.moves import filter, filterfalse, map, range, zip, zip_longest + +__all__ = [ + 'accumulate', + 'all_equal', + 'consume', + 'dotproduct', + 'first_true', + 'flatten', + 'grouper', + 'iter_except', + 'ncycles', + 'nth', + 'nth_combination', + 'padnone', + 'pairwise', + 'partition', + 'powerset', + 'prepend', + 'quantify', + 'random_combination_with_replacement', + 'random_combination', + 'random_permutation', + 'random_product', + 'repeatfunc', + 'roundrobin', + 'tabulate', + 'tail', + 'take', + 'unique_everseen', + 'unique_justseen', +] + + +def accumulate(iterable, func=operator.add): + """ + Return an iterator whose items are the accumulated results of a function + (specified by the optional *func* argument) that takes two arguments. + By default, returns accumulated sums with :func:`operator.add`. + + >>> list(accumulate([1, 2, 3, 4, 5])) # Running sum + [1, 3, 6, 10, 15] + >>> list(accumulate([1, 2, 3], func=operator.mul)) # Running product + [1, 2, 6] + >>> list(accumulate([0, 1, -1, 2, 3, 2], func=max)) # Running maximum + [0, 1, 1, 2, 3, 3] + + This function is available in the ``itertools`` module for Python 3.2 and + greater. + + """ + it = iter(iterable) + try: + total = next(it) + except StopIteration: + return + else: + yield total + + for element in it: + total = func(total, element) + yield total + + +def take(n, iterable): + """Return first *n* items of the iterable as a list. + + >>> take(3, range(10)) + [0, 1, 2] + >>> take(5, range(3)) + [0, 1, 2] + + Effectively a short replacement for ``next`` based iterator consumption + when you want more than one item, but less than the whole iterator. + + """ + return list(islice(iterable, n)) + + +def tabulate(function, start=0): + """Return an iterator over the results of ``func(start)``, + ``func(start + 1)``, ``func(start + 2)``... + + *func* should be a function that accepts one integer argument. + + If *start* is not specified it defaults to 0. It will be incremented each + time the iterator is advanced. + + >>> square = lambda x: x ** 2 + >>> iterator = tabulate(square, -3) + >>> take(4, iterator) + [9, 4, 1, 0] + + """ + return map(function, count(start)) + + +def tail(n, iterable): + """Return an iterator over the last *n* items of *iterable*. + + >>> t = tail(3, 'ABCDEFG') + >>> list(t) + ['E', 'F', 'G'] + + """ + return iter(deque(iterable, maxlen=n)) + + +def consume(iterator, n=None): + """Advance *iterable* by *n* steps. If *n* is ``None``, consume it + entirely. + + Efficiently exhausts an iterator without returning values. Defaults to + consuming the whole iterator, but an optional second argument may be + provided to limit consumption. + + >>> i = (x for x in range(10)) + >>> next(i) + 0 + >>> consume(i, 3) + >>> next(i) + 4 + >>> consume(i) + >>> next(i) + Traceback (most recent call last): + File "", line 1, in + StopIteration + + If the iterator has fewer items remaining than the provided limit, the + whole iterator will be consumed. + + >>> i = (x for x in range(3)) + >>> consume(i, 5) + >>> next(i) + Traceback (most recent call last): + File "", line 1, in + StopIteration + + """ + # Use functions that consume iterators at C speed. + if n is None: + # feed the entire iterator into a zero-length deque + deque(iterator, maxlen=0) + else: + # advance to the empty slice starting at position n + next(islice(iterator, n, n), None) + + +def nth(iterable, n, default=None): + """Returns the nth item or a default value. + + >>> l = range(10) + >>> nth(l, 3) + 3 + >>> nth(l, 20, "zebra") + 'zebra' + + """ + return next(islice(iterable, n, None), default) + + +def all_equal(iterable): + """ + Returns ``True`` if all the elements are equal to each other. + + >>> all_equal('aaaa') + True + >>> all_equal('aaab') + False + + """ + g = groupby(iterable) + return next(g, True) and not next(g, False) + + +def quantify(iterable, pred=bool): + """Return the how many times the predicate is true. + + >>> quantify([True, False, True]) + 2 + + """ + return sum(map(pred, iterable)) + + +def padnone(iterable): + """Returns the sequence of elements and then returns ``None`` indefinitely. + + >>> take(5, padnone(range(3))) + [0, 1, 2, None, None] + + Useful for emulating the behavior of the built-in :func:`map` function. + + See also :func:`padded`. + + """ + return chain(iterable, repeat(None)) + + +def ncycles(iterable, n): + """Returns the sequence elements *n* times + + >>> list(ncycles(["a", "b"], 3)) + ['a', 'b', 'a', 'b', 'a', 'b'] + + """ + return chain.from_iterable(repeat(tuple(iterable), n)) + + +def dotproduct(vec1, vec2): + """Returns the dot product of the two iterables. + + >>> dotproduct([10, 10], [20, 20]) + 400 + + """ + return sum(map(operator.mul, vec1, vec2)) + + +def flatten(listOfLists): + """Return an iterator flattening one level of nesting in a list of lists. + + >>> list(flatten([[0, 1], [2, 3]])) + [0, 1, 2, 3] + + See also :func:`collapse`, which can flatten multiple levels of nesting. + + """ + return chain.from_iterable(listOfLists) + + +def repeatfunc(func, times=None, *args): + """Call *func* with *args* repeatedly, returning an iterable over the + results. + + If *times* is specified, the iterable will terminate after that many + repetitions: + + >>> from operator import add + >>> times = 4 + >>> args = 3, 5 + >>> list(repeatfunc(add, times, *args)) + [8, 8, 8, 8] + + If *times* is ``None`` the iterable will not terminate: + + >>> from random import randrange + >>> times = None + >>> args = 1, 11 + >>> take(6, repeatfunc(randrange, times, *args)) # doctest:+SKIP + [2, 4, 8, 1, 8, 4] + + """ + if times is None: + return starmap(func, repeat(args)) + return starmap(func, repeat(args, times)) + + +def pairwise(iterable): + """Returns an iterator of paired items, overlapping, from the original + + >>> take(4, pairwise(count())) + [(0, 1), (1, 2), (2, 3), (3, 4)] + + """ + a, b = tee(iterable) + next(b, None) + return zip(a, b) + + +def grouper(n, iterable, fillvalue=None): + """Collect data into fixed-length chunks or blocks. + + >>> list(grouper(3, 'ABCDEFG', 'x')) + [('A', 'B', 'C'), ('D', 'E', 'F'), ('G', 'x', 'x')] + + """ + args = [iter(iterable)] * n + return zip_longest(fillvalue=fillvalue, *args) + + +def roundrobin(*iterables): + """Yields an item from each iterable, alternating between them. + + >>> list(roundrobin('ABC', 'D', 'EF')) + ['A', 'D', 'E', 'B', 'F', 'C'] + + This function produces the same output as :func:`interleave_longest`, but + may perform better for some inputs (in particular when the number of + iterables is small). + + """ + # Recipe credited to George Sakkis + pending = len(iterables) + if PY2: + nexts = cycle(iter(it).next for it in iterables) + else: + nexts = cycle(iter(it).__next__ for it in iterables) + while pending: + try: + for next in nexts: + yield next() + except StopIteration: + pending -= 1 + nexts = cycle(islice(nexts, pending)) + + +def partition(pred, iterable): + """ + Returns a 2-tuple of iterables derived from the input iterable. + The first yields the items that have ``pred(item) == False``. + The second yields the items that have ``pred(item) == True``. + + >>> is_odd = lambda x: x % 2 != 0 + >>> iterable = range(10) + >>> even_items, odd_items = partition(is_odd, iterable) + >>> list(even_items), list(odd_items) + ([0, 2, 4, 6, 8], [1, 3, 5, 7, 9]) + + """ + # partition(is_odd, range(10)) --> 0 2 4 6 8 and 1 3 5 7 9 + t1, t2 = tee(iterable) + return filterfalse(pred, t1), filter(pred, t2) + + +def powerset(iterable): + """Yields all possible subsets of the iterable. + + >>> list(powerset([1,2,3])) + [(), (1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3)] + + """ + s = list(iterable) + return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1)) + + +def unique_everseen(iterable, key=None): + """ + Yield unique elements, preserving order. + + >>> list(unique_everseen('AAAABBBCCDAABBB')) + ['A', 'B', 'C', 'D'] + >>> list(unique_everseen('ABBCcAD', str.lower)) + ['A', 'B', 'C', 'D'] + + Sequences with a mix of hashable and unhashable items can be used. + The function will be slower (i.e., `O(n^2)`) for unhashable items. + + """ + seenset = set() + seenset_add = seenset.add + seenlist = [] + seenlist_add = seenlist.append + if key is None: + for element in iterable: + try: + if element not in seenset: + seenset_add(element) + yield element + except TypeError: + if element not in seenlist: + seenlist_add(element) + yield element + else: + for element in iterable: + k = key(element) + try: + if k not in seenset: + seenset_add(k) + yield element + except TypeError: + if k not in seenlist: + seenlist_add(k) + yield element + + +def unique_justseen(iterable, key=None): + """Yields elements in order, ignoring serial duplicates + + >>> list(unique_justseen('AAAABBBCCDAABBB')) + ['A', 'B', 'C', 'D', 'A', 'B'] + >>> list(unique_justseen('ABBCcAD', str.lower)) + ['A', 'B', 'C', 'A', 'D'] + + """ + return map(next, map(operator.itemgetter(1), groupby(iterable, key))) + + +def iter_except(func, exception, first=None): + """Yields results from a function repeatedly until an exception is raised. + + Converts a call-until-exception interface to an iterator interface. + Like ``iter(func, sentinel)``, but uses an exception instead of a sentinel + to end the loop. + + >>> l = [0, 1, 2] + >>> list(iter_except(l.pop, IndexError)) + [2, 1, 0] + + """ + try: + if first is not None: + yield first() + while 1: + yield func() + except exception: + pass + + +def first_true(iterable, default=False, pred=None): + """ + Returns the first true value in the iterable. + + If no true value is found, returns *default* + + If *pred* is not None, returns the first item for which + ``pred(item) == True`` . + + >>> first_true(range(10)) + 1 + >>> first_true(range(10), pred=lambda x: x > 5) + 6 + >>> first_true(range(10), default='missing', pred=lambda x: x > 9) + 'missing' + + """ + return next(filter(pred, iterable), default) + + +def random_product(*args, **kwds): + """Draw an item at random from each of the input iterables. + + >>> random_product('abc', range(4), 'XYZ') # doctest:+SKIP + ('c', 3, 'Z') + + If *repeat* is provided as a keyword argument, that many items will be + drawn from each iterable. + + >>> random_product('abcd', range(4), repeat=2) # doctest:+SKIP + ('a', 2, 'd', 3) + + This equivalent to taking a random selection from + ``itertools.product(*args, **kwarg)``. + + """ + pools = [tuple(pool) for pool in args] * kwds.get('repeat', 1) + return tuple(choice(pool) for pool in pools) + + +def random_permutation(iterable, r=None): + """Return a random *r* length permutation of the elements in *iterable*. + + If *r* is not specified or is ``None``, then *r* defaults to the length of + *iterable*. + + >>> random_permutation(range(5)) # doctest:+SKIP + (3, 4, 0, 1, 2) + + This equivalent to taking a random selection from + ``itertools.permutations(iterable, r)``. + + """ + pool = tuple(iterable) + r = len(pool) if r is None else r + return tuple(sample(pool, r)) + + +def random_combination(iterable, r): + """Return a random *r* length subsequence of the elements in *iterable*. + + >>> random_combination(range(5), 3) # doctest:+SKIP + (2, 3, 4) + + This equivalent to taking a random selection from + ``itertools.combinations(iterable, r)``. + + """ + pool = tuple(iterable) + n = len(pool) + indices = sorted(sample(range(n), r)) + return tuple(pool[i] for i in indices) + + +def random_combination_with_replacement(iterable, r): + """Return a random *r* length subsequence of elements in *iterable*, + allowing individual elements to be repeated. + + >>> random_combination_with_replacement(range(3), 5) # doctest:+SKIP + (0, 0, 1, 2, 2) + + This equivalent to taking a random selection from + ``itertools.combinations_with_replacement(iterable, r)``. + + """ + pool = tuple(iterable) + n = len(pool) + indices = sorted(randrange(n) for i in range(r)) + return tuple(pool[i] for i in indices) + + +def nth_combination(iterable, r, index): + """Equivalent to ``list(combinations(iterable, r))[index]``. + + The subsequences of *iterable* that are of length *r* can be ordered + lexicographically. :func:`nth_combination` computes the subsequence at + sort position *index* directly, without computing the previous + subsequences. + + """ + pool = tuple(iterable) + n = len(pool) + if (r < 0) or (r > n): + raise ValueError + + c = 1 + k = min(r, n - r) + for i in range(1, k + 1): + c = c * (n - k + i) // i + + if index < 0: + index += c + + if (index < 0) or (index >= c): + raise IndexError + + result = [] + while r: + c, n, r = c * r // n, n - 1, r - 1 + while index >= c: + index -= c + c, n = c * (n - r) // n, n - 1 + result.append(pool[-1 - n]) + + return tuple(result) + + +def prepend(value, iterator): + """Yield *value*, followed by the elements in *iterator*. + + >>> value = '0' + >>> iterator = ['1', '2', '3'] + >>> list(prepend(value, iterator)) + ['0', '1', '2', '3'] + + To prepend multiple values, see :func:`itertools.chain`. + + """ + return chain([value], iterator) diff --git a/tests/wpt/web-platform-tests/2dcontext/best-practices/.gitkeep b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/tests/__init__.py similarity index 100% rename from tests/wpt/web-platform-tests/2dcontext/best-practices/.gitkeep rename to tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/tests/__init__.py diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/tests/test_more.py b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/tests/test_more.py new file mode 100644 index 00000000000..2023ba6a4cb --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/tests/test_more.py @@ -0,0 +1,1848 @@ +from __future__ import division, print_function, unicode_literals + +from decimal import Decimal +from doctest import DocTestSuite +from fractions import Fraction +from functools import partial, reduce +from heapq import merge +from io import StringIO +from itertools import ( + chain, + count, + groupby, + islice, + permutations, + product, + repeat, +) +from operator import add, mul, itemgetter +from unittest import TestCase + +from six.moves import filter, map, range, zip + +import more_itertools as mi + + +def load_tests(loader, tests, ignore): + # Add the doctests + tests.addTests(DocTestSuite('more_itertools.more')) + return tests + + +class CollateTests(TestCase): + """Unit tests for ``collate()``""" + # Also accidentally tests peekable, though that could use its own tests + + def test_default(self): + """Test with the default `key` function.""" + iterables = [range(4), range(7), range(3, 6)] + self.assertEqual( + sorted(reduce(list.__add__, [list(it) for it in iterables])), + list(mi.collate(*iterables)) + ) + + def test_key(self): + """Test using a custom `key` function.""" + iterables = [range(5, 0, -1), range(4, 0, -1)] + actual = sorted( + reduce(list.__add__, [list(it) for it in iterables]), reverse=True + ) + expected = list(mi.collate(*iterables, key=lambda x: -x)) + self.assertEqual(actual, expected) + + def test_empty(self): + """Be nice if passed an empty list of iterables.""" + self.assertEqual([], list(mi.collate())) + + def test_one(self): + """Work when only 1 iterable is passed.""" + self.assertEqual([0, 1], list(mi.collate(range(2)))) + + def test_reverse(self): + """Test the `reverse` kwarg.""" + iterables = [range(4, 0, -1), range(7, 0, -1), range(3, 6, -1)] + + actual = sorted( + reduce(list.__add__, [list(it) for it in iterables]), reverse=True + ) + expected = list(mi.collate(*iterables, reverse=True)) + self.assertEqual(actual, expected) + + def test_alias(self): + self.assertNotEqual(merge.__doc__, mi.collate.__doc__) + self.assertNotEqual(partial.__doc__, mi.collate.__doc__) + + +class ChunkedTests(TestCase): + """Tests for ``chunked()``""" + + def test_even(self): + """Test when ``n`` divides evenly into the length of the iterable.""" + self.assertEqual( + list(mi.chunked('ABCDEF', 3)), [['A', 'B', 'C'], ['D', 'E', 'F']] + ) + + def test_odd(self): + """Test when ``n`` does not divide evenly into the length of the + iterable. + + """ + self.assertEqual( + list(mi.chunked('ABCDE', 3)), [['A', 'B', 'C'], ['D', 'E']] + ) + + +class FirstTests(TestCase): + """Tests for ``first()``""" + + def test_many(self): + """Test that it works on many-item iterables.""" + # Also try it on a generator expression to make sure it works on + # whatever those return, across Python versions. + self.assertEqual(mi.first(x for x in range(4)), 0) + + def test_one(self): + """Test that it doesn't raise StopIteration prematurely.""" + self.assertEqual(mi.first([3]), 3) + + def test_empty_stop_iteration(self): + """It should raise StopIteration for empty iterables.""" + self.assertRaises(ValueError, lambda: mi.first([])) + + def test_default(self): + """It should return the provided default arg for empty iterables.""" + self.assertEqual(mi.first([], 'boo'), 'boo') + + +class PeekableTests(TestCase): + """Tests for ``peekable()`` behavor not incidentally covered by testing + ``collate()`` + + """ + def test_peek_default(self): + """Make sure passing a default into ``peek()`` works.""" + p = mi.peekable([]) + self.assertEqual(p.peek(7), 7) + + def test_truthiness(self): + """Make sure a ``peekable`` tests true iff there are items remaining in + the iterable. + + """ + p = mi.peekable([]) + self.assertFalse(p) + + p = mi.peekable(range(3)) + self.assertTrue(p) + + def test_simple_peeking(self): + """Make sure ``next`` and ``peek`` advance and don't advance the + iterator, respectively. + + """ + p = mi.peekable(range(10)) + self.assertEqual(next(p), 0) + self.assertEqual(p.peek(), 1) + self.assertEqual(next(p), 1) + + def test_indexing(self): + """ + Indexing into the peekable shouldn't advance the iterator. + """ + p = mi.peekable('abcdefghijkl') + + # The 0th index is what ``next()`` will return + self.assertEqual(p[0], 'a') + self.assertEqual(next(p), 'a') + + # Indexing further into the peekable shouldn't advance the itertor + self.assertEqual(p[2], 'd') + self.assertEqual(next(p), 'b') + + # The 0th index moves up with the iterator; the last index follows + self.assertEqual(p[0], 'c') + self.assertEqual(p[9], 'l') + + self.assertEqual(next(p), 'c') + self.assertEqual(p[8], 'l') + + # Negative indexing should work too + self.assertEqual(p[-2], 'k') + self.assertEqual(p[-9], 'd') + self.assertRaises(IndexError, lambda: p[-10]) + + def test_slicing(self): + """Slicing the peekable shouldn't advance the iterator.""" + seq = list('abcdefghijkl') + p = mi.peekable(seq) + + # Slicing the peekable should just be like slicing a re-iterable + self.assertEqual(p[1:4], seq[1:4]) + + # Advancing the iterator moves the slices up also + self.assertEqual(next(p), 'a') + self.assertEqual(p[1:4], seq[1:][1:4]) + + # Implicit starts and stop should work + self.assertEqual(p[:5], seq[1:][:5]) + self.assertEqual(p[:], seq[1:][:]) + + # Indexing past the end should work + self.assertEqual(p[:100], seq[1:][:100]) + + # Steps should work, including negative + self.assertEqual(p[::2], seq[1:][::2]) + self.assertEqual(p[::-1], seq[1:][::-1]) + + def test_slicing_reset(self): + """Test slicing on a fresh iterable each time""" + iterable = ['0', '1', '2', '3', '4', '5'] + indexes = list(range(-4, len(iterable) + 4)) + [None] + steps = [1, 2, 3, 4, -1, -2, -3, 4] + for slice_args in product(indexes, indexes, steps): + it = iter(iterable) + p = mi.peekable(it) + next(p) + index = slice(*slice_args) + actual = p[index] + expected = iterable[1:][index] + self.assertEqual(actual, expected, slice_args) + + def test_slicing_error(self): + iterable = '01234567' + p = mi.peekable(iter(iterable)) + + # Prime the cache + p.peek() + old_cache = list(p._cache) + + # Illegal slice + with self.assertRaises(ValueError): + p[1:-1:0] + + # Neither the cache nor the iteration should be affected + self.assertEqual(old_cache, list(p._cache)) + self.assertEqual(list(p), list(iterable)) + + def test_passthrough(self): + """Iterating a peekable without using ``peek()`` or ``prepend()`` + should just give the underlying iterable's elements (a trivial test but + useful to set a baseline in case something goes wrong)""" + expected = [1, 2, 3, 4, 5] + actual = list(mi.peekable(expected)) + self.assertEqual(actual, expected) + + # prepend() behavior tests + + def test_prepend(self): + """Tests intersperesed ``prepend()`` and ``next()`` calls""" + it = mi.peekable(range(2)) + actual = [] + + # Test prepend() before next() + it.prepend(10) + actual += [next(it), next(it)] + + # Test prepend() between next()s + it.prepend(11) + actual += [next(it), next(it)] + + # Test prepend() after source iterable is consumed + it.prepend(12) + actual += [next(it)] + + expected = [10, 0, 11, 1, 12] + self.assertEqual(actual, expected) + + def test_multi_prepend(self): + """Tests prepending multiple items and getting them in proper order""" + it = mi.peekable(range(5)) + actual = [next(it), next(it)] + it.prepend(10, 11, 12) + it.prepend(20, 21) + actual += list(it) + expected = [0, 1, 20, 21, 10, 11, 12, 2, 3, 4] + self.assertEqual(actual, expected) + + def test_empty(self): + """Tests prepending in front of an empty iterable""" + it = mi.peekable([]) + it.prepend(10) + actual = list(it) + expected = [10] + self.assertEqual(actual, expected) + + def test_prepend_truthiness(self): + """Tests that ``__bool__()`` or ``__nonzero__()`` works properly + with ``prepend()``""" + it = mi.peekable(range(5)) + self.assertTrue(it) + actual = list(it) + self.assertFalse(it) + it.prepend(10) + self.assertTrue(it) + actual += [next(it)] + self.assertFalse(it) + expected = [0, 1, 2, 3, 4, 10] + self.assertEqual(actual, expected) + + def test_multi_prepend_peek(self): + """Tests prepending multiple elements and getting them in reverse order + while peeking""" + it = mi.peekable(range(5)) + actual = [next(it), next(it)] + self.assertEqual(it.peek(), 2) + it.prepend(10, 11, 12) + self.assertEqual(it.peek(), 10) + it.prepend(20, 21) + self.assertEqual(it.peek(), 20) + actual += list(it) + self.assertFalse(it) + expected = [0, 1, 20, 21, 10, 11, 12, 2, 3, 4] + self.assertEqual(actual, expected) + + def test_prepend_after_stop(self): + """Test resuming iteration after a previous exhaustion""" + it = mi.peekable(range(3)) + self.assertEqual(list(it), [0, 1, 2]) + self.assertRaises(StopIteration, lambda: next(it)) + it.prepend(10) + self.assertEqual(next(it), 10) + self.assertRaises(StopIteration, lambda: next(it)) + + def test_prepend_slicing(self): + """Tests interaction between prepending and slicing""" + seq = list(range(20)) + p = mi.peekable(seq) + + p.prepend(30, 40, 50) + pseq = [30, 40, 50] + seq # pseq for prepended_seq + + # adapt the specific tests from test_slicing + self.assertEqual(p[0], 30) + self.assertEqual(p[1:8], pseq[1:8]) + self.assertEqual(p[1:], pseq[1:]) + self.assertEqual(p[:5], pseq[:5]) + self.assertEqual(p[:], pseq[:]) + self.assertEqual(p[:100], pseq[:100]) + self.assertEqual(p[::2], pseq[::2]) + self.assertEqual(p[::-1], pseq[::-1]) + + def test_prepend_indexing(self): + """Tests interaction between prepending and indexing""" + seq = list(range(20)) + p = mi.peekable(seq) + + p.prepend(30, 40, 50) + + self.assertEqual(p[0], 30) + self.assertEqual(next(p), 30) + self.assertEqual(p[2], 0) + self.assertEqual(next(p), 40) + self.assertEqual(p[0], 50) + self.assertEqual(p[9], 8) + self.assertEqual(next(p), 50) + self.assertEqual(p[8], 8) + self.assertEqual(p[-2], 18) + self.assertEqual(p[-9], 11) + self.assertRaises(IndexError, lambda: p[-21]) + + def test_prepend_iterable(self): + """Tests prepending from an iterable""" + it = mi.peekable(range(5)) + # Don't directly use the range() object to avoid any range-specific + # optimizations + it.prepend(*(x for x in range(5))) + actual = list(it) + expected = list(chain(range(5), range(5))) + self.assertEqual(actual, expected) + + def test_prepend_many(self): + """Tests that prepending a huge number of elements works""" + it = mi.peekable(range(5)) + # Don't directly use the range() object to avoid any range-specific + # optimizations + it.prepend(*(x for x in range(20000))) + actual = list(it) + expected = list(chain(range(20000), range(5))) + self.assertEqual(actual, expected) + + def test_prepend_reversed(self): + """Tests prepending from a reversed iterable""" + it = mi.peekable(range(3)) + it.prepend(*reversed((10, 11, 12))) + actual = list(it) + expected = [12, 11, 10, 0, 1, 2] + self.assertEqual(actual, expected) + + +class ConsumerTests(TestCase): + """Tests for ``consumer()``""" + + def test_consumer(self): + @mi.consumer + def eater(): + while True: + x = yield # noqa + + e = eater() + e.send('hi') # without @consumer, would raise TypeError + + +class DistinctPermutationsTests(TestCase): + def test_distinct_permutations(self): + """Make sure the output for ``distinct_permutations()`` is the same as + set(permutations(it)). + + """ + iterable = ['z', 'a', 'a', 'q', 'q', 'q', 'y'] + test_output = sorted(mi.distinct_permutations(iterable)) + ref_output = sorted(set(permutations(iterable))) + self.assertEqual(test_output, ref_output) + + def test_other_iterables(self): + """Make sure ``distinct_permutations()`` accepts a different type of + iterables. + + """ + # a generator + iterable = (c for c in ['z', 'a', 'a', 'q', 'q', 'q', 'y']) + test_output = sorted(mi.distinct_permutations(iterable)) + # "reload" it + iterable = (c for c in ['z', 'a', 'a', 'q', 'q', 'q', 'y']) + ref_output = sorted(set(permutations(iterable))) + self.assertEqual(test_output, ref_output) + + # an iterator + iterable = iter(['z', 'a', 'a', 'q', 'q', 'q', 'y']) + test_output = sorted(mi.distinct_permutations(iterable)) + # "reload" it + iterable = iter(['z', 'a', 'a', 'q', 'q', 'q', 'y']) + ref_output = sorted(set(permutations(iterable))) + self.assertEqual(test_output, ref_output) + + +class IlenTests(TestCase): + def test_ilen(self): + """Sanity-checks for ``ilen()``.""" + # Non-empty + self.assertEqual( + mi.ilen(filter(lambda x: x % 10 == 0, range(101))), 11 + ) + + # Empty + self.assertEqual(mi.ilen((x for x in range(0))), 0) + + # Iterable with __len__ + self.assertEqual(mi.ilen(list(range(6))), 6) + + +class WithIterTests(TestCase): + def test_with_iter(self): + s = StringIO('One fish\nTwo fish') + initial_words = [line.split()[0] for line in mi.with_iter(s)] + + # Iterable's items should be faithfully represented + self.assertEqual(initial_words, ['One', 'Two']) + # The file object should be closed + self.assertEqual(s.closed, True) + + +class OneTests(TestCase): + def test_basic(self): + it = iter(['item']) + self.assertEqual(mi.one(it), 'item') + + def test_too_short(self): + it = iter([]) + self.assertRaises(ValueError, lambda: mi.one(it)) + self.assertRaises(IndexError, lambda: mi.one(it, too_short=IndexError)) + + def test_too_long(self): + it = count() + self.assertRaises(ValueError, lambda: mi.one(it)) # burn 0 and 1 + self.assertEqual(next(it), 2) + self.assertRaises( + OverflowError, lambda: mi.one(it, too_long=OverflowError) + ) + + +class IntersperseTest(TestCase): + """ Tests for intersperse() """ + + def test_even(self): + iterable = (x for x in '01') + self.assertEqual( + list(mi.intersperse(None, iterable)), ['0', None, '1'] + ) + + def test_odd(self): + iterable = (x for x in '012') + self.assertEqual( + list(mi.intersperse(None, iterable)), ['0', None, '1', None, '2'] + ) + + def test_nested(self): + element = ('a', 'b') + iterable = (x for x in '012') + actual = list(mi.intersperse(element, iterable)) + expected = ['0', ('a', 'b'), '1', ('a', 'b'), '2'] + self.assertEqual(actual, expected) + + def test_not_iterable(self): + self.assertRaises(TypeError, lambda: mi.intersperse('x', 1)) + + def test_n(self): + for n, element, expected in [ + (1, '_', ['0', '_', '1', '_', '2', '_', '3', '_', '4', '_', '5']), + (2, '_', ['0', '1', '_', '2', '3', '_', '4', '5']), + (3, '_', ['0', '1', '2', '_', '3', '4', '5']), + (4, '_', ['0', '1', '2', '3', '_', '4', '5']), + (5, '_', ['0', '1', '2', '3', '4', '_', '5']), + (6, '_', ['0', '1', '2', '3', '4', '5']), + (7, '_', ['0', '1', '2', '3', '4', '5']), + (3, ['a', 'b'], ['0', '1', '2', ['a', 'b'], '3', '4', '5']), + ]: + iterable = (x for x in '012345') + actual = list(mi.intersperse(element, iterable, n=n)) + self.assertEqual(actual, expected) + + def test_n_zero(self): + self.assertRaises( + ValueError, lambda: list(mi.intersperse('x', '012', n=0)) + ) + + +class UniqueToEachTests(TestCase): + """Tests for ``unique_to_each()``""" + + def test_all_unique(self): + """When all the input iterables are unique the output should match + the input.""" + iterables = [[1, 2], [3, 4, 5], [6, 7, 8]] + self.assertEqual(mi.unique_to_each(*iterables), iterables) + + def test_duplicates(self): + """When there are duplicates in any of the input iterables that aren't + in the rest, those duplicates should be emitted.""" + iterables = ["mississippi", "missouri"] + self.assertEqual( + mi.unique_to_each(*iterables), [['p', 'p'], ['o', 'u', 'r']] + ) + + def test_mixed(self): + """When the input iterables contain different types the function should + still behave properly""" + iterables = ['x', (i for i in range(3)), [1, 2, 3], tuple()] + self.assertEqual(mi.unique_to_each(*iterables), [['x'], [0], [3], []]) + + +class WindowedTests(TestCase): + """Tests for ``windowed()``""" + + def test_basic(self): + actual = list(mi.windowed([1, 2, 3, 4, 5], 3)) + expected = [(1, 2, 3), (2, 3, 4), (3, 4, 5)] + self.assertEqual(actual, expected) + + def test_large_size(self): + """ + When the window size is larger than the iterable, and no fill value is + given,``None`` should be filled in. + """ + actual = list(mi.windowed([1, 2, 3, 4, 5], 6)) + expected = [(1, 2, 3, 4, 5, None)] + self.assertEqual(actual, expected) + + def test_fillvalue(self): + """ + When sizes don't match evenly, the given fill value should be used. + """ + iterable = [1, 2, 3, 4, 5] + + for n, kwargs, expected in [ + (6, {}, [(1, 2, 3, 4, 5, '!')]), # n > len(iterable) + (3, {'step': 3}, [(1, 2, 3), (4, 5, '!')]), # using ``step`` + ]: + actual = list(mi.windowed(iterable, n, fillvalue='!', **kwargs)) + self.assertEqual(actual, expected) + + def test_zero(self): + """When the window size is zero, an empty tuple should be emitted.""" + actual = list(mi.windowed([1, 2, 3, 4, 5], 0)) + expected = [tuple()] + self.assertEqual(actual, expected) + + def test_negative(self): + """When the window size is negative, ValueError should be raised.""" + with self.assertRaises(ValueError): + list(mi.windowed([1, 2, 3, 4, 5], -1)) + + def test_step(self): + """The window should advance by the number of steps provided""" + iterable = [1, 2, 3, 4, 5, 6, 7] + for n, step, expected in [ + (3, 2, [(1, 2, 3), (3, 4, 5), (5, 6, 7)]), # n > step + (3, 3, [(1, 2, 3), (4, 5, 6), (7, None, None)]), # n == step + (3, 4, [(1, 2, 3), (5, 6, 7)]), # line up nicely + (3, 5, [(1, 2, 3), (6, 7, None)]), # off by one + (3, 6, [(1, 2, 3), (7, None, None)]), # off by two + (3, 7, [(1, 2, 3)]), # step past the end + (7, 8, [(1, 2, 3, 4, 5, 6, 7)]), # step > len(iterable) + ]: + actual = list(mi.windowed(iterable, n, step=step)) + self.assertEqual(actual, expected) + + # Step must be greater than or equal to 1 + with self.assertRaises(ValueError): + list(mi.windowed(iterable, 3, step=0)) + + +class BucketTests(TestCase): + """Tests for ``bucket()``""" + + def test_basic(self): + iterable = [10, 20, 30, 11, 21, 31, 12, 22, 23, 33] + D = mi.bucket(iterable, key=lambda x: 10 * (x // 10)) + + # In-order access + self.assertEqual(list(D[10]), [10, 11, 12]) + + # Out of order access + self.assertEqual(list(D[30]), [30, 31, 33]) + self.assertEqual(list(D[20]), [20, 21, 22, 23]) + + self.assertEqual(list(D[40]), []) # Nothing in here! + + def test_in(self): + iterable = [10, 20, 30, 11, 21, 31, 12, 22, 23, 33] + D = mi.bucket(iterable, key=lambda x: 10 * (x // 10)) + + self.assertTrue(10 in D) + self.assertFalse(40 in D) + self.assertTrue(20 in D) + self.assertFalse(21 in D) + + # Checking in-ness shouldn't advance the iterator + self.assertEqual(next(D[10]), 10) + + def test_validator(self): + iterable = count(0) + key = lambda x: int(str(x)[0]) # First digit of each number + validator = lambda x: 0 < x < 10 # No leading zeros + D = mi.bucket(iterable, key, validator=validator) + self.assertEqual(mi.take(3, D[1]), [1, 10, 11]) + self.assertNotIn(0, D) # Non-valid entries don't return True + self.assertNotIn(0, D._cache) # Don't store non-valid entries + self.assertEqual(list(D[0]), []) + + +class SpyTests(TestCase): + """Tests for ``spy()``""" + + def test_basic(self): + original_iterable = iter('abcdefg') + head, new_iterable = mi.spy(original_iterable) + self.assertEqual(head, ['a']) + self.assertEqual( + list(new_iterable), ['a', 'b', 'c', 'd', 'e', 'f', 'g'] + ) + + def test_unpacking(self): + original_iterable = iter('abcdefg') + (first, second, third), new_iterable = mi.spy(original_iterable, 3) + self.assertEqual(first, 'a') + self.assertEqual(second, 'b') + self.assertEqual(third, 'c') + self.assertEqual( + list(new_iterable), ['a', 'b', 'c', 'd', 'e', 'f', 'g'] + ) + + def test_too_many(self): + original_iterable = iter('abc') + head, new_iterable = mi.spy(original_iterable, 4) + self.assertEqual(head, ['a', 'b', 'c']) + self.assertEqual(list(new_iterable), ['a', 'b', 'c']) + + def test_zero(self): + original_iterable = iter('abc') + head, new_iterable = mi.spy(original_iterable, 0) + self.assertEqual(head, []) + self.assertEqual(list(new_iterable), ['a', 'b', 'c']) + + +class InterleaveTests(TestCase): + def test_even(self): + actual = list(mi.interleave([1, 4, 7], [2, 5, 8], [3, 6, 9])) + expected = [1, 2, 3, 4, 5, 6, 7, 8, 9] + self.assertEqual(actual, expected) + + def test_short(self): + actual = list(mi.interleave([1, 4], [2, 5, 7], [3, 6, 8])) + expected = [1, 2, 3, 4, 5, 6] + self.assertEqual(actual, expected) + + def test_mixed_types(self): + it_list = ['a', 'b', 'c', 'd'] + it_str = '12345' + it_inf = count() + actual = list(mi.interleave(it_list, it_str, it_inf)) + expected = ['a', '1', 0, 'b', '2', 1, 'c', '3', 2, 'd', '4', 3] + self.assertEqual(actual, expected) + + +class InterleaveLongestTests(TestCase): + def test_even(self): + actual = list(mi.interleave_longest([1, 4, 7], [2, 5, 8], [3, 6, 9])) + expected = [1, 2, 3, 4, 5, 6, 7, 8, 9] + self.assertEqual(actual, expected) + + def test_short(self): + actual = list(mi.interleave_longest([1, 4], [2, 5, 7], [3, 6, 8])) + expected = [1, 2, 3, 4, 5, 6, 7, 8] + self.assertEqual(actual, expected) + + def test_mixed_types(self): + it_list = ['a', 'b', 'c', 'd'] + it_str = '12345' + it_gen = (x for x in range(3)) + actual = list(mi.interleave_longest(it_list, it_str, it_gen)) + expected = ['a', '1', 0, 'b', '2', 1, 'c', '3', 2, 'd', '4', '5'] + self.assertEqual(actual, expected) + + +class TestCollapse(TestCase): + """Tests for ``collapse()``""" + + def test_collapse(self): + l = [[1], 2, [[3], 4], [[[5]]]] + self.assertEqual(list(mi.collapse(l)), [1, 2, 3, 4, 5]) + + def test_collapse_to_string(self): + l = [["s1"], "s2", [["s3"], "s4"], [[["s5"]]]] + self.assertEqual(list(mi.collapse(l)), ["s1", "s2", "s3", "s4", "s5"]) + + def test_collapse_flatten(self): + l = [[1], [2], [[3], 4], [[[5]]]] + self.assertEqual(list(mi.collapse(l, levels=1)), list(mi.flatten(l))) + + def test_collapse_to_level(self): + l = [[1], 2, [[3], 4], [[[5]]]] + self.assertEqual(list(mi.collapse(l, levels=2)), [1, 2, 3, 4, [5]]) + self.assertEqual( + list(mi.collapse(mi.collapse(l, levels=1), levels=1)), + list(mi.collapse(l, levels=2)) + ) + + def test_collapse_to_list(self): + l = (1, [2], (3, [4, (5,)], 'ab')) + actual = list(mi.collapse(l, base_type=list)) + expected = [1, [2], 3, [4, (5,)], 'ab'] + self.assertEqual(actual, expected) + + +class SideEffectTests(TestCase): + """Tests for ``side_effect()``""" + + def test_individual(self): + # The function increments the counter for each call + counter = [0] + + def func(arg): + counter[0] += 1 + + result = list(mi.side_effect(func, range(10))) + self.assertEqual(result, list(range(10))) + self.assertEqual(counter[0], 10) + + def test_chunked(self): + # The function increments the counter for each call + counter = [0] + + def func(arg): + counter[0] += 1 + + result = list(mi.side_effect(func, range(10), 2)) + self.assertEqual(result, list(range(10))) + self.assertEqual(counter[0], 5) + + def test_before_after(self): + f = StringIO() + collector = [] + + def func(item): + print(item, file=f) + collector.append(f.getvalue()) + + def it(): + yield u'a' + yield u'b' + raise RuntimeError('kaboom') + + before = lambda: print('HEADER', file=f) + after = f.close + + try: + mi.consume(mi.side_effect(func, it(), before=before, after=after)) + except RuntimeError: + pass + + # The iterable should have been written to the file + self.assertEqual(collector, [u'HEADER\na\n', u'HEADER\na\nb\n']) + + # The file should be closed even though something bad happened + self.assertTrue(f.closed) + + def test_before_fails(self): + f = StringIO() + func = lambda x: print(x, file=f) + + def before(): + raise RuntimeError('ouch') + + try: + mi.consume( + mi.side_effect(func, u'abc', before=before, after=f.close) + ) + except RuntimeError: + pass + + # The file should be closed even though something bad happened in the + # before function + self.assertTrue(f.closed) + + +class SlicedTests(TestCase): + """Tests for ``sliced()``""" + + def test_even(self): + """Test when the length of the sequence is divisible by *n*""" + seq = 'ABCDEFGHI' + self.assertEqual(list(mi.sliced(seq, 3)), ['ABC', 'DEF', 'GHI']) + + def test_odd(self): + """Test when the length of the sequence is not divisible by *n*""" + seq = 'ABCDEFGHI' + self.assertEqual(list(mi.sliced(seq, 4)), ['ABCD', 'EFGH', 'I']) + + def test_not_sliceable(self): + seq = (x for x in 'ABCDEFGHI') + + with self.assertRaises(TypeError): + list(mi.sliced(seq, 3)) + + +class SplitAtTests(TestCase): + """Tests for ``split()``""" + + def comp_with_str_split(self, str_to_split, delim): + pred = lambda c: c == delim + actual = list(map(''.join, mi.split_at(str_to_split, pred))) + expected = str_to_split.split(delim) + self.assertEqual(actual, expected) + + def test_seperators(self): + test_strs = ['', 'abcba', 'aaabbbcccddd', 'e'] + for s, delim in product(test_strs, 'abcd'): + self.comp_with_str_split(s, delim) + + +class SplitBeforeTest(TestCase): + """Tests for ``split_before()``""" + + def test_starts_with_sep(self): + actual = list(mi.split_before('xooxoo', lambda c: c == 'x')) + expected = [['x', 'o', 'o'], ['x', 'o', 'o']] + self.assertEqual(actual, expected) + + def test_ends_with_sep(self): + actual = list(mi.split_before('ooxoox', lambda c: c == 'x')) + expected = [['o', 'o'], ['x', 'o', 'o'], ['x']] + self.assertEqual(actual, expected) + + def test_no_sep(self): + actual = list(mi.split_before('ooo', lambda c: c == 'x')) + expected = [['o', 'o', 'o']] + self.assertEqual(actual, expected) + + +class SplitAfterTest(TestCase): + """Tests for ``split_after()``""" + + def test_starts_with_sep(self): + actual = list(mi.split_after('xooxoo', lambda c: c == 'x')) + expected = [['x'], ['o', 'o', 'x'], ['o', 'o']] + self.assertEqual(actual, expected) + + def test_ends_with_sep(self): + actual = list(mi.split_after('ooxoox', lambda c: c == 'x')) + expected = [['o', 'o', 'x'], ['o', 'o', 'x']] + self.assertEqual(actual, expected) + + def test_no_sep(self): + actual = list(mi.split_after('ooo', lambda c: c == 'x')) + expected = [['o', 'o', 'o']] + self.assertEqual(actual, expected) + + +class PaddedTest(TestCase): + """Tests for ``padded()``""" + + def test_no_n(self): + seq = [1, 2, 3] + + # No fillvalue + self.assertEqual(mi.take(5, mi.padded(seq)), [1, 2, 3, None, None]) + + # With fillvalue + self.assertEqual( + mi.take(5, mi.padded(seq, fillvalue='')), [1, 2, 3, '', ''] + ) + + def test_invalid_n(self): + self.assertRaises(ValueError, lambda: list(mi.padded([1, 2, 3], n=-1))) + self.assertRaises(ValueError, lambda: list(mi.padded([1, 2, 3], n=0))) + + def test_valid_n(self): + seq = [1, 2, 3, 4, 5] + + # No need for padding: len(seq) <= n + self.assertEqual(list(mi.padded(seq, n=4)), [1, 2, 3, 4, 5]) + self.assertEqual(list(mi.padded(seq, n=5)), [1, 2, 3, 4, 5]) + + # No fillvalue + self.assertEqual( + list(mi.padded(seq, n=7)), [1, 2, 3, 4, 5, None, None] + ) + + # With fillvalue + self.assertEqual( + list(mi.padded(seq, fillvalue='', n=7)), [1, 2, 3, 4, 5, '', ''] + ) + + def test_next_multiple(self): + seq = [1, 2, 3, 4, 5, 6] + + # No need for padding: len(seq) % n == 0 + self.assertEqual( + list(mi.padded(seq, n=3, next_multiple=True)), [1, 2, 3, 4, 5, 6] + ) + + # Padding needed: len(seq) < n + self.assertEqual( + list(mi.padded(seq, n=8, next_multiple=True)), + [1, 2, 3, 4, 5, 6, None, None] + ) + + # No padding needed: len(seq) == n + self.assertEqual( + list(mi.padded(seq, n=6, next_multiple=True)), [1, 2, 3, 4, 5, 6] + ) + + # Padding needed: len(seq) > n + self.assertEqual( + list(mi.padded(seq, n=4, next_multiple=True)), + [1, 2, 3, 4, 5, 6, None, None] + ) + + # With fillvalue + self.assertEqual( + list(mi.padded(seq, fillvalue='', n=4, next_multiple=True)), + [1, 2, 3, 4, 5, 6, '', ''] + ) + + +class DistributeTest(TestCase): + """Tests for distribute()""" + + def test_invalid_n(self): + self.assertRaises(ValueError, lambda: mi.distribute(-1, [1, 2, 3])) + self.assertRaises(ValueError, lambda: mi.distribute(0, [1, 2, 3])) + + def test_basic(self): + iterable = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + + for n, expected in [ + (1, [iterable]), + (2, [[1, 3, 5, 7, 9], [2, 4, 6, 8, 10]]), + (3, [[1, 4, 7, 10], [2, 5, 8], [3, 6, 9]]), + (10, [[n] for n in range(1, 10 + 1)]), + ]: + self.assertEqual( + [list(x) for x in mi.distribute(n, iterable)], expected + ) + + def test_large_n(self): + iterable = [1, 2, 3, 4] + self.assertEqual( + [list(x) for x in mi.distribute(6, iterable)], + [[1], [2], [3], [4], [], []] + ) + + +class StaggerTest(TestCase): + """Tests for ``stagger()``""" + + def test_default(self): + iterable = [0, 1, 2, 3] + actual = list(mi.stagger(iterable)) + expected = [(None, 0, 1), (0, 1, 2), (1, 2, 3)] + self.assertEqual(actual, expected) + + def test_offsets(self): + iterable = [0, 1, 2, 3] + for offsets, expected in [ + ((-2, 0, 2), [('', 0, 2), ('', 1, 3)]), + ((-2, -1), [('', ''), ('', 0), (0, 1), (1, 2), (2, 3)]), + ((1, 2), [(1, 2), (2, 3)]), + ]: + all_groups = mi.stagger(iterable, offsets=offsets, fillvalue='') + self.assertEqual(list(all_groups), expected) + + def test_longest(self): + iterable = [0, 1, 2, 3] + for offsets, expected in [ + ( + (-1, 0, 1), + [('', 0, 1), (0, 1, 2), (1, 2, 3), (2, 3, ''), (3, '', '')] + ), + ((-2, -1), [('', ''), ('', 0), (0, 1), (1, 2), (2, 3), (3, '')]), + ((1, 2), [(1, 2), (2, 3), (3, '')]), + ]: + all_groups = mi.stagger( + iterable, offsets=offsets, fillvalue='', longest=True + ) + self.assertEqual(list(all_groups), expected) + + +class ZipOffsetTest(TestCase): + """Tests for ``zip_offset()``""" + + def test_shortest(self): + a_1 = [0, 1, 2, 3] + a_2 = [0, 1, 2, 3, 4, 5] + a_3 = [0, 1, 2, 3, 4, 5, 6, 7] + actual = list( + mi.zip_offset(a_1, a_2, a_3, offsets=(-1, 0, 1), fillvalue='') + ) + expected = [('', 0, 1), (0, 1, 2), (1, 2, 3), (2, 3, 4), (3, 4, 5)] + self.assertEqual(actual, expected) + + def test_longest(self): + a_1 = [0, 1, 2, 3] + a_2 = [0, 1, 2, 3, 4, 5] + a_3 = [0, 1, 2, 3, 4, 5, 6, 7] + actual = list( + mi.zip_offset(a_1, a_2, a_3, offsets=(-1, 0, 1), longest=True) + ) + expected = [ + (None, 0, 1), + (0, 1, 2), + (1, 2, 3), + (2, 3, 4), + (3, 4, 5), + (None, 5, 6), + (None, None, 7), + ] + self.assertEqual(actual, expected) + + def test_mismatch(self): + iterables = [0, 1, 2], [2, 3, 4] + offsets = (-1, 0, 1) + self.assertRaises( + ValueError, + lambda: list(mi.zip_offset(*iterables, offsets=offsets)) + ) + + +class SortTogetherTest(TestCase): + """Tests for sort_together()""" + + def test_key_list(self): + """tests `key_list` including default, iterables include duplicates""" + iterables = [ + ['GA', 'GA', 'GA', 'CT', 'CT', 'CT'], + ['May', 'Aug.', 'May', 'June', 'July', 'July'], + [97, 20, 100, 70, 100, 20] + ] + + self.assertEqual( + mi.sort_together(iterables), + [ + ('CT', 'CT', 'CT', 'GA', 'GA', 'GA'), + ('June', 'July', 'July', 'May', 'Aug.', 'May'), + (70, 100, 20, 97, 20, 100) + ] + ) + + self.assertEqual( + mi.sort_together(iterables, key_list=(0, 1)), + [ + ('CT', 'CT', 'CT', 'GA', 'GA', 'GA'), + ('July', 'July', 'June', 'Aug.', 'May', 'May'), + (100, 20, 70, 20, 97, 100) + ] + ) + + self.assertEqual( + mi.sort_together(iterables, key_list=(0, 1, 2)), + [ + ('CT', 'CT', 'CT', 'GA', 'GA', 'GA'), + ('July', 'July', 'June', 'Aug.', 'May', 'May'), + (20, 100, 70, 20, 97, 100) + ] + ) + + self.assertEqual( + mi.sort_together(iterables, key_list=(2,)), + [ + ('GA', 'CT', 'CT', 'GA', 'GA', 'CT'), + ('Aug.', 'July', 'June', 'May', 'May', 'July'), + (20, 20, 70, 97, 100, 100) + ] + ) + + def test_invalid_key_list(self): + """tests `key_list` for indexes not available in `iterables`""" + iterables = [ + ['GA', 'GA', 'GA', 'CT', 'CT', 'CT'], + ['May', 'Aug.', 'May', 'June', 'July', 'July'], + [97, 20, 100, 70, 100, 20] + ] + + self.assertRaises( + IndexError, lambda: mi.sort_together(iterables, key_list=(5,)) + ) + + def test_reverse(self): + """tests `reverse` to ensure a reverse sort for `key_list` iterables""" + iterables = [ + ['GA', 'GA', 'GA', 'CT', 'CT', 'CT'], + ['May', 'Aug.', 'May', 'June', 'July', 'July'], + [97, 20, 100, 70, 100, 20] + ] + + self.assertEqual( + mi.sort_together(iterables, key_list=(0, 1, 2), reverse=True), + [('GA', 'GA', 'GA', 'CT', 'CT', 'CT'), + ('May', 'May', 'Aug.', 'June', 'July', 'July'), + (100, 97, 20, 70, 100, 20)] + ) + + def test_uneven_iterables(self): + """tests trimming of iterables to the shortest length before sorting""" + iterables = [['GA', 'GA', 'GA', 'CT', 'CT', 'CT', 'MA'], + ['May', 'Aug.', 'May', 'June', 'July', 'July'], + [97, 20, 100, 70, 100, 20, 0]] + + self.assertEqual( + mi.sort_together(iterables), + [ + ('CT', 'CT', 'CT', 'GA', 'GA', 'GA'), + ('June', 'July', 'July', 'May', 'Aug.', 'May'), + (70, 100, 20, 97, 20, 100) + ] + ) + + +class DivideTest(TestCase): + """Tests for divide()""" + + def test_invalid_n(self): + self.assertRaises(ValueError, lambda: mi.divide(-1, [1, 2, 3])) + self.assertRaises(ValueError, lambda: mi.divide(0, [1, 2, 3])) + + def test_basic(self): + iterable = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + + for n, expected in [ + (1, [iterable]), + (2, [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]), + (3, [[1, 2, 3, 4], [5, 6, 7], [8, 9, 10]]), + (10, [[n] for n in range(1, 10 + 1)]), + ]: + self.assertEqual( + [list(x) for x in mi.divide(n, iterable)], expected + ) + + def test_large_n(self): + iterable = [1, 2, 3, 4] + self.assertEqual( + [list(x) for x in mi.divide(6, iterable)], + [[1], [2], [3], [4], [], []] + ) + + +class TestAlwaysIterable(TestCase): + """Tests for always_iterable()""" + def test_single(self): + self.assertEqual(list(mi.always_iterable(1)), [1]) + + def test_strings(self): + for obj in ['foo', b'bar', u'baz']: + actual = list(mi.always_iterable(obj)) + expected = [obj] + self.assertEqual(actual, expected) + + def test_base_type(self): + dict_obj = {'a': 1, 'b': 2} + str_obj = '123' + + # Default: dicts are iterable like they normally are + default_actual = list(mi.always_iterable(dict_obj)) + default_expected = list(dict_obj) + self.assertEqual(default_actual, default_expected) + + # Unitary types set: dicts are not iterable + custom_actual = list(mi.always_iterable(dict_obj, base_type=dict)) + custom_expected = [dict_obj] + self.assertEqual(custom_actual, custom_expected) + + # With unitary types set, strings are iterable + str_actual = list(mi.always_iterable(str_obj, base_type=None)) + str_expected = list(str_obj) + self.assertEqual(str_actual, str_expected) + + def test_iterables(self): + self.assertEqual(list(mi.always_iterable([0, 1])), [0, 1]) + self.assertEqual( + list(mi.always_iterable([0, 1], base_type=list)), [[0, 1]] + ) + self.assertEqual( + list(mi.always_iterable(iter('foo'))), ['f', 'o', 'o'] + ) + self.assertEqual(list(mi.always_iterable([])), []) + + def test_none(self): + self.assertEqual(list(mi.always_iterable(None)), []) + + def test_generator(self): + def _gen(): + yield 0 + yield 1 + + self.assertEqual(list(mi.always_iterable(_gen())), [0, 1]) + + +class AdjacentTests(TestCase): + def test_typical(self): + actual = list(mi.adjacent(lambda x: x % 5 == 0, range(10))) + expected = [(True, 0), (True, 1), (False, 2), (False, 3), (True, 4), + (True, 5), (True, 6), (False, 7), (False, 8), (False, 9)] + self.assertEqual(actual, expected) + + def test_empty_iterable(self): + actual = list(mi.adjacent(lambda x: x % 5 == 0, [])) + expected = [] + self.assertEqual(actual, expected) + + def test_length_one(self): + actual = list(mi.adjacent(lambda x: x % 5 == 0, [0])) + expected = [(True, 0)] + self.assertEqual(actual, expected) + + actual = list(mi.adjacent(lambda x: x % 5 == 0, [1])) + expected = [(False, 1)] + self.assertEqual(actual, expected) + + def test_consecutive_true(self): + """Test that when the predicate matches multiple consecutive elements + it doesn't repeat elements in the output""" + actual = list(mi.adjacent(lambda x: x % 5 < 2, range(10))) + expected = [(True, 0), (True, 1), (True, 2), (False, 3), (True, 4), + (True, 5), (True, 6), (True, 7), (False, 8), (False, 9)] + self.assertEqual(actual, expected) + + def test_distance(self): + actual = list(mi.adjacent(lambda x: x % 5 == 0, range(10), distance=2)) + expected = [(True, 0), (True, 1), (True, 2), (True, 3), (True, 4), + (True, 5), (True, 6), (True, 7), (False, 8), (False, 9)] + self.assertEqual(actual, expected) + + actual = list(mi.adjacent(lambda x: x % 5 == 0, range(10), distance=3)) + expected = [(True, 0), (True, 1), (True, 2), (True, 3), (True, 4), + (True, 5), (True, 6), (True, 7), (True, 8), (False, 9)] + self.assertEqual(actual, expected) + + def test_large_distance(self): + """Test distance larger than the length of the iterable""" + iterable = range(10) + actual = list(mi.adjacent(lambda x: x % 5 == 4, iterable, distance=20)) + expected = list(zip(repeat(True), iterable)) + self.assertEqual(actual, expected) + + actual = list(mi.adjacent(lambda x: False, iterable, distance=20)) + expected = list(zip(repeat(False), iterable)) + self.assertEqual(actual, expected) + + def test_zero_distance(self): + """Test that adjacent() reduces to zip+map when distance is 0""" + iterable = range(1000) + predicate = lambda x: x % 4 == 2 + actual = mi.adjacent(predicate, iterable, 0) + expected = zip(map(predicate, iterable), iterable) + self.assertTrue(all(a == e for a, e in zip(actual, expected))) + + def test_negative_distance(self): + """Test that adjacent() raises an error with negative distance""" + pred = lambda x: x + self.assertRaises( + ValueError, lambda: mi.adjacent(pred, range(1000), -1) + ) + self.assertRaises( + ValueError, lambda: mi.adjacent(pred, range(10), -10) + ) + + def test_grouping(self): + """Test interaction of adjacent() with groupby_transform()""" + iterable = mi.adjacent(lambda x: x % 5 == 0, range(10)) + grouper = mi.groupby_transform(iterable, itemgetter(0), itemgetter(1)) + actual = [(k, list(g)) for k, g in grouper] + expected = [ + (True, [0, 1]), + (False, [2, 3]), + (True, [4, 5, 6]), + (False, [7, 8, 9]), + ] + self.assertEqual(actual, expected) + + def test_call_once(self): + """Test that the predicate is only called once per item.""" + already_seen = set() + iterable = range(10) + + def predicate(item): + self.assertNotIn(item, already_seen) + already_seen.add(item) + return True + + actual = list(mi.adjacent(predicate, iterable)) + expected = [(True, x) for x in iterable] + self.assertEqual(actual, expected) + + +class GroupByTransformTests(TestCase): + def assertAllGroupsEqual(self, groupby1, groupby2): + """Compare two groupby objects for equality, both keys and groups.""" + for a, b in zip(groupby1, groupby2): + key1, group1 = a + key2, group2 = b + self.assertEqual(key1, key2) + self.assertListEqual(list(group1), list(group2)) + self.assertRaises(StopIteration, lambda: next(groupby1)) + self.assertRaises(StopIteration, lambda: next(groupby2)) + + def test_default_funcs(self): + """Test that groupby_transform() with default args mimics groupby()""" + iterable = [(x // 5, x) for x in range(1000)] + actual = mi.groupby_transform(iterable) + expected = groupby(iterable) + self.assertAllGroupsEqual(actual, expected) + + def test_valuefunc(self): + iterable = [(int(x / 5), int(x / 3), x) for x in range(10)] + + # Test the standard usage of grouping one iterable using another's keys + grouper = mi.groupby_transform( + iterable, keyfunc=itemgetter(0), valuefunc=itemgetter(-1) + ) + actual = [(k, list(g)) for k, g in grouper] + expected = [(0, [0, 1, 2, 3, 4]), (1, [5, 6, 7, 8, 9])] + self.assertEqual(actual, expected) + + grouper = mi.groupby_transform( + iterable, keyfunc=itemgetter(1), valuefunc=itemgetter(-1) + ) + actual = [(k, list(g)) for k, g in grouper] + expected = [(0, [0, 1, 2]), (1, [3, 4, 5]), (2, [6, 7, 8]), (3, [9])] + self.assertEqual(actual, expected) + + # and now for something a little different + d = dict(zip(range(10), 'abcdefghij')) + grouper = mi.groupby_transform( + range(10), keyfunc=lambda x: x // 5, valuefunc=d.get + ) + actual = [(k, ''.join(g)) for k, g in grouper] + expected = [(0, 'abcde'), (1, 'fghij')] + self.assertEqual(actual, expected) + + def test_no_valuefunc(self): + iterable = range(1000) + + def key(x): + return x // 5 + + actual = mi.groupby_transform(iterable, key, valuefunc=None) + expected = groupby(iterable, key) + self.assertAllGroupsEqual(actual, expected) + + actual = mi.groupby_transform(iterable, key) # default valuefunc + expected = groupby(iterable, key) + self.assertAllGroupsEqual(actual, expected) + + +class NumericRangeTests(TestCase): + def test_basic(self): + for args, expected in [ + ((4,), [0, 1, 2, 3]), + ((4.0,), [0.0, 1.0, 2.0, 3.0]), + ((1.0, 4), [1.0, 2.0, 3.0]), + ((1, 4.0), [1, 2, 3]), + ((1.0, 5), [1.0, 2.0, 3.0, 4.0]), + ((0, 20, 5), [0, 5, 10, 15]), + ((0, 20, 5.0), [0.0, 5.0, 10.0, 15.0]), + ((0, 10, 3), [0, 3, 6, 9]), + ((0, 10, 3.0), [0.0, 3.0, 6.0, 9.0]), + ((0, -5, -1), [0, -1, -2, -3, -4]), + ((0.0, -5, -1), [0.0, -1.0, -2.0, -3.0, -4.0]), + ((1, 2, Fraction(1, 2)), [Fraction(1, 1), Fraction(3, 2)]), + ((0,), []), + ((0.0,), []), + ((1, 0), []), + ((1.0, 0.0), []), + ((Fraction(2, 1),), [Fraction(0, 1), Fraction(1, 1)]), + ((Decimal('2.0'),), [Decimal('0.0'), Decimal('1.0')]), + ]: + actual = list(mi.numeric_range(*args)) + self.assertEqual(actual, expected) + self.assertTrue( + all(type(a) == type(e) for a, e in zip(actual, expected)) + ) + + def test_arg_count(self): + self.assertRaises(TypeError, lambda: list(mi.numeric_range())) + self.assertRaises( + TypeError, lambda: list(mi.numeric_range(0, 1, 2, 3)) + ) + + def test_zero_step(self): + self.assertRaises( + ValueError, lambda: list(mi.numeric_range(1, 2, 0)) + ) + + +class CountCycleTests(TestCase): + def test_basic(self): + expected = [ + (0, 'a'), (0, 'b'), (0, 'c'), + (1, 'a'), (1, 'b'), (1, 'c'), + (2, 'a'), (2, 'b'), (2, 'c'), + ] + for actual in [ + mi.take(9, mi.count_cycle('abc')), # n=None + list(mi.count_cycle('abc', 3)), # n=3 + ]: + self.assertEqual(actual, expected) + + def test_empty(self): + self.assertEqual(list(mi.count_cycle('')), []) + self.assertEqual(list(mi.count_cycle('', 2)), []) + + def test_negative(self): + self.assertEqual(list(mi.count_cycle('abc', -3)), []) + + +class LocateTests(TestCase): + def test_default_pred(self): + iterable = [0, 1, 1, 0, 1, 0, 0] + actual = list(mi.locate(iterable)) + expected = [1, 2, 4] + self.assertEqual(actual, expected) + + def test_no_matches(self): + iterable = [0, 0, 0] + actual = list(mi.locate(iterable)) + expected = [] + self.assertEqual(actual, expected) + + def test_custom_pred(self): + iterable = ['0', 1, 1, '0', 1, '0', '0'] + pred = lambda x: x == '0' + actual = list(mi.locate(iterable, pred)) + expected = [0, 3, 5, 6] + self.assertEqual(actual, expected) + + +class StripFunctionTests(TestCase): + def test_hashable(self): + iterable = list('www.example.com') + pred = lambda x: x in set('cmowz.') + + self.assertEqual(list(mi.lstrip(iterable, pred)), list('example.com')) + self.assertEqual(list(mi.rstrip(iterable, pred)), list('www.example')) + self.assertEqual(list(mi.strip(iterable, pred)), list('example')) + + def test_not_hashable(self): + iterable = [ + list('http://'), list('www'), list('.example'), list('.com') + ] + pred = lambda x: x in [list('http://'), list('www'), list('.com')] + + self.assertEqual(list(mi.lstrip(iterable, pred)), iterable[2:]) + self.assertEqual(list(mi.rstrip(iterable, pred)), iterable[:3]) + self.assertEqual(list(mi.strip(iterable, pred)), iterable[2: 3]) + + def test_math(self): + iterable = [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2] + pred = lambda x: x <= 2 + + self.assertEqual(list(mi.lstrip(iterable, pred)), iterable[3:]) + self.assertEqual(list(mi.rstrip(iterable, pred)), iterable[:-3]) + self.assertEqual(list(mi.strip(iterable, pred)), iterable[3:-3]) + + +class IsliceExtendedTests(TestCase): + def test_all(self): + iterable = ['0', '1', '2', '3', '4', '5'] + indexes = list(range(-4, len(iterable) + 4)) + [None] + steps = [1, 2, 3, 4, -1, -2, -3, 4] + for slice_args in product(indexes, indexes, steps): + try: + actual = list(mi.islice_extended(iterable, *slice_args)) + except Exception as e: + self.fail((slice_args, e)) + + expected = iterable[slice(*slice_args)] + self.assertEqual(actual, expected, slice_args) + + def test_zero_step(self): + with self.assertRaises(ValueError): + list(mi.islice_extended([1, 2, 3], 0, 1, 0)) + + +class ConsecutiveGroupsTest(TestCase): + def test_numbers(self): + iterable = [-10, -8, -7, -6, 1, 2, 4, 5, -1, 7] + actual = [list(g) for g in mi.consecutive_groups(iterable)] + expected = [[-10], [-8, -7, -6], [1, 2], [4, 5], [-1], [7]] + self.assertEqual(actual, expected) + + def test_custom_ordering(self): + iterable = ['1', '10', '11', '20', '21', '22', '30', '31'] + ordering = lambda x: int(x) + actual = [list(g) for g in mi.consecutive_groups(iterable, ordering)] + expected = [['1'], ['10', '11'], ['20', '21', '22'], ['30', '31']] + self.assertEqual(actual, expected) + + def test_exotic_ordering(self): + iterable = [ + ('a', 'b', 'c', 'd'), + ('a', 'c', 'b', 'd'), + ('a', 'c', 'd', 'b'), + ('a', 'd', 'b', 'c'), + ('d', 'b', 'c', 'a'), + ('d', 'c', 'a', 'b'), + ] + ordering = list(permutations('abcd')).index + actual = [list(g) for g in mi.consecutive_groups(iterable, ordering)] + expected = [ + [('a', 'b', 'c', 'd')], + [('a', 'c', 'b', 'd'), ('a', 'c', 'd', 'b'), ('a', 'd', 'b', 'c')], + [('d', 'b', 'c', 'a'), ('d', 'c', 'a', 'b')], + ] + self.assertEqual(actual, expected) + + +class DifferenceTest(TestCase): + def test_normal(self): + iterable = [10, 20, 30, 40, 50] + actual = list(mi.difference(iterable)) + expected = [10, 10, 10, 10, 10] + self.assertEqual(actual, expected) + + def test_custom(self): + iterable = [10, 20, 30, 40, 50] + actual = list(mi.difference(iterable, add)) + expected = [10, 30, 50, 70, 90] + self.assertEqual(actual, expected) + + def test_roundtrip(self): + original = list(range(100)) + accumulated = mi.accumulate(original) + actual = list(mi.difference(accumulated)) + self.assertEqual(actual, original) + + def test_one(self): + self.assertEqual(list(mi.difference([0])), [0]) + + def test_empty(self): + self.assertEqual(list(mi.difference([])), []) + + +class SeekableTest(TestCase): + def test_exhaustion_reset(self): + iterable = [str(n) for n in range(10)] + + s = mi.seekable(iterable) + self.assertEqual(list(s), iterable) # Normal iteration + self.assertEqual(list(s), []) # Iterable is exhausted + + s.seek(0) + self.assertEqual(list(s), iterable) # Back in action + + def test_partial_reset(self): + iterable = [str(n) for n in range(10)] + + s = mi.seekable(iterable) + self.assertEqual(mi.take(5, s), iterable[:5]) # Normal iteration + + s.seek(1) + self.assertEqual(list(s), iterable[1:]) # Get the rest of the iterable + + def test_forward(self): + iterable = [str(n) for n in range(10)] + + s = mi.seekable(iterable) + self.assertEqual(mi.take(1, s), iterable[:1]) # Normal iteration + + s.seek(3) # Skip over index 2 + self.assertEqual(list(s), iterable[3:]) # Result is similar to slicing + + s.seek(0) # Back to 0 + self.assertEqual(list(s), iterable) # No difference in result + + def test_past_end(self): + iterable = [str(n) for n in range(10)] + + s = mi.seekable(iterable) + self.assertEqual(mi.take(1, s), iterable[:1]) # Normal iteration + + s.seek(20) + self.assertEqual(list(s), []) # Iterable is exhausted + + s.seek(0) # Back to 0 + self.assertEqual(list(s), iterable) # No difference in result + + def test_elements(self): + iterable = map(str, count()) + + s = mi.seekable(iterable) + mi.take(10, s) + + elements = s.elements() + self.assertEqual( + [elements[i] for i in range(10)], [str(n) for n in range(10)] + ) + self.assertEqual(len(elements), 10) + + mi.take(10, s) + self.assertEqual(list(elements), [str(n) for n in range(20)]) + + +class SequenceViewTests(TestCase): + def test_init(self): + view = mi.SequenceView((1, 2, 3)) + self.assertEqual(repr(view), "SequenceView((1, 2, 3))") + self.assertRaises(TypeError, lambda: mi.SequenceView({})) + + def test_update(self): + seq = [1, 2, 3] + view = mi.SequenceView(seq) + self.assertEqual(len(view), 3) + self.assertEqual(repr(view), "SequenceView([1, 2, 3])") + + seq.pop() + self.assertEqual(len(view), 2) + self.assertEqual(repr(view), "SequenceView([1, 2])") + + def test_indexing(self): + seq = ('a', 'b', 'c', 'd', 'e', 'f') + view = mi.SequenceView(seq) + for i in range(-len(seq), len(seq)): + self.assertEqual(view[i], seq[i]) + + def test_slicing(self): + seq = ('a', 'b', 'c', 'd', 'e', 'f') + view = mi.SequenceView(seq) + n = len(seq) + indexes = list(range(-n - 1, n + 1)) + [None] + steps = list(range(-n, n + 1)) + steps.remove(0) + for slice_args in product(indexes, indexes, steps): + i = slice(*slice_args) + self.assertEqual(view[i], seq[i]) + + def test_abc_methods(self): + # collections.Sequence should provide all of this functionality + seq = ('a', 'b', 'c', 'd', 'e', 'f', 'f') + view = mi.SequenceView(seq) + + # __contains__ + self.assertIn('b', view) + self.assertNotIn('g', view) + + # __iter__ + self.assertEqual(list(iter(view)), list(seq)) + + # __reversed__ + self.assertEqual(list(reversed(view)), list(reversed(seq))) + + # index + self.assertEqual(view.index('b'), 1) + + # count + self.assertEqual(seq.count('f'), 2) + + +class RunLengthTest(TestCase): + def test_encode(self): + iterable = (int(str(n)[0]) for n in count(800)) + actual = mi.take(4, mi.run_length.encode(iterable)) + expected = [(8, 100), (9, 100), (1, 1000), (2, 1000)] + self.assertEqual(actual, expected) + + def test_decode(self): + iterable = [('d', 4), ('c', 3), ('b', 2), ('a', 1)] + actual = ''.join(mi.run_length.decode(iterable)) + expected = 'ddddcccbba' + self.assertEqual(actual, expected) + + +class ExactlyNTests(TestCase): + """Tests for ``exactly_n()``""" + + def test_true(self): + """Iterable has ``n`` ``True`` elements""" + self.assertTrue(mi.exactly_n([True, False, True], 2)) + self.assertTrue(mi.exactly_n([1, 1, 1, 0], 3)) + self.assertTrue(mi.exactly_n([False, False], 0)) + self.assertTrue(mi.exactly_n(range(100), 10, lambda x: x < 10)) + + def test_false(self): + """Iterable does not have ``n`` ``True`` elements""" + self.assertFalse(mi.exactly_n([True, False, False], 2)) + self.assertFalse(mi.exactly_n([True, True, False], 1)) + self.assertFalse(mi.exactly_n([False], 1)) + self.assertFalse(mi.exactly_n([True], -1)) + self.assertFalse(mi.exactly_n(repeat(True), 100)) + + def test_empty(self): + """Return ``True`` if the iterable is empty and ``n`` is 0""" + self.assertTrue(mi.exactly_n([], 0)) + self.assertFalse(mi.exactly_n([], 1)) + + +class AlwaysReversibleTests(TestCase): + """Tests for ``always_reversible()``""" + + def test_regular_reversed(self): + self.assertEqual(list(reversed(range(10))), + list(mi.always_reversible(range(10)))) + self.assertEqual(list(reversed([1, 2, 3])), + list(mi.always_reversible([1, 2, 3]))) + self.assertEqual(reversed([1, 2, 3]).__class__, + mi.always_reversible([1, 2, 3]).__class__) + + def test_nonseq_reversed(self): + # Create a non-reversible generator from a sequence + with self.assertRaises(TypeError): + reversed(x for x in range(10)) + + self.assertEqual(list(reversed(range(10))), + list(mi.always_reversible(x for x in range(10)))) + self.assertEqual(list(reversed([1, 2, 3])), + list(mi.always_reversible(x for x in [1, 2, 3]))) + self.assertNotEqual(reversed((1, 2)).__class__, + mi.always_reversible(x for x in (1, 2)).__class__) + + +class CircularShiftsTests(TestCase): + def test_empty(self): + # empty iterable -> empty list + self.assertEqual(list(mi.circular_shifts([])), []) + + def test_simple_circular_shifts(self): + # test the a simple iterator case + self.assertEqual( + mi.circular_shifts(range(4)), + [(0, 1, 2, 3), (1, 2, 3, 0), (2, 3, 0, 1), (3, 0, 1, 2)] + ) + + def test_duplicates(self): + # test non-distinct entries + self.assertEqual( + mi.circular_shifts([0, 1, 0, 1]), + [(0, 1, 0, 1), (1, 0, 1, 0), (0, 1, 0, 1), (1, 0, 1, 0)] + ) + + +class MakeDecoratorTests(TestCase): + def test_basic(self): + slicer = mi.make_decorator(islice) + + @slicer(1, 10, 2) + def user_function(arg_1, arg_2, kwarg_1=None): + self.assertEqual(arg_1, 'arg_1') + self.assertEqual(arg_2, 'arg_2') + self.assertEqual(kwarg_1, 'kwarg_1') + return map(str, count()) + + it = user_function('arg_1', 'arg_2', kwarg_1='kwarg_1') + actual = list(it) + expected = ['1', '3', '5', '7', '9'] + self.assertEqual(actual, expected) + + def test_result_index(self): + def stringify(*args, **kwargs): + self.assertEqual(args[0], 'arg_0') + iterable = args[1] + self.assertEqual(args[2], 'arg_2') + self.assertEqual(kwargs['kwarg_1'], 'kwarg_1') + return map(str, iterable) + + stringifier = mi.make_decorator(stringify, result_index=1) + + @stringifier('arg_0', 'arg_2', kwarg_1='kwarg_1') + def user_function(n): + return count(n) + + it = user_function(1) + actual = mi.take(5, it) + expected = ['1', '2', '3', '4', '5'] + self.assertEqual(actual, expected) + + def test_wrap_class(self): + seeker = mi.make_decorator(mi.seekable) + + @seeker() + def user_function(n): + return map(str, range(n)) + + it = user_function(5) + self.assertEqual(list(it), ['0', '1', '2', '3', '4']) + + it.seek(0) + self.assertEqual(list(it), ['0', '1', '2', '3', '4']) + + +class MapReduceTests(TestCase): + def test_default(self): + iterable = (str(x) for x in range(5)) + keyfunc = lambda x: int(x) // 2 + actual = sorted(mi.map_reduce(iterable, keyfunc).items()) + expected = [(0, ['0', '1']), (1, ['2', '3']), (2, ['4'])] + self.assertEqual(actual, expected) + + def test_valuefunc(self): + iterable = (str(x) for x in range(5)) + keyfunc = lambda x: int(x) // 2 + valuefunc = int + actual = sorted(mi.map_reduce(iterable, keyfunc, valuefunc).items()) + expected = [(0, [0, 1]), (1, [2, 3]), (2, [4])] + self.assertEqual(actual, expected) + + def test_reducefunc(self): + iterable = (str(x) for x in range(5)) + keyfunc = lambda x: int(x) // 2 + valuefunc = int + reducefunc = lambda value_list: reduce(mul, value_list, 1) + actual = sorted( + mi.map_reduce(iterable, keyfunc, valuefunc, reducefunc).items() + ) + expected = [(0, 0), (1, 6), (2, 4)] + self.assertEqual(actual, expected) + + def test_ret(self): + d = mi.map_reduce([1, 0, 2, 0, 1, 0], bool) + self.assertEqual(d, {False: [0, 0, 0], True: [1, 2, 1]}) + self.assertRaises(KeyError, lambda: d[None].append(1)) diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/tests/test_recipes.py b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/tests/test_recipes.py new file mode 100644 index 00000000000..81721fdf9fe --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/more_itertools/tests/test_recipes.py @@ -0,0 +1,607 @@ +from doctest import DocTestSuite +from unittest import TestCase + +from itertools import combinations +from six.moves import range + +import more_itertools as mi + + +def load_tests(loader, tests, ignore): + # Add the doctests + tests.addTests(DocTestSuite('more_itertools.recipes')) + return tests + + +class AccumulateTests(TestCase): + """Tests for ``accumulate()``""" + + def test_empty(self): + """Test that an empty input returns an empty output""" + self.assertEqual(list(mi.accumulate([])), []) + + def test_default(self): + """Test accumulate with the default function (addition)""" + self.assertEqual(list(mi.accumulate([1, 2, 3])), [1, 3, 6]) + + def test_bogus_function(self): + """Test accumulate with an invalid function""" + with self.assertRaises(TypeError): + list(mi.accumulate([1, 2, 3], func=lambda x: x)) + + def test_custom_function(self): + """Test accumulate with a custom function""" + self.assertEqual( + list(mi.accumulate((1, 2, 3, 2, 1), func=max)), [1, 2, 3, 3, 3] + ) + + +class TakeTests(TestCase): + """Tests for ``take()``""" + + def test_simple_take(self): + """Test basic usage""" + t = mi.take(5, range(10)) + self.assertEqual(t, [0, 1, 2, 3, 4]) + + def test_null_take(self): + """Check the null case""" + t = mi.take(0, range(10)) + self.assertEqual(t, []) + + def test_negative_take(self): + """Make sure taking negative items results in a ValueError""" + self.assertRaises(ValueError, lambda: mi.take(-3, range(10))) + + def test_take_too_much(self): + """Taking more than an iterator has remaining should return what the + iterator has remaining. + + """ + t = mi.take(10, range(5)) + self.assertEqual(t, [0, 1, 2, 3, 4]) + + +class TabulateTests(TestCase): + """Tests for ``tabulate()``""" + + def test_simple_tabulate(self): + """Test the happy path""" + t = mi.tabulate(lambda x: x) + f = tuple([next(t) for _ in range(3)]) + self.assertEqual(f, (0, 1, 2)) + + def test_count(self): + """Ensure tabulate accepts specific count""" + t = mi.tabulate(lambda x: 2 * x, -1) + f = (next(t), next(t), next(t)) + self.assertEqual(f, (-2, 0, 2)) + + +class TailTests(TestCase): + """Tests for ``tail()``""" + + def test_greater(self): + """Length of iterable is greather than requested tail""" + self.assertEqual(list(mi.tail(3, 'ABCDEFG')), ['E', 'F', 'G']) + + def test_equal(self): + """Length of iterable is equal to the requested tail""" + self.assertEqual( + list(mi.tail(7, 'ABCDEFG')), ['A', 'B', 'C', 'D', 'E', 'F', 'G'] + ) + + def test_less(self): + """Length of iterable is less than requested tail""" + self.assertEqual( + list(mi.tail(8, 'ABCDEFG')), ['A', 'B', 'C', 'D', 'E', 'F', 'G'] + ) + + +class ConsumeTests(TestCase): + """Tests for ``consume()``""" + + def test_sanity(self): + """Test basic functionality""" + r = (x for x in range(10)) + mi.consume(r, 3) + self.assertEqual(3, next(r)) + + def test_null_consume(self): + """Check the null case""" + r = (x for x in range(10)) + mi.consume(r, 0) + self.assertEqual(0, next(r)) + + def test_negative_consume(self): + """Check that negative consumsion throws an error""" + r = (x for x in range(10)) + self.assertRaises(ValueError, lambda: mi.consume(r, -1)) + + def test_total_consume(self): + """Check that iterator is totally consumed by default""" + r = (x for x in range(10)) + mi.consume(r) + self.assertRaises(StopIteration, lambda: next(r)) + + +class NthTests(TestCase): + """Tests for ``nth()``""" + + def test_basic(self): + """Make sure the nth item is returned""" + l = range(10) + for i, v in enumerate(l): + self.assertEqual(mi.nth(l, i), v) + + def test_default(self): + """Ensure a default value is returned when nth item not found""" + l = range(3) + self.assertEqual(mi.nth(l, 100, "zebra"), "zebra") + + def test_negative_item_raises(self): + """Ensure asking for a negative item raises an exception""" + self.assertRaises(ValueError, lambda: mi.nth(range(10), -3)) + + +class AllEqualTests(TestCase): + """Tests for ``all_equal()``""" + + def test_true(self): + """Everything is equal""" + self.assertTrue(mi.all_equal('aaaaaa')) + self.assertTrue(mi.all_equal([0, 0, 0, 0])) + + def test_false(self): + """Not everything is equal""" + self.assertFalse(mi.all_equal('aaaaab')) + self.assertFalse(mi.all_equal([0, 0, 0, 1])) + + def test_tricky(self): + """Not everything is identical, but everything is equal""" + items = [1, complex(1, 0), 1.0] + self.assertTrue(mi.all_equal(items)) + + def test_empty(self): + """Return True if the iterable is empty""" + self.assertTrue(mi.all_equal('')) + self.assertTrue(mi.all_equal([])) + + def test_one(self): + """Return True if the iterable is singular""" + self.assertTrue(mi.all_equal('0')) + self.assertTrue(mi.all_equal([0])) + + +class QuantifyTests(TestCase): + """Tests for ``quantify()``""" + + def test_happy_path(self): + """Make sure True count is returned""" + q = [True, False, True] + self.assertEqual(mi.quantify(q), 2) + + def test_custom_predicate(self): + """Ensure non-default predicates return as expected""" + q = range(10) + self.assertEqual(mi.quantify(q, lambda x: x % 2 == 0), 5) + + +class PadnoneTests(TestCase): + """Tests for ``padnone()``""" + + def test_happy_path(self): + """wrapper iterator should return None indefinitely""" + r = range(2) + p = mi.padnone(r) + self.assertEqual([0, 1, None, None], [next(p) for _ in range(4)]) + + +class NcyclesTests(TestCase): + """Tests for ``nyclces()``""" + + def test_happy_path(self): + """cycle a sequence three times""" + r = ["a", "b", "c"] + n = mi.ncycles(r, 3) + self.assertEqual( + ["a", "b", "c", "a", "b", "c", "a", "b", "c"], + list(n) + ) + + def test_null_case(self): + """asking for 0 cycles should return an empty iterator""" + n = mi.ncycles(range(100), 0) + self.assertRaises(StopIteration, lambda: next(n)) + + def test_pathalogical_case(self): + """asking for negative cycles should return an empty iterator""" + n = mi.ncycles(range(100), -10) + self.assertRaises(StopIteration, lambda: next(n)) + + +class DotproductTests(TestCase): + """Tests for ``dotproduct()``'""" + + def test_happy_path(self): + """simple dotproduct example""" + self.assertEqual(400, mi.dotproduct([10, 10], [20, 20])) + + +class FlattenTests(TestCase): + """Tests for ``flatten()``""" + + def test_basic_usage(self): + """ensure list of lists is flattened one level""" + f = [[0, 1, 2], [3, 4, 5]] + self.assertEqual(list(range(6)), list(mi.flatten(f))) + + def test_single_level(self): + """ensure list of lists is flattened only one level""" + f = [[0, [1, 2]], [[3, 4], 5]] + self.assertEqual([0, [1, 2], [3, 4], 5], list(mi.flatten(f))) + + +class RepeatfuncTests(TestCase): + """Tests for ``repeatfunc()``""" + + def test_simple_repeat(self): + """test simple repeated functions""" + r = mi.repeatfunc(lambda: 5) + self.assertEqual([5, 5, 5, 5, 5], [next(r) for _ in range(5)]) + + def test_finite_repeat(self): + """ensure limited repeat when times is provided""" + r = mi.repeatfunc(lambda: 5, times=5) + self.assertEqual([5, 5, 5, 5, 5], list(r)) + + def test_added_arguments(self): + """ensure arguments are applied to the function""" + r = mi.repeatfunc(lambda x: x, 2, 3) + self.assertEqual([3, 3], list(r)) + + def test_null_times(self): + """repeat 0 should return an empty iterator""" + r = mi.repeatfunc(range, 0, 3) + self.assertRaises(StopIteration, lambda: next(r)) + + +class PairwiseTests(TestCase): + """Tests for ``pairwise()``""" + + def test_base_case(self): + """ensure an iterable will return pairwise""" + p = mi.pairwise([1, 2, 3]) + self.assertEqual([(1, 2), (2, 3)], list(p)) + + def test_short_case(self): + """ensure an empty iterator if there's not enough values to pair""" + p = mi.pairwise("a") + self.assertRaises(StopIteration, lambda: next(p)) + + +class GrouperTests(TestCase): + """Tests for ``grouper()``""" + + def test_even(self): + """Test when group size divides evenly into the length of + the iterable. + + """ + self.assertEqual( + list(mi.grouper(3, 'ABCDEF')), [('A', 'B', 'C'), ('D', 'E', 'F')] + ) + + def test_odd(self): + """Test when group size does not divide evenly into the length of the + iterable. + + """ + self.assertEqual( + list(mi.grouper(3, 'ABCDE')), [('A', 'B', 'C'), ('D', 'E', None)] + ) + + def test_fill_value(self): + """Test that the fill value is used to pad the final group""" + self.assertEqual( + list(mi.grouper(3, 'ABCDE', 'x')), + [('A', 'B', 'C'), ('D', 'E', 'x')] + ) + + +class RoundrobinTests(TestCase): + """Tests for ``roundrobin()``""" + + def test_even_groups(self): + """Ensure ordered output from evenly populated iterables""" + self.assertEqual( + list(mi.roundrobin('ABC', [1, 2, 3], range(3))), + ['A', 1, 0, 'B', 2, 1, 'C', 3, 2] + ) + + def test_uneven_groups(self): + """Ensure ordered output from unevenly populated iterables""" + self.assertEqual( + list(mi.roundrobin('ABCD', [1, 2], range(0))), + ['A', 1, 'B', 2, 'C', 'D'] + ) + + +class PartitionTests(TestCase): + """Tests for ``partition()``""" + + def test_bool(self): + """Test when pred() returns a boolean""" + lesser, greater = mi.partition(lambda x: x > 5, range(10)) + self.assertEqual(list(lesser), [0, 1, 2, 3, 4, 5]) + self.assertEqual(list(greater), [6, 7, 8, 9]) + + def test_arbitrary(self): + """Test when pred() returns an integer""" + divisibles, remainders = mi.partition(lambda x: x % 3, range(10)) + self.assertEqual(list(divisibles), [0, 3, 6, 9]) + self.assertEqual(list(remainders), [1, 2, 4, 5, 7, 8]) + + +class PowersetTests(TestCase): + """Tests for ``powerset()``""" + + def test_combinatorics(self): + """Ensure a proper enumeration""" + p = mi.powerset([1, 2, 3]) + self.assertEqual( + list(p), + [(), (1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3)] + ) + + +class UniqueEverseenTests(TestCase): + """Tests for ``unique_everseen()``""" + + def test_everseen(self): + """ensure duplicate elements are ignored""" + u = mi.unique_everseen('AAAABBBBCCDAABBB') + self.assertEqual( + ['A', 'B', 'C', 'D'], + list(u) + ) + + def test_custom_key(self): + """ensure the custom key comparison works""" + u = mi.unique_everseen('aAbACCc', key=str.lower) + self.assertEqual(list('abC'), list(u)) + + def test_unhashable(self): + """ensure things work for unhashable items""" + iterable = ['a', [1, 2, 3], [1, 2, 3], 'a'] + u = mi.unique_everseen(iterable) + self.assertEqual(list(u), ['a', [1, 2, 3]]) + + def test_unhashable_key(self): + """ensure things work for unhashable items with a custom key""" + iterable = ['a', [1, 2, 3], [1, 2, 3], 'a'] + u = mi.unique_everseen(iterable, key=lambda x: x) + self.assertEqual(list(u), ['a', [1, 2, 3]]) + + +class UniqueJustseenTests(TestCase): + """Tests for ``unique_justseen()``""" + + def test_justseen(self): + """ensure only last item is remembered""" + u = mi.unique_justseen('AAAABBBCCDABB') + self.assertEqual(list('ABCDAB'), list(u)) + + def test_custom_key(self): + """ensure the custom key comparison works""" + u = mi.unique_justseen('AABCcAD', str.lower) + self.assertEqual(list('ABCAD'), list(u)) + + +class IterExceptTests(TestCase): + """Tests for ``iter_except()``""" + + def test_exact_exception(self): + """ensure the exact specified exception is caught""" + l = [1, 2, 3] + i = mi.iter_except(l.pop, IndexError) + self.assertEqual(list(i), [3, 2, 1]) + + def test_generic_exception(self): + """ensure the generic exception can be caught""" + l = [1, 2] + i = mi.iter_except(l.pop, Exception) + self.assertEqual(list(i), [2, 1]) + + def test_uncaught_exception_is_raised(self): + """ensure a non-specified exception is raised""" + l = [1, 2, 3] + i = mi.iter_except(l.pop, KeyError) + self.assertRaises(IndexError, lambda: list(i)) + + def test_first(self): + """ensure first is run before the function""" + l = [1, 2, 3] + f = lambda: 25 + i = mi.iter_except(l.pop, IndexError, f) + self.assertEqual(list(i), [25, 3, 2, 1]) + + +class FirstTrueTests(TestCase): + """Tests for ``first_true()``""" + + def test_something_true(self): + """Test with no keywords""" + self.assertEqual(mi.first_true(range(10)), 1) + + def test_nothing_true(self): + """Test default return value.""" + self.assertEqual(mi.first_true([0, 0, 0]), False) + + def test_default(self): + """Test with a default keyword""" + self.assertEqual(mi.first_true([0, 0, 0], default='!'), '!') + + def test_pred(self): + """Test with a custom predicate""" + self.assertEqual( + mi.first_true([2, 4, 6], pred=lambda x: x % 3 == 0), 6 + ) + + +class RandomProductTests(TestCase): + """Tests for ``random_product()`` + + Since random.choice() has different results with the same seed across + python versions 2.x and 3.x, these tests use highly probably events to + create predictable outcomes across platforms. + """ + + def test_simple_lists(self): + """Ensure that one item is chosen from each list in each pair. + Also ensure that each item from each list eventually appears in + the chosen combinations. + + Odds are roughly 1 in 7.1 * 10e16 that one item from either list will + not be chosen after 100 samplings of one item from each list. Just to + be safe, better use a known random seed, too. + + """ + nums = [1, 2, 3] + lets = ['a', 'b', 'c'] + n, m = zip(*[mi.random_product(nums, lets) for _ in range(100)]) + n, m = set(n), set(m) + self.assertEqual(n, set(nums)) + self.assertEqual(m, set(lets)) + self.assertEqual(len(n), len(nums)) + self.assertEqual(len(m), len(lets)) + + def test_list_with_repeat(self): + """ensure multiple items are chosen, and that they appear to be chosen + from one list then the next, in proper order. + + """ + nums = [1, 2, 3] + lets = ['a', 'b', 'c'] + r = list(mi.random_product(nums, lets, repeat=100)) + self.assertEqual(2 * 100, len(r)) + n, m = set(r[::2]), set(r[1::2]) + self.assertEqual(n, set(nums)) + self.assertEqual(m, set(lets)) + self.assertEqual(len(n), len(nums)) + self.assertEqual(len(m), len(lets)) + + +class RandomPermutationTests(TestCase): + """Tests for ``random_permutation()``""" + + def test_full_permutation(self): + """ensure every item from the iterable is returned in a new ordering + + 15 elements have a 1 in 1.3 * 10e12 of appearing in sorted order, so + we fix a seed value just to be sure. + + """ + i = range(15) + r = mi.random_permutation(i) + self.assertEqual(set(i), set(r)) + if i == r: + raise AssertionError("Values were not permuted") + + def test_partial_permutation(self): + """ensure all returned items are from the iterable, that the returned + permutation is of the desired length, and that all items eventually + get returned. + + Sampling 100 permutations of length 5 from a set of 15 leaves a + (2/3)^100 chance that an item will not be chosen. Multiplied by 15 + items, there is a 1 in 2.6e16 chance that at least 1 item will not + show up in the resulting output. Using a random seed will fix that. + + """ + items = range(15) + item_set = set(items) + all_items = set() + for _ in range(100): + permutation = mi.random_permutation(items, 5) + self.assertEqual(len(permutation), 5) + permutation_set = set(permutation) + self.assertLessEqual(permutation_set, item_set) + all_items |= permutation_set + self.assertEqual(all_items, item_set) + + +class RandomCombinationTests(TestCase): + """Tests for ``random_combination()``""" + + def test_psuedorandomness(self): + """ensure different subsets of the iterable get returned over many + samplings of random combinations""" + items = range(15) + all_items = set() + for _ in range(50): + combination = mi.random_combination(items, 5) + all_items |= set(combination) + self.assertEqual(all_items, set(items)) + + def test_no_replacement(self): + """ensure that elements are sampled without replacement""" + items = range(15) + for _ in range(50): + combination = mi.random_combination(items, len(items)) + self.assertEqual(len(combination), len(set(combination))) + self.assertRaises( + ValueError, lambda: mi.random_combination(items, len(items) + 1) + ) + + +class RandomCombinationWithReplacementTests(TestCase): + """Tests for ``random_combination_with_replacement()``""" + + def test_replacement(self): + """ensure that elements are sampled with replacement""" + items = range(5) + combo = mi.random_combination_with_replacement(items, len(items) * 2) + self.assertEqual(2 * len(items), len(combo)) + if len(set(combo)) == len(combo): + raise AssertionError("Combination contained no duplicates") + + def test_pseudorandomness(self): + """ensure different subsets of the iterable get returned over many + samplings of random combinations""" + items = range(15) + all_items = set() + for _ in range(50): + combination = mi.random_combination_with_replacement(items, 5) + all_items |= set(combination) + self.assertEqual(all_items, set(items)) + + +class NthCombinationTests(TestCase): + def test_basic(self): + iterable = 'abcdefg' + r = 4 + for index, expected in enumerate(combinations(iterable, r)): + actual = mi.nth_combination(iterable, r, index) + self.assertEqual(actual, expected) + + def test_long(self): + actual = mi.nth_combination(range(180), 4, 2000000) + expected = (2, 12, 35, 126) + self.assertEqual(actual, expected) + + +class PrependTests(TestCase): + def test_basic(self): + value = 'a' + iterator = iter('bcdefg') + actual = list(mi.prepend(value, iterator)) + expected = list('abcdefg') + self.assertEqual(actual, expected) + + def test_multiple(self): + value = 'ab' + iterator = iter('cdefg') + actual = tuple(mi.prepend(value, iterator)) + expected = ('ab',) + tuple('cdefg') + self.assertEqual(actual, expected) diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/setup.cfg b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/setup.cfg new file mode 100644 index 00000000000..7c0e37ba6cf --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/setup.cfg @@ -0,0 +1,3 @@ +[flake8] +exclude = ./docs/conf.py, .eggs/ +ignore = E731, E741, F999 diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/setup.py b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/setup.py new file mode 100644 index 00000000000..484e4d06f79 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/setup.py @@ -0,0 +1,59 @@ +# Hack to prevent stupid error on exit of `python setup.py test`. (See +# http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html.) +try: + import multiprocessing # noqa +except ImportError: + pass +from re import sub + +from setuptools import setup, find_packages + + +def get_long_description(): + # Fix display issues on PyPI caused by RST markup + readme = open('README.rst').read() + + version_lines = [] + with open('docs/versions.rst') as infile: + next(infile) + for line in infile: + line = line.rstrip().replace('.. automodule:: more_itertools', '') + version_lines.append(line) + version_history = '\n'.join(version_lines) + version_history = sub(r':func:`([a-zA-Z0-9._]+)`', r'\1', version_history) + + ret = readme + '\n\n' + version_history + return ret + + +setup( + name='more-itertools', + version='4.2.0', + description='More routines for operating on iterables, beyond itertools', + long_description=get_long_description(), + author='Erik Rose', + author_email='erikrose@grinchcentral.com', + license='MIT', + packages=find_packages(exclude=['ez_setup']), + install_requires=['six>=1.0.0,<2.0.0'], + test_suite='more_itertools.tests', + url='https://github.com/erikrose/more-itertools', + include_package_data=True, + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'Natural Language :: English', + 'License :: OSI Approved :: MIT License', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.2', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Topic :: Software Development :: Libraries'], + keywords=['itertools', 'iterator', 'iteration', 'filter', 'peek', + 'peekable', 'collate', 'chunk', 'chunked'], +) diff --git a/tests/wpt/web-platform-tests/tools/third_party/more-itertools/tox.ini b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/tox.ini new file mode 100644 index 00000000000..70c68c058d1 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/more-itertools/tox.ini @@ -0,0 +1,5 @@ +[tox] +envlist = py27, py34, py35, py36, py37 + +[testenv] +commands = {envbindir}/python -m unittest discover -v diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/.github/PULL_REQUEST_TEMPLATE.md b/tests/wpt/web-platform-tests/tools/third_party/pytest/.github/PULL_REQUEST_TEMPLATE.md index bf9fc199f59..23a9f8c5683 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/.github/PULL_REQUEST_TEMPLATE.md +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/.github/PULL_REQUEST_TEMPLATE.md @@ -1,15 +1,14 @@ Thanks for submitting a PR, your contribution is really appreciated! -Here's a quick checklist that should be present in PRs: +Here's a quick checklist that should be present in PRs (you can delete this text from the final description, this is +just a guideline): -- [ ] Add a new news fragment into the changelog folder - * name it `$issue_id.$type` for example (588.bug) - * if you don't have an issue_id change it to the pr id after creating the pr - * ensure type is one of `removal`, `feature`, `bugfix`, `vendor`, `doc` or `trivial` - * Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files." -- [ ] Target: for `bugfix`, `vendor`, `doc` or `trivial` fixes, target `master`; for removals or features target `features`; -- [ ] Make sure to include reasonable tests for your change if necessary +- [ ] Create a new changelog file in the `changelog` folder, with a name like `..rst`. See [changelog/README.rst](/changelog/README.rst) for details. +- [ ] Target the `master` branch for bug fixes, documentation updates and trivial changes. +- [ ] Target the `features` branch for new features and removals/deprecations. +- [ ] Include documentation when adding new features. +- [ ] Include new tests or update existing tests when applicable. -Unless your change is a trivial or a documentation fix (e.g., a typo or reword of a small section) please: +Unless your change is trivial or a small documentation fix (e.g., a typo or reword of a small section) please: -- [ ] Add yourself to `AUTHORS`, in alphabetical order; +- [ ] Add yourself to `AUTHORS` in alphabetical order; diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/.gitignore b/tests/wpt/web-platform-tests/tools/third_party/pytest/.gitignore index 3b7ec9facf2..afb6bf9fd3f 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/.gitignore +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/.gitignore @@ -19,7 +19,7 @@ include/ .hypothesis/ # autogenerated -_pytest/_version.py +src/_pytest/_version.py # setuptools .eggs/ @@ -33,6 +33,7 @@ env/ 3rdparty/ .tox .cache +.pytest_cache .coverage .ropeproject .idea diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/.pre-commit-config.yaml b/tests/wpt/web-platform-tests/tools/third_party/pytest/.pre-commit-config.yaml new file mode 100644 index 00000000000..e50891bbc1c --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/.pre-commit-config.yaml @@ -0,0 +1,36 @@ +exclude: doc/en/example/py2py3/test_py2.py +repos: +- repo: https://github.com/ambv/black + rev: 18.4a4 + hooks: + - id: black + args: [--safe, --quiet] + language_version: python3.6 +- repo: https://github.com/asottile/blacken-docs + rev: v0.1.1 + hooks: + - id: blacken-docs + additional_dependencies: [black==18.5b1] + language_version: python3.6 +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v1.2.3 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: debug-statements + exclude: _pytest/debugging.py + - id: flake8 +- repo: https://github.com/asottile/pyupgrade + rev: v1.2.0 + hooks: + - id: pyupgrade +- repo: local + hooks: + - id: rst + name: rst + entry: rst-lint --encoding utf-8 + files: ^(CHANGELOG.rst|HOWTORELEASE.rst|README.rst|changelog/.*)$ + language: python + additional_dependencies: [pygments, restructuredtext_lint] + python_version: python3.6 diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/.travis.yml b/tests/wpt/web-platform-tests/tools/third_party/pytest/.travis.yml index 938391cde09..1d092149b5d 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/.travis.yml +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/.travis.yml @@ -1,17 +1,19 @@ sudo: false language: python +stages: +- linting +- test +- deploy python: - '3.6' -# command to install dependencies install: - pip install --upgrade --pre tox -# # command to run tests env: matrix: # coveralls is not listed in tox's envlist, but should run in travis - TOXENV=coveralls # note: please use "tox --listenvs" to populate the build matrix below - - TOXENV=linting + # please remove the linting env in all cases - TOXENV=py27 - TOXENV=py34 - TOXENV=py36 @@ -29,7 +31,7 @@ env: - TOXENV=doctesting - TOXENV=docs -matrix: +jobs: include: - env: TOXENV=pypy python: 'pypy-5.4' @@ -39,9 +41,30 @@ matrix: python: '3.5' - env: TOXENV=py37 python: 'nightly' - allow_failures: - - env: TOXENV=py37 - python: 'nightly' + + - stage: deploy + python: '3.6' + env: + install: pip install -U setuptools setuptools_scm + script: skip + deploy: + provider: pypi + user: nicoddemus + distributions: sdist bdist_wheel + skip_upload_docs: true + password: + secure: xanTgTUu6XDQVqB/0bwJQXoDMnU5tkwZc5koz6mBkkqZhKdNOi2CLoC1XhiSZ+ah24l4V1E0GAqY5kBBcy9d7NVe4WNg4tD095LsHw+CRU6/HCVIFfyk2IZ+FPAlguesCcUiJSXOrlBF+Wj68wEvLoK7EoRFbJeiZ/f91Ww1sbtDlqXABWGHrmhPJL5Wva7o7+wG7JwJowqdZg1pbQExsCc7b53w4v2RBu3D6TJaTAzHiVsW+nUSI67vKI/uf+cR/OixsTfy37wlHgSwihYmrYLFls3V0bSpahCim3bCgMaFZx8S8xrdgJ++PzBCof2HeflFKvW+VCkoYzGEG4NrTWJoNz6ni4red9GdvfjGH3YCjAKS56h9x58zp2E5rpsb/kVq5/45xzV+dq6JRuhQ1nJWjBC6fSKAc/bfwnuFK3EBxNLkvBssLHvsNjj5XG++cB8DdS9wVGUqjpoK4puaXUWFqy4q3S9F86HEsKNgExtieA9qNx+pCIZVs6JCXZNjr0I5eVNzqJIyggNgJG6RyravsU35t9Zd9doL5g4Y7UKmAGTn1Sz24HQ4sMQgXdm2SyD8gEK5je4tlhUvfGtDvMSlstq71kIn9nRpFnqB6MFlbYSEAZmo8dGbCquoUc++6Rum208wcVbrzzVtGlXB/Ow9AbFMYeAGA0+N/K1e59c= + on: + tags: true + repo: pytest-dev/pytest + - stage: linting + python: '3.6' + env: + install: + - pip install pre-commit + - pre-commit install-hooks + script: + - pre-commit run --all-files script: tox --recreate @@ -54,3 +77,7 @@ notifications: skip_join: true email: - pytest-commit@python.org +cache: + directories: + - $HOME/.cache/pip + - $HOME/.cache/pre-commit diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/AUTHORS b/tests/wpt/web-platform-tests/tools/third_party/pytest/AUTHORS index 44ae6aa43ab..3edfdcf85ea 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/AUTHORS +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/AUTHORS @@ -3,21 +3,27 @@ merlinux GmbH, Germany, office at merlinux eu Contributors include:: +Aaron Coleman Abdeali JK Abhijeet Kasurde Ahn Ki-Wook +Alan Velasco Alexander Johnson Alexei Kozlenok Anatoly Bubenkoff +Anders Hovmöller Andras Tim Andreas Zeidler Andrzej Ostrowski Andy Freeland Anthon van der Neut +Anthony Shaw Anthony Sottile Antony Lee Armin Rigo +Aron Coyle Aron Curzon +Aviral Verma Aviv Palivoda Barney Gale Ben Webb @@ -25,11 +31,13 @@ Benjamin Peterson Bernard Pratz Bob Ippolito Brian Dorsey +Brian Maissy Brian Okken Brianna Laugher Bruno Oliveira Cal Leeming Carl Friedrich Bolz +Carlos Jenkins Ceridwen Charles Cloud Charnjit SiNGH (CCSJ) @@ -38,6 +46,7 @@ Christian Boelsen Christian Theunert Christian Tismer Christopher Gilling +Cyrus Maden Daniel Grana Daniel Hahler Daniel Nuri @@ -73,16 +82,20 @@ Greg Price Grig Gheorghiu Grigorii Eremeev (budulianin) Guido Wesdorp +Guoqiang Zhang Harald Armin Massa +Henk-Jaap Wagenaar Hugo van Kemenade Hui Wang (coldnight) Ian Bicking +Ian Lesperance Jaap Broekhuizen Jan Balster Janne Vanhala Jason R. Coombs Javier Domingo Cansino Javier Romero +Jeff Rackauckas Jeff Widman John Eddie Ayson John Towler @@ -90,13 +103,16 @@ Jon Sonesen Jonas Obrist Jordan Guymon Jordan Moldow +Jordan Speicher Joshua Bronson Jurko Gospodnetić Justyna Janczyszyn Kale Kundert Katarzyna Jachim +Katerina Koukiou Kevin Cox Kodi B. Arfer +Kostis Anagnostopoulos Lawrence Mitchell Lee Kamentsky Lev Maximov @@ -131,22 +147,26 @@ Michael Seifert Michal Wajszczuk Mihai Capotă Mike Lundy +Miro Hrončok Nathaniel Waisbrot Ned Batchelder Neven Mundar Nicolas Delaby Oleg Pidsadnyi +Oleg Sushchenko Oliver Bestwalter Omar Kohl Omer Hadari Patrick Hayes Paweł Adamczak +Pedro Algarvio Pieter Mulder Piotr Banaszkiewicz Punyashloka Biswal Quentin Pradet Ralf Schmitt Ran Benita +Raphael Castaneda Raphael Pierzina Raquel Alegre Ravi Chandra @@ -173,17 +193,21 @@ Tareq Alayan Ted Xiao Thomas Grainger Thomas Hisch +Tim Strazny Tom Dalton Tom Viner Trevor Bekolay Tyler Goodlet +Tzu-ping Chung Vasily Kuznetsov Victor Uriarte Vidar T. Fauske Vitaly Lashmanov Vlad Dragos +William Lee Wouter van Ackooy Xuan Luong Xuecong Liao Zoltán Máté Roland Puntaier +Allan Feldman diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/CHANGELOG.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/CHANGELOG.rst index 7e7bfaf0441..21a090414a0 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/CHANGELOG.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/CHANGELOG.rst @@ -1,4 +1,4 @@ -.. +.. You should *NOT* be adding new change log entries to this file, this file is managed by towncrier. You *may* edit previous change logs to fix problems like typo corrections or such. @@ -8,6 +8,695 @@ .. towncrier release notes start +Pytest 3.6.2 (2018-06-20) +========================= + +Bug Fixes +--------- + +- Fix regression in ``Node.add_marker`` by extracting the mark object of a + ``MarkDecorator``. (`#3555 + `_) + +- Warnings without ``location`` were reported as ``None``. This is corrected to + now report ````. (`#3563 + `_) + +- Continue to call finalizers in the stack when a finalizer in a former scope + raises an exception. (`#3569 + `_) + +- Fix encoding error with `print` statements in doctests (`#3583 + `_) + + +Improved Documentation +---------------------- + +- Add documentation for the ``--strict`` flag. (`#3549 + `_) + + +Trivial/Internal Changes +------------------------ + +- Update old quotation style to parens in fixture.rst documentation. (`#3525 + `_) + +- Improve display of hint about ``--fulltrace`` with ``KeyboardInterrupt``. + (`#3545 `_) + +- pytest's testsuite is no longer runnable through ``python setup.py test`` -- + instead invoke ``pytest`` or ``tox`` directly. (`#3552 + `_) + +- Fix typo in documentation (`#3567 + `_) + + +Pytest 3.6.1 (2018-06-05) +========================= + +Bug Fixes +--------- + +- Fixed a bug where stdout and stderr were logged twice by junitxml when a test + was marked xfail. (`#3491 + `_) + +- Fix ``usefixtures`` mark applyed to unittest tests by correctly instantiating + ``FixtureInfo``. (`#3498 + `_) + +- Fix assertion rewriter compatibility with libraries that monkey patch + ``file`` objects. (`#3503 + `_) + + +Improved Documentation +---------------------- + +- Added a section on how to use fixtures as factories to the fixture + documentation. (`#3461 `_) + + +Trivial/Internal Changes +------------------------ + +- Enable caching for pip/pre-commit in order to reduce build time on + travis/appveyor. (`#3502 + `_) + +- Switch pytest to the src/ layout as we already suggested it for good practice + - now we implement it as well. (`#3513 + `_) + +- Fix if in tests to support 3.7.0b5, where a docstring handling in AST got + reverted. (`#3530 `_) + +- Remove some python2.5 compatibility code. (`#3529 + `_) + + +Pytest 3.6.0 (2018-05-23) +========================= + +Features +-------- + +- Revamp the internals of the ``pytest.mark`` implementation with correct per + node handling which fixes a number of long standing bugs caused by the old + design. This introduces new ``Node.iter_markers(name)`` and + ``Node.get_closest_mark(name)`` APIs. Users are **strongly encouraged** to + read the `reasons for the revamp in the docs + `_, + or jump over to details about `updating existing code to use the new APIs + `_. (`#3317 + `_) + +- Now when ``@pytest.fixture`` is applied more than once to the same function a + ``ValueError`` is raised. This buggy behavior would cause surprising problems + and if was working for a test suite it was mostly by accident. (`#2334 + `_) + +- Support for Python 3.7's builtin ``breakpoint()`` method, see `Using the + builtin breakpoint function + `_ for + details. (`#3180 `_) + +- ``monkeypatch`` now supports a ``context()`` function which acts as a context + manager which undoes all patching done within the ``with`` block. (`#3290 + `_) + +- The ``--pdb`` option now causes KeyboardInterrupt to enter the debugger, + instead of stopping the test session. On python 2.7, hitting CTRL+C again + exits the debugger. On python 3.2 and higher, use CTRL+D. (`#3299 + `_) + +- pytest not longer changes the log level of the root logger when the + ``log-level`` parameter has greater numeric value than that of the level of + the root logger, which makes it play better with custom logging configuration + in user code. (`#3307 `_) + + +Bug Fixes +--------- + +- A rare race-condition which might result in corrupted ``.pyc`` files on + Windows has been hopefully solved. (`#3008 + `_) + +- Also use iter_marker for discovering the marks applying for marker + expressions from the cli to avoid the bad data from the legacy mark storage. + (`#3441 `_) + +- When showing diffs of failed assertions where the contents contain only + whitespace, escape them using ``repr()`` first to make it easy to spot the + differences. (`#3443 `_) + + +Improved Documentation +---------------------- + +- Change documentation copyright year to a range which auto-updates itself each + time it is published. (`#3303 + `_) + + +Trivial/Internal Changes +------------------------ + +- ``pytest`` now depends on the `python-atomicwrites + `_ library. (`#3008 + `_) + +- Update all pypi.python.org URLs to pypi.org. (`#3431 + `_) + +- Detect `pytest_` prefixed hooks using the internal plugin manager since + ``pluggy`` is deprecating the ``implprefix`` argument to ``PluginManager``. + (`#3487 `_) + +- Import ``Mapping`` and ``Sequence`` from ``_pytest.compat`` instead of + directly from ``collections`` in ``python_api.py::approx``. Add ``Mapping`` + to ``_pytest.compat``, import it from ``collections`` on python 2, but from + ``collections.abc`` on Python 3 to avoid a ``DeprecationWarning`` on Python + 3.7 or newer. (`#3497 `_) + + +Pytest 3.5.1 (2018-04-23) +========================= + + +Bug Fixes +--------- + +- Reset ``sys.last_type``, ``sys.last_value`` and ``sys.last_traceback`` before + each test executes. Those attributes are added by pytest during the test run + to aid debugging, but were never reset so they would create a leaking + reference to the last failing test's frame which in turn could never be + reclaimed by the garbage collector. (`#2798 + `_) + +- ``pytest.raises`` now raises ``TypeError`` when receiving an unknown keyword + argument. (`#3348 `_) + +- ``pytest.raises`` now works with exception classes that look like iterables. + (`#3372 `_) + + +Improved Documentation +---------------------- + +- Fix typo in ``caplog`` fixture documentation, which incorrectly identified + certain attributes as methods. (`#3406 + `_) + + +Trivial/Internal Changes +------------------------ + +- Added a more indicative error message when parametrizing a function whose + argument takes a default value. (`#3221 + `_) + +- Remove internal ``_pytest.terminal.flatten`` function in favor of + ``more_itertools.collapse``. (`#3330 + `_) + +- Import some modules from ``collections.abc`` instead of ``collections`` as + the former modules trigger ``DeprecationWarning`` in Python 3.7. (`#3339 + `_) + +- record_property is no longer experimental, removing the warnings was + forgotten. (`#3360 `_) + +- Mention in documentation and CLI help that fixtures with leading ``_`` are + printed by ``pytest --fixtures`` only if the ``-v`` option is added. (`#3398 + `_) + + +Pytest 3.5.0 (2018-03-21) +========================= + +Deprecations and Removals +------------------------- + +- ``record_xml_property`` fixture is now deprecated in favor of the more + generic ``record_property``. (`#2770 + `_) + +- Defining ``pytest_plugins`` is now deprecated in non-top-level conftest.py + files, because they "leak" to the entire directory tree. (`#3084 + `_) + + +Features +-------- + +- New ``--show-capture`` command-line option that allows to specify how to + display captured output when tests fail: ``no``, ``stdout``, ``stderr``, + ``log`` or ``all`` (the default). (`#1478 + `_) + +- New ``--rootdir`` command-line option to override the rules for discovering + the root directory. See `customize + `_ in the documentation for + details. (`#1642 `_) + +- Fixtures are now instantiated based on their scopes, with higher-scoped + fixtures (such as ``session``) being instantiated first than lower-scoped + fixtures (such as ``function``). The relative order of fixtures of the same + scope is kept unchanged, based in their declaration order and their + dependencies. (`#2405 `_) + +- ``record_xml_property`` renamed to ``record_property`` and is now compatible + with xdist, markers and any reporter. ``record_xml_property`` name is now + deprecated. (`#2770 `_) + +- New ``--nf``, ``--new-first`` options: run new tests first followed by the + rest of the tests, in both cases tests are also sorted by the file modified + time, with more recent files coming first. (`#3034 + `_) + +- New ``--last-failed-no-failures`` command-line option that allows to specify + the behavior of the cache plugin's ```--last-failed`` feature when no tests + failed in the last run (or no cache was found): ``none`` or ``all`` (the + default). (`#3139 `_) + +- New ``--doctest-continue-on-failure`` command-line option to enable doctests + to show multiple failures for each snippet, instead of stopping at the first + failure. (`#3149 `_) + +- Captured log messages are added to the ```` tag in the generated + junit xml file if the ``junit_logging`` ini option is set to ``system-out``. + If the value of this ini option is ``system-err``, the logs are written to + ````. The default value for ``junit_logging`` is ``no``, meaning + captured logs are not written to the output file. (`#3156 + `_) + +- Allow the logging plugin to handle ``pytest_runtest_logstart`` and + ``pytest_runtest_logfinish`` hooks when live logs are enabled. (`#3189 + `_) + +- Passing `--log-cli-level` in the command-line now automatically activates + live logging. (`#3190 `_) + +- Add command line option ``--deselect`` to allow deselection of individual + tests at collection time. (`#3198 + `_) + +- Captured logs are printed before entering pdb. (`#3204 + `_) + +- Deselected item count is now shown before tests are run, e.g. ``collected X + items / Y deselected``. (`#3213 + `_) + +- The builtin module ``platform`` is now available for use in expressions in + ``pytest.mark``. (`#3236 + `_) + +- The *short test summary info* section now is displayed after tracebacks and + warnings in the terminal. (`#3255 + `_) + +- New ``--verbosity`` flag to set verbosity level explicitly. (`#3296 + `_) + +- ``pytest.approx`` now accepts comparing a numpy array with a scalar. (`#3312 + `_) + + +Bug Fixes +--------- + +- Suppress ``IOError`` when closing the temporary file used for capturing + streams in Python 2.7. (`#2370 + `_) + +- Fixed ``clear()`` method on ``caplog`` fixture which cleared ``records``, but + not the ``text`` property. (`#3297 + `_) + +- During test collection, when stdin is not allowed to be read, the + ``DontReadFromStdin`` object still allow itself to be iterable and resolved + to an iterator without crashing. (`#3314 + `_) + + +Improved Documentation +---------------------- + +- Added a `reference `_ page + to the docs. (`#1713 `_) + + +Trivial/Internal Changes +------------------------ + +- Change minimum requirement of ``attrs`` to ``17.4.0``. (`#3228 + `_) + +- Renamed example directories so all tests pass when ran from the base + directory. (`#3245 `_) + +- Internal ``mark.py`` module has been turned into a package. (`#3250 + `_) + +- ``pytest`` now depends on the `more-itertools + `_ package. (`#3265 + `_) + +- Added warning when ``[pytest]`` section is used in a ``.cfg`` file passed + with ``-c`` (`#3268 `_) + +- ``nodeids`` can now be passed explicitly to ``FSCollector`` and ``Node`` + constructors. (`#3291 `_) + +- Internal refactoring of ``FormattedExcinfo`` to use ``attrs`` facilities and + remove old support code for legacy Python versions. (`#3292 + `_) + +- Refactoring to unify how verbosity is handled internally. (`#3296 + `_) + +- Internal refactoring to better integrate with argparse. (`#3304 + `_) + +- Fix a python example when calling a fixture in doc/en/usage.rst (`#3308 + `_) + + +Pytest 3.4.2 (2018-03-04) +========================= + +Bug Fixes +--------- + +- Removed progress information when capture option is ``no``. (`#3203 + `_) + +- Refactor check of bindir from ``exists`` to ``isdir``. (`#3241 + `_) + +- Fix ``TypeError`` issue when using ``approx`` with a ``Decimal`` value. + (`#3247 `_) + +- Fix reference cycle generated when using the ``request`` fixture. (`#3249 + `_) + +- ``[tool:pytest]`` sections in ``*.cfg`` files passed by the ``-c`` option are + now properly recognized. (`#3260 + `_) + + +Improved Documentation +---------------------- + +- Add logging plugin to plugins list. (`#3209 + `_) + + +Trivial/Internal Changes +------------------------ + +- Fix minor typo in fixture.rst (`#3259 + `_) + + +Pytest 3.4.1 (2018-02-20) +========================= + +Bug Fixes +--------- + +- Move import of ``doctest.UnexpectedException`` to top-level to avoid possible + errors when using ``--pdb``. (`#1810 + `_) + +- Added printing of captured stdout/stderr before entering pdb, and improved a + test which was giving false negatives about output capturing. (`#3052 + `_) + +- Fix ordering of tests using parametrized fixtures which can lead to fixtures + being created more than necessary. (`#3161 + `_) + +- Fix bug where logging happening at hooks outside of "test run" hooks would + cause an internal error. (`#3184 + `_) + +- Detect arguments injected by ``unittest.mock.patch`` decorator correctly when + pypi ``mock.patch`` is installed and imported. (`#3206 + `_) + +- Errors shown when a ``pytest.raises()`` with ``match=`` fails are now cleaner + on what happened: When no exception was raised, the "matching '...'" part got + removed as it falsely implies that an exception was raised but it didn't + match. When a wrong exception was raised, it's now thrown (like + ``pytest.raised()`` without ``match=`` would) instead of complaining about + the unmatched text. (`#3222 + `_) + +- Fixed output capture handling in doctests on macOS. (`#985 + `_) + + +Improved Documentation +---------------------- + +- Add Sphinx parameter docs for ``match`` and ``message`` args to + ``pytest.raises``. (`#3202 + `_) + + +Trivial/Internal Changes +------------------------ + +- pytest has changed the publication procedure and is now being published to + PyPI directly from Travis. (`#3060 + `_) + +- Rename ``ParameterSet._for_parameterize()`` to ``_for_parametrize()`` in + order to comply with the naming convention. (`#3166 + `_) + +- Skip failing pdb/doctest test on mac. (`#985 + `_) + + +Pytest 3.4.0 (2018-01-30) +========================= + +Deprecations and Removals +------------------------- + +- All pytest classes now subclass ``object`` for better Python 2/3 compatibility. + This should not affect user code except in very rare edge cases. (`#2147 + `_) + + +Features +-------- + +- Introduce ``empty_parameter_set_mark`` ini option to select which mark to + apply when ``@pytest.mark.parametrize`` is given an empty set of parameters. + Valid options are ``skip`` (default) and ``xfail``. Note that it is planned + to change the default to ``xfail`` in future releases as this is considered + less error prone. (`#2527 + `_) + +- **Incompatible change**: after community feedback the `logging + `_ functionality has + undergone some changes. Please consult the `logging documentation + `_ + for details. (`#3013 `_) + +- Console output falls back to "classic" mode when capturing is disabled (``-s``), + otherwise the output gets garbled to the point of being useless. (`#3038 + `_) + +- New `pytest_runtest_logfinish + `_ + hook which is called when a test item has finished executing, analogous to + `pytest_runtest_logstart + `_. + (`#3101 `_) + +- Improve performance when collecting tests using many fixtures. (`#3107 + `_) + +- New ``caplog.get_records(when)`` method which provides access to the captured + records for the ``"setup"``, ``"call"`` and ``"teardown"`` + testing stages. (`#3117 `_) + +- New fixture ``record_xml_attribute`` that allows modifying and inserting + attributes on the ```` xml node in JUnit reports. (`#3130 + `_) + +- The default cache directory has been renamed from ``.cache`` to + ``.pytest_cache`` after community feedback that the name ``.cache`` did not + make it clear that it was used by pytest. (`#3138 + `_) + +- Colorize the levelname column in the live-log output. (`#3142 + `_) + + +Bug Fixes +--------- + +- Fix hanging pexpect test on MacOS by using flush() instead of wait(). + (`#2022 `_) + +- Fix restoring Python state after in-process pytest runs with the + ``pytester`` plugin; this may break tests using multiple inprocess + pytest runs if later ones depend on earlier ones leaking global interpreter + changes. (`#3016 `_) + +- Fix skipping plugin reporting hook when test aborted before plugin setup + hook. (`#3074 `_) + +- Fix progress percentage reported when tests fail during teardown. (`#3088 + `_) + +- **Incompatible change**: ``-o/--override`` option no longer eats all the + remaining options, which can lead to surprising behavior: for example, + ``pytest -o foo=1 /path/to/test.py`` would fail because ``/path/to/test.py`` + would be considered as part of the ``-o`` command-line argument. One + consequence of this is that now multiple configuration overrides need + multiple ``-o`` flags: ``pytest -o foo=1 -o bar=2``. (`#3103 + `_) + + +Improved Documentation +---------------------- + +- Document hooks (defined with ``historic=True``) which cannot be used with + ``hookwrapper=True``. (`#2423 + `_) + +- Clarify that warning capturing doesn't change the warning filter by default. + (`#2457 `_) + +- Clarify a possible confusion when using pytest_fixture_setup with fixture + functions that return None. (`#2698 + `_) + +- Fix the wording of a sentence on doctest flags used in pytest. (`#3076 + `_) + +- Prefer ``https://*.readthedocs.io`` over ``http://*.rtfd.org`` for links in + the documentation. (`#3092 + `_) + +- Improve readability (wording, grammar) of Getting Started guide (`#3131 + `_) + +- Added note that calling pytest.main multiple times from the same process is + not recommended because of import caching. (`#3143 + `_) + + +Trivial/Internal Changes +------------------------ + +- Show a simple and easy error when keyword expressions trigger a syntax error + (for example, ``"-k foo and import"`` will show an error that you can not use + the ``import`` keyword in expressions). (`#2953 + `_) + +- Change parametrized automatic test id generation to use the ``__name__`` + attribute of functions instead of the fallback argument name plus counter. + (`#2976 `_) + +- Replace py.std with stdlib imports. (`#3067 + `_) + +- Corrected 'you' to 'your' in logging docs. (`#3129 + `_) + + +Pytest 3.3.2 (2017-12-25) +========================= + +Bug Fixes +--------- + +- pytester: ignore files used to obtain current user metadata in the fd leak + detector. (`#2784 `_) + +- Fix **memory leak** where objects returned by fixtures were never destructed + by the garbage collector. (`#2981 + `_) + +- Fix conversion of pyargs to filename to not convert symlinks on Python 2. (`#2985 + `_) + +- ``PYTEST_DONT_REWRITE`` is now checked for plugins too rather than only for + test modules. (`#2995 `_) + + +Improved Documentation +---------------------- + +- Add clarifying note about behavior of multiple parametrized arguments (`#3001 + `_) + + +Trivial/Internal Changes +------------------------ + +- Code cleanup. (`#3015 `_, + `#3021 `_) + +- Clean up code by replacing imports and references of `_ast` to `ast`. (`#3018 + `_) + + +Pytest 3.3.1 (2017-12-05) +========================= + +Bug Fixes +--------- + +- Fix issue about ``-p no:`` having no effect. (`#2920 + `_) + +- Fix regression with warnings that contained non-strings in their arguments in + Python 2. (`#2956 `_) + +- Always escape null bytes when setting ``PYTEST_CURRENT_TEST``. (`#2957 + `_) + +- Fix ``ZeroDivisionError`` when using the ``testmon`` plugin when no tests + were actually collected. (`#2971 + `_) + +- Bring back ``TerminalReporter.writer`` as an alias to + ``TerminalReporter._tw``. This alias was removed by accident in the ``3.3.0`` + release. (`#2984 `_) + +- The ``pytest-capturelog`` plugin is now also blacklisted, avoiding errors when + running pytest with it still installed. (`#3004 + `_) + + +Improved Documentation +---------------------- + +- Fix broken link to plugin ``pytest-localserver``. (`#2963 + `_) + + +Trivial/Internal Changes +------------------------ + +- Update github "bugs" link in ``CONTRIBUTING.rst`` (`#2949 + `_) + + Pytest 3.3.0 (2017-11-23) ========================= @@ -68,7 +757,7 @@ Features - Match ``warns`` signature to ``raises`` by adding ``match`` keyword. (`#2708 `_) -- Pytest now captures and displays output from the standard `logging` module. +- Pytest now captures and displays output from the standard ``logging`` module. The user can control the logging level to be captured by specifying options in ``pytest.ini``, the command line and also during individual tests using markers. Also, a ``caplog`` fixture is available that enables users to test @@ -115,10 +804,10 @@ Bug Fixes `_) - If an exception happens while loading a plugin, pytest no longer hides the - original traceback. In python2 it will show the original traceback with a new - message that explains in which plugin. In python3 it will show 2 canonized + original traceback. In Python 2 it will show the original traceback with a new + message that explains in which plugin. In Python 3 it will show 2 canonized exceptions, the original exception while loading the plugin in addition to an - exception that PyTest throws about loading a plugin. (`#2491 + exception that pytest throws about loading a plugin. (`#2491 `_) - ``capsys`` and ``capfd`` can now be used by other fixtures. (`#2709 @@ -693,7 +1382,7 @@ Changes * Testcase reports with a ``url`` attribute will now properly write this to junitxml. Thanks `@fushi`_ for the PR (`#1874`_). -* Remove common items from dict comparision output when verbosity=1. Also update +* Remove common items from dict comparison output when verbosity=1. Also update the truncation message to make it clearer that pytest truncates all assertion messages if verbosity < 2 (`#1512`_). Thanks `@mattduck`_ for the PR @@ -705,7 +1394,7 @@ Changes * fix `#2013`_: turn RecordedWarning into ``namedtuple``, to give it a comprehensible repr while preventing unwarranted modification. -* fix `#2208`_: ensure a iteration limit for _pytest.compat.get_real_func. +* fix `#2208`_: ensure an iteration limit for _pytest.compat.get_real_func. Thanks `@RonnyPfannschmidt`_ for the report and PR. * Hooks are now verified after collection is complete, rather than right after loading installed plugins. This @@ -809,7 +1498,7 @@ Bug Fixes Notably, importing the ``anydbm`` module is fixed. (`#2248`_). Thanks `@pfhayes`_ for the PR. -* junitxml: Fix problematic case where system-out tag occured twice per testcase +* junitxml: Fix problematic case where system-out tag occurred twice per testcase element in the XML report. Thanks `@kkoukiou`_ for the PR. * Fix regression, pytest now skips unittest correctly if run with ``--pdb`` @@ -2405,7 +3094,7 @@ time or change existing behaviors in order to make them less surprising/more use "::" node id specifications (copy pasted from "-v" output) - fix issue544 by only removing "@NUM" at the end of "::" separated parts - and if the part has an ".py" extension + and if the part has a ".py" extension - don't use py.std import helper, rather import things directly. Thanks Bruno Oliveira. @@ -2676,7 +3365,7 @@ time or change existing behaviors in order to make them less surprising/more use would not work correctly because pytest assumes @pytest.mark.some gets a function to be decorated already. We now at least detect if this - arg is an lambda and thus the example will work. Thanks Alex Gaynor + arg is a lambda and thus the example will work. Thanks Alex Gaynor for bringing it up. - xfail a test on pypy that checks wrong encoding/ascii (pypy does @@ -2989,7 +3678,7 @@ Bug fixes: rather use the post-2.0 parametrize features instead of yield, see: http://pytest.org/latest/example/parametrize.html - fix autouse-issue where autouse-fixtures would not be discovered - if defined in a a/conftest.py file and tests in a/tests/test_some.py + if defined in an a/conftest.py file and tests in a/tests/test_some.py - fix issue226 - LIFO ordering for fixture teardowns - fix issue224 - invocations with >256 char arguments now work - fix issue91 - add/discuss package/directory level setups in example @@ -3559,7 +4248,7 @@ Bug fixes: - make path.bestrelpath(path) return ".", note that when calling X.bestrelpath the assumption is that X is a directory. - make initial conftest discovery ignore "--" prefixed arguments -- fix resultlog plugin when used in an multicpu/multihost xdist situation +- fix resultlog plugin when used in a multicpu/multihost xdist situation (thanks Jakub Gustak) - perform distributed testing related reporting in the xdist-plugin rather than having dist-related code in the generic py.test diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/CONTRIBUTING.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/CONTRIBUTING.rst index d85a894b910..c005c2fb254 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/CONTRIBUTING.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/CONTRIBUTING.rst @@ -48,8 +48,7 @@ fix the bug itself. Fix bugs -------- -Look through the GitHub issues for bugs. Here is a filter you can use: -https://github.com/pytest-dev/pytest/labels/type%3A%20bug +Look through the `GitHub issues for bugs `_. :ref:`Talk ` to developers to find out how you can fix specific bugs. @@ -60,8 +59,7 @@ Don't forget to check the issue trackers of your favourite plugins, too! Implement features ------------------ -Look through the GitHub issues for enhancements. Here is a filter you can use: -https://github.com/pytest-dev/pytest/labels/enhancement +Look through the `GitHub issues for enhancements `_. :ref:`Talk ` to developers to find out how you can implement specific features. @@ -141,7 +139,7 @@ Here's a rundown of how a repository transfer usually proceeds * ``joedoe`` transfers repository ownership to ``pytest-dev`` administrator ``calvin``. * ``calvin`` creates ``pytest-xyz-admin`` and ``pytest-xyz-developers`` teams, inviting ``joedoe`` to both as **maintainer**. * ``calvin`` transfers repository to ``pytest-dev`` and configures team access: - + - ``pytest-xyz-admin`` **admin** access; - ``pytest-xyz-developers`` **write** access; @@ -164,10 +162,11 @@ Preparing Pull Requests Short version ~~~~~~~~~~~~~ -#. Fork the repository; -#. Target ``master`` for bugfixes and doc changes; +#. Fork the repository. +#. Enable and install `pre-commit `_ to ensure style-guides and code checks are followed. +#. Target ``master`` for bugfixes and doc changes. #. Target ``features`` for new features or functionality changes. -#. Follow **PEP-8**. There's a ``tox`` command to help fixing it: ``tox -e fix-lint``. +#. Follow **PEP-8** for naming and `black `_ for formatting. #. Tests are run using ``tox``:: tox -e linting,py27,py36 @@ -178,7 +177,7 @@ Short version and one of ``bugfix``, ``removal``, ``feature``, ``vendor``, ``doc`` or ``trivial`` for the issue type. #. Unless your change is a trivial or a documentation fix (e.g., a typo or reword of a small section) please - add yourself to the ``AUTHORS`` file, in alphabetical order; + add yourself to the ``AUTHORS`` file, in alphabetical order. Long version @@ -204,20 +203,30 @@ Here is a simple overview, with pytest-specific bits: $ git clone git@github.com:YOUR_GITHUB_USERNAME/pytest.git $ cd pytest # now, to fix a bug create your own branch off "master": - + $ git checkout -b your-bugfix-branch-name master # or to instead add a feature create your own branch off "features": - + $ git checkout -b your-feature-branch-name features - Given we have "major.minor.micro" version numbers, bugfixes will usually - be released in micro releases whereas features will be released in + Given we have "major.minor.micro" version numbers, bugfixes will usually + be released in micro releases whereas features will be released in minor releases and incompatible changes in major releases. If you need some help with Git, follow this quick start guide: https://git.wiki.kernel.org/index.php/QuickStart +#. Install `pre-commit `_ and its hook on the pytest repo:: + + $ pip install --user pre-commit + $ pre-commit install + + Afterwards ``pre-commit`` will run whenever you commit. + + https://pre-commit.com/ is a framework for managing and maintaining multi-language pre-commit hooks + to ensure code-style and code formatting is consistent. + #. Install tox Tox is used to run all the tests and will automatically setup virtualenvs @@ -236,15 +245,7 @@ Here is a simple overview, with pytest-specific bits: This command will run tests via the "tox" tool against Python 2.7 and 3.6 and also perform "lint" coding-style checks. -#. You can now edit your local working copy. Please follow PEP-8. - - You can now make the changes you want and run the tests again as necessary. - - If you have too much linting errors, try running:: - - $ tox -e fix-lint - - To fix pep8 related errors. +#. You can now edit your local working copy and run the tests again as necessary. Please follow PEP-8 for naming. You can pass different options to ``tox``. For example, to run tests on Python 2.7 and pass options to pytest (e.g. enter pdb on failure) to pytest you can do:: @@ -255,6 +256,9 @@ Here is a simple overview, with pytest-specific bits: $ tox -e py36 -- testing/test_config.py + + When committing, ``pre-commit`` will re-format the files if necessary. + #. Commit and push once your tests pass and you are happy with your change(s):: $ git commit -a -m "" @@ -276,3 +280,15 @@ Here is a simple overview, with pytest-specific bits: base: features # if it's a feature +Joining the Development Team +---------------------------- + +Anyone who has successfully seen through a pull request which did not +require any extra work from the development team to merge will +themselves gain commit access if they so wish (if we forget to ask please send a friendly +reminder). This does not mean your workflow to contribute changes, +everyone goes through the same pull-request-and-review process and +no-one merges their own pull requests unless already approved. It does however mean you can +participate in the development process more fully since you can merge +pull requests from other contributors yourself after having reviewed +them. diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/HOWTORELEASE.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/HOWTORELEASE.rst index 48a3461d4bc..97bddf7202b 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/HOWTORELEASE.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/HOWTORELEASE.rst @@ -12,7 +12,7 @@ taking a lot of time to make a new one. #. Install development dependencies in a virtual environment with:: - pip3 install -r tasks/requirements.txt + pip3 install -U -r tasks/requirements.txt #. Create a branch ``release-X.Y.Z`` with the version for the release. @@ -22,44 +22,28 @@ taking a lot of time to make a new one. Ensure your are in a clean work tree. -#. Generate docs, changelog, announcements and upload a package to - your ``devpi`` staging server:: +#. Generate docs, changelog, announcements and a **local** tag:: - invoke generate.pre-release --password - - If ``--password`` is not given, it is assumed the user is already logged in ``devpi``. - If you don't have an account, please ask for one. + invoke generate.pre-release #. Open a PR for this branch targeting ``master``. -#. Test the package +#. After all tests pass and the PR has been approved, publish to PyPI by pushing the tag:: - * **Manual method** + git push git@github.com:pytest-dev/pytest.git - Run from multiple machines:: + Wait for the deploy to complete, then make sure it is `available on PyPI `_. - devpi use https://devpi.net/USER/dev - devpi test pytest==VERSION +#. Send an email announcement with the contents from:: - Check that tests pass for relevant combinations with:: + doc/en/announce/release-.rst - devpi list pytest + To the following mailing lists: - * **CI servers** + * pytest-dev@python.org (all releases) + * python-announce-list@python.org (all releases) + * testing-in-python@lists.idyll.org (only major/minor releases) - Configure a repository as per-instructions on - devpi-cloud-test_ to test the package on Travis_ and AppVeyor_. - All test environments should pass. - -#. Publish to PyPI:: - - invoke generate.publish-release - - where PYPI_NAME is the name of pypi.python.org as configured in your ``~/.pypirc`` - file `for devpi `_. + And announce it on `Twitter `_ with the ``#pytest`` hashtag. #. After a minor/major release, merge ``release-X.Y.Z`` into ``master`` and push (or open a PR). - -.. _devpi-cloud-test: https://github.com/obestwalter/devpi-cloud-test -.. _AppVeyor: https://www.appveyor.com/ -.. _Travis: https://travis-ci.org diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/README.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/README.rst index 3630dd4c62a..564ffff6c91 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/README.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/README.rst @@ -6,13 +6,13 @@ ------ .. image:: https://img.shields.io/pypi/v/pytest.svg - :target: https://pypi.python.org/pypi/pytest + :target: https://pypi.org/project/pytest/ -.. image:: https://anaconda.org/conda-forge/pytest/badges/version.svg +.. image:: https://img.shields.io/conda/vn/conda-forge/pytest.svg :target: https://anaconda.org/conda-forge/pytest .. image:: https://img.shields.io/pypi/pyversions/pytest.svg - :target: https://pypi.python.org/pypi/pytest + :target: https://pypi.org/project/pytest/ .. image:: https://img.shields.io/coveralls/pytest-dev/pytest/master.svg :target: https://coveralls.io/r/pytest-dev/pytest @@ -23,6 +23,12 @@ .. image:: https://ci.appveyor.com/api/projects/status/mrgbjaua7t33pg6b?svg=true :target: https://ci.appveyor.com/project/pytestbot/pytest +.. image:: https://img.shields.io/badge/code%20style-black-000000.svg + :target: https://github.com/ambv/black + +.. image:: https://www.codetriage.com/pytest-dev/pytest/badges/users.svg + :target: https://www.codetriage.com/pytest-dev/pytest + The ``pytest`` framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries. @@ -34,6 +40,7 @@ An example of a simple test: def inc(x): return x + 1 + def test_answer(): assert inc(3) == 5 diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/deprecated.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/deprecated.py deleted file mode 100644 index 9c0fbeca7bc..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/deprecated.py +++ /dev/null @@ -1,52 +0,0 @@ -""" -This module contains deprecation messages and bits of code used elsewhere in the codebase -that is planned to be removed in the next pytest release. - -Keeping it in a central location makes it easy to track what is deprecated and should -be removed when the time comes. -""" -from __future__ import absolute_import, division, print_function - - -class RemovedInPytest4Warning(DeprecationWarning): - """warning class for features removed in pytest 4.0""" - - -MAIN_STR_ARGS = 'passing a string to pytest.main() is deprecated, ' \ - 'pass a list of arguments instead.' - -YIELD_TESTS = 'yield tests are deprecated, and scheduled to be removed in pytest 4.0' - -FUNCARG_PREFIX = ( - '{name}: declaring fixtures using "pytest_funcarg__" prefix is deprecated ' - 'and scheduled to be removed in pytest 4.0. ' - 'Please remove the prefix and use the @pytest.fixture decorator instead.') - -SETUP_CFG_PYTEST = '[pytest] section in setup.cfg files is deprecated, use [tool:pytest] instead.' - -GETFUNCARGVALUE = "use of getfuncargvalue is deprecated, use getfixturevalue" - -RESULT_LOG = ( - '--result-log is deprecated and scheduled for removal in pytest 4.0.\n' - 'See https://docs.pytest.org/en/latest/usage.html#creating-resultlog-format-files for more information.' -) - -MARK_INFO_ATTRIBUTE = RemovedInPytest4Warning( - "MarkInfo objects are deprecated as they contain the merged marks" -) - -MARK_PARAMETERSET_UNPACKING = RemovedInPytest4Warning( - "Applying marks directly to parameters is deprecated," - " please use pytest.param(..., marks=...) instead.\n" - "For more details, see: https://docs.pytest.org/en/latest/parametrize.html" -) - -COLLECTOR_MAKEITEM = RemovedInPytest4Warning( - "pycollector makeitem was removed " - "as it is an accidentially leaked internal api" -) - -METAFUNC_ADD_CALL = ( - "Metafunc.addcall is deprecated and scheduled to be removed in pytest 4.0.\n" - "Please use Metafunc.parametrize instead." -) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/doctest.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/doctest.py deleted file mode 100644 index bba90e551c5..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/doctest.py +++ /dev/null @@ -1,369 +0,0 @@ -""" discover and run doctests in modules and test files.""" -from __future__ import absolute_import, division, print_function - -import traceback - -import pytest -from _pytest._code.code import ExceptionInfo, ReprFileLocation, TerminalRepr -from _pytest.fixtures import FixtureRequest - - -DOCTEST_REPORT_CHOICE_NONE = 'none' -DOCTEST_REPORT_CHOICE_CDIFF = 'cdiff' -DOCTEST_REPORT_CHOICE_NDIFF = 'ndiff' -DOCTEST_REPORT_CHOICE_UDIFF = 'udiff' -DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE = 'only_first_failure' - -DOCTEST_REPORT_CHOICES = ( - DOCTEST_REPORT_CHOICE_NONE, - DOCTEST_REPORT_CHOICE_CDIFF, - DOCTEST_REPORT_CHOICE_NDIFF, - DOCTEST_REPORT_CHOICE_UDIFF, - DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE, -) - - -def pytest_addoption(parser): - parser.addini('doctest_optionflags', 'option flags for doctests', - type="args", default=["ELLIPSIS"]) - parser.addini("doctest_encoding", 'encoding used for doctest files', default="utf-8") - group = parser.getgroup("collect") - group.addoption("--doctest-modules", - action="store_true", default=False, - help="run doctests in all .py modules", - dest="doctestmodules") - group.addoption("--doctest-report", - type=str.lower, default="udiff", - help="choose another output format for diffs on doctest failure", - choices=DOCTEST_REPORT_CHOICES, - dest="doctestreport") - group.addoption("--doctest-glob", - action="append", default=[], metavar="pat", - help="doctests file matching pattern, default: test*.txt", - dest="doctestglob") - group.addoption("--doctest-ignore-import-errors", - action="store_true", default=False, - help="ignore doctest ImportErrors", - dest="doctest_ignore_import_errors") - - -def pytest_collect_file(path, parent): - config = parent.config - if path.ext == ".py": - if config.option.doctestmodules and not _is_setup_py(config, path, parent): - return DoctestModule(path, parent) - elif _is_doctest(config, path, parent): - return DoctestTextfile(path, parent) - - -def _is_setup_py(config, path, parent): - if path.basename != "setup.py": - return False - contents = path.read() - return 'setuptools' in contents or 'distutils' in contents - - -def _is_doctest(config, path, parent): - if path.ext in ('.txt', '.rst') and parent.session.isinitpath(path): - return True - globs = config.getoption("doctestglob") or ['test*.txt'] - for glob in globs: - if path.check(fnmatch=glob): - return True - return False - - -class ReprFailDoctest(TerminalRepr): - - def __init__(self, reprlocation, lines): - self.reprlocation = reprlocation - self.lines = lines - - def toterminal(self, tw): - for line in self.lines: - tw.line(line) - self.reprlocation.toterminal(tw) - - -class DoctestItem(pytest.Item): - def __init__(self, name, parent, runner=None, dtest=None): - super(DoctestItem, self).__init__(name, parent) - self.runner = runner - self.dtest = dtest - self.obj = None - self.fixture_request = None - - def setup(self): - if self.dtest is not None: - self.fixture_request = _setup_fixtures(self) - globs = dict(getfixture=self.fixture_request.getfixturevalue) - for name, value in self.fixture_request.getfixturevalue('doctest_namespace').items(): - globs[name] = value - self.dtest.globs.update(globs) - - def runtest(self): - _check_all_skipped(self.dtest) - self.runner.run(self.dtest) - - def repr_failure(self, excinfo): - import doctest - if excinfo.errisinstance((doctest.DocTestFailure, - doctest.UnexpectedException)): - doctestfailure = excinfo.value - example = doctestfailure.example - test = doctestfailure.test - filename = test.filename - if test.lineno is None: - lineno = None - else: - lineno = test.lineno + example.lineno + 1 - message = excinfo.type.__name__ - reprlocation = ReprFileLocation(filename, lineno, message) - checker = _get_checker() - report_choice = _get_report_choice(self.config.getoption("doctestreport")) - if lineno is not None: - lines = doctestfailure.test.docstring.splitlines(False) - # add line numbers to the left of the error message - lines = ["%03d %s" % (i + test.lineno + 1, x) - for (i, x) in enumerate(lines)] - # trim docstring error lines to 10 - lines = lines[max(example.lineno - 9, 0):example.lineno + 1] - else: - lines = ['EXAMPLE LOCATION UNKNOWN, not showing all tests of that example'] - indent = '>>>' - for line in example.source.splitlines(): - lines.append('??? %s %s' % (indent, line)) - indent = '...' - if excinfo.errisinstance(doctest.DocTestFailure): - lines += checker.output_difference(example, - doctestfailure.got, report_choice).split("\n") - else: - inner_excinfo = ExceptionInfo(excinfo.value.exc_info) - lines += ["UNEXPECTED EXCEPTION: %s" % - repr(inner_excinfo.value)] - lines += traceback.format_exception(*excinfo.value.exc_info) - return ReprFailDoctest(reprlocation, lines) - else: - return super(DoctestItem, self).repr_failure(excinfo) - - def reportinfo(self): - return self.fspath, self.dtest.lineno, "[doctest] %s" % self.name - - -def _get_flag_lookup(): - import doctest - return dict(DONT_ACCEPT_TRUE_FOR_1=doctest.DONT_ACCEPT_TRUE_FOR_1, - DONT_ACCEPT_BLANKLINE=doctest.DONT_ACCEPT_BLANKLINE, - NORMALIZE_WHITESPACE=doctest.NORMALIZE_WHITESPACE, - ELLIPSIS=doctest.ELLIPSIS, - IGNORE_EXCEPTION_DETAIL=doctest.IGNORE_EXCEPTION_DETAIL, - COMPARISON_FLAGS=doctest.COMPARISON_FLAGS, - ALLOW_UNICODE=_get_allow_unicode_flag(), - ALLOW_BYTES=_get_allow_bytes_flag(), - ) - - -def get_optionflags(parent): - optionflags_str = parent.config.getini("doctest_optionflags") - flag_lookup_table = _get_flag_lookup() - flag_acc = 0 - for flag in optionflags_str: - flag_acc |= flag_lookup_table[flag] - return flag_acc - - -class DoctestTextfile(pytest.Module): - obj = None - - def collect(self): - import doctest - - # inspired by doctest.testfile; ideally we would use it directly, - # but it doesn't support passing a custom checker - encoding = self.config.getini("doctest_encoding") - text = self.fspath.read_text(encoding) - filename = str(self.fspath) - name = self.fspath.basename - globs = {'__name__': '__main__'} - - optionflags = get_optionflags(self) - runner = doctest.DebugRunner(verbose=0, optionflags=optionflags, - checker=_get_checker()) - _fix_spoof_python2(runner, encoding) - - parser = doctest.DocTestParser() - test = parser.get_doctest(text, globs, name, filename, 0) - if test.examples: - yield DoctestItem(test.name, self, runner, test) - - -def _check_all_skipped(test): - """raises pytest.skip() if all examples in the given DocTest have the SKIP - option set. - """ - import doctest - all_skipped = all(x.options.get(doctest.SKIP, False) for x in test.examples) - if all_skipped: - pytest.skip('all tests skipped by +SKIP option') - - -class DoctestModule(pytest.Module): - def collect(self): - import doctest - if self.fspath.basename == "conftest.py": - module = self.config.pluginmanager._importconftest(self.fspath) - else: - try: - module = self.fspath.pyimport() - except ImportError: - if self.config.getvalue('doctest_ignore_import_errors'): - pytest.skip('unable to import module %r' % self.fspath) - else: - raise - # uses internal doctest module parsing mechanism - finder = doctest.DocTestFinder() - optionflags = get_optionflags(self) - runner = doctest.DebugRunner(verbose=0, optionflags=optionflags, - checker=_get_checker()) - - for test in finder.find(module, module.__name__): - if test.examples: # skip empty doctests - yield DoctestItem(test.name, self, runner, test) - - -def _setup_fixtures(doctest_item): - """ - Used by DoctestTextfile and DoctestItem to setup fixture information. - """ - def func(): - pass - - doctest_item.funcargs = {} - fm = doctest_item.session._fixturemanager - doctest_item._fixtureinfo = fm.getfixtureinfo(node=doctest_item, func=func, - cls=None, funcargs=False) - fixture_request = FixtureRequest(doctest_item) - fixture_request._fillfixtures() - return fixture_request - - -def _get_checker(): - """ - Returns a doctest.OutputChecker subclass that takes in account the - ALLOW_UNICODE option to ignore u'' prefixes in strings and ALLOW_BYTES - to strip b'' prefixes. - Useful when the same doctest should run in Python 2 and Python 3. - - An inner class is used to avoid importing "doctest" at the module - level. - """ - if hasattr(_get_checker, 'LiteralsOutputChecker'): - return _get_checker.LiteralsOutputChecker() - - import doctest - import re - - class LiteralsOutputChecker(doctest.OutputChecker): - """ - Copied from doctest_nose_plugin.py from the nltk project: - https://github.com/nltk/nltk - - Further extended to also support byte literals. - """ - - _unicode_literal_re = re.compile(r"(\W|^)[uU]([rR]?[\'\"])", re.UNICODE) - _bytes_literal_re = re.compile(r"(\W|^)[bB]([rR]?[\'\"])", re.UNICODE) - - def check_output(self, want, got, optionflags): - res = doctest.OutputChecker.check_output(self, want, got, - optionflags) - if res: - return True - - allow_unicode = optionflags & _get_allow_unicode_flag() - allow_bytes = optionflags & _get_allow_bytes_flag() - if not allow_unicode and not allow_bytes: - return False - - else: # pragma: no cover - def remove_prefixes(regex, txt): - return re.sub(regex, r'\1\2', txt) - - if allow_unicode: - want = remove_prefixes(self._unicode_literal_re, want) - got = remove_prefixes(self._unicode_literal_re, got) - if allow_bytes: - want = remove_prefixes(self._bytes_literal_re, want) - got = remove_prefixes(self._bytes_literal_re, got) - res = doctest.OutputChecker.check_output(self, want, got, - optionflags) - return res - - _get_checker.LiteralsOutputChecker = LiteralsOutputChecker - return _get_checker.LiteralsOutputChecker() - - -def _get_allow_unicode_flag(): - """ - Registers and returns the ALLOW_UNICODE flag. - """ - import doctest - return doctest.register_optionflag('ALLOW_UNICODE') - - -def _get_allow_bytes_flag(): - """ - Registers and returns the ALLOW_BYTES flag. - """ - import doctest - return doctest.register_optionflag('ALLOW_BYTES') - - -def _get_report_choice(key): - """ - This function returns the actual `doctest` module flag value, we want to do it as late as possible to avoid - importing `doctest` and all its dependencies when parsing options, as it adds overhead and breaks tests. - """ - import doctest - - return { - DOCTEST_REPORT_CHOICE_UDIFF: doctest.REPORT_UDIFF, - DOCTEST_REPORT_CHOICE_CDIFF: doctest.REPORT_CDIFF, - DOCTEST_REPORT_CHOICE_NDIFF: doctest.REPORT_NDIFF, - DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE: doctest.REPORT_ONLY_FIRST_FAILURE, - DOCTEST_REPORT_CHOICE_NONE: 0, - }[key] - - -def _fix_spoof_python2(runner, encoding): - """ - Installs a "SpoofOut" into the given DebugRunner so it properly deals with unicode output. This - should patch only doctests for text files because they don't have a way to declare their - encoding. Doctests in docstrings from Python modules don't have the same problem given that - Python already decoded the strings. - - This fixes the problem related in issue #2434. - """ - from _pytest.compat import _PY2 - if not _PY2: - return - - from doctest import _SpoofOut - - class UnicodeSpoof(_SpoofOut): - - def getvalue(self): - result = _SpoofOut.getvalue(self) - if encoding: - result = result.decode(encoding) - return result - - runner._fakeout = UnicodeSpoof() - - -@pytest.fixture(scope='session') -def doctest_namespace(): - """ - Inject names into the doctest namespace. - """ - return dict() diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/logging.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/logging.py deleted file mode 100644 index ed4db25ad44..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/logging.py +++ /dev/null @@ -1,337 +0,0 @@ -from __future__ import absolute_import, division, print_function - -import logging -from contextlib import closing, contextmanager -import sys -import six - -import pytest -import py - - -DEFAULT_LOG_FORMAT = '%(filename)-25s %(lineno)4d %(levelname)-8s %(message)s' -DEFAULT_LOG_DATE_FORMAT = '%H:%M:%S' - - -def get_option_ini(config, *names): - for name in names: - ret = config.getoption(name) # 'default' arg won't work as expected - if ret is None: - ret = config.getini(name) - if ret: - return ret - - -def pytest_addoption(parser): - """Add options to control log capturing.""" - group = parser.getgroup('logging') - - def add_option_ini(option, dest, default=None, type=None, **kwargs): - parser.addini(dest, default=default, type=type, - help='default value for ' + option) - group.addoption(option, dest=dest, **kwargs) - - add_option_ini( - '--no-print-logs', - dest='log_print', action='store_const', const=False, default=True, - type='bool', - help='disable printing caught logs on failed tests.') - add_option_ini( - '--log-level', - dest='log_level', default=None, - help='logging level used by the logging module') - add_option_ini( - '--log-format', - dest='log_format', default=DEFAULT_LOG_FORMAT, - help='log format as used by the logging module.') - add_option_ini( - '--log-date-format', - dest='log_date_format', default=DEFAULT_LOG_DATE_FORMAT, - help='log date format as used by the logging module.') - add_option_ini( - '--log-cli-level', - dest='log_cli_level', default=None, - help='cli logging level.') - add_option_ini( - '--log-cli-format', - dest='log_cli_format', default=None, - help='log format as used by the logging module.') - add_option_ini( - '--log-cli-date-format', - dest='log_cli_date_format', default=None, - help='log date format as used by the logging module.') - add_option_ini( - '--log-file', - dest='log_file', default=None, - help='path to a file when logging will be written to.') - add_option_ini( - '--log-file-level', - dest='log_file_level', default=None, - help='log file logging level.') - add_option_ini( - '--log-file-format', - dest='log_file_format', default=DEFAULT_LOG_FORMAT, - help='log format as used by the logging module.') - add_option_ini( - '--log-file-date-format', - dest='log_file_date_format', default=DEFAULT_LOG_DATE_FORMAT, - help='log date format as used by the logging module.') - - -@contextmanager -def logging_using_handler(handler, logger=None): - """Context manager that safely registers a given handler.""" - logger = logger or logging.getLogger(logger) - - if handler in logger.handlers: # reentrancy - # Adding the same handler twice would confuse logging system. - # Just don't do that. - yield - else: - logger.addHandler(handler) - try: - yield - finally: - logger.removeHandler(handler) - - -@contextmanager -def catching_logs(handler, formatter=None, - level=logging.NOTSET, logger=None): - """Context manager that prepares the whole logging machinery properly.""" - logger = logger or logging.getLogger(logger) - - if formatter is not None: - handler.setFormatter(formatter) - handler.setLevel(level) - - with logging_using_handler(handler, logger): - orig_level = logger.level - logger.setLevel(min(orig_level, level)) - try: - yield handler - finally: - logger.setLevel(orig_level) - - -class LogCaptureHandler(logging.StreamHandler): - """A logging handler that stores log records and the log text.""" - - def __init__(self): - """Creates a new log handler.""" - logging.StreamHandler.__init__(self, py.io.TextIO()) - self.records = [] - - def emit(self, record): - """Keep the log records in a list in addition to the log text.""" - self.records.append(record) - logging.StreamHandler.emit(self, record) - - -class LogCaptureFixture(object): - """Provides access and control of log capturing.""" - - def __init__(self, item): - """Creates a new funcarg.""" - self._item = item - - @property - def handler(self): - return self._item.catch_log_handler - - @property - def text(self): - """Returns the log text.""" - return self.handler.stream.getvalue() - - @property - def records(self): - """Returns the list of log records.""" - return self.handler.records - - @property - def record_tuples(self): - """Returns a list of a striped down version of log records intended - for use in assertion comparison. - - The format of the tuple is: - - (logger_name, log_level, message) - """ - return [(r.name, r.levelno, r.getMessage()) for r in self.records] - - def clear(self): - """Reset the list of log records.""" - self.handler.records = [] - - def set_level(self, level, logger=None): - """Sets the level for capturing of logs. - - By default, the level is set on the handler used to capture - logs. Specify a logger name to instead set the level of any - logger. - """ - if logger is None: - logger = self.handler - else: - logger = logging.getLogger(logger) - logger.setLevel(level) - - @contextmanager - def at_level(self, level, logger=None): - """Context manager that sets the level for capturing of logs. - - By default, the level is set on the handler used to capture - logs. Specify a logger name to instead set the level of any - logger. - """ - if logger is None: - logger = self.handler - else: - logger = logging.getLogger(logger) - - orig_level = logger.level - logger.setLevel(level) - try: - yield - finally: - logger.setLevel(orig_level) - - -@pytest.fixture -def caplog(request): - """Access and control log capturing. - - Captured logs are available through the following methods:: - - * caplog.text() -> string containing formatted log output - * caplog.records() -> list of logging.LogRecord instances - * caplog.record_tuples() -> list of (logger_name, level, message) tuples - """ - return LogCaptureFixture(request.node) - - -def get_actual_log_level(config, *setting_names): - """Return the actual logging level.""" - - for setting_name in setting_names: - log_level = config.getoption(setting_name) - if log_level is None: - log_level = config.getini(setting_name) - if log_level: - break - else: - return - - if isinstance(log_level, six.string_types): - log_level = log_level.upper() - try: - return int(getattr(logging, log_level, log_level)) - except ValueError: - # Python logging does not recognise this as a logging level - raise pytest.UsageError( - "'{0}' is not recognized as a logging level name for " - "'{1}'. Please consider passing the " - "logging level num instead.".format( - log_level, - setting_name)) - - -def pytest_configure(config): - config.pluginmanager.register(LoggingPlugin(config), - 'logging-plugin') - - -class LoggingPlugin(object): - """Attaches to the logging module and captures log messages for each test. - """ - - def __init__(self, config): - """Creates a new plugin to capture log messages. - - The formatter can be safely shared across all handlers so - create a single one for the entire test session here. - """ - self.log_cli_level = get_actual_log_level( - config, 'log_cli_level', 'log_level') or logging.WARNING - - self.print_logs = get_option_ini(config, 'log_print') - self.formatter = logging.Formatter( - get_option_ini(config, 'log_format'), - get_option_ini(config, 'log_date_format')) - - log_cli_handler = logging.StreamHandler(sys.stderr) - log_cli_format = get_option_ini( - config, 'log_cli_format', 'log_format') - log_cli_date_format = get_option_ini( - config, 'log_cli_date_format', 'log_date_format') - log_cli_formatter = logging.Formatter( - log_cli_format, - datefmt=log_cli_date_format) - self.log_cli_handler = log_cli_handler # needed for a single unittest - self.live_logs = catching_logs(log_cli_handler, - formatter=log_cli_formatter, - level=self.log_cli_level) - - log_file = get_option_ini(config, 'log_file') - if log_file: - self.log_file_level = get_actual_log_level( - config, 'log_file_level') or logging.WARNING - - log_file_format = get_option_ini( - config, 'log_file_format', 'log_format') - log_file_date_format = get_option_ini( - config, 'log_file_date_format', 'log_date_format') - self.log_file_handler = logging.FileHandler( - log_file, - # Each pytest runtests session will write to a clean logfile - mode='w') - log_file_formatter = logging.Formatter( - log_file_format, - datefmt=log_file_date_format) - self.log_file_handler.setFormatter(log_file_formatter) - else: - self.log_file_handler = None - - @contextmanager - def _runtest_for(self, item, when): - """Implements the internals of pytest_runtest_xxx() hook.""" - with catching_logs(LogCaptureHandler(), - formatter=self.formatter) as log_handler: - item.catch_log_handler = log_handler - try: - yield # run test - finally: - del item.catch_log_handler - - if self.print_logs: - # Add a captured log section to the report. - log = log_handler.stream.getvalue().strip() - item.add_report_section(when, 'log', log) - - @pytest.hookimpl(hookwrapper=True) - def pytest_runtest_setup(self, item): - with self._runtest_for(item, 'setup'): - yield - - @pytest.hookimpl(hookwrapper=True) - def pytest_runtest_call(self, item): - with self._runtest_for(item, 'call'): - yield - - @pytest.hookimpl(hookwrapper=True) - def pytest_runtest_teardown(self, item): - with self._runtest_for(item, 'teardown'): - yield - - @pytest.hookimpl(hookwrapper=True) - def pytest_runtestloop(self, session): - """Runs all collected test items.""" - with self.live_logs: - if self.log_file_handler is not None: - with closing(self.log_file_handler): - with catching_logs(self.log_file_handler, - level=self.log_file_level): - yield # run all the tests - else: - yield # run all the tests diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/main.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/main.py deleted file mode 100644 index 25554098dac..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/main.py +++ /dev/null @@ -1,821 +0,0 @@ -""" core implementation of testing process: init, session, runtest loop. """ -from __future__ import absolute_import, division, print_function - -import functools -import os -import six -import sys - -import _pytest -from _pytest import nodes -import _pytest._code -import py -try: - from collections import MutableMapping as MappingMixin -except ImportError: - from UserDict import DictMixin as MappingMixin - -from _pytest.config import directory_arg, UsageError, hookimpl -from _pytest.outcomes import exit -from _pytest.runner import collect_one_node - -tracebackcutdir = py.path.local(_pytest.__file__).dirpath() - -# exitcodes for the command line -EXIT_OK = 0 -EXIT_TESTSFAILED = 1 -EXIT_INTERRUPTED = 2 -EXIT_INTERNALERROR = 3 -EXIT_USAGEERROR = 4 -EXIT_NOTESTSCOLLECTED = 5 - - -def pytest_addoption(parser): - parser.addini("norecursedirs", "directory patterns to avoid for recursion", - type="args", default=['.*', 'build', 'dist', 'CVS', '_darcs', '{arch}', '*.egg', 'venv']) - parser.addini("testpaths", "directories to search for tests when no files or directories are given in the " - "command line.", - type="args", default=[]) - # parser.addini("dirpatterns", - # "patterns specifying possible locations of test files", - # type="linelist", default=["**/test_*.txt", - # "**/test_*.py", "**/*_test.py"] - # ) - group = parser.getgroup("general", "running and selection options") - group._addoption('-x', '--exitfirst', action="store_const", - dest="maxfail", const=1, - help="exit instantly on first error or failed test."), - group._addoption('--maxfail', metavar="num", - action="store", type=int, dest="maxfail", default=0, - help="exit after first num failures or errors.") - group._addoption('--strict', action="store_true", - help="marks not registered in configuration file raise errors.") - group._addoption("-c", metavar="file", type=str, dest="inifilename", - help="load configuration from `file` instead of trying to locate one of the implicit " - "configuration files.") - group._addoption("--continue-on-collection-errors", action="store_true", - default=False, dest="continue_on_collection_errors", - help="Force test execution even if collection errors occur.") - - group = parser.getgroup("collect", "collection") - group.addoption('--collectonly', '--collect-only', action="store_true", - help="only collect tests, don't execute them."), - group.addoption('--pyargs', action="store_true", - help="try to interpret all arguments as python packages.") - group.addoption("--ignore", action="append", metavar="path", - help="ignore path during collection (multi-allowed).") - # when changing this to --conf-cut-dir, config.py Conftest.setinitial - # needs upgrading as well - group.addoption('--confcutdir', dest="confcutdir", default=None, - metavar="dir", type=functools.partial(directory_arg, optname="--confcutdir"), - help="only load conftest.py's relative to specified dir.") - group.addoption('--noconftest', action="store_true", - dest="noconftest", default=False, - help="Don't load any conftest.py files.") - group.addoption('--keepduplicates', '--keep-duplicates', action="store_true", - dest="keepduplicates", default=False, - help="Keep duplicate tests.") - group.addoption('--collect-in-virtualenv', action='store_true', - dest='collect_in_virtualenv', default=False, - help="Don't ignore tests in a local virtualenv directory") - - group = parser.getgroup("debugconfig", - "test session debugging and configuration") - group.addoption('--basetemp', dest="basetemp", default=None, metavar="dir", - help="base temporary directory for this test run.") - - -def pytest_configure(config): - __import__('pytest').config = config # compatibiltiy - - -def wrap_session(config, doit): - """Skeleton command line program""" - session = Session(config) - session.exitstatus = EXIT_OK - initstate = 0 - try: - try: - config._do_configure() - initstate = 1 - config.hook.pytest_sessionstart(session=session) - initstate = 2 - session.exitstatus = doit(config, session) or 0 - except UsageError: - raise - except Failed: - session.exitstatus = EXIT_TESTSFAILED - except KeyboardInterrupt: - excinfo = _pytest._code.ExceptionInfo() - if initstate < 2 and isinstance(excinfo.value, exit.Exception): - sys.stderr.write('{0}: {1}\n'.format( - excinfo.typename, excinfo.value.msg)) - config.hook.pytest_keyboard_interrupt(excinfo=excinfo) - session.exitstatus = EXIT_INTERRUPTED - except: # noqa - excinfo = _pytest._code.ExceptionInfo() - config.notify_exception(excinfo, config.option) - session.exitstatus = EXIT_INTERNALERROR - if excinfo.errisinstance(SystemExit): - sys.stderr.write("mainloop: caught Spurious SystemExit!\n") - - finally: - excinfo = None # Explicitly break reference cycle. - session.startdir.chdir() - if initstate >= 2: - config.hook.pytest_sessionfinish( - session=session, - exitstatus=session.exitstatus) - config._ensure_unconfigure() - return session.exitstatus - - -def pytest_cmdline_main(config): - return wrap_session(config, _main) - - -def _main(config, session): - """ default command line protocol for initialization, session, - running tests and reporting. """ - config.hook.pytest_collection(session=session) - config.hook.pytest_runtestloop(session=session) - - if session.testsfailed: - return EXIT_TESTSFAILED - elif session.testscollected == 0: - return EXIT_NOTESTSCOLLECTED - - -def pytest_collection(session): - return session.perform_collect() - - -def pytest_runtestloop(session): - if (session.testsfailed and - not session.config.option.continue_on_collection_errors): - raise session.Interrupted( - "%d errors during collection" % session.testsfailed) - - if session.config.option.collectonly: - return True - - for i, item in enumerate(session.items): - nextitem = session.items[i + 1] if i + 1 < len(session.items) else None - item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem) - if session.shouldfail: - raise session.Failed(session.shouldfail) - if session.shouldstop: - raise session.Interrupted(session.shouldstop) - return True - - -def _in_venv(path): - """Attempts to detect if ``path`` is the root of a Virtual Environment by - checking for the existence of the appropriate activate script""" - bindir = path.join('Scripts' if sys.platform.startswith('win') else 'bin') - if not bindir.exists(): - return False - activates = ('activate', 'activate.csh', 'activate.fish', - 'Activate', 'Activate.bat', 'Activate.ps1') - return any([fname.basename in activates for fname in bindir.listdir()]) - - -def pytest_ignore_collect(path, config): - ignore_paths = config._getconftest_pathlist("collect_ignore", path=path.dirpath()) - ignore_paths = ignore_paths or [] - excludeopt = config.getoption("ignore") - if excludeopt: - ignore_paths.extend([py.path.local(x) for x in excludeopt]) - - if py.path.local(path) in ignore_paths: - return True - - allow_in_venv = config.getoption("collect_in_virtualenv") - if _in_venv(path) and not allow_in_venv: - return True - - # Skip duplicate paths. - keepduplicates = config.getoption("keepduplicates") - duplicate_paths = config.pluginmanager._duplicatepaths - if not keepduplicates: - if path in duplicate_paths: - return True - else: - duplicate_paths.add(path) - - return False - - -class FSHookProxy: - def __init__(self, fspath, pm, remove_mods): - self.fspath = fspath - self.pm = pm - self.remove_mods = remove_mods - - def __getattr__(self, name): - x = self.pm.subset_hook_caller(name, remove_plugins=self.remove_mods) - self.__dict__[name] = x - return x - - -class _CompatProperty(object): - def __init__(self, name): - self.name = name - - def __get__(self, obj, owner): - if obj is None: - return self - - # TODO: reenable in the features branch - # warnings.warn( - # "usage of {owner!r}.{name} is deprecated, please use pytest.{name} instead".format( - # name=self.name, owner=type(owner).__name__), - # PendingDeprecationWarning, stacklevel=2) - return getattr(__import__('pytest'), self.name) - - -class NodeKeywords(MappingMixin): - def __init__(self, node): - self.node = node - self.parent = node.parent - self._markers = {node.name: True} - - def __getitem__(self, key): - try: - return self._markers[key] - except KeyError: - if self.parent is None: - raise - return self.parent.keywords[key] - - def __setitem__(self, key, value): - self._markers[key] = value - - def __delitem__(self, key): - raise ValueError("cannot delete key in keywords dict") - - def __iter__(self): - seen = set(self._markers) - if self.parent is not None: - seen.update(self.parent.keywords) - return iter(seen) - - def __len__(self): - return len(self.__iter__()) - - def keys(self): - return list(self) - - def __repr__(self): - return "" % (self.node, ) - - -class Node(object): - """ base class for Collector and Item the test collection tree. - Collector subclasses have children, Items are terminal nodes.""" - - def __init__(self, name, parent=None, config=None, session=None): - #: a unique name within the scope of the parent node - self.name = name - - #: the parent collector node. - self.parent = parent - - #: the pytest config object - self.config = config or parent.config - - #: the session this node is part of - self.session = session or parent.session - - #: filesystem path where this node was collected from (can be None) - self.fspath = getattr(parent, 'fspath', None) - - #: keywords/markers collected from all scopes - self.keywords = NodeKeywords(self) - - #: allow adding of extra keywords to use for matching - self.extra_keyword_matches = set() - - # used for storing artificial fixturedefs for direct parametrization - self._name2pseudofixturedef = {} - - @property - def ihook(self): - """ fspath sensitive hook proxy used to call pytest hooks""" - return self.session.gethookproxy(self.fspath) - - Module = _CompatProperty("Module") - Class = _CompatProperty("Class") - Instance = _CompatProperty("Instance") - Function = _CompatProperty("Function") - File = _CompatProperty("File") - Item = _CompatProperty("Item") - - def _getcustomclass(self, name): - maybe_compatprop = getattr(type(self), name) - if isinstance(maybe_compatprop, _CompatProperty): - return getattr(__import__('pytest'), name) - else: - cls = getattr(self, name) - # TODO: reenable in the features branch - # warnings.warn("use of node.%s is deprecated, " - # "use pytest_pycollect_makeitem(...) to create custom " - # "collection nodes" % name, category=DeprecationWarning) - return cls - - def __repr__(self): - return "<%s %r>" % (self.__class__.__name__, - getattr(self, 'name', None)) - - def warn(self, code, message): - """ generate a warning with the given code and message for this - item. """ - assert isinstance(code, str) - fslocation = getattr(self, "location", None) - if fslocation is None: - fslocation = getattr(self, "fspath", None) - self.ihook.pytest_logwarning.call_historic(kwargs=dict( - code=code, message=message, - nodeid=self.nodeid, fslocation=fslocation)) - - # methods for ordering nodes - @property - def nodeid(self): - """ a ::-separated string denoting its collection tree address. """ - try: - return self._nodeid - except AttributeError: - self._nodeid = x = self._makeid() - return x - - def _makeid(self): - return self.parent.nodeid + "::" + self.name - - def __hash__(self): - return hash(self.nodeid) - - def setup(self): - pass - - def teardown(self): - pass - - def listchain(self): - """ return list of all parent collectors up to self, - starting from root of collection tree. """ - chain = [] - item = self - while item is not None: - chain.append(item) - item = item.parent - chain.reverse() - return chain - - def add_marker(self, marker): - """ dynamically add a marker object to the node. - - ``marker`` can be a string or pytest.mark.* instance. - """ - from _pytest.mark import MarkDecorator, MARK_GEN - if isinstance(marker, six.string_types): - marker = getattr(MARK_GEN, marker) - elif not isinstance(marker, MarkDecorator): - raise ValueError("is not a string or pytest.mark.* Marker") - self.keywords[marker.name] = marker - - def get_marker(self, name): - """ get a marker object from this node or None if - the node doesn't have a marker with that name. """ - val = self.keywords.get(name, None) - if val is not None: - from _pytest.mark import MarkInfo, MarkDecorator - if isinstance(val, (MarkDecorator, MarkInfo)): - return val - - def listextrakeywords(self): - """ Return a set of all extra keywords in self and any parents.""" - extra_keywords = set() - item = self - for item in self.listchain(): - extra_keywords.update(item.extra_keyword_matches) - return extra_keywords - - def listnames(self): - return [x.name for x in self.listchain()] - - def addfinalizer(self, fin): - """ register a function to be called when this node is finalized. - - This method can only be called when this node is active - in a setup chain, for example during self.setup(). - """ - self.session._setupstate.addfinalizer(fin, self) - - def getparent(self, cls): - """ get the next parent node (including ourself) - which is an instance of the given class""" - current = self - while current and not isinstance(current, cls): - current = current.parent - return current - - def _prunetraceback(self, excinfo): - pass - - def _repr_failure_py(self, excinfo, style=None): - fm = self.session._fixturemanager - if excinfo.errisinstance(fm.FixtureLookupError): - return excinfo.value.formatrepr() - tbfilter = True - if self.config.option.fulltrace: - style = "long" - else: - tb = _pytest._code.Traceback([excinfo.traceback[-1]]) - self._prunetraceback(excinfo) - if len(excinfo.traceback) == 0: - excinfo.traceback = tb - tbfilter = False # prunetraceback already does it - if style == "auto": - style = "long" - # XXX should excinfo.getrepr record all data and toterminal() process it? - if style is None: - if self.config.option.tbstyle == "short": - style = "short" - else: - style = "long" - - try: - os.getcwd() - abspath = False - except OSError: - abspath = True - - return excinfo.getrepr(funcargs=True, abspath=abspath, - showlocals=self.config.option.showlocals, - style=style, tbfilter=tbfilter) - - repr_failure = _repr_failure_py - - -class Collector(Node): - """ Collector instances create children through collect() - and thus iteratively build a tree. - """ - - class CollectError(Exception): - """ an error during collection, contains a custom message. """ - - def collect(self): - """ returns a list of children (items and collectors) - for this collection node. - """ - raise NotImplementedError("abstract") - - def repr_failure(self, excinfo): - """ represent a collection failure. """ - if excinfo.errisinstance(self.CollectError): - exc = excinfo.value - return str(exc.args[0]) - return self._repr_failure_py(excinfo, style="short") - - def _prunetraceback(self, excinfo): - if hasattr(self, 'fspath'): - traceback = excinfo.traceback - ntraceback = traceback.cut(path=self.fspath) - if ntraceback == traceback: - ntraceback = ntraceback.cut(excludepath=tracebackcutdir) - excinfo.traceback = ntraceback.filter() - - -class FSCollector(Collector): - def __init__(self, fspath, parent=None, config=None, session=None): - fspath = py.path.local(fspath) # xxx only for test_resultlog.py? - name = fspath.basename - if parent is not None: - rel = fspath.relto(parent.fspath) - if rel: - name = rel - name = name.replace(os.sep, nodes.SEP) - super(FSCollector, self).__init__(name, parent, config, session) - self.fspath = fspath - - def _check_initialpaths_for_relpath(self): - for initialpath in self.session._initialpaths: - if self.fspath.common(initialpath) == initialpath: - return self.fspath.relto(initialpath.dirname) - - def _makeid(self): - relpath = self.fspath.relto(self.config.rootdir) - - if not relpath: - relpath = self._check_initialpaths_for_relpath() - if os.sep != nodes.SEP: - relpath = relpath.replace(os.sep, nodes.SEP) - return relpath - - -class File(FSCollector): - """ base class for collecting tests from a file. """ - - -class Item(Node): - """ a basic test invocation item. Note that for a single function - there might be multiple test invocation items. - """ - nextitem = None - - def __init__(self, name, parent=None, config=None, session=None): - super(Item, self).__init__(name, parent, config, session) - self._report_sections = [] - - def add_report_section(self, when, key, content): - """ - Adds a new report section, similar to what's done internally to add stdout and - stderr captured output:: - - item.add_report_section("call", "stdout", "report section contents") - - :param str when: - One of the possible capture states, ``"setup"``, ``"call"``, ``"teardown"``. - :param str key: - Name of the section, can be customized at will. Pytest uses ``"stdout"`` and - ``"stderr"`` internally. - - :param str content: - The full contents as a string. - """ - if content: - self._report_sections.append((when, key, content)) - - def reportinfo(self): - return self.fspath, None, "" - - @property - def location(self): - try: - return self._location - except AttributeError: - location = self.reportinfo() - # bestrelpath is a quite slow function - cache = self.config.__dict__.setdefault("_bestrelpathcache", {}) - try: - fspath = cache[location[0]] - except KeyError: - fspath = self.session.fspath.bestrelpath(location[0]) - cache[location[0]] = fspath - location = (fspath, location[1], str(location[2])) - self._location = location - return location - - -class NoMatch(Exception): - """ raised if matching cannot locate a matching names. """ - - -class Interrupted(KeyboardInterrupt): - """ signals an interrupted test run. """ - __module__ = 'builtins' # for py3 - - -class Failed(Exception): - """ signals an stop as failed test run. """ - - -class Session(FSCollector): - Interrupted = Interrupted - Failed = Failed - - def __init__(self, config): - FSCollector.__init__(self, config.rootdir, parent=None, - config=config, session=self) - self.testsfailed = 0 - self.testscollected = 0 - self.shouldstop = False - self.shouldfail = False - self.trace = config.trace.root.get("collection") - self._norecursepatterns = config.getini("norecursedirs") - self.startdir = py.path.local() - self.config.pluginmanager.register(self, name="session") - - def _makeid(self): - return "" - - @hookimpl(tryfirst=True) - def pytest_collectstart(self): - if self.shouldfail: - raise self.Failed(self.shouldfail) - if self.shouldstop: - raise self.Interrupted(self.shouldstop) - - @hookimpl(tryfirst=True) - def pytest_runtest_logreport(self, report): - if report.failed and not hasattr(report, 'wasxfail'): - self.testsfailed += 1 - maxfail = self.config.getvalue("maxfail") - if maxfail and self.testsfailed >= maxfail: - self.shouldfail = "stopping after %d failures" % ( - self.testsfailed) - pytest_collectreport = pytest_runtest_logreport - - def isinitpath(self, path): - return path in self._initialpaths - - def gethookproxy(self, fspath): - # check if we have the common case of running - # hooks with all conftest.py filesall conftest.py - pm = self.config.pluginmanager - my_conftestmodules = pm._getconftestmodules(fspath) - remove_mods = pm._conftest_plugins.difference(my_conftestmodules) - if remove_mods: - # one or more conftests are not in use at this fspath - proxy = FSHookProxy(fspath, pm, remove_mods) - else: - # all plugis are active for this fspath - proxy = self.config.hook - return proxy - - def perform_collect(self, args=None, genitems=True): - hook = self.config.hook - try: - items = self._perform_collect(args, genitems) - self.config.pluginmanager.check_pending() - hook.pytest_collection_modifyitems(session=self, - config=self.config, items=items) - finally: - hook.pytest_collection_finish(session=self) - self.testscollected = len(items) - return items - - def _perform_collect(self, args, genitems): - if args is None: - args = self.config.args - self.trace("perform_collect", self, args) - self.trace.root.indent += 1 - self._notfound = [] - self._initialpaths = set() - self._initialparts = [] - self.items = items = [] - for arg in args: - parts = self._parsearg(arg) - self._initialparts.append(parts) - self._initialpaths.add(parts[0]) - rep = collect_one_node(self) - self.ihook.pytest_collectreport(report=rep) - self.trace.root.indent -= 1 - if self._notfound: - errors = [] - for arg, exc in self._notfound: - line = "(no name %r in any of %r)" % (arg, exc.args[0]) - errors.append("not found: %s\n%s" % (arg, line)) - # XXX: test this - raise UsageError(*errors) - if not genitems: - return rep.result - else: - if rep.passed: - for node in rep.result: - self.items.extend(self.genitems(node)) - return items - - def collect(self): - for parts in self._initialparts: - arg = "::".join(map(str, parts)) - self.trace("processing argument", arg) - self.trace.root.indent += 1 - try: - for x in self._collect(arg): - yield x - except NoMatch: - # we are inside a make_report hook so - # we cannot directly pass through the exception - self._notfound.append((arg, sys.exc_info()[1])) - - self.trace.root.indent -= 1 - - def _collect(self, arg): - names = self._parsearg(arg) - path = names.pop(0) - if path.check(dir=1): - assert not names, "invalid arg %r" % (arg,) - for path in path.visit(fil=lambda x: x.check(file=1), - rec=self._recurse, bf=True, sort=True): - for x in self._collectfile(path): - yield x - else: - assert path.check(file=1) - for x in self.matchnodes(self._collectfile(path), names): - yield x - - def _collectfile(self, path): - ihook = self.gethookproxy(path) - if not self.isinitpath(path): - if ihook.pytest_ignore_collect(path=path, config=self.config): - return () - return ihook.pytest_collect_file(path=path, parent=self) - - def _recurse(self, path): - ihook = self.gethookproxy(path.dirpath()) - if ihook.pytest_ignore_collect(path=path, config=self.config): - return - for pat in self._norecursepatterns: - if path.check(fnmatch=pat): - return False - ihook = self.gethookproxy(path) - ihook.pytest_collect_directory(path=path, parent=self) - return True - - def _tryconvertpyarg(self, x): - """Convert a dotted module name to path. - - """ - import pkgutil - try: - loader = pkgutil.find_loader(x) - except ImportError: - return x - if loader is None: - return x - # This method is sometimes invoked when AssertionRewritingHook, which - # does not define a get_filename method, is already in place: - try: - path = loader.get_filename(x) - except AttributeError: - # Retrieve path from AssertionRewritingHook: - path = loader.modules[x][0].co_filename - if loader.is_package(x): - path = os.path.dirname(path) - return path - - def _parsearg(self, arg): - """ return (fspath, names) tuple after checking the file exists. """ - parts = str(arg).split("::") - if self.config.option.pyargs: - parts[0] = self._tryconvertpyarg(parts[0]) - relpath = parts[0].replace("/", os.sep) - path = self.config.invocation_dir.join(relpath, abs=True) - if not path.check(): - if self.config.option.pyargs: - raise UsageError( - "file or package not found: " + arg + - " (missing __init__.py?)") - else: - raise UsageError("file not found: " + arg) - parts[0] = path - return parts - - def matchnodes(self, matching, names): - self.trace("matchnodes", matching, names) - self.trace.root.indent += 1 - nodes = self._matchnodes(matching, names) - num = len(nodes) - self.trace("matchnodes finished -> ", num, "nodes") - self.trace.root.indent -= 1 - if num == 0: - raise NoMatch(matching, names[:1]) - return nodes - - def _matchnodes(self, matching, names): - if not matching or not names: - return matching - name = names[0] - assert name - nextnames = names[1:] - resultnodes = [] - for node in matching: - if isinstance(node, Item): - if not names: - resultnodes.append(node) - continue - assert isinstance(node, Collector) - rep = collect_one_node(node) - if rep.passed: - has_matched = False - for x in rep.result: - # TODO: remove parametrized workaround once collection structure contains parametrization - if x.name == name or x.name.split("[")[0] == name: - resultnodes.extend(self.matchnodes([x], nextnames)) - has_matched = True - # XXX accept IDs that don't have "()" for class instances - if not has_matched and len(rep.result) == 1 and x.name == "()": - nextnames.insert(0, name) - resultnodes.extend(self.matchnodes([x], nextnames)) - else: - # report collection failures here to avoid failing to run some test - # specified in the command line because the module could not be - # imported (#134) - node.ihook.pytest_collectreport(report=rep) - return resultnodes - - def genitems(self, node): - self.trace("genitems", node) - if isinstance(node, Item): - node.ihook.pytest_itemcollected(item=node) - yield node - else: - assert isinstance(node, Collector) - rep = collect_one_node(node) - if rep.passed: - for subnode in rep.result: - for x in self.genitems(subnode): - yield x - node.ihook.pytest_collectreport(report=rep) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/nodes.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/nodes.py deleted file mode 100644 index ad3af2ce67c..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/nodes.py +++ /dev/null @@ -1,37 +0,0 @@ -SEP = "/" - - -def _splitnode(nodeid): - """Split a nodeid into constituent 'parts'. - - Node IDs are strings, and can be things like: - '' - 'testing/code' - 'testing/code/test_excinfo.py' - 'testing/code/test_excinfo.py::TestFormattedExcinfo::()' - - Return values are lists e.g. - [] - ['testing', 'code'] - ['testing', 'code', 'test_excinfo.py'] - ['testing', 'code', 'test_excinfo.py', 'TestFormattedExcinfo', '()'] - """ - if nodeid == '': - # If there is no root node at all, return an empty list so the caller's logic can remain sane - return [] - parts = nodeid.split(SEP) - # Replace single last element 'test_foo.py::Bar::()' with multiple elements 'test_foo.py', 'Bar', '()' - parts[-1:] = parts[-1].split("::") - return parts - - -def ischildnode(baseid, nodeid): - """Return True if the nodeid is a child node of the baseid. - - E.g. 'foo/bar::Baz::()' is a child of 'foo', 'foo/bar' and 'foo/bar::Baz', but not of 'foo/blorp' - """ - base_parts = _splitnode(baseid) - node_parts = _splitnode(nodeid) - if len(node_parts) < len(base_parts): - return False - return node_parts[:len(base_parts)] == base_parts diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/skipping.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/skipping.py deleted file mode 100644 index a1e5b43800b..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/skipping.py +++ /dev/null @@ -1,397 +0,0 @@ -""" support for skip/xfail functions and markers. """ -from __future__ import absolute_import, division, print_function - -import os -import six -import sys -import traceback - -from _pytest.config import hookimpl -from _pytest.mark import MarkInfo, MarkDecorator -from _pytest.outcomes import fail, skip, xfail, TEST_OUTCOME - - -def pytest_addoption(parser): - group = parser.getgroup("general") - group.addoption('--runxfail', - action="store_true", dest="runxfail", default=False, - help="run tests even if they are marked xfail") - - parser.addini("xfail_strict", "default for the strict parameter of xfail " - "markers when not given explicitly (default: " - "False)", - default=False, - type="bool") - - -def pytest_configure(config): - if config.option.runxfail: - # yay a hack - import pytest - old = pytest.xfail - config._cleanup.append(lambda: setattr(pytest, "xfail", old)) - - def nop(*args, **kwargs): - pass - - nop.Exception = xfail.Exception - setattr(pytest, "xfail", nop) - - config.addinivalue_line("markers", - "skip(reason=None): skip the given test function with an optional reason. " - "Example: skip(reason=\"no way of currently testing this\") skips the " - "test." - ) - config.addinivalue_line("markers", - "skipif(condition): skip the given test function if eval(condition) " - "results in a True value. Evaluation happens within the " - "module global context. Example: skipif('sys.platform == \"win32\"') " - "skips the test if we are on the win32 platform. see " - "http://pytest.org/latest/skipping.html" - ) - config.addinivalue_line("markers", - "xfail(condition, reason=None, run=True, raises=None, strict=False): " - "mark the test function as an expected failure if eval(condition) " - "has a True value. Optionally specify a reason for better reporting " - "and run=False if you don't even want to execute the test function. " - "If only specific exception(s) are expected, you can list them in " - "raises, and if the test fails in other ways, it will be reported as " - "a true failure. See http://pytest.org/latest/skipping.html" - ) - - -class MarkEvaluator(object): - def __init__(self, item, name): - self.item = item - self._marks = None - self._mark = None - self._mark_name = name - - def __bool__(self): - self._marks = self._get_marks() - return bool(self._marks) - __nonzero__ = __bool__ - - def wasvalid(self): - return not hasattr(self, 'exc') - - def _get_marks(self): - - keyword = self.item.keywords.get(self._mark_name) - if isinstance(keyword, MarkDecorator): - return [keyword.mark] - elif isinstance(keyword, MarkInfo): - return [x.combined for x in keyword] - else: - return [] - - def invalidraise(self, exc): - raises = self.get('raises') - if not raises: - return - return not isinstance(exc, raises) - - def istrue(self): - try: - return self._istrue() - except TEST_OUTCOME: - self.exc = sys.exc_info() - if isinstance(self.exc[1], SyntaxError): - msg = [" " * (self.exc[1].offset + 4) + "^", ] - msg.append("SyntaxError: invalid syntax") - else: - msg = traceback.format_exception_only(*self.exc[:2]) - fail("Error evaluating %r expression\n" - " %s\n" - "%s" - % (self._mark_name, self.expr, "\n".join(msg)), - pytrace=False) - - def _getglobals(self): - d = {'os': os, 'sys': sys, 'config': self.item.config} - if hasattr(self.item, 'obj'): - d.update(self.item.obj.__globals__) - return d - - def _istrue(self): - if hasattr(self, 'result'): - return self.result - self._marks = self._get_marks() - - if self._marks: - self.result = False - for mark in self._marks: - self._mark = mark - if 'condition' in mark.kwargs: - args = (mark.kwargs['condition'],) - else: - args = mark.args - - for expr in args: - self.expr = expr - if isinstance(expr, six.string_types): - d = self._getglobals() - result = cached_eval(self.item.config, expr, d) - else: - if "reason" not in mark.kwargs: - # XXX better be checked at collection time - msg = "you need to specify reason=STRING " \ - "when using booleans as conditions." - fail(msg) - result = bool(expr) - if result: - self.result = True - self.reason = mark.kwargs.get('reason', None) - self.expr = expr - return self.result - - if not args: - self.result = True - self.reason = mark.kwargs.get('reason', None) - return self.result - return False - - def get(self, attr, default=None): - if self._mark is None: - return default - return self._mark.kwargs.get(attr, default) - - def getexplanation(self): - expl = getattr(self, 'reason', None) or self.get('reason', None) - if not expl: - if not hasattr(self, 'expr'): - return "" - else: - return "condition: " + str(self.expr) - return expl - - -@hookimpl(tryfirst=True) -def pytest_runtest_setup(item): - # Check if skip or skipif are specified as pytest marks - item._skipped_by_mark = False - skipif_info = item.keywords.get('skipif') - if isinstance(skipif_info, (MarkInfo, MarkDecorator)): - eval_skipif = MarkEvaluator(item, 'skipif') - if eval_skipif.istrue(): - item._skipped_by_mark = True - skip(eval_skipif.getexplanation()) - - skip_info = item.keywords.get('skip') - if isinstance(skip_info, (MarkInfo, MarkDecorator)): - item._skipped_by_mark = True - if 'reason' in skip_info.kwargs: - skip(skip_info.kwargs['reason']) - elif skip_info.args: - skip(skip_info.args[0]) - else: - skip("unconditional skip") - - item._evalxfail = MarkEvaluator(item, 'xfail') - check_xfail_no_run(item) - - -@hookimpl(hookwrapper=True) -def pytest_pyfunc_call(pyfuncitem): - check_xfail_no_run(pyfuncitem) - outcome = yield - passed = outcome.excinfo is None - if passed: - check_strict_xfail(pyfuncitem) - - -def check_xfail_no_run(item): - """check xfail(run=False)""" - if not item.config.option.runxfail: - evalxfail = item._evalxfail - if evalxfail.istrue(): - if not evalxfail.get('run', True): - xfail("[NOTRUN] " + evalxfail.getexplanation()) - - -def check_strict_xfail(pyfuncitem): - """check xfail(strict=True) for the given PASSING test""" - evalxfail = pyfuncitem._evalxfail - if evalxfail.istrue(): - strict_default = pyfuncitem.config.getini('xfail_strict') - is_strict_xfail = evalxfail.get('strict', strict_default) - if is_strict_xfail: - del pyfuncitem._evalxfail - explanation = evalxfail.getexplanation() - fail('[XPASS(strict)] ' + explanation, pytrace=False) - - -@hookimpl(hookwrapper=True) -def pytest_runtest_makereport(item, call): - outcome = yield - rep = outcome.get_result() - evalxfail = getattr(item, '_evalxfail', None) - # unitttest special case, see setting of _unexpectedsuccess - if hasattr(item, '_unexpectedsuccess') and rep.when == "call": - from _pytest.compat import _is_unittest_unexpected_success_a_failure - if item._unexpectedsuccess: - rep.longrepr = "Unexpected success: {0}".format(item._unexpectedsuccess) - else: - rep.longrepr = "Unexpected success" - if _is_unittest_unexpected_success_a_failure(): - rep.outcome = "failed" - else: - rep.outcome = "passed" - rep.wasxfail = rep.longrepr - elif item.config.option.runxfail: - pass # don't interefere - elif call.excinfo and call.excinfo.errisinstance(xfail.Exception): - rep.wasxfail = "reason: " + call.excinfo.value.msg - rep.outcome = "skipped" - elif evalxfail and not rep.skipped and evalxfail.wasvalid() and \ - evalxfail.istrue(): - if call.excinfo: - if evalxfail.invalidraise(call.excinfo.value): - rep.outcome = "failed" - else: - rep.outcome = "skipped" - rep.wasxfail = evalxfail.getexplanation() - elif call.when == "call": - strict_default = item.config.getini('xfail_strict') - is_strict_xfail = evalxfail.get('strict', strict_default) - explanation = evalxfail.getexplanation() - if is_strict_xfail: - rep.outcome = "failed" - rep.longrepr = "[XPASS(strict)] {0}".format(explanation) - else: - rep.outcome = "passed" - rep.wasxfail = explanation - elif item._skipped_by_mark and rep.skipped and type(rep.longrepr) is tuple: - # skipped by mark.skipif; change the location of the failure - # to point to the item definition, otherwise it will display - # the location of where the skip exception was raised within pytest - filename, line, reason = rep.longrepr - filename, line = item.location[:2] - rep.longrepr = filename, line, reason - -# called by terminalreporter progress reporting - - -def pytest_report_teststatus(report): - if hasattr(report, "wasxfail"): - if report.skipped: - return "xfailed", "x", "xfail" - elif report.passed: - return "xpassed", "X", ("XPASS", {'yellow': True}) - -# called by the terminalreporter instance/plugin - - -def pytest_terminal_summary(terminalreporter): - tr = terminalreporter - if not tr.reportchars: - # for name in "xfailed skipped failed xpassed": - # if not tr.stats.get(name, 0): - # tr.write_line("HINT: use '-r' option to see extra " - # "summary info about tests") - # break - return - - lines = [] - for char in tr.reportchars: - if char == "x": - show_xfailed(terminalreporter, lines) - elif char == "X": - show_xpassed(terminalreporter, lines) - elif char in "fF": - show_simple(terminalreporter, lines, 'failed', "FAIL %s") - elif char in "sS": - show_skipped(terminalreporter, lines) - elif char == "E": - show_simple(terminalreporter, lines, 'error', "ERROR %s") - elif char == 'p': - show_simple(terminalreporter, lines, 'passed', "PASSED %s") - - if lines: - tr._tw.sep("=", "short test summary info") - for line in lines: - tr._tw.line(line) - - -def show_simple(terminalreporter, lines, stat, format): - failed = terminalreporter.stats.get(stat) - if failed: - for rep in failed: - pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid) - lines.append(format % (pos,)) - - -def show_xfailed(terminalreporter, lines): - xfailed = terminalreporter.stats.get("xfailed") - if xfailed: - for rep in xfailed: - pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid) - reason = rep.wasxfail - lines.append("XFAIL %s" % (pos,)) - if reason: - lines.append(" " + str(reason)) - - -def show_xpassed(terminalreporter, lines): - xpassed = terminalreporter.stats.get("xpassed") - if xpassed: - for rep in xpassed: - pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid) - reason = rep.wasxfail - lines.append("XPASS %s %s" % (pos, reason)) - - -def cached_eval(config, expr, d): - if not hasattr(config, '_evalcache'): - config._evalcache = {} - try: - return config._evalcache[expr] - except KeyError: - import _pytest._code - exprcode = _pytest._code.compile(expr, mode="eval") - config._evalcache[expr] = x = eval(exprcode, d) - return x - - -def folded_skips(skipped): - d = {} - for event in skipped: - key = event.longrepr - assert len(key) == 3, (event, key) - keywords = getattr(event, 'keywords', {}) - # folding reports with global pytestmark variable - # this is workaround, because for now we cannot identify the scope of a skip marker - # TODO: revisit after marks scope would be fixed - when = getattr(event, 'when', None) - if when == 'setup' and 'skip' in keywords and 'pytestmark' not in keywords: - key = (key[0], None, key[2], ) - d.setdefault(key, []).append(event) - values = [] - for key, events in d.items(): - values.append((len(events),) + key) - return values - - -def show_skipped(terminalreporter, lines): - tr = terminalreporter - skipped = tr.stats.get('skipped', []) - if skipped: - # if not tr.hasopt('skipped'): - # tr.write_line( - # "%d skipped tests, specify -rs for more info" % - # len(skipped)) - # return - fskips = folded_skips(skipped) - if fskips: - # tr.write_sep("_", "skipped test summary") - for num, fspath, lineno, reason in fskips: - if reason.startswith("Skipped: "): - reason = reason[9:] - if lineno is not None: - lines.append( - "SKIP [%d] %s:%d: %s" % - (num, fspath, lineno + 1, reason)) - else: - lines.append( - "SKIP [%d] %s: %s" % - (num, fspath, reason)) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/appveyor.yml b/tests/wpt/web-platform-tests/tools/third_party/pytest/appveyor.yml index 4f4afe15c38..b808fa6d91a 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/appveyor.yml +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/appveyor.yml @@ -42,3 +42,7 @@ build: false # Not a C# project, build stuff at the test step instead. test_script: - call scripts\call-tox.bat + +cache: + - '%LOCALAPPDATA%\pip\cache' + - '%USERPROFILE%\.cache\pre-commit' diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/bench.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/bench.py index ce94964172f..4e72444e7d7 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/bench.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/bench.py @@ -1,12 +1,13 @@ import sys -if __name__ == '__main__': +if __name__ == "__main__": import cProfile - import pytest + import pytest # NOQA import pstats + script = sys.argv[1:] if len(sys.argv) > 1 else "empty.py" - stats = cProfile.run('pytest.cmdline.main(%r)' % script, 'prof') + stats = cProfile.run("pytest.cmdline.main(%r)" % script, "prof") p = pstats.Stats("prof") p.strip_dirs() - p.sort_stats('cumulative') + p.sort_stats("cumulative") print(p.print_stats(500)) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/bench_argcomplete.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/bench_argcomplete.py index d66c664f346..495e2c4ed3b 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/bench_argcomplete.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/bench_argcomplete.py @@ -5,15 +5,18 @@ # FilesCompleter 75.1109 69.2116 # FastFilesCompleter 0.7383 1.0760 +import timeit -if __name__ == '__main__': - import sys - import timeit - from argcomplete.completers import FilesCompleter - from _pytest._argcomplete import FastFilesCompleter - count = 1000 # only a few seconds - setup = 'from __main__ import FastFilesCompleter\nfc = FastFilesCompleter()' - run = 'fc("/d")' - sys.stdout.write('%s\n' % (timeit.timeit(run, - setup=setup.replace('Fast', ''), number=count))) - sys.stdout.write('%s\n' % (timeit.timeit(run, setup=setup, number=count))) +imports = [ + "from argcomplete.completers import FilesCompleter as completer", + "from _pytest._argcomplete import FastFilesCompleter as completer", +] + +count = 1000 # only a few seconds +setup = "%s\nfc = completer()" +run = 'fc("/d")' + + +if __name__ == "__main__": + print(timeit.timeit(run, setup=setup % imports[0], number=count)) + print((timeit.timeit(run, setup=setup % imports[1], number=count))) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/empty.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/empty.py index ac5e25701da..b90319936b3 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/empty.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/empty.py @@ -1,3 +1,4 @@ import py + for i in range(1000): py.builtin.exec_("def test_func_%d(): pass" % i) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/manyparam.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/manyparam.py index d2bca0e8acd..a25b098de86 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/manyparam.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/manyparam.py @@ -1,12 +1,15 @@ import pytest -@pytest.fixture(scope='module', params=range(966)) + +@pytest.fixture(scope="module", params=range(966)) def foo(request): return request.param + def test_it(foo): pass + + def test_it2(foo): pass - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/skip.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/skip.py index 960b308645a..b105e79f82e 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/skip.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/bench/skip.py @@ -1,10 +1,11 @@ - +from six.moves import range import pytest SKIP = True -@pytest.mark.parametrize("x", xrange(5000)) + +@pytest.mark.parametrize("x", range(5000)) def test_foo(x): if SKIP: pytest.skip("heh") diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2920.bugfix b/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2920.bugfix deleted file mode 100644 index 9c5217278ae..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2920.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix issue about ``-p no:`` having no effect. diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2949.trivial b/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2949.trivial deleted file mode 100644 index 39789e72b7a..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2949.trivial +++ /dev/null @@ -1 +0,0 @@ -Update github "bugs" link in CONTRIBUTING.rst diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2956.bugfix b/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2956.bugfix deleted file mode 100644 index 13717657bf1..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2956.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix regression with warnings that contained non-strings in their arguments in Python 2. diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2957.bugfix b/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2957.bugfix deleted file mode 100644 index 589665b692a..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2957.bugfix +++ /dev/null @@ -1 +0,0 @@ -Always escape null bytes when setting ``PYTEST_CURRENT_TEST``. diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2963.doc b/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2963.doc deleted file mode 100644 index c9a1d661b64..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2963.doc +++ /dev/null @@ -1 +0,0 @@ -Fix broken link to plugin pytest-localserver. diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2971.bugfix b/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2971.bugfix deleted file mode 100644 index 36684e8c880..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2971.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix ``ZeroDivisionError`` when using the ``testmon`` plugin when no tests were actually collected. diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2984.bugfix b/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2984.bugfix deleted file mode 100644 index 21f5748d523..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/2984.bugfix +++ /dev/null @@ -1 +0,0 @@ -Bring back ``TerminalReporter.writer`` as an alias to ``TerminalReporter._tw``. This alias was removed by accident in the ``3.3.0`` release. diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/README.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/README.rst new file mode 100644 index 00000000000..e34bd4da267 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/changelog/README.rst @@ -0,0 +1,32 @@ +This directory contains "newsfragments" which are short files that contain a small **ReST**-formatted +text that will be added to the next ``CHANGELOG``. + +The ``CHANGELOG`` will be read by users, so this description should be aimed to pytest users +instead of describing internal changes which are only relevant to the developers. + +Make sure to use full sentences with correct case and punctuation, for example:: + + Fix issue with non-ascii messages from the ``warnings`` module. + +Each file should be named like ``..rst``, where +```` is an issue number, and ```` is one of: + +* ``feature``: new user facing features, like new command-line options and new behavior. +* ``bugfix``: fixes a reported bug. +* ``doc``: documentation improvement, like rewording an entire session or adding missing docs. +* ``removal``: feature deprecation or removal. +* ``vendor``: changes in packages vendored in pytest. +* ``trivial``: fixing a small typo or internal change that might be noteworthy. + +So for example: ``123.feature.rst``, ``456.bugfix.rst``. + +If your PR fixes an issue, use that number here. If there is no issue, +then after you submit the PR and get the PR number you can add a +changelog using that instead. + +If you are not sure what issue type to use, don't hesitate to ask in your PR. + +Note that the ``towncrier`` tool will automatically +reflow your text, so it will work best if you stick to a single paragraph, but multiple sentences and links are OK +and encouraged. You can install ``towncrier`` and then run ``towncrier --draft`` +if you want to get a preview of how your change will look in the final release notes. diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/_templates/globaltoc.html b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/_templates/globaltoc.html index fdd4dd59b32..0e088d67ef3 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/_templates/globaltoc.html +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/_templates/globaltoc.html @@ -2,15 +2,16 @@ {%- if display_toc %} diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/_templates/links.html b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/_templates/links.html index d855a013f34..6f27757a348 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/_templates/links.html +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/_templates/links.html @@ -1,11 +1,8 @@

Useful Links

- diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/_themes/flask/theme.conf b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/_themes/flask/theme.conf index 18c720f804c..372b0028393 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/_themes/flask/theme.conf +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/_themes/flask/theme.conf @@ -6,4 +6,4 @@ pygments_style = flask_theme_support.FlaskyStyle [options] index_logo = '' index_logo_height = 120px -touch_icon = +touch_icon = diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/_themes/flask_theme_support.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/_themes/flask_theme_support.py index 33f47449c11..0dcf53b7542 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/_themes/flask_theme_support.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/_themes/flask_theme_support.py @@ -1,7 +1,19 @@ # flasky extensions. flasky pygments style based on tango style from pygments.style import Style -from pygments.token import Keyword, Name, Comment, String, Error, \ - Number, Operator, Generic, Whitespace, Punctuation, Other, Literal +from pygments.token import ( + Keyword, + Name, + Comment, + String, + Error, + Number, + Operator, + Generic, + Whitespace, + Punctuation, + Other, + Literal, +) class FlaskyStyle(Style): @@ -10,77 +22,68 @@ class FlaskyStyle(Style): styles = { # No corresponding class for the following: - #Text: "", # class: '' - Whitespace: "underline #f8f8f8", # class: 'w' - Error: "#a40000 border:#ef2929", # class: 'err' - Other: "#000000", # class 'x' - - Comment: "italic #8f5902", # class: 'c' - Comment.Preproc: "noitalic", # class: 'cp' - - Keyword: "bold #004461", # class: 'k' - Keyword.Constant: "bold #004461", # class: 'kc' - Keyword.Declaration: "bold #004461", # class: 'kd' - Keyword.Namespace: "bold #004461", # class: 'kn' - Keyword.Pseudo: "bold #004461", # class: 'kp' - Keyword.Reserved: "bold #004461", # class: 'kr' - Keyword.Type: "bold #004461", # class: 'kt' - - Operator: "#582800", # class: 'o' - Operator.Word: "bold #004461", # class: 'ow' - like keywords - - Punctuation: "bold #000000", # class: 'p' - + # Text: "", # class: '' + Whitespace: "underline #f8f8f8", # class: 'w' + Error: "#a40000 border:#ef2929", # class: 'err' + Other: "#000000", # class 'x' + Comment: "italic #8f5902", # class: 'c' + Comment.Preproc: "noitalic", # class: 'cp' + Keyword: "bold #004461", # class: 'k' + Keyword.Constant: "bold #004461", # class: 'kc' + Keyword.Declaration: "bold #004461", # class: 'kd' + Keyword.Namespace: "bold #004461", # class: 'kn' + Keyword.Pseudo: "bold #004461", # class: 'kp' + Keyword.Reserved: "bold #004461", # class: 'kr' + Keyword.Type: "bold #004461", # class: 'kt' + Operator: "#582800", # class: 'o' + Operator.Word: "bold #004461", # class: 'ow' - like keywords + Punctuation: "bold #000000", # class: 'p' # because special names such as Name.Class, Name.Function, etc. # are not recognized as such later in the parsing, we choose them # to look the same as ordinary variables. - Name: "#000000", # class: 'n' - Name.Attribute: "#c4a000", # class: 'na' - to be revised - Name.Builtin: "#004461", # class: 'nb' - Name.Builtin.Pseudo: "#3465a4", # class: 'bp' - Name.Class: "#000000", # class: 'nc' - to be revised - Name.Constant: "#000000", # class: 'no' - to be revised - Name.Decorator: "#888", # class: 'nd' - to be revised - Name.Entity: "#ce5c00", # class: 'ni' - Name.Exception: "bold #cc0000", # class: 'ne' - Name.Function: "#000000", # class: 'nf' - Name.Property: "#000000", # class: 'py' - Name.Label: "#f57900", # class: 'nl' - Name.Namespace: "#000000", # class: 'nn' - to be revised - Name.Other: "#000000", # class: 'nx' - Name.Tag: "bold #004461", # class: 'nt' - like a keyword - Name.Variable: "#000000", # class: 'nv' - to be revised - Name.Variable.Class: "#000000", # class: 'vc' - to be revised - Name.Variable.Global: "#000000", # class: 'vg' - to be revised - Name.Variable.Instance: "#000000", # class: 'vi' - to be revised - - Number: "#990000", # class: 'm' - - Literal: "#000000", # class: 'l' - Literal.Date: "#000000", # class: 'ld' - - String: "#4e9a06", # class: 's' - String.Backtick: "#4e9a06", # class: 'sb' - String.Char: "#4e9a06", # class: 'sc' - String.Doc: "italic #8f5902", # class: 'sd' - like a comment - String.Double: "#4e9a06", # class: 's2' - String.Escape: "#4e9a06", # class: 'se' - String.Heredoc: "#4e9a06", # class: 'sh' - String.Interpol: "#4e9a06", # class: 'si' - String.Other: "#4e9a06", # class: 'sx' - String.Regex: "#4e9a06", # class: 'sr' - String.Single: "#4e9a06", # class: 's1' - String.Symbol: "#4e9a06", # class: 'ss' - - Generic: "#000000", # class: 'g' - Generic.Deleted: "#a40000", # class: 'gd' - Generic.Emph: "italic #000000", # class: 'ge' - Generic.Error: "#ef2929", # class: 'gr' - Generic.Heading: "bold #000080", # class: 'gh' - Generic.Inserted: "#00A000", # class: 'gi' - Generic.Output: "#888", # class: 'go' - Generic.Prompt: "#745334", # class: 'gp' - Generic.Strong: "bold #000000", # class: 'gs' - Generic.Subheading: "bold #800080", # class: 'gu' - Generic.Traceback: "bold #a40000", # class: 'gt' + Name: "#000000", # class: 'n' + Name.Attribute: "#c4a000", # class: 'na' - to be revised + Name.Builtin: "#004461", # class: 'nb' + Name.Builtin.Pseudo: "#3465a4", # class: 'bp' + Name.Class: "#000000", # class: 'nc' - to be revised + Name.Constant: "#000000", # class: 'no' - to be revised + Name.Decorator: "#888", # class: 'nd' - to be revised + Name.Entity: "#ce5c00", # class: 'ni' + Name.Exception: "bold #cc0000", # class: 'ne' + Name.Function: "#000000", # class: 'nf' + Name.Property: "#000000", # class: 'py' + Name.Label: "#f57900", # class: 'nl' + Name.Namespace: "#000000", # class: 'nn' - to be revised + Name.Other: "#000000", # class: 'nx' + Name.Tag: "bold #004461", # class: 'nt' - like a keyword + Name.Variable: "#000000", # class: 'nv' - to be revised + Name.Variable.Class: "#000000", # class: 'vc' - to be revised + Name.Variable.Global: "#000000", # class: 'vg' - to be revised + Name.Variable.Instance: "#000000", # class: 'vi' - to be revised + Number: "#990000", # class: 'm' + Literal: "#000000", # class: 'l' + Literal.Date: "#000000", # class: 'ld' + String: "#4e9a06", # class: 's' + String.Backtick: "#4e9a06", # class: 'sb' + String.Char: "#4e9a06", # class: 'sc' + String.Doc: "italic #8f5902", # class: 'sd' - like a comment + String.Double: "#4e9a06", # class: 's2' + String.Escape: "#4e9a06", # class: 'se' + String.Heredoc: "#4e9a06", # class: 'sh' + String.Interpol: "#4e9a06", # class: 'si' + String.Other: "#4e9a06", # class: 'sx' + String.Regex: "#4e9a06", # class: 'sr' + String.Single: "#4e9a06", # class: 's1' + String.Symbol: "#4e9a06", # class: 'ss' + Generic: "#000000", # class: 'g' + Generic.Deleted: "#a40000", # class: 'gd' + Generic.Emph: "italic #000000", # class: 'ge' + Generic.Error: "#ef2929", # class: 'gr' + Generic.Heading: "bold #000080", # class: 'gh' + Generic.Inserted: "#00A000", # class: 'gi' + Generic.Output: "#888", # class: 'go' + Generic.Prompt: "#745334", # class: 'gp' + Generic.Strong: "bold #000000", # class: 'gs' + Generic.Subheading: "bold #800080", # class: 'gu' + Generic.Traceback: "bold #a40000", # class: 'gt' } diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/index.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/index.rst index 1a5f3760b68..107fcd2ad33 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/index.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/index.rst @@ -5,7 +5,17 @@ Release announcements .. toctree:: :maxdepth: 2 - + + release-3.6.2 + release-3.6.1 + release-3.6.0 + release-3.5.1 + release-3.5.0 + release-3.4.2 + release-3.4.1 + release-3.4.0 + release-3.3.2 + release-3.3.1 release-3.3.0 release-3.2.5 release-3.2.4 diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.0.3.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.0.3.rst index 9bbfdaab361..81d01eb99f9 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.0.3.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.0.3.rst @@ -1,4 +1,4 @@ -py.test 2.0.3: bug fixes and speed ups +py.test 2.0.3: bug fixes and speed ups =========================================================================== Welcome to pytest-2.0.3, a maintenance and bug fix release of pytest, @@ -37,4 +37,3 @@ Changes between 2.0.2 and 2.0.3 internally) - fix issue37: avoid invalid characters in junitxml's output - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.1.1.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.1.1.rst index ecdd69f4dc9..c2285eba9fa 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.1.1.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.1.1.rst @@ -34,4 +34,3 @@ Changes between 2.1.0 and 2.1.1 - fix issue59: provide system-out/err tags for junitxml output - fix issue61: assertion rewriting on boolean operations with 3 or more operands - you can now build a man page with "cd doc ; make man" - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.1.2.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.1.2.rst index 51b7591d366..1975f368a3f 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.1.2.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.1.2.rst @@ -30,4 +30,3 @@ Changes between 2.1.1 and 2.1.2 - fix issue68 / packages now work with assertion rewriting - fix issue66: use different assertion rewriting caches when the -O option is passed - don't try assertion rewriting on Jython, use reinterp - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.1.3.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.1.3.rst index f4da60b8ba4..a43bc058c17 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.1.3.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.1.3.rst @@ -9,7 +9,7 @@ and integration testing. See extensive docs with examples here: The release contains another fix to the perfected assertions introduced with the 2.1 series as well as the new possibility to customize reporting -for assertion expressions on a per-directory level. +for assertion expressions on a per-directory level. If you want to install or upgrade pytest, just type one of:: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.2.1.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.2.1.rst index 5d28bcb01f4..44281597eab 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.2.1.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.2.1.rst @@ -27,7 +27,7 @@ Changes between 2.2.0 and 2.2.1 ---------------------------------------- - fix issue99 (in pytest and py) internallerrors with resultlog now - produce better output - fixed by normalizing pytest_internalerror + produce better output - fixed by normalizing pytest_internalerror input arguments. - fix issue97 / traceback issues (in pytest and py) improve traceback output in conjunction with jinja2 and cython which hack tracebacks @@ -35,7 +35,7 @@ Changes between 2.2.0 and 2.2.1 the final test in a test node will now run its teardown directly instead of waiting for the end of the session. Thanks Dave Hunt for the good reporting and feedback. The pytest_runtest_protocol as well - as the pytest_runtest_teardown hooks now have "nextitem" available + as the pytest_runtest_teardown hooks now have "nextitem" available which will be None indicating the end of the test run. - fix collection crash due to unknown-source collected items, thanks to Ralf Schmitt (fixed by depending on a more recent pylib) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.2.2.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.2.2.rst index 733aedec413..22ef0bc7a16 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.2.2.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.2.2.rst @@ -4,7 +4,7 @@ pytest-2.2.2: bug fixes pytest-2.2.2 (updated to 2.2.3 to fix packaging issues) is a minor backward-compatible release of the versatile py.test testing tool. It contains bug fixes and a few refinements particularly to reporting with -"--collectonly", see below for betails. +"--collectonly", see below for betails. For general information see here: @@ -27,7 +27,7 @@ Changes between 2.2.1 and 2.2.2 - fix issue101: wrong args to unittest.TestCase test function now produce better output -- fix issue102: report more useful errors and hints for when a +- fix issue102: report more useful errors and hints for when a test directory was renamed and some pyc/__pycache__ remain - fix issue106: allow parametrize to be applied multiple times e.g. from module, class and at function level. @@ -38,6 +38,6 @@ Changes between 2.2.1 and 2.2.2 - fix issue115: make --collectonly robust against early failure (missing files/directories) - "-qq --collectonly" now shows only files and the number of tests in them -- "-q --collectonly" now shows test ids +- "-q --collectonly" now shows test ids - allow adding of attributes to test reports such that it also works with distributed testing (no upgrade of pytest-xdist needed) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.2.4.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.2.4.rst index 67f0feb27c7..a8fb9b93c5b 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.2.4.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.2.4.rst @@ -36,4 +36,3 @@ Changes between 2.2.3 and 2.2.4 configure/sessionstart where called - fix issue #144: better mangle test ids to junitxml classnames - upgrade distribute_setup.py to 0.6.27 - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.0.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.0.rst index f863aad0ace..061aa025c1e 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.0.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.0.rst @@ -1,7 +1,7 @@ pytest-2.3: improved fixtures / better unittest integration ============================================================================= -pytest-2.3 comes with many major improvements for fixture/funcarg management +pytest-2.3 comes with many major improvements for fixture/funcarg management and parametrized testing in Python. It is now easier, more efficient and more predicatable to re-run the same tests with different fixture instances. Also, you can directly declare the caching "scope" of @@ -9,7 +9,7 @@ fixtures so that dependent tests throughout your whole test suite can re-use database or other expensive fixture objects with ease. Lastly, it's possible for fixture functions (formerly known as funcarg factories) to use other fixtures, allowing for a completely modular and -re-useable fixture design. +re-useable fixture design. For detailed info and tutorial-style examples, see: @@ -27,7 +27,7 @@ All changes are backward compatible and you should be able to continue to run your test suites and 3rd party plugins that worked with pytest-2.2.4. -If you are interested in the precise reasoning (including examples) of the +If you are interested in the precise reasoning (including examples) of the pytest-2.3 fixture evolution, please consult http://pytest.org/latest/funcarg_compare.html @@ -43,7 +43,7 @@ and more details for those already in the knowing of pytest can be found in the CHANGELOG below. Particular thanks for this release go to Floris Bruynooghe, Alex Okrushko -Carl Meyer, Ronny Pfannschmidt, Benjamin Peterson and Alex Gaynor for helping +Carl Meyer, Ronny Pfannschmidt, Benjamin Peterson and Alex Gaynor for helping to get the new features right and well integrated. Ronny and Floris also helped to fix a number of bugs and yet more people helped by providing bug reports. @@ -94,7 +94,7 @@ Changes between 2.2.4 and 2.3.0 - pluginmanager.register(...) now raises ValueError if the plugin has been already registered or the name is taken -- fix issue159: improve http://pytest.org/latest/faq.html +- fix issue159: improve http://pytest.org/latest/faq.html especially with respect to the "magic" history, also mention pytest-django, trial and unittest integration. @@ -125,10 +125,9 @@ Changes between 2.2.4 and 2.3.0 you can use startdir.bestrelpath(yourpath) to show nice relative path - - allow plugins to implement both pytest_report_header and + - allow plugins to implement both pytest_report_header and pytest_sessionstart (sessionstart is invoked first). - don't show deselected reason line if there is none - py.test -vv will show all of assert comparisons instead of truncating - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.1.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.1.rst index b787dc203f4..6f8770b3451 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.1.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.1.rst @@ -3,16 +3,16 @@ pytest-2.3.1: fix regression with factory functions pytest-2.3.1 is a quick follow-up release: -- fix issue202 - regression with fixture functions/funcarg factories: - using "self" is now safe again and works as in 2.2.4. Thanks +- fix issue202 - regression with fixture functions/funcarg factories: + using "self" is now safe again and works as in 2.2.4. Thanks to Eduard Schettino for the quick bug report. -- disable pexpect pytest self tests on Freebsd - thanks Koob for the +- disable pexpect pytest self tests on Freebsd - thanks Koob for the quick reporting - fix/improve interactive docs with --markers -See +See http://pytest.org/ diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.2.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.2.rst index 75312b429cd..484feaaa5a2 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.2.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.2.rst @@ -8,9 +8,9 @@ pytest-2.3.2 is another stabilization release: - fix teardown-ordering for parametrized setups - fix unittest and trial compat behaviour with respect to runTest() methods - issue 206 and others: some improvements to packaging -- fix issue127 and others: improve some docs +- fix issue127 and others: improve some docs -See +See http://pytest.org/ @@ -26,7 +26,7 @@ holger krekel Changes between 2.3.1 and 2.3.2 ----------------------------------- -- fix issue208 and fix issue29 use new py version to avoid long pauses +- fix issue208 and fix issue29 use new py version to avoid long pauses when printing tracebacks in long modules - fix issue205 - conftests in subdirs customizing diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.3.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.3.rst index 3a48b6ac4ba..0cb598a426a 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.3.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.3.rst @@ -6,7 +6,7 @@ which offers uebersimple assertions, scalable fixture mechanisms and deep customization for testing with Python. Particularly, this release provides: -- integration fixes and improvements related to flask, numpy, nose, +- integration fixes and improvements related to flask, numpy, nose, unittest, mock - makes pytest work on py24 again (yes, people sometimes still need to use it) @@ -16,7 +16,7 @@ this release provides: Thanks to Manuel Jacob, Thomas Waldmann, Ronny Pfannschmidt, Pavel Repin and Andreas Taumoefolau for providing patches and all for the issues. -See +See http://pytest.org/ @@ -59,4 +59,3 @@ Changes between 2.3.2 and 2.3.3 - fix issue127 - improve documentation for pytest_addoption() and add a ``config.getoption(name)`` helper function for consistency. - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.4.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.4.rst index d6c597b5489..e2e8cb143a3 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.4.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.4.rst @@ -10,15 +10,15 @@ comes with the following fixes and features: can write: -k "name1 or name2" etc. This is a slight usage incompatibility if you used special syntax like "TestClass.test_method" which you now need to write as -k "TestClass and test_method" to match a certain - method in a certain test class. + method in a certain test class. - allow to dynamically define markers via item.keywords[...]=assignment integrating with "-m" option -- yielded test functions will now have autouse-fixtures active but +- yielded test functions will now have autouse-fixtures active but cannot accept fixtures as funcargs - it's anyway recommended to rather use the post-2.0 parametrize features instead of yield, see: http://pytest.org/latest/example/parametrize.html - fix autouse-issue where autouse-fixtures would not be discovered - if defined in a a/conftest.py file and tests in a/tests/test_some.py + if defined in an a/conftest.py file and tests in a/tests/test_some.py - fix issue226 - LIFO ordering for fixture teardowns - fix issue224 - invocations with >256 char arguments now work - fix issue91 - add/discuss package/directory level setups in example @@ -26,7 +26,7 @@ comes with the following fixes and features: Thanks in particular to Thomas Waldmann for spotting and reporting issues. -See +See http://pytest.org/ diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.5.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.5.rst index 112399ef3ca..465dd826ed4 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.5.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.3.5.rst @@ -13,8 +13,8 @@ few interesting new plugins saw the light last month: - pytest-random: randomize test ordering And several others like pytest-django saw maintenance releases. -For a more complete list, check out -https://pypi.python.org/pypi?%3Aaction=search&term=pytest&submit=search. +For a more complete list, check out +https://pypi.org/search/?q=pytest For general information see: @@ -81,7 +81,7 @@ Changes between 2.3.4 and 2.3.5 - fix bug where using capsys with pytest.set_trace() in a test function would break when looking at capsys.readouterr() -- allow to specify prefixes starting with "_" when +- allow to specify prefixes starting with "_" when customizing python_functions test discovery. (thanks Graham Horler) - improve PYTEST_DEBUG tracing output by putting @@ -94,4 +94,3 @@ Changes between 2.3.4 and 2.3.5 - fix issue134 - print the collect errors that prevent running specified test items - fix issue266 - accept unicode in MarkEvaluator expressions - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.4.0.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.4.0.rst index be3aaedb09f..25f6254c529 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.4.0.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.4.0.rst @@ -1,9 +1,9 @@ pytest-2.4.0: new fixture features/hooks and bug fixes =========================================================================== -The just released pytest-2.4.0 brings many improvements and numerous +The just released pytest-2.4.0 brings many improvements and numerous bug fixes while remaining plugin- and test-suite compatible apart -from a few supposedly very minor incompatibilities. See below for +from a few supposedly very minor incompatibilities. See below for a full list of details. A few feature highlights: - new yield-style fixtures `pytest.yield_fixture @@ -13,7 +13,7 @@ a full list of details. A few feature highlights: - improved pdb support: ``import pdb ; pdb.set_trace()`` now works without requiring prior disabling of stdout/stderr capturing. Also the ``--pdb`` options works now on collection and internal errors - and we introduced a new experimental hook for IDEs/plugins to + and we introduced a new experimental hook for IDEs/plugins to intercept debugging: ``pytest_exception_interact(node, call, report)``. - shorter monkeypatch variant to allow specifying an import path as @@ -23,21 +23,21 @@ a full list of details. A few feature highlights: called if the corresponding setup method succeeded. - integrate tab-completion on command line options if you - have `argcomplete `_ + have `argcomplete `_ configured. - allow boolean expression directly with skipif/xfail if a "reason" is also specified. - a new hook ``pytest_load_initial_conftests`` allows plugins like - `pytest-django `_ to + `pytest-django `_ to influence the environment before conftest files import ``django``. - reporting: color the last line red or green depending if failures/errors occurred or everything passed. -The documentation has been updated to accommodate the changes, -see `http://pytest.org `_ +The documentation has been updated to accommodate the changes, +see `http://pytest.org `_ To install or upgrade pytest:: @@ -45,8 +45,8 @@ To install or upgrade pytest:: easy_install -U pytest -**Many thanks to all who helped, including Floris Bruynooghe, -Brianna Laugher, Andreas Pelme, Anthon van der Neut, Anatoly Bubenkoff, +**Many thanks to all who helped, including Floris Bruynooghe, +Brianna Laugher, Andreas Pelme, Anthon van der Neut, Anatoly Bubenkoff, Vladimir Keleshev, Mathieu Agopian, Ronny Pfannschmidt, Christian Theunert and many others.** @@ -101,12 +101,12 @@ new features: - make "import pdb ; pdb.set_trace()" work natively wrt capturing (no "-s" needed anymore), making ``pytest.set_trace()`` a mere shortcut. -- fix issue181: --pdb now also works on collect errors (and - on internal errors) . This was implemented by a slight internal - refactoring and the introduction of a new hook +- fix issue181: --pdb now also works on collect errors (and + on internal errors) . This was implemented by a slight internal + refactoring and the introduction of a new hook ``pytest_exception_interact`` hook (see next item). -- fix issue341: introduce new experimental hook for IDEs/terminals to +- fix issue341: introduce new experimental hook for IDEs/terminals to intercept debugging: ``pytest_exception_interact(node, call, report)``. - new monkeypatch.setattr() variant to provide a shorter @@ -124,7 +124,7 @@ new features: phase of a node. - simplify pytest.mark.parametrize() signature: allow to pass a - CSV-separated string to specify argnames. For example: + CSV-separated string to specify argnames. For example: ``pytest.mark.parametrize("input,expected", [(1,2), (2,3)])`` works as well as the previous: ``pytest.mark.parametrize(("input", "expected"), ...)``. @@ -149,10 +149,10 @@ new features: Bug fixes: -- fix issue358 - capturing options are now parsed more properly +- fix issue358 - capturing options are now parsed more properly by using a new parser.parse_known_args method. -- pytest now uses argparse instead of optparse (thanks Anthon) which +- pytest now uses argparse instead of optparse (thanks Anthon) which means that "argparse" is added as a dependency if installing into python2.6 environments or below. @@ -193,7 +193,7 @@ Bug fixes: - fix issue323 - sorting of many module-scoped arg parametrizations - make sessionfinish hooks execute with the same cwd-context as at - session start (helps fix plugin behaviour which write output files + session start (helps fix plugin behaviour which write output files with relative path such as pytest-cov) - fix issue316 - properly reference collection hooks in docs @@ -201,7 +201,7 @@ Bug fixes: - fix issue 306 - cleanup of -k/-m options to only match markers/test names/keywords respectively. Thanks Wouter van Ackooy. -- improved doctest counting for doctests in python modules -- +- improved doctest counting for doctests in python modules -- files without any doctest items will not show up anymore and doctest examples are counted as separate test items. thanks Danilo Bellini. @@ -211,7 +211,7 @@ Bug fixes: mode. Thanks Jason R. Coombs. - fix junitxml generation when test output contains control characters, - addressing issue267, thanks Jaap Broekhuizen + addressing issue267, thanks Jaap Broekhuizen - fix issue338: honor --tb style for setup/teardown errors as well. Thanks Maho. @@ -220,6 +220,5 @@ Bug fixes: - better parametrize error messages, thanks Brianna Laugher - pytest_terminal_summary(terminalreporter) hooks can now use - ".section(title)" and ".line(msg)" methods to print extra + ".section(title)" and ".line(msg)" methods to print extra information at the end of a test run. - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.4.1.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.4.1.rst index 64ba170f897..308df6bdc40 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.4.1.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.4.1.rst @@ -8,7 +8,7 @@ compared to 2.3.5 before they hit more people: "type" keyword should also be converted to the respective types. thanks Floris Bruynooghe, @dnozay. (fixes issue360 and issue362) -- fix dotted filename completion when using argcomplete +- fix dotted filename completion when using argcomplete thanks Anthon van der Neuth. (fixes issue361) - fix regression when a 1-tuple ("arg",) is used for specifying diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.4.2.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.4.2.rst index 3b4aa95abbc..ab08b72aaf7 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.4.2.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.4.2.rst @@ -26,9 +26,9 @@ pytest-2.4.2 is another bug-fixing release: - remove attempt to "dup" stdout at startup as it's icky. the normal capturing should catch enough possibilities - of tests messing up standard FDs. + of tests messing up standard FDs. -- add pluginmanager.do_configure(config) as a link to +- add pluginmanager.do_configure(config) as a link to config.do_configure() for plugin-compatibility as usual, docs at http://pytest.org and upgrades via:: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.5.0.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.5.0.rst index b04a825cd8e..29064e05e6d 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.5.0.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.5.0.rst @@ -4,7 +4,7 @@ pytest-2.5.0: now down to ZERO reported bugs! pytest-2.5.0 is a big fixing release, the result of two community bug fixing days plus numerous additional works from many people and reporters. The release should be fully compatible to 2.4.2, existing -plugins and test suites. We aim at maintaining this level of ZERO reported +plugins and test suites. We aim at maintaining this level of ZERO reported bugs because it's no fun if your testing tool has bugs, is it? Under a condition, though: when submitting a bug report please provide clear information about the circumstances and a simple example which @@ -17,12 +17,12 @@ help. For those who use older Python versions, please note that pytest is not automatically tested on python2.5 due to virtualenv, setuptools and tox not supporting it anymore. Manual verification shows that it mostly -works fine but it's not going to be part of the automated release +works fine but it's not going to be part of the automated release process and thus likely to break in the future. -As usual, current docs are at +As usual, current docs are at - http://pytest.org + http://pytest.org and you can upgrade from pypi via:: @@ -40,28 +40,28 @@ holger krekel 2.5.0 ----------------------------------- -- dropped python2.5 from automated release testing of pytest itself - which means it's probably going to break soon (but still works +- dropped python2.5 from automated release testing of pytest itself + which means it's probably going to break soon (but still works with this release we believe). - simplified and fixed implementation for calling finalizers when - parametrized fixtures or function arguments are involved. finalization + parametrized fixtures or function arguments are involved. finalization is now performed lazily at setup time instead of in the "teardown phase". - While this might sound odd at first, it helps to ensure that we are + While this might sound odd at first, it helps to ensure that we are correctly handling setup/teardown even in complex code. User-level code should not be affected unless it's implementing the pytest_runtest_teardown hook and expecting certain fixture instances are torn down within (very unlikely and would have been unreliable anyway). -- PR90: add --color=yes|no|auto option to force terminal coloring +- PR90: add --color=yes|no|auto option to force terminal coloring mode ("auto" is default). Thanks Marc Abramowitz. - fix issue319 - correctly show unicode in assertion errors. Many thanks to Floris Bruynooghe for the complete PR. Also means we depend on py>=1.4.19 now. -- fix issue396 - correctly sort and finalize class-scoped parametrized - tests independently from number of methods on the class. +- fix issue396 - correctly sort and finalize class-scoped parametrized + tests independently from number of methods on the class. - refix issue323 in a better way -- parametrization should now never cause Runtime Recursion errors because the underlying algorithm @@ -70,18 +70,18 @@ holger krekel to problems for more than >966 non-function scoped parameters). - fix issue290 - there is preliminary support now for parametrizing - with repeated same values (sometimes useful to test if calling + with repeated same values (sometimes useful to test if calling a second time works as with the first time). - close issue240 - document precisely how pytest module importing - works, discuss the two common test directory layouts, and how it + works, discuss the two common test directory layouts, and how it interacts with PEP420-namespace packages. - fix issue246 fix finalizer order to be LIFO on independent fixtures - depending on a parametrized higher-than-function scoped fixture. + depending on a parametrized higher-than-function scoped fixture. (was quite some effort so please bear with the complexity of this sentence :) Thanks Ralph Schmitt for the precise failure example. - + - fix issue244 by implementing special index for parameters to only use indices for paramentrized test ids @@ -99,9 +99,9 @@ holger krekel filtering with simple strings that are not valid python expressions. Examples: "-k 1.3" matches all tests parametrized with 1.3. "-k None" filters all tests that have "None" in their name - and conversely "-k 'not None'". + and conversely "-k 'not None'". Previously these examples would raise syntax errors. - + - fix issue384 by removing the trial support code since the unittest compat enhancements allow trial to handle it on its own @@ -109,7 +109,7 @@ holger krekel - don't hide an ImportError when importing a plugin produces one. fixes issue375. -- fix issue275 - allow usefixtures and autouse fixtures +- fix issue275 - allow usefixtures and autouse fixtures for running doctest text files. - fix issue380 by making --resultlog only rely on longrepr instead @@ -135,20 +135,20 @@ holger krekel (it already did neutralize pytest.mark.xfail markers) - refine pytest / pkg_resources interactions: The AssertionRewritingHook - PEP302 compliant loader now registers itself with setuptools/pkg_resources + PEP302 compliant loader now registers itself with setuptools/pkg_resources properly so that the pkg_resources.resource_stream method works properly. Fixes issue366. Thanks for the investigations and full PR to Jason R. Coombs. - pytestconfig fixture is now session-scoped as it is the same object during the - whole test run. Fixes issue370. + whole test run. Fixes issue370. - avoid one surprising case of marker malfunction/confusion:: - + @pytest.mark.some(lambda arg: ...) def test_function(): - would not work correctly because pytest assumes @pytest.mark.some - gets a function to be decorated already. We now at least detect if this + would not work correctly because pytest assumes @pytest.mark.some + gets a function to be decorated already. We now at least detect if this arg is a lambda and thus the example will work. Thanks Alex Gaynor for bringing it up. @@ -159,11 +159,11 @@ holger krekel although it's not needed by pytest itself atm. Also fix caching. Fixes issue376. -- fix issue221 - handle importing of namespace-package with no +- fix issue221 - handle importing of namespace-package with no __init__.py properly. - refactor internal FixtureRequest handling to avoid monkeypatching. - One of the positive user-facing effects is that the "request" object + One of the positive user-facing effects is that the "request" object can now be used in closures. - fixed version comparison in pytest.importskip(modname, minverstring) @@ -172,4 +172,3 @@ holger krekel does not duplicate the unittest-API into the "plain" namespace. - fix verbose reporting for @mock'd test functions - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.5.1.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.5.1.rst index a3a74cec626..22e69a836b9 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.5.1.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.5.1.rst @@ -1,8 +1,8 @@ pytest-2.5.1: fixes and new home page styling =========================================================================== -pytest is a mature Python testing tool with more than a 1000 tests -against itself, passing on many different interpreters and platforms. +pytest is a mature Python testing tool with more than a 1000 tests +against itself, passing on many different interpreters and platforms. The 2.5.1 release maintains the "zero-reported-bugs" promise by fixing the three bugs reported since the last release a few days ago. It also @@ -11,12 +11,12 @@ the flask theme from Armin Ronacher: http://pytest.org -If you have anything more to improve styling and docs, +If you have anything more to improve styling and docs, we'd be very happy to merge further pull requests. On the coding side, the release also contains a little enhancement to fixture decorators allowing to directly influence generation of test -ids, thanks to Floris Bruynooghe. Other thanks for helping with +ids, thanks to Floris Bruynooghe. Other thanks for helping with this release go to Anatoly Bubenkoff and Ronny Pfannschmidt. As usual, you can upgrade from pypi via:: @@ -37,11 +37,10 @@ holger krekel - Allow parameterized fixtures to specify the ID of the parameters by adding an ids argument to pytest.fixture() and pytest.yield_fixture(). - Thanks Floris Bruynooghe. + Thanks Floris Bruynooghe. - fix issue404 by always using the binary xml escape in the junitxml plugin. Thanks Ronny Pfannschmidt. - fix issue407: fix addoption docstring to point to argparse instead of optparse. Thanks Daniel D. Wright. - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.5.2.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.5.2.rst index d5cfca2dbda..c389f5f5403 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.5.2.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.5.2.rst @@ -1,8 +1,8 @@ -pytest-2.5.2: fixes +pytest-2.5.2: fixes =========================================================================== -pytest is a mature Python testing tool with more than a 1000 tests -against itself, passing on many different interpreters and platforms. +pytest is a mature Python testing tool with more than a 1000 tests +against itself, passing on many different interpreters and platforms. The 2.5.2 release fixes a few bugs with two maybe-bugs remaining and actively being worked on (and waiting for the bug reporter's input). @@ -19,18 +19,18 @@ As usual, you can upgrade from pypi via:: Thanks to the following people who contributed to this release: - Anatoly Bubenkov + Anatoly Bubenkov Ronny Pfannschmidt Floris Bruynooghe - Bruno Oliveira - Andreas Pelme + Bruno Oliveira + Andreas Pelme Jurko Gospodnetić - Piotr Banaszkiewicz - Simon Liedtke - lakka - Lukasz Balcerzak - Philippe Muller - Daniel Hahler + Piotr Banaszkiewicz + Simon Liedtke + lakka + Lukasz Balcerzak + Philippe Muller + Daniel Hahler have fun, holger krekel @@ -39,11 +39,11 @@ holger krekel ----------------------------------- - fix issue409 -- better interoperate with cx_freeze by not - trying to import from collections.abc which causes problems + trying to import from collections.abc which causes problems for py27/cx_freeze. Thanks Wolfgang L. for reporting and tracking it down. - fixed docs and code to use "pytest" instead of "py.test" almost everywhere. - Thanks Jurko Gospodnetic for the complete PR. + Thanks Jurko Gospodnetic for the complete PR. - fix issue425: mention at end of "py.test -h" that --markers and --fixtures work according to specified test path (or current dir) @@ -54,11 +54,10 @@ holger krekel - copy, cleanup and integrate py.io capture from pylib 1.4.20.dev2 (rev 13d9af95547e) - + - address issue416: clarify docs as to conftest.py loading semantics - fix issue429: comparing byte strings with non-ascii chars in assert expressions now work better. Thanks Floris Bruynooghe. - make capfd/capsys.capture private, its unused and shouldn't be exposed - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.6.1.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.6.1.rst index 6f27c5861ca..fba6f2993a5 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.6.1.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.6.1.rst @@ -52,8 +52,7 @@ Changes 2.6.1 "::" node id specifications (copy pasted from "-v" output) - fix issue544 by only removing "@NUM" at the end of "::" separated parts - and if the part has an ".py" extension + and if the part has a ".py" extension - don't use py.std import helper, rather import things directly. Thanks Bruno Oliveira. - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.6.2.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.6.2.rst index 4efc73a4eaa..f6ce178a107 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.6.2.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.6.2.rst @@ -49,4 +49,3 @@ holger krekel - Do not mark as universal wheel because Python 2.6 is different from other builds due to the extra argparse dependency. Fixes issue566. Thanks sontek. - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.6.3.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.6.3.rst index ee0d2692c47..7353dfee71c 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.6.3.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.6.3.rst @@ -49,4 +49,3 @@ Changes 2.6.3 - check xfail/skip also with non-python function test items. Thanks Floris Bruynooghe. - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.7.0.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.7.0.rst index 4e317ff8f34..d63081edb1b 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.7.0.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.7.0.rst @@ -98,4 +98,3 @@ holger krekel - On failure, the ``sys.last_value``, ``sys.last_type`` and ``sys.last_traceback`` are set, so that a user can inspect the error via postmortem debugging (almarklein). - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.7.2.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.7.2.rst index 69130ad623f..1e3950de4d0 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.7.2.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.7.2.rst @@ -55,4 +55,3 @@ The py.test Development Team - fix issue756, fix issue752 (and similar issues): depend on py-1.4.29 which has a refined algorithm for traceback generation. - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.8.3.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.8.3.rst index d080ac724c1..b131a7e1f14 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.8.3.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.8.3.rst @@ -53,7 +53,6 @@ The py.test Development Team Thanks Gabriel Reis for the PR. - add more talks to the documentation -- extend documentation on the --ignore cli option -- use pytest-runner for setuptools integration +- extend documentation on the --ignore cli option +- use pytest-runner for setuptools integration - minor fixes for interaction with OS X El Capitan system integrity protection (thanks Florian) - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.8.7.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.8.7.rst index d98d731064b..9005f56363a 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.8.7.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.8.7.rst @@ -28,4 +28,4 @@ The py.test Development Team 2.8.7 (compared to 2.8.6) ------------------------- -- fix #1338: use predictable object resolution for monkeypatch \ No newline at end of file +- fix #1338: use predictable object resolution for monkeypatch diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.9.0.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.9.0.rst index 011b1ffb9d2..8d829996d83 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.9.0.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.9.0.rst @@ -14,25 +14,25 @@ As usual, you can upgrade from pypi via:: Thanks to all who contributed to this release, among them: - Anatoly Bubenkov - Bruno Oliveira - Buck Golemon - David Vierra - Florian Bruhin - Galaczi Endre - Georgy Dyuldin - Lukas Bednar - Luke Murphy - Marcin Biernat - Matt Williams - Michael Aquilina - Raphael Pierzina - Ronny Pfannschmidt - Ryan Wooden - Tiemo Kieft - TomV - holger krekel - jab + Anatoly Bubenkov + Bruno Oliveira + Buck Golemon + David Vierra + Florian Bruhin + Galaczi Endre + Georgy Dyuldin + Lukas Bednar + Luke Murphy + Marcin Biernat + Matt Williams + Michael Aquilina + Raphael Pierzina + Ronny Pfannschmidt + Ryan Wooden + Tiemo Kieft + TomV + holger krekel + jab Happy testing, @@ -76,18 +76,18 @@ The py.test Development Team **Changes** * **Important**: `py.code `_ has been - merged into the ``pytest`` repository as ``pytest._code``. This decision - was made because ``py.code`` had very few uses outside ``pytest`` and the - fact that it was in a different repository made it difficult to fix bugs on + merged into the ``pytest`` repository as ``pytest._code``. This decision + was made because ``py.code`` had very few uses outside ``pytest`` and the + fact that it was in a different repository made it difficult to fix bugs on its code in a timely manner. The team hopes with this to be able to better refactor out and improve that code. This change shouldn't affect users, but it is useful to let users aware if they encounter any strange behavior. - - Keep in mind that the code for ``pytest._code`` is **private** and + + Keep in mind that the code for ``pytest._code`` is **private** and **experimental**, so you definitely should not import it explicitly! - Please note that the original ``py.code`` is still available in + Please note that the original ``py.code`` is still available in `pylib `_. * ``pytest_enter_pdb`` now optionally receives the pytest config object. @@ -129,8 +129,8 @@ The py.test Development Team * Fix (`#1422`_): junit record_xml_property doesn't allow multiple records with same name. - - + + .. _`traceback style docs`: https://pytest.org/latest/usage.html#modifying-python-traceback-printing .. _#1422: https://github.com/pytest-dev/pytest/issues/1422 @@ -156,4 +156,4 @@ The py.test Development Team .. _@tomviner: https://github.com/tomviner .. _@RonnyPfannschmidt: https://github.com/RonnyPfannschmidt .. _@rabbbit: https://github.com/rabbbit -.. _@hackebrot: https://github.com/hackebrot \ No newline at end of file +.. _@hackebrot: https://github.com/hackebrot diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.9.1.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.9.1.rst index 3277da1e9b0..c71f3851638 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.9.1.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-2.9.1.rst @@ -14,17 +14,17 @@ As usual, you can upgrade from pypi via:: Thanks to all who contributed to this release, among them: - Bruno Oliveira - Daniel Hahler - Dmitry Malinovsky - Florian Bruhin - Floris Bruynooghe - Matt Bachmann - Ronny Pfannschmidt - TomV - Vladimir Bolshakov - Zearin - palaviv + Bruno Oliveira + Daniel Hahler + Dmitry Malinovsky + Florian Bruhin + Floris Bruynooghe + Matt Bachmann + Ronny Pfannschmidt + TomV + Vladimir Bolshakov + Zearin + palaviv Happy testing, diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.0.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.0.rst index 4bf1e8534ec..ca3e9e32763 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.0.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.0.rst @@ -8,10 +8,10 @@ against itself, passing on many different interpreters and platforms. This release contains a lot of bugs fixes and improvements, and much of the work done on it was possible because of the 2016 Sprint[1], which -was funded by an indiegogo campaign which raised over US$12,000 with -nearly 100 backers. +was funded by an indiegogo campaign which raised over US$12,000 with +nearly 100 backers. -There's a "What's new in pytest 3.0" [2] blog post highlighting the +There's a "What's new in pytest 3.0" [2] blog post highlighting the major features in this release. To see the complete changelog and documentation, please visit: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.1.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.1.rst index 9fb38047b9c..eb6f6a50ef7 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.1.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.1.rst @@ -7,7 +7,7 @@ This release fixes some regressions reported in version 3.0.0, being a drop-in replacement. To upgrade: pip install --upgrade pytest - + The changelog is available at http://doc.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.2.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.2.rst index 9d1c05f2d45..4af412fc5ee 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.2.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.2.rst @@ -7,7 +7,7 @@ This release fixes some regressions and bugs reported in version 3.0.1, being a drop-in replacement. To upgrade:: pip install --upgrade pytest - + The changelog is available at http://doc.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.3.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.3.rst index f00172195db..896d4787304 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.3.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.3.rst @@ -3,11 +3,11 @@ pytest-3.0.3 pytest 3.0.3 has just been released to PyPI. -This release fixes some regressions and bugs reported in the last version, +This release fixes some regressions and bugs reported in the last version, being a drop-in replacement. To upgrade:: pip install --upgrade pytest - + The changelog is available at http://doc.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.4.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.4.rst index 852057037dd..855bc56d5b8 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.4.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.4.rst @@ -3,11 +3,11 @@ pytest-3.0.4 pytest 3.0.4 has just been released to PyPI. -This release fixes some regressions and bugs reported in the last version, +This release fixes some regressions and bugs reported in the last version, being a drop-in replacement. To upgrade:: pip install --upgrade pytest - + The changelog is available at http://doc.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.5.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.5.rst index 3e2419d7e5d..2f369827588 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.5.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.5.rst @@ -6,7 +6,7 @@ pytest 3.0.5 has just been released to PyPI. This is a bug-fix release, being a drop-in replacement. To upgrade:: pip install --upgrade pytest - + The changelog is available at http://doc.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.6.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.6.rst index 2988b9cb3b8..149c2d65e1a 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.6.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.6.rst @@ -6,7 +6,7 @@ pytest 3.0.6 has just been released to PyPI. This is a bug-fix release, being a drop-in replacement. To upgrade:: pip install --upgrade pytest - + The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.7.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.7.rst index 591557aa787..b37e4f61dee 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.7.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.0.7.rst @@ -6,7 +6,7 @@ pytest 3.0.7 has just been released to PyPI. This is a bug-fix release, being a drop-in replacement. To upgrade:: pip install --upgrade pytest - + The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.1.1.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.1.1.rst index 370b8fd7355..4ce7531977c 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.1.1.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.1.1.rst @@ -6,7 +6,7 @@ pytest 3.1.1 has just been released to PyPI. This is a bug-fix release, being a drop-in replacement. To upgrade:: pip install --upgrade pytest - + The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.1.2.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.1.2.rst index 60168a857ba..8ed0c93e9ad 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.1.2.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.1.2.rst @@ -6,7 +6,7 @@ pytest 3.1.2 has just been released to PyPI. This is a bug-fix release, being a drop-in replacement. To upgrade:: pip install --upgrade pytest - + The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.1.3.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.1.3.rst index a55280626ba..d7771f92232 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.1.3.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.1.3.rst @@ -6,7 +6,7 @@ pytest 3.1.3 has just been released to PyPI. This is a bug-fix release, being a drop-in replacement. To upgrade:: pip install --upgrade pytest - + The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.1.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.1.rst index 899ffcd4b4a..afe2c5bfe2c 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.1.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.1.rst @@ -6,7 +6,7 @@ pytest 3.2.1 has just been released to PyPI. This is a bug-fix release, being a drop-in replacement. To upgrade:: pip install --upgrade pytest - + The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.2.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.2.rst index 599bf872775..88e32873a1b 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.2.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.2.rst @@ -6,7 +6,7 @@ pytest 3.2.2 has just been released to PyPI. This is a bug-fix release, being a drop-in replacement. To upgrade:: pip install --upgrade pytest - + The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.3.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.3.rst index 589374974d9..ddfda4d132f 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.3.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.3.rst @@ -6,7 +6,7 @@ pytest 3.2.3 has just been released to PyPI. This is a bug-fix release, being a drop-in replacement. To upgrade:: pip install --upgrade pytest - + The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.4.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.4.rst index 44bfcc27e29..65e486b7aa2 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.4.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.4.rst @@ -6,7 +6,7 @@ pytest 3.2.4 has just been released to PyPI. This is a bug-fix release, being a drop-in replacement. To upgrade:: pip install --upgrade pytest - + The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.5.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.5.rst index a520ce2b333..2e5304c6f27 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.5.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.2.5.rst @@ -6,7 +6,7 @@ pytest 3.2.5 has just been released to PyPI. This is a bug-fix release, being a drop-in replacement. To upgrade:: pip install --upgrade pytest - + The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.3.1.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.3.1.rst new file mode 100644 index 00000000000..7eed836ae6d --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.3.1.rst @@ -0,0 +1,25 @@ +pytest-3.3.1 +======================================= + +pytest 3.3.1 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. + +Thanks to all who contributed to this release, among them: + +* Bruno Oliveira +* Daniel Hahler +* Eugene Prikazchikov +* Florian Bruhin +* Roland Puntaier +* Ronny Pfannschmidt +* Sebastian Rahlf +* Tom Viner + + +Happy testing, +The pytest Development Team diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.3.2.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.3.2.rst new file mode 100644 index 00000000000..d9acef947dd --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.3.2.rst @@ -0,0 +1,28 @@ +pytest-3.3.2 +======================================= + +pytest 3.3.2 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. + +Thanks to all who contributed to this release, among them: + +* Anthony Sottile +* Antony Lee +* Austin +* Bruno Oliveira +* Florian Bruhin +* Floris Bruynooghe +* Henk-Jaap Wagenaar +* Jurko Gospodnetić +* Ronny Pfannschmidt +* Srinivas Reddy Thatiparthy +* Thomas Hisch + + +Happy testing, +The pytest Development Team diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.4.0.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.4.0.rst new file mode 100644 index 00000000000..df1e004f1cc --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.4.0.rst @@ -0,0 +1,52 @@ +pytest-3.4.0 +======================================= + +The pytest team is proud to announce the 3.4.0 release! + +pytest is a mature Python testing tool with more than a 1600 tests +against itself, passing on many different interpreters and platforms. + +This release contains a number of bugs fixes and improvements, so users are encouraged +to take a look at the CHANGELOG: + + http://doc.pytest.org/en/latest/changelog.html + +For complete documentation, please visit: + + http://docs.pytest.org + +As usual, you can upgrade from pypi via: + + pip install -U pytest + +Thanks to all who contributed to this release, among them: + +* Aaron +* Alan Velasco +* Anders Hovmöller +* Andrew Toolan +* Anthony Sottile +* Aron Coyle +* Brian Maissy +* Bruno Oliveira +* Cyrus Maden +* Florian Bruhin +* Henk-Jaap Wagenaar +* Ian Lesperance +* Jon Dufresne +* Jurko Gospodnetić +* Kate +* Kimberly +* Per A. Brodtkorb +* Pierre-Alexandre Fonta +* Raphael Castaneda +* Ronny Pfannschmidt +* ST John +* Segev Finer +* Thomas Hisch +* Tzu-ping Chung +* feuillemorte + + +Happy testing, +The Pytest Development Team diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.4.1.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.4.1.rst new file mode 100644 index 00000000000..e37f5d7e240 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.4.1.rst @@ -0,0 +1,27 @@ +pytest-3.4.1 +======================================= + +pytest 3.4.1 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. + +Thanks to all who contributed to this release, among them: + +* Aaron +* Alan Velasco +* Andy Freeland +* Brian Maissy +* Bruno Oliveira +* Florian Bruhin +* Jason R. Coombs +* Marcin Bachry +* Pedro Algarvio +* Ronny Pfannschmidt + + +Happy testing, +The pytest Development Team diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.4.2.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.4.2.rst new file mode 100644 index 00000000000..8e9988228fa --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.4.2.rst @@ -0,0 +1,28 @@ +pytest-3.4.2 +======================================= + +pytest 3.4.2 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. + +Thanks to all who contributed to this release, among them: + +* Allan Feldman +* Bruno Oliveira +* Florian Bruhin +* Jason R. Coombs +* Kyle Altendorf +* Maik Figura +* Ronny Pfannschmidt +* codetriage-readme-bot +* feuillemorte +* joshm91 +* mike + + +Happy testing, +The pytest Development Team diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.5.0.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.5.0.rst new file mode 100644 index 00000000000..54a05cea24d --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.5.0.rst @@ -0,0 +1,51 @@ +pytest-3.5.0 +======================================= + +The pytest team is proud to announce the 3.5.0 release! + +pytest is a mature Python testing tool with more than a 1600 tests +against itself, passing on many different interpreters and platforms. + +This release contains a number of bugs fixes and improvements, so users are encouraged +to take a look at the CHANGELOG: + + http://doc.pytest.org/en/latest/changelog.html + +For complete documentation, please visit: + + http://docs.pytest.org + +As usual, you can upgrade from pypi via: + + pip install -U pytest + +Thanks to all who contributed to this release, among them: + +* Allan Feldman +* Brian Maissy +* Bruno Oliveira +* Carlos Jenkins +* Daniel Hahler +* Florian Bruhin +* Jason R. Coombs +* Jeffrey Rackauckas +* Jordan Speicher +* Julien Palard +* Kale Kundert +* Kostis Anagnostopoulos +* Kyle Altendorf +* Maik Figura +* Pedro Algarvio +* Ronny Pfannschmidt +* Tadeu Manoel +* Tareq Alayan +* Thomas Hisch +* William Lee +* codetriage-readme-bot +* feuillemorte +* joshm91 +* mike + + +Happy testing, +The Pytest Development Team diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.5.1.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.5.1.rst new file mode 100644 index 00000000000..91f14390eeb --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.5.1.rst @@ -0,0 +1,30 @@ +pytest-3.5.1 +======================================= + +pytest 3.5.1 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. + +Thanks to all who contributed to this release, among them: + +* Brian Maissy +* Bruno Oliveira +* Darren Burns +* David Chudzicki +* Floris Bruynooghe +* Holger Kohr +* Irmen de Jong +* Jeffrey Rackauckas +* Rachel Kogan +* Ronny Pfannschmidt +* Stefan Scherfke +* Tim Strazny +* Семён Марьясин + + +Happy testing, +The pytest Development Team diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.6.0.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.6.0.rst new file mode 100644 index 00000000000..37361cf4add --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.6.0.rst @@ -0,0 +1,41 @@ +pytest-3.6.0 +======================================= + +The pytest team is proud to announce the 3.6.0 release! + +pytest is a mature Python testing tool with more than a 1600 tests +against itself, passing on many different interpreters and platforms. + +This release contains a number of bugs fixes and improvements, so users are encouraged +to take a look at the CHANGELOG: + + http://doc.pytest.org/en/latest/changelog.html + +For complete documentation, please visit: + + http://docs.pytest.org + +As usual, you can upgrade from pypi via: + + pip install -U pytest + +Thanks to all who contributed to this release, among them: + +* Anthony Shaw +* ApaDoctor +* Brian Maissy +* Bruno Oliveira +* Jon Dufresne +* Katerina Koukiou +* Miro Hrončok +* Rachel Kogan +* Ronny Pfannschmidt +* Tim Hughes +* Tyler Goodlet +* Ville Skyttä +* aviral1701 +* feuillemorte + + +Happy testing, +The Pytest Development Team diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.6.1.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.6.1.rst new file mode 100644 index 00000000000..3bedcf46a85 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.6.1.rst @@ -0,0 +1,24 @@ +pytest-3.6.1 +======================================= + +pytest 3.6.1 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. + +Thanks to all who contributed to this release, among them: + +* Anthony Sottile +* Bruno Oliveira +* Jeffrey Rackauckas +* Miro Hrončok +* Niklas Meinzer +* Oliver Bestwalter +* Ronny Pfannschmidt + + +Happy testing, +The pytest Development Team diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.6.2.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.6.2.rst new file mode 100644 index 00000000000..a1215f57689 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/announce/release-3.6.2.rst @@ -0,0 +1,29 @@ +pytest-3.6.2 +======================================= + +pytest 3.6.2 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. + +Thanks to all who contributed to this release, among them: + +* Alan Velasco +* Alex Barbato +* Anthony Sottile +* Bartosz Cierocki +* Bruno Oliveira +* Daniel Hahler +* Guoqiang Zhang +* Hynek Schlawack +* John T. Wodder II +* Michael Käufl +* Ronny Pfannschmidt +* Samuel Dion-Girardeau + + +Happy testing, +The pytest Development Team diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/assert.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/assert.rst index 4a852978ed2..e0e9b930587 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/assert.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/assert.rst @@ -29,17 +29,17 @@ you will see the return value of the function call:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 1 item - + test_assert1.py F [100%] - + ================================= FAILURES ================================= ______________________________ test_function _______________________________ - + def test_function(): > assert f() == 4 E assert 3 == 4 E + where 3 = f() - + test_assert1.py:5: AssertionError ========================= 1 failed in 0.12 seconds ========================= @@ -91,7 +91,7 @@ In the context manager form you may use the keyword argument ``message`` to specify a custom failure message:: >>> with raises(ZeroDivisionError, message="Expecting ZeroDivisionError"): - ... pass + ... pass ... Failed: Expecting ZeroDivisionError If you want to write test code that works on Python 2.4 as well, @@ -172,12 +172,12 @@ if you run this module:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 1 item - + test_assert2.py F [100%] - + ================================= FAILURES ================================= ___________________________ test_set_comparison ____________________________ - + def test_set_comparison(): set1 = set("1308") set2 = set("8035") @@ -188,7 +188,7 @@ if you run this module:: E Extra items in the right set: E '5' E Use -v to get the full diff - + test_assert2.py:5: AssertionError ========================= 1 failed in 0.12 seconds ========================= @@ -209,7 +209,7 @@ the ``pytest_assertrepr_compare`` hook. .. autofunction:: _pytest.hookspec.pytest_assertrepr_compare :noindex: -As an example consider adding the following hook in a :ref:`conftest.py ` +As an example consider adding the following hook in a :ref:`conftest.py ` file which provides an alternative explanation for ``Foo`` objects:: # content of conftest.py @@ -241,14 +241,14 @@ the conftest file:: F [100%] ================================= FAILURES ================================= _______________________________ test_compare _______________________________ - + def test_compare(): f1 = Foo(1) f2 = Foo(2) > assert f1 == f2 E assert Comparing Foo instances: E vals: 1 != 2 - + test_foocompare.py:11: AssertionError 1 failed in 0.12 seconds diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/backwards-compatibility.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/backwards-compatibility.rst index 84f2c43edaa..55506e7c338 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/backwards-compatibility.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/backwards-compatibility.rst @@ -15,91 +15,6 @@ We will only remove deprecated functionality in major releases (e.g. if we depre Deprecation Roadmap ------------------- -This page lists deprecated features and when we plan to remove them. It is important to list the feature, the version where it got deprecated and the version we plan to remove it. +We track deprecation and removal of features using milestones and the `deprecation `_ and `removal `_ labels on GitHub. -Following our deprecation policy, we should aim to keep features for *at least* two minor versions after it was considered deprecated. - - -Future Releases -~~~~~~~~~~~~~~~ - -3.4 -^^^ - -**Old style classes** - -Issue: `#2147 `_. - -Deprecated in ``3.2``. - -4.0 -^^^ - -**Yield tests** - -Deprecated in ``3.0``. - -**pytest-namespace hook** - -deprecated in ``3.2``. - -**Marks in parameter sets** - -Deprecated in ``3.2``. - -**--result-log** - -Deprecated in ``3.0``. - -See `#830 `_ for more information. Suggested alternative: `pytest-tap `_. - -**metafunc.addcall** - -Issue: `#2876 `_. - -Deprecated in ``3.3``. - -**pytest_plugins in non-toplevel conftests** - -There is a deep conceptual confusion as ``conftest.py`` files themselves are activated/deactivated based on path, but the plugins they depend on aren't. - -Issue: `#2639 `_. - -Not yet officially deprecated. - -**passing a single string to pytest.main()** - -Pass a list of strings to ``pytest.main()`` instead. - -Deprecated in ``3.1``. - -**[pytest] section in setup.cfg** - -Use ``[tool:pytest]`` instead for compatibility with other tools. - -Deprecated in ``3.0``. - -Past Releases -~~~~~~~~~~~~~ - -3.0 -^^^ - -* The following deprecated commandline options were removed: - - * ``--genscript``: no longer supported; - * ``--no-assert``: use ``--assert=plain`` instead; - * ``--nomagic``: use ``--assert=plain`` instead; - * ``--report``: use ``-r`` instead; - -* Removed all ``py.test-X*`` entry points. The versioned, suffixed entry points - were never documented and a leftover from a pre-virtualenv era. These entry - points also created broken entry points in wheels, so removing them also - removes a source of confusion for users. - - - -3.3 -^^^ - -* Dropped support for EOL Python 2.6 and 3.3. \ No newline at end of file +Following our deprecation policy, after starting issuing deprecation warnings we keep features for *at least* two minor versions before considering removal. diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/bash-completion.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/bash-completion.rst index 81fe62183fb..08d9782090c 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/bash-completion.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/bash-completion.rst @@ -14,7 +14,7 @@ Install argcomplete using:: For global activation of all argcomplete enabled python applications run:: - sudo activate-global-python-argcomplete + sudo activate-global-python-argcomplete For permanent (but not global) ``pytest`` activation, use:: @@ -23,6 +23,3 @@ For permanent (but not global) ``pytest`` activation, use:: For one-time activation of argcomplete for ``pytest`` only, use:: eval "$(register-python-argcomplete pytest)" - - - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/builtin.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/builtin.rst index d11eb5606e0..c2d23469bc8 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/builtin.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/builtin.rst @@ -1,105 +1,42 @@ +:orphan: .. _`pytest helpers`: Pytest API and builtin fixtures ================================================ -This is a list of ``pytest.*`` API functions and fixtures. + +Most of the information of this page has been moved over to :ref:`reference`. For information on plugin hooks and objects, see :ref:`plugins`. For information on the ``pytest.mark`` mechanism, see :ref:`mark`. -For the below objects, you can also interactively ask for help, e.g. by -typing on the Python interactive prompt something like:: - - import pytest - help(pytest) - -.. currentmodule:: pytest - -Invoking pytest interactively ---------------------------------------------------- - -.. autofunction:: main - -More examples at :ref:`pytest.main-usage` - - -Helpers for assertions about Exceptions/Warnings --------------------------------------------------------- - -.. autofunction:: raises - -Examples at :ref:`assertraises`. - -.. autofunction:: deprecated_call - -Comparing floating point numbers --------------------------------- - -.. autofunction:: approx - -Raising a specific test outcome --------------------------------------- - -You can use the following functions in your test, fixture or setup -functions to force a certain test outcome. Note that most often -you can rather use declarative marks, see :ref:`skipping`. - -.. autofunction:: _pytest.outcomes.fail -.. autofunction:: _pytest.outcomes.skip -.. autofunction:: _pytest.outcomes.importorskip -.. autofunction:: _pytest.outcomes.xfail -.. autofunction:: _pytest.outcomes.exit - -Fixtures and requests ------------------------------------------------------ - -To mark a fixture function: - -.. autofunction:: _pytest.fixtures.fixture - -Tutorial at :ref:`fixtures`. - -The ``request`` object that can be used from fixture functions. - -.. autoclass:: _pytest.fixtures.FixtureRequest() - :members: - - -.. _builtinfixtures: -.. _builtinfuncargs: - -Builtin fixtures/function arguments ------------------------------------------ - -You can ask for available builtin or project-custom -:ref:`fixtures ` by typing:: +For information about fixtures, see :ref:`fixtures`. To see a complete list of available fixtures (add ``-v`` to also see fixtures with leading ``_``), type :: $ pytest -q --fixtures cache Return a cache object that can persist state between testing sessions. - + cache.get(key, default) cache.set(key, value) - + Keys must be a ``/`` separated value, where the first part is usually the name of your plugin or application to avoid clashes with other cache users. - + Values can be any object handled by the json stdlib module. capsys - Enable capturing of writes to sys.stdout/sys.stderr and make + Enable capturing of writes to ``sys.stdout`` and ``sys.stderr`` and make captured output available via ``capsys.readouterr()`` method calls - which return a ``(out, err)`` tuple. ``out`` and ``err`` will be ``text`` + which return a ``(out, err)`` namedtuple. ``out`` and ``err`` will be ``text`` objects. capsysbinary - Enable capturing of writes to sys.stdout/sys.stderr and make + Enable capturing of writes to ``sys.stdout`` and ``sys.stderr`` and make captured output available via ``capsys.readouterr()`` method calls which return a ``(out, err)`` tuple. ``out`` and ``err`` will be ``bytes`` objects. capfd - Enable capturing of writes to file descriptors 1 and 2 and make + Enable capturing of writes to file descriptors ``1`` and ``2`` and make captured output available via ``capfd.readouterr()`` method calls which return a ``(out, err)`` tuple. ``out`` and ``err`` will be ``text`` objects. @@ -109,25 +46,45 @@ You can ask for available builtin or project-custom which return a ``(out, err)`` tuple. ``out`` and ``err`` will be ``bytes`` objects. doctest_namespace - Inject names into the doctest namespace. + Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests. pytestconfig - the pytest config object with access to command line opts. - record_xml_property - Add extra xml properties to the tag for the calling test. + Session-scoped fixture that returns the :class:`_pytest.config.Config` object. + + Example:: + + def test_foo(pytestconfig): + if pytestconfig.getoption("verbose"): + ... + record_property + Add an extra properties the calling test. + User properties become part of the test report and are available to the + configured reporters, like JUnit XML. The fixture is callable with ``(name, value)``, with value being automatically xml-encoded. + + Example:: + + def test_function(record_property): + record_property("example_key", 1) + record_xml_property + (Deprecated) use record_property. + record_xml_attribute + Add extra xml attributes to the tag for the calling test. + The fixture is callable with ``(name, value)``, with value being + automatically xml-encoded caplog Access and control log capturing. - + Captured logs are available through the following methods:: - - * caplog.text() -> string containing formatted log output - * caplog.records() -> list of logging.LogRecord instances - * caplog.record_tuples() -> list of (logger_name, level, message) tuples + + * caplog.text -> string containing formatted log output + * caplog.records -> list of logging.LogRecord instances + * caplog.record_tuples -> list of (logger_name, level, message) tuples + * caplog.clear() -> clear captured records and formatted log output string monkeypatch The returned ``monkeypatch`` fixture provides these helper methods to modify objects, dictionaries or os.environ:: - + monkeypatch.setattr(obj, name, value, raising=True) monkeypatch.delattr(obj, name, raising=True) monkeypatch.setitem(mapping, name, value) @@ -136,17 +93,14 @@ You can ask for available builtin or project-custom monkeypatch.delenv(name, value, raising=True) monkeypatch.syspath_prepend(path) monkeypatch.chdir(path) - + All modifications will be undone after the requesting test function or fixture has finished. The ``raising`` parameter determines if a KeyError or AttributeError will be raised if the set/deletion operation has no target. recwarn - Return a WarningsRecorder instance that provides these methods: - - * ``pop(category=None)``: return last warning matching the category. - * ``clear()``: clear list of warnings - + Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions. + See http://docs.python.org/library/warnings.html for information on warning categories. tmpdir_factory @@ -157,5 +111,12 @@ You can ask for available builtin or project-custom created as a sub directory of the base temporary directory. The returned object is a `py.path.local`_ path object. - + + .. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html + no tests ran in 0.12 seconds + +You can also interactively ask for help, e.g. by typing on the Python interactive prompt something like:: + + import pytest + help(pytest) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/cache.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/cache.rst index c88721b11b0..37bcf7070d4 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/cache.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/cache.rst @@ -20,7 +20,7 @@ last ``pytest`` invocation: For cleanup (usually not needed), a ``--cache-clear`` option allows to remove all cross-session cache contents ahead of a test run. -Other plugins may access the `config.cache`_ object to set/get +Other plugins may access the `config.cache`_ object to set/get **json encodable** values between ``pytest`` invocations. .. note:: @@ -49,26 +49,26 @@ If you run this for the first time you will see two failures:: .................F.......F........................ [100%] ================================= FAILURES ================================= _______________________________ test_num[17] _______________________________ - + i = 17 - + @pytest.mark.parametrize("i", range(50)) def test_num(i): if i in (17, 25): > pytest.fail("bad luck") E Failed: bad luck - + test_50.py:6: Failed _______________________________ test_num[25] _______________________________ - + i = 25 - + @pytest.mark.parametrize("i", range(50)) def test_num(i): if i in (17, 25): > pytest.fail("bad luck") E Failed: bad luck - + test_50.py:6: Failed 2 failed, 48 passed in 0.12 seconds @@ -78,35 +78,34 @@ If you then run it with ``--lf``:: =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: - collected 50 items + collected 50 items / 48 deselected run-last-failure: rerun previous 2 failures - + test_50.py FF [100%] - + ================================= FAILURES ================================= _______________________________ test_num[17] _______________________________ - + i = 17 - + @pytest.mark.parametrize("i", range(50)) def test_num(i): if i in (17, 25): > pytest.fail("bad luck") E Failed: bad luck - + test_50.py:6: Failed _______________________________ test_num[25] _______________________________ - + i = 25 - + @pytest.mark.parametrize("i", range(50)) def test_num(i): if i in (17, 25): > pytest.fail("bad luck") E Failed: bad luck - + test_50.py:6: Failed - =========================== 48 tests deselected ============================ ================= 2 failed, 48 deselected in 0.12 seconds ================== You have run only the two failing test from the last run, while 48 tests have @@ -122,36 +121,50 @@ of ``FF`` and dots):: rootdir: $REGENDOC_TMPDIR, inifile: collected 50 items run-last-failure: rerun previous 2 failures first - + test_50.py FF................................................ [100%] - + ================================= FAILURES ================================= _______________________________ test_num[17] _______________________________ - + i = 17 - + @pytest.mark.parametrize("i", range(50)) def test_num(i): if i in (17, 25): > pytest.fail("bad luck") E Failed: bad luck - + test_50.py:6: Failed _______________________________ test_num[25] _______________________________ - + i = 25 - + @pytest.mark.parametrize("i", range(50)) def test_num(i): if i in (17, 25): > pytest.fail("bad luck") E Failed: bad luck - + test_50.py:6: Failed =================== 2 failed, 48 passed in 0.12 seconds ==================== .. _`config.cache`: +New ``--nf``, ``--new-first`` options: run new tests first followed by the rest +of the tests, in both cases tests are also sorted by the file modified time, +with more recent files coming first. + +Behavior when no tests failed in the last run +--------------------------------------------- + +When no tests failed in the last run, or when no cached ``lastfailed`` data was +found, ``pytest`` can be configured either to run all of the tests or no tests, +using the ``--last-failed-no-failures`` option, which takes one of the following values:: + + pytest --last-failed-no-failures all # run all tests (default behavior) + pytest --last-failed-no-failures none # run no tests and exit + The new config.cache object -------------------------------- @@ -185,13 +198,13 @@ of the sleep:: F [100%] ================================= FAILURES ================================= ______________________________ test_function _______________________________ - + mydata = 42 - + def test_function(mydata): > assert mydata == 23 E assert 42 == 23 - + test_caching.py:14: AssertionError 1 failed in 0.12 seconds @@ -202,17 +215,17 @@ the cache and this will be quick:: F [100%] ================================= FAILURES ================================= ______________________________ test_function _______________________________ - + mydata = 42 - + def test_function(mydata): > assert mydata == 23 E assert 42 == 23 - + test_caching.py:14: AssertionError 1 failed in 0.12 seconds -See the `cache-api`_ for more details. +See the :ref:`cache-api` for more details. Inspecting Cache content @@ -221,17 +234,19 @@ Inspecting Cache content You can always peek at the content of the cache using the ``--cache-show`` command line option:: - $ py.test --cache-show + $ pytest --cache-show =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: - cachedir: $REGENDOC_TMPDIR/.cache + cachedir: $REGENDOC_TMPDIR/.pytest_cache ------------------------------- cache values ------------------------------- cache/lastfailed contains: {'test_caching.py::test_function': True} + cache/nodeids contains: + ['test_caching.py::test_function'] example/value contains: 42 - + ======================= no tests ran in 0.12 seconds ======================= Clearing Cache content @@ -245,24 +260,3 @@ by adding the ``--cache-clear`` option like this:: This is recommended for invocations from Continuous Integration servers where isolation and correctness is more important than speed. - - -.. _`cache-api`: - -config.cache API ------------------- - -The ``config.cache`` object allows other plugins, -including ``conftest.py`` files, -to safely and flexibly store and retrieve values across -test runs because the ``config`` object is available -in many places. - -Under the hood, the cache plugin uses the simple -dumps/loads API of the json stdlib module - -.. currentmodule:: _pytest.cacheprovider - -.. automethod:: Cache.get -.. automethod:: Cache.set -.. automethod:: Cache.makedir diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/capture.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/capture.rst index a87b57f8fc0..ab86fb55f3d 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/capture.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/capture.rst @@ -9,7 +9,8 @@ Default stdout/stderr/stdin capturing behaviour During test execution any output sent to ``stdout`` and ``stderr`` is captured. If a test or a setup method fails its according captured -output will usually be shown along with the failure traceback. +output will usually be shown along with the failure traceback. (this +behavior can be configured by the ``--show-capture`` command-line option). In addition, ``stdin`` is set to a "null" object which will fail on attempts to read from it because it is rarely desired @@ -67,16 +68,16 @@ of the failing function and hide the other one:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 2 items - + test_module.py .F [100%] - + ================================= FAILURES ================================= ________________________________ test_func2 ________________________________ - + def test_func2(): > assert False E assert False - + test_module.py:9: AssertionError -------------------------- Captured stdout setup --------------------------- setting up @@ -91,15 +92,15 @@ an example test function that performs some output related checks: .. code-block:: python - def test_myoutput(capsys): # or use "capfd" for fd-level - print ("hello") + def test_myoutput(capsys): # or use "capfd" for fd-level + print("hello") sys.stderr.write("world\n") - out, err = capsys.readouterr() - assert out == "hello\n" - assert err == "world\n" - print ("next") - out, err = capsys.readouterr() - assert out == "next\n" + captured = capsys.readouterr() + assert captured.out == "hello\n" + assert captured.err == "world\n" + print("next") + captured = capsys.readouterr() + assert captured.out == "next\n" The ``readouterr()`` call snapshots the output so far - and capturing will be continued. After the test @@ -117,6 +118,10 @@ system level output streams (FD1 and FD2). .. versionadded:: 3.3 +The return value from ``readouterr`` changed to a ``namedtuple`` with two attributes, ``out`` and ``err``. + +.. versionadded:: 3.3 + If the code under test writes non-textual data, you can capture this using the ``capsysbinary`` fixture which instead returns ``bytes`` from the ``readouterr`` method. The ``capfsysbinary`` fixture is currently only @@ -140,9 +145,9 @@ as a context manager, disabling capture inside the ``with`` block: .. code-block:: python def test_disabling_capturing(capsys): - print('this output is captured') + print("this output is captured") with capsys.disabled(): - print('output not captured, going directly to sys.stdout') - print('this output is also captured') + print("output not captured, going directly to sys.stdout") + print("this output is also captured") .. include:: links.inc diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/check_sphinx.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/check_sphinx.py deleted file mode 100644 index 0f536ffa6ac..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/check_sphinx.py +++ /dev/null @@ -1,17 +0,0 @@ -import py -import subprocess -def test_build_docs(tmpdir): - doctrees = tmpdir.join("doctrees") - htmldir = tmpdir.join("html") - subprocess.check_call([ - "sphinx-build", "-W", "-bhtml", - "-d", str(doctrees), ".", str(htmldir)]) - -def test_linkcheck(tmpdir): - doctrees = tmpdir.join("doctrees") - htmldir = tmpdir.join("html") - subprocess.check_call( - ["sphinx-build", "-blinkcheck", - "-d", str(doctrees), ".", str(htmldir)]) - - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/conf.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/conf.py index 40f1e4165e4..ebff6ff3bfa 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/conf.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/conf.py @@ -18,14 +18,18 @@ # The full version, including alpha/beta/rc tags. # The short X.Y version. -import os, sys +import os +import sys +import datetime + from _pytest import __version__ as version + release = ".".join(version.split(".")[:2]) # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) autodoc_member_order = "bysource" todo_include_todos = 1 @@ -33,58 +37,68 @@ todo_include_todos = 1 # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.autosummary', - 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode'] +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.todo", + "sphinx.ext.autosummary", + "sphinx.ext.intersphinx", + "sphinx.ext.viewcode", + "sphinxcontrib_trio", +] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'contents' +master_doc = "contents" # General information about the project. -project = u'pytest' -copyright = u'2015, holger krekel and pytest-dev team' - +project = u"pytest" +year = datetime.datetime.utcnow().year +copyright = u"2015–{} , holger krekel and pytest-dev team".format(year) # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ['links.inc', '_build', 'naming20.rst', 'test/*', +exclude_patterns = [ + "links.inc", + "_build", + "naming20.rst", + "test/*", "old_*", - '*attic*', - '*/attic*', - 'funcargs.rst', - 'setup.rst', - 'example/remoteinterp.rst', - ] + "*attic*", + "*/attic*", + "funcargs.rst", + "setup.rst", + "example/remoteinterp.rst", +] # The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). @@ -92,39 +106,36 @@ add_module_names = False # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- -sys.path.append(os.path.abspath('_themes')) -html_theme_path = ['_themes'] +sys.path.append(os.path.abspath("_themes")) +html_theme_path = ["_themes"] # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'flask' +html_theme = "flask" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -html_theme_options = { - 'index_logo': None -} +html_theme_options = {"index_logo": None} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -html_title = 'pytest documentation' +html_title = "pytest documentation" # A shorter title for the navigation bar. Default is the same as html_title. html_short_title = "pytest-%s" % release @@ -145,37 +156,37 @@ html_favicon = "img/pytest1favi.ico" # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} -#html_sidebars = {'index': 'indexsidebar.html'} +# html_sidebars = {} +# html_sidebars = {'index': 'indexsidebar.html'} html_sidebars = { - 'index': [ - 'sidebarintro.html', - 'globaltoc.html', - 'links.html', - 'sourcelink.html', - 'searchbox.html' + "index": [ + "sidebarintro.html", + "globaltoc.html", + "links.html", + "sourcelink.html", + "searchbox.html", + ], + "**": [ + "globaltoc.html", + "relations.html", + "links.html", + "sourcelink.html", + "searchbox.html", ], - '**': [ - 'globaltoc.html', - 'relations.html', - 'links.html', - 'sourcelink.html', - 'searchbox.html' - ] } # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} -#html_additional_pages = {'index': 'index.html'} +# html_additional_pages = {} +# html_additional_pages = {'index': 'index.html'} # If false, no module index is generated. @@ -185,63 +196,68 @@ html_domain_indices = True html_use_index = False # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. html_show_sourcelink = False # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'pytestdoc' +htmlhelp_basename = "pytestdoc" # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' +# latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' +# latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('contents', 'pytest.tex', u'pytest Documentation', - u'holger krekel, trainer and consultant, http://merlinux.eu', 'manual'), + ( + "contents", + "pytest.tex", + u"pytest Documentation", + u"holger krekel, trainer and consultant, http://merlinux.eu", + "manual", + ) ] # The name of an image file (relative to this directory) to place at the top of # the title page. -latex_logo = 'img/pytest1.png' +latex_logo = "img/pytest1.png" # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Additional stuff for the LaTeX preamble. -#latex_preamble = '' +# latex_preamble = '' # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. latex_domain_indices = False @@ -250,74 +266,78 @@ latex_domain_indices = False # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - ('usage', 'pytest', u'pytest usage', - [u'holger krekel at merlinux eu'], 1) -] +man_pages = [("usage", "pytest", u"pytest usage", [u"holger krekel at merlinux eu"], 1)] # -- Options for Epub output --------------------------------------------------- # Bibliographic Dublin Core info. -epub_title = u'pytest' -epub_author = u'holger krekel at merlinux eu' -epub_publisher = u'holger krekel at merlinux eu' -epub_copyright = u'2013, holger krekel et alii' +epub_title = u"pytest" +epub_author = u"holger krekel at merlinux eu" +epub_publisher = u"holger krekel at merlinux eu" +epub_copyright = u"2013, holger krekel et alii" # The language of the text. It defaults to the language option # or en if the language is not set. -#epub_language = '' +# epub_language = '' # The scheme of the identifier. Typical schemes are ISBN or URL. -#epub_scheme = '' +# epub_scheme = '' # The unique identifier of the text. This can be a ISBN number # or the project homepage. -#epub_identifier = '' +# epub_identifier = '' # A unique identification for the text. -#epub_uid = '' +# epub_uid = '' # HTML files that should be inserted before the pages created by sphinx. # The format is a list of tuples containing the path and title. -#epub_pre_files = [] +# epub_pre_files = [] # HTML files shat should be inserted after the pages created by sphinx. # The format is a list of tuples containing the path and title. -#epub_post_files = [] +# epub_post_files = [] # A list of files that should not be packed into the epub file. -#epub_exclude_files = [] +# epub_exclude_files = [] # The depth of the table of contents in toc.ncx. -#epub_tocdepth = 3 +# epub_tocdepth = 3 # Allow duplicate toc entries. -#epub_tocdup = True +# epub_tocdup = True # -- Options for texinfo output ------------------------------------------------ texinfo_documents = [ - (master_doc, 'pytest', 'pytest Documentation', - ('Holger Krekel@*Benjamin Peterson@*Ronny Pfannschmidt@*' - 'Floris Bruynooghe@*others'), - 'pytest', - 'simple powerful testing with Python', - 'Programming', - 1), + ( + master_doc, + "pytest", + "pytest Documentation", + ( + "Holger Krekel@*Benjamin Peterson@*Ronny Pfannschmidt@*" + "Floris Bruynooghe@*others" + ), + "pytest", + "simple powerful testing with Python", + "Programming", + 1, + ) ] # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'python': ('http://docs.python.org/', None), -# 'lib': ("http://docs.python.org/2.7library/", None), - } +intersphinx_mapping = {"python": ("http://docs.python.org/3", None)} def setup(app): - #from sphinx.ext.autodoc import cut_lines - #app.connect('autodoc-process-docstring', cut_lines(4, what=['module'])) - app.add_description_unit('confval', 'confval', - objname='configuration value', - indextemplate='pair: %s; configuration value') + # from sphinx.ext.autodoc import cut_lines + # app.connect('autodoc-process-docstring', cut_lines(4, what=['module'])) + app.add_description_unit( + "confval", + "confval", + objname="configuration value", + indextemplate="pair: %s; configuration value", + ) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/contact.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/contact.rst index 83d496640d5..efc6a8f57d3 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/contact.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/contact.rst @@ -8,9 +8,9 @@ Contact channels - `pytest issue tracker`_ to report bugs or suggest features (for version 2.0 and above). -- `pytest on stackoverflow.com `_ - to post questions with the tag ``pytest``. New Questions will usually - be seen by pytest users or developers and answered quickly. +- `pytest on stackoverflow.com `_ + to post questions with the tag ``pytest``. New Questions will usually + be seen by pytest users or developers and answered quickly. - `Testing In Python`_: a mailing list for Python testing tools and discussion. @@ -47,4 +47,3 @@ Contact channels .. _`development mailing list`: .. _`pytest-dev at python.org (mailing list)`: http://mail.python.org/mailman/listinfo/pytest-dev .. _`pytest-commit at python.org (mailing list)`: http://mail.python.org/mailman/listinfo/pytest-commit - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/contents.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/contents.rst index 7a6570e0bc5..9f1d8d85ac2 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/contents.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/contents.rst @@ -14,14 +14,13 @@ Full pytest documentation usage existingtestsuite assert - builtin fixture + mark monkeypatch tmpdir capture warnings doctest - mark skipping parametrize cache @@ -31,6 +30,7 @@ Full pytest documentation plugins writing_plugins logging + reference goodpractices pythonpath @@ -62,4 +62,3 @@ Full pytest documentation :maxdepth: 1 changelog - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/customize.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/customize.rst index 8133704a52c..c1a3498c7b6 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/customize.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/customize.rst @@ -38,6 +38,10 @@ Here's a summary what ``pytest`` uses ``rootdir`` for: Important to emphasize that ``rootdir`` is **NOT** used to modify ``sys.path``/``PYTHONPATH`` or influence how modules are imported. See :ref:`pythonpath` for more details. +``--rootdir=path`` command-line option can be used to force a specific directory. +The directory passed may contain environment variables when it is used in conjunction +with ``addopts`` in a ``pytest.ini`` file. + Finding the ``rootdir`` ~~~~~~~~~~~~~~~~~~~~~~~ @@ -152,182 +156,4 @@ above will show verbose output because ``-v`` overwrites ``-q``. Builtin configuration file options ---------------------------------------------- -.. confval:: minversion - - Specifies a minimal pytest version required for running tests. - - minversion = 2.1 # will fail if we run with pytest-2.0 - -.. confval:: addopts - - Add the specified ``OPTS`` to the set of command line arguments as if they - had been specified by the user. Example: if you have this ini file content: - - .. code-block:: ini - - [pytest] - addopts = --maxfail=2 -rf # exit after 2 failures, report fail info - - issuing ``pytest test_hello.py`` actually means:: - - pytest --maxfail=2 -rf test_hello.py - - Default is to add no options. - -.. confval:: norecursedirs - - Set the directory basename patterns to avoid when recursing - for test discovery. The individual (fnmatch-style) patterns are - applied to the basename of a directory to decide if to recurse into it. - Pattern matching characters:: - - * matches everything - ? matches any single character - [seq] matches any character in seq - [!seq] matches any char not in seq - - Default patterns are ``'.*', 'build', 'dist', 'CVS', '_darcs', '{arch}', '*.egg', 'venv'``. - Setting a ``norecursedirs`` replaces the default. Here is an example of - how to avoid certain directories: - - .. code-block:: ini - - # content of pytest.ini - [pytest] - norecursedirs = .svn _build tmp* - - This would tell ``pytest`` to not look into typical subversion or - sphinx-build directories or into any ``tmp`` prefixed directory. - - Additionally, ``pytest`` will attempt to intelligently identify and ignore a - virtualenv by the presence of an activation script. Any directory deemed to - be the root of a virtual environment will not be considered during test - collection unless ``‑‑collect‑in‑virtualenv`` is given. Note also that - ``norecursedirs`` takes precedence over ``‑‑collect‑in‑virtualenv``; e.g. if - you intend to run tests in a virtualenv with a base directory that matches - ``'.*'`` you *must* override ``norecursedirs`` in addition to using the - ``‑‑collect‑in‑virtualenv`` flag. - -.. confval:: testpaths - - .. versionadded:: 2.8 - - Sets list of directories that should be searched for tests when - no specific directories, files or test ids are given in the command line when - executing pytest from the :ref:`rootdir ` directory. - Useful when all project tests are in a known location to speed up - test collection and to avoid picking up undesired tests by accident. - - .. code-block:: ini - - # content of pytest.ini - [pytest] - testpaths = testing doc - - This tells pytest to only look for tests in ``testing`` and ``doc`` - directories when executing from the root directory. - -.. confval:: python_files - - One or more Glob-style file patterns determining which python files - are considered as test modules. By default, pytest will consider - any file matching with ``test_*.py`` and ``*_test.py`` globs as a test - module. - -.. confval:: python_classes - - One or more name prefixes or glob-style patterns determining which classes - are considered for test collection. By default, pytest will consider any - class prefixed with ``Test`` as a test collection. Here is an example of how - to collect tests from classes that end in ``Suite``: - - .. code-block:: ini - - # content of pytest.ini - [pytest] - python_classes = *Suite - - Note that ``unittest.TestCase`` derived classes are always collected - regardless of this option, as ``unittest``'s own collection framework is used - to collect those tests. - -.. confval:: python_functions - - One or more name prefixes or glob-patterns determining which test functions - and methods are considered tests. By default, pytest will consider any - function prefixed with ``test`` as a test. Here is an example of how - to collect test functions and methods that end in ``_test``: - - .. code-block:: ini - - # content of pytest.ini - [pytest] - python_functions = *_test - - Note that this has no effect on methods that live on a ``unittest - .TestCase`` derived class, as ``unittest``'s own collection framework is used - to collect those tests. - - See :ref:`change naming conventions` for more detailed examples. - -.. confval:: doctest_optionflags - - One or more doctest flag names from the standard ``doctest`` module. - :doc:`See how pytest handles doctests `. - -.. confval:: confcutdir - - Sets a directory where search upwards for ``conftest.py`` files stops. - By default, pytest will stop searching for ``conftest.py`` files upwards - from ``pytest.ini``/``tox.ini``/``setup.cfg`` of the project if any, - or up to the file-system root. - - -.. confval:: filterwarnings - - .. versionadded:: 3.1 - - Sets a list of filters and actions that should be taken for matched - warnings. By default all warnings emitted during the test session - will be displayed in a summary at the end of the test session. - - .. code-block:: ini - - # content of pytest.ini - [pytest] - filterwarnings = - error - ignore::DeprecationWarning - - This tells pytest to ignore deprecation warnings and turn all other warnings - into errors. For more information please refer to :ref:`warnings`. - -.. confval:: cache_dir - - .. versionadded:: 3.2 - - Sets a directory where stores content of cache plugin. Default directory is - ``.cache`` which is created in :ref:`rootdir `. Directory may be - relative or absolute path. If setting relative path, then directory is created - relative to :ref:`rootdir `. Additionally path may contain environment - variables, that will be expanded. For more information about cache plugin - please refer to :ref:`cache_provider`. - - -.. confval:: console_output_style - - .. versionadded:: 3.3 - - Sets the console output style while running tests: - - * ``classic``: classic pytest output. - * ``progress``: like classic pytest output, but with a progress indicator. - - The default is ``progress``, but you can fallback to ``classic`` if you prefer or - the new mode is causing unexpected problems: - - .. code-block:: ini - - # content of pytest.ini - [pytest] - console_output_style = classic +For the full list of options consult the :ref:`reference documentation `. diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/development_guide.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/development_guide.rst index 465e97de0f9..69e866943e5 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/development_guide.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/development_guide.rst @@ -2,7 +2,7 @@ Development Guide ================= -Some general guidelines regarding development in pytest for core maintainers and general contributors. Nothing here +Some general guidelines regarding development in pytest for maintainers and contributors. Nothing here is set in stone and can't be changed, feel free to suggest improvements or changes in the workflow. @@ -10,7 +10,7 @@ Code Style ---------- * `PEP-8 `_ -* `flake8 `_ for quality checks +* `flake8 `_ for quality checks * `invoke `_ to automate development tasks @@ -37,72 +37,19 @@ Any question, feature, bug or proposal is welcome as an issue. Users are encoura GitHub issues should use labels to categorize them. Labels should be created sporadically, to fill a niche; we should avoid creating labels just for the sake of creating them. -Here is a list of labels and a brief description mentioning their intent. +Each label should include a description in the GitHub's interface stating its purpose. +Temporary labels +~~~~~~~~~~~~~~~~ -**Type** +To classify issues for a special event it is encouraged to create a temporary label. This helps those involved to find +the relevant issues to work on. Examples of that are sprints in Python events or global hacking events. -* ``type: backward compatibility``: issue that will cause problems with old pytest versions. -* ``type: bug``: problem that needs to be addressed. -* ``type: deprecation``: feature that will be deprecated in the future. -* ``type: docs``: documentation missing or needing clarification. -* ``type: enhancement``: new feature or API change, should be merged into ``features``. -* ``type: feature-branch``: new feature or API change, should be merged into ``features``. -* ``type: infrastructure``: improvement to development/releases/CI structure. -* ``type: performance``: performance or memory problem/improvement. -* ``type: proposal``: proposal for a new feature, often to gather opinions or design the API around the new feature. -* ``type: question``: question regarding usage, installation, internals or how to test something. -* ``type: refactoring``: internal improvements to the code. -* ``type: regression``: indicates a problem that was introduced in a release which was working previously. +* ``temporary: EP2017 sprint``: candidate issues or PRs tackled during the EuroPython 2017 -**Status** +Issues created at those events should have other relevant labels added as well. -* ``status: critical``: grave problem or usability issue that affects lots of users. -* ``status: easy``: easy issue that is friendly to new contributors. -* ``status: help wanted``: core developers need help from experts on this topic. -* ``status: needs information``: reporter needs to provide more information; can be closed after 2 or more weeks of inactivity. - -**Topic** - -* ``topic: collection`` -* ``topic: fixtures`` -* ``topic: parametrize`` -* ``topic: reporting`` -* ``topic: selection`` -* ``topic: tracebacks`` - -**Plugin (internal or external)** - -* ``plugin: cache`` -* ``plugin: capture`` -* ``plugin: doctests`` -* ``plugin: junitxml`` -* ``plugin: monkeypatch`` -* ``plugin: nose`` -* ``plugin: pastebin`` -* ``plugin: pytester`` -* ``plugin: tmpdir`` -* ``plugin: unittest`` -* ``plugin: warnings`` -* ``plugin: xdist`` - - -**OS** - -Issues specific to a single operating system. Do not use as a means to indicate where an issue originated from, only -for problems that happen **only** in that system. - -* ``os: linux`` -* ``os: mac`` -* ``os: windows`` - -**Temporary** - -Used to classify issues for limited time, to help find issues related in events for example. -They should be removed after they are no longer relevant. - -* ``temporary: EP2017 sprint``: -* ``temporary: sprint-candidate``: +Those labels should be removed after they are no longer relevant. .. include:: ../../HOWTORELEASE.rst diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/doctest.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/doctest.rst index 4c5a878dd61..9488ee82657 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/doctest.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/doctest.rst @@ -65,9 +65,9 @@ then you can just invoke ``pytest`` without command line options:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini collected 1 item - + mymodule.py . [100%] - + ========================= 1 passed in 0.12 seconds ========================= It is possible to use fixtures using the ``getfixture`` helper:: @@ -81,9 +81,9 @@ Also, :ref:`usefixtures` and :ref:`autouse` fixtures are supported when executing text doctest files. The standard ``doctest`` module provides some setting flags to configure the -strictness of doctest tests. In pytest You can enable those flags those flags -using the configuration file. To make pytest ignore trailing whitespaces and -ignore lengthy exception stack traces you can just write: +strictness of doctest tests. In pytest, you can enable those flags using the +configuration file. To make pytest ignore trailing whitespaces and ignore +lengthy exception stack traces you can just write: .. code-block:: ini @@ -115,6 +115,13 @@ itself:: >>> get_unicode_greeting() # doctest: +ALLOW_UNICODE 'Hello' +By default, pytest would report only the first failure for a given doctest. If +you want to continue the test even when you have failures, do:: + + pytest --doctest-modules --doctest-continue-on-failure + + +.. _`doctest_namespace`: The 'doctest_namespace' fixture ------------------------------- @@ -161,5 +168,3 @@ by using one of standard doctest modules format in options pytest --doctest-modules --doctest-report cdiff pytest --doctest-modules --doctest-report ndiff pytest --doctest-modules --doctest-report only_first_failure - - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/failure_demo.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/failure_demo.py index d31fba2adaa..dc27f5dfbc1 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/failure_demo.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/failure_demo.py @@ -2,135 +2,158 @@ from pytest import raises import _pytest._code import py -def otherfunc(a,b): - assert a==b -def somefunc(x,y): - otherfunc(x,y) +def otherfunc(a, b): + assert a == b + + +def somefunc(x, y): + otherfunc(x, y) + + +def otherfunc_multi(a, b): + assert a == b -def otherfunc_multi(a,b): - assert (a == - b) def test_generative(param1, param2): assert param1 * 2 < param2 + def pytest_generate_tests(metafunc): - if 'param1' in metafunc.fixturenames: + if "param1" in metafunc.fixturenames: metafunc.addcall(funcargs=dict(param1=3, param2=6)) + class TestFailing(object): + def test_simple(self): + def f(): return 42 + def g(): return 43 assert f() == g() def test_simple_multiline(self): - otherfunc_multi( - 42, - 6*9) + otherfunc_multi(42, 6 * 9) def test_not(self): + def f(): return 42 + assert not f() + class TestSpecialisedExplanations(object): + def test_eq_text(self): - assert 'spam' == 'eggs' + assert "spam" == "eggs" def test_eq_similar_text(self): - assert 'foo 1 bar' == 'foo 2 bar' + assert "foo 1 bar" == "foo 2 bar" def test_eq_multiline_text(self): - assert 'foo\nspam\nbar' == 'foo\neggs\nbar' + assert "foo\nspam\nbar" == "foo\neggs\nbar" def test_eq_long_text(self): - a = '1'*100 + 'a' + '2'*100 - b = '1'*100 + 'b' + '2'*100 + a = "1" * 100 + "a" + "2" * 100 + b = "1" * 100 + "b" + "2" * 100 assert a == b def test_eq_long_text_multiline(self): - a = '1\n'*100 + 'a' + '2\n'*100 - b = '1\n'*100 + 'b' + '2\n'*100 + a = "1\n" * 100 + "a" + "2\n" * 100 + b = "1\n" * 100 + "b" + "2\n" * 100 assert a == b def test_eq_list(self): assert [0, 1, 2] == [0, 1, 3] def test_eq_list_long(self): - a = [0]*100 + [1] + [3]*100 - b = [0]*100 + [2] + [3]*100 + a = [0] * 100 + [1] + [3] * 100 + b = [0] * 100 + [2] + [3] * 100 assert a == b def test_eq_dict(self): - assert {'a': 0, 'b': 1, 'c': 0} == {'a': 0, 'b': 2, 'd': 0} + assert {"a": 0, "b": 1, "c": 0} == {"a": 0, "b": 2, "d": 0} def test_eq_set(self): - assert set([0, 10, 11, 12]) == set([0, 20, 21]) + assert {0, 10, 11, 12} == {0, 20, 21} def test_eq_longer_list(self): - assert [1,2] == [1,2,3] + assert [1, 2] == [1, 2, 3] def test_in_list(self): assert 1 in [0, 2, 3, 4, 5] def test_not_in_text_multiline(self): - text = 'some multiline\ntext\nwhich\nincludes foo\nand a\ntail' - assert 'foo' not in text + text = "some multiline\ntext\nwhich\nincludes foo\nand a\ntail" + assert "foo" not in text def test_not_in_text_single(self): - text = 'single foo line' - assert 'foo' not in text + text = "single foo line" + assert "foo" not in text def test_not_in_text_single_long(self): - text = 'head ' * 50 + 'foo ' + 'tail ' * 20 - assert 'foo' not in text + text = "head " * 50 + "foo " + "tail " * 20 + assert "foo" not in text def test_not_in_text_single_long_term(self): - text = 'head ' * 50 + 'f'*70 + 'tail ' * 20 - assert 'f'*70 not in text + text = "head " * 50 + "f" * 70 + "tail " * 20 + assert "f" * 70 not in text def test_attribute(): + class Foo(object): b = 1 + i = Foo() assert i.b == 2 def test_attribute_instance(): + class Foo(object): b = 1 + assert Foo().b == 2 def test_attribute_failure(): + class Foo(object): + def _get_b(self): - raise Exception('Failed to get attrib') + raise Exception("Failed to get attrib") + b = property(_get_b) + i = Foo() assert i.b == 2 def test_attribute_multiple(): + class Foo(object): b = 1 + class Bar(object): b = 2 + assert Foo().b == Bar().b def globf(x): - return x+1 + return x + 1 + class TestRaises(object): + def test_raises(self): - s = 'qwe' + s = "qwe" # NOQA raises(TypeError, "int(s)") def test_raises_doesnt(self): @@ -140,15 +163,15 @@ class TestRaises(object): raise ValueError("demo error") def test_tupleerror(self): - a,b = [1] + a, b = [1] # NOQA def test_reinterpret_fails_with_print_for_the_fun_of_it(self): - l = [1,2,3] - print ("l is %r" % l) - a,b = l.pop() + items = [1, 2, 3] + print("items is %r" % items) + a, b = items.pop() def test_some_error(self): - if namenotexi: + if namenotexi: # NOQA pass def func1(self): @@ -157,31 +180,37 @@ class TestRaises(object): # thanks to Matthew Scott for this test def test_dynamic_compile_shows_nicely(): - src = 'def foo():\n assert 1 == 0\n' - name = 'abc-123' - module = py.std.imp.new_module(name) - code = _pytest._code.compile(src, name, 'exec') + import imp + import sys + + src = "def foo():\n assert 1 == 0\n" + name = "abc-123" + module = imp.new_module(name) + code = _pytest._code.compile(src, name, "exec") py.builtin.exec_(code, module.__dict__) - py.std.sys.modules[name] = module + sys.modules[name] = module module.foo() - class TestMoreErrors(object): + def test_complex_error(self): + def f(): return 44 + def g(): return 43 + somefunc(f(), g()) def test_z1_unpack_error(self): - l = [] - a,b = l + items = [] + a, b = items def test_z2_type_error(self): - l = 3 - a,b = l + items = 3 + a, b = items def test_startswith(self): s = "123" @@ -189,17 +218,20 @@ class TestMoreErrors(object): assert s.startswith(g) def test_startswith_nested(self): + def f(): return "123" + def g(): return "456" + assert f().startswith(g()) def test_global_func(self): assert isinstance(globf(42), float) def test_instance(self): - self.x = 6*7 + self.x = 6 * 7 assert self.x != 42 def test_compare(self): @@ -216,23 +248,31 @@ class TestMoreErrors(object): class TestCustomAssertMsg(object): def test_single_line(self): + class A(object): a = 1 + b = 2 assert A.a == b, "A.a appears not to be b" def test_multiline(self): + class A(object): a = 1 + b = 2 - assert A.a == b, "A.a appears not to be b\n" \ - "or does not appear to be b\none of those" + assert ( + A.a == b + ), "A.a appears not to be b\n" "or does not appear to be b\none of those" def test_custom_repr(self): + class JSON(object): a = 1 + def __repr__(self): return "This is JSON\n{\n 'foo': 'bar'\n}" + a = JSON() b = 2 assert a.a == b, a diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/global_testmodule_config/conftest.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/global_testmodule_config/conftest.py index 71e8c54be53..4859bea78e6 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/global_testmodule_config/conftest.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/global_testmodule_config/conftest.py @@ -1,10 +1,13 @@ -import pytest, py +import pytest +import py + mydir = py.path.local(__file__).dirpath() + def pytest_runtest_setup(item): if isinstance(item, pytest.Function): if not item.fspath.relto(mydir): return mod = item.getparent(pytest.Module).obj - if hasattr(mod, 'hello'): - print ("mod.hello %r" % (mod.hello,)) + if hasattr(mod, "hello"): + print("mod.hello %r" % (mod.hello,)) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/global_testmodule_config/test_hello.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/global_testmodule_config/test_hello_world.py similarity index 100% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/global_testmodule_config/test_hello.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/global_testmodule_config/test_hello_world.py diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/test_failures.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/test_failures.py index 2e5cd20b194..1150ec12f66 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/test_failures.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/test_failures.py @@ -1,14 +1,14 @@ import py -failure_demo = py.path.local(__file__).dirpath('failure_demo.py') -pytest_plugins = 'pytester', + +failure_demo = py.path.local(__file__).dirpath("failure_demo.py") +pytest_plugins = "pytester", + def test_failure_demo_fails_properly(testdir): target = testdir.tmpdir.join(failure_demo.basename) failure_demo.copy(target) failure_demo.copy(testdir.tmpdir.join(failure_demo.basename)) result = testdir.runpytest(target, syspathinsert=True) - result.stdout.fnmatch_lines([ - "*42 failed*" - ]) + result.stdout.fnmatch_lines(["*42 failed*"]) assert result.ret != 0 diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/test_setup_flow_example.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/test_setup_flow_example.py index 100effa499f..c00711dc238 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/test_setup_flow_example.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/assertion/test_setup_flow_example.py @@ -1,7 +1,9 @@ def setup_module(module): module.TestStateFullThing.classcount = 0 + class TestStateFullThing(object): + def setup_class(cls): cls.classcount += 1 @@ -19,9 +21,11 @@ class TestStateFullThing(object): assert self.classcount == 1 assert self.id == 23 + def teardown_module(module): assert module.TestStateFullThing.classcount == 0 + """ For this example the control flow happens as follows:: import test_setup_flow_example setup_module(test_setup_flow_example) @@ -39,4 +43,3 @@ Note that ``setup_class(TestStateFullThing)`` is called and not to insert ``setup_class = classmethod(setup_class)`` to make your setup function callable. """ - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/attic.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/attic.rst index 9e124a5d09d..d6fecf340b6 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/attic.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/attic.rst @@ -9,15 +9,18 @@ example: specifying and selecting acceptance tests # ./conftest.py def pytest_option(parser): group = parser.getgroup("myproject") - group.addoption("-A", dest="acceptance", action="store_true", - help="run (slow) acceptance tests") + group.addoption( + "-A", dest="acceptance", action="store_true", help="run (slow) acceptance tests" + ) + def pytest_funcarg__accept(request): return AcceptFixture(request) + class AcceptFixture(object): def __init__(self, request): - if not request.config.getoption('acceptance'): + if not request.config.getoption("acceptance"): pytest.skip("specify -A to run acceptance tests") self.tmpdir = request.config.mktemp(request.function.__name__, numbered=True) @@ -61,6 +64,7 @@ extend the `accept example`_ by putting this in our test module: arg.tmpdir.mkdir("special") return arg + class TestSpecialAcceptance(object): def test_sometest(self, accept): assert accept.tmpdir.join("special").check() diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/conftest.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/conftest.py index ea3c1cffb72..466c62c06ab 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/conftest.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/conftest.py @@ -1,16 +1,20 @@ import pytest + @pytest.fixture("session") def setup(request): setup = CostlySetup() yield setup setup.finalize() + class CostlySetup(object): + def __init__(self): import time - print ("performing costly setup") + + print("performing costly setup") time.sleep(5) self.timecostly = 1 diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub1/__init__.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub_a/__init__.py similarity index 100% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub1/__init__.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub_a/__init__.py diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub1/test_quick.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub_a/test_quick.py similarity index 96% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub1/test_quick.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub_a/test_quick.py index d97657867e0..38dda2660d2 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub1/test_quick.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub_a/test_quick.py @@ -1,3 +1,2 @@ - def test_quick(setup): pass diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub2/__init__.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub_b/__init__.py similarity index 100% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub2/__init__.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub_b/__init__.py diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub2/test_two.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub_b/test_two.py similarity index 100% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub2/test_two.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub_b/test_two.py index 6ed6ee4d898..b1653aaab88 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub2/test_two.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/costlysetup/sub_b/test_two.py @@ -1,6 +1,6 @@ def test_something(setup): assert setup.timecostly == 1 + def test_something_more(setup): assert setup.timecostly == 1 - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/markers.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/markers.rst index 43c20d5b7dc..bf352bc8129 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/markers.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/markers.rst @@ -32,13 +32,12 @@ You can then restrict a test run to only run tests marked with ``webtest``:: $ pytest -v -m webtest =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: - collecting ... collected 4 items - + collecting ... collected 4 items / 3 deselected + test_server.py::test_send_http PASSED [100%] - - ============================ 3 tests deselected ============================ + ================== 1 passed, 3 deselected in 0.12 seconds ================== Or the inverse, running all tests except the webtest ones:: @@ -46,15 +45,14 @@ Or the inverse, running all tests except the webtest ones:: $ pytest -v -m "not webtest" =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: - collecting ... collected 4 items - + collecting ... collected 4 items / 1 deselected + test_server.py::test_something_quick PASSED [ 33%] test_server.py::test_another PASSED [ 66%] test_server.py::TestClass::test_method PASSED [100%] - - ============================ 1 tests deselected ============================ + ================== 3 passed, 1 deselected in 0.12 seconds ================== Selecting tests based on their node ID @@ -67,12 +65,12 @@ tests based on their module, class, method, or function name:: $ pytest -v test_server.py::TestClass::test_method =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 1 item - + test_server.py::TestClass::test_method PASSED [100%] - + ========================= 1 passed in 0.12 seconds ========================= You can also select on the class:: @@ -80,12 +78,12 @@ You can also select on the class:: $ pytest -v test_server.py::TestClass =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 1 item - + test_server.py::TestClass::test_method PASSED [100%] - + ========================= 1 passed in 0.12 seconds ========================= Or select multiple nodes:: @@ -93,13 +91,13 @@ Or select multiple nodes:: $ pytest -v test_server.py::TestClass test_server.py::test_send_http =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 2 items - + test_server.py::TestClass::test_method PASSED [ 50%] test_server.py::test_send_http PASSED [100%] - + ========================= 2 passed in 0.12 seconds ========================= .. _node-id: @@ -131,13 +129,12 @@ select tests based on their names:: $ pytest -v -k http # running with the above defined example module =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: - collecting ... collected 4 items - + collecting ... collected 4 items / 3 deselected + test_server.py::test_send_http PASSED [100%] - - ============================ 3 tests deselected ============================ + ================== 1 passed, 3 deselected in 0.12 seconds ================== And you can also run all tests except the ones that match the keyword:: @@ -145,15 +142,14 @@ And you can also run all tests except the ones that match the keyword:: $ pytest -k "not send_http" -v =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: - collecting ... collected 4 items - + collecting ... collected 4 items / 1 deselected + test_server.py::test_something_quick PASSED [ 33%] test_server.py::test_another PASSED [ 66%] test_server.py::TestClass::test_method PASSED [100%] - - ============================ 1 tests deselected ============================ + ================== 3 passed, 1 deselected in 0.12 seconds ================== Or to select "http" and "quick" tests:: @@ -161,14 +157,13 @@ Or to select "http" and "quick" tests:: $ pytest -k "http or quick" -v =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: - collecting ... collected 4 items - + collecting ... collected 4 items / 2 deselected + test_server.py::test_send_http PASSED [ 50%] test_server.py::test_something_quick PASSED [100%] - - ============================ 2 tests deselected ============================ + ================== 2 passed, 2 deselected in 0.12 seconds ================== .. note:: @@ -204,21 +199,21 @@ You can ask which markers exist for your test suite - the list includes our just $ pytest --markers @pytest.mark.webtest: mark a test as a webtest. - + @pytest.mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test. - + @pytest.mark.skipif(condition): skip the given test function if eval(condition) results in a True value. Evaluation happens within the module global context. Example: skipif('sys.platform == "win32"') skips the test if we are on the win32 platform. see http://pytest.org/latest/skipping.html - + @pytest.mark.xfail(condition, reason=None, run=True, raises=None, strict=False): mark the test function as an expected failure if eval(condition) has a True value. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See http://pytest.org/latest/skipping.html - + @pytest.mark.parametrize(argnames, argvalues): call a test function multiple times passing in different arguments in turn. argvalues generally needs to be a list of values if argnames specifies only one name or a list of tuples of values if argnames specifies multiple names. Example: @parametrize('arg1', [1,2]) would lead to two calls of the decorated test function, one with arg1=1 and another with arg1=2.see http://pytest.org/latest/parametrize.html for more info and examples. - - @pytest.mark.usefixtures(fixturename1, fixturename2, ...): mark tests as needing all of the specified fixtures. see http://pytest.org/latest/fixture.html#usefixtures - + + @pytest.mark.usefixtures(fixturename1, fixturename2, ...): mark tests as needing all of the specified fixtures. see http://pytest.org/latest/fixture.html#usefixtures + @pytest.mark.tryfirst: mark a hook implementation function such that the plugin machinery will try to call it first/as early as possible. - + @pytest.mark.trylast: mark a hook implementation function such that the plugin machinery will try to call it last/as late as possible. - + For an example on how to add and work with markers from a plugin, see :ref:`adding a custom marker from a plugin`. @@ -232,7 +227,7 @@ For an example on how to add and work with markers from a plugin, see * Asking for existing markers via ``pytest --markers`` gives good output * Typos in function markers are treated as an error if you use - the ``--strict`` option. + the ``--strict`` option. .. _`scoped-marking`: @@ -335,11 +330,10 @@ specifies via named environments:: "env(name): mark test to run only on named environment") def pytest_runtest_setup(item): - envmarker = item.get_marker("env") - if envmarker is not None: - envname = envmarker.args[0] - if envname != item.config.getoption("-E"): - pytest.skip("test requires env %r" % envname) + envnames = [mark.args[0] for mark in item.iter_markers(name='env')] + if envnames: + if item.config.getoption("-E") not in envnames: + pytest.skip("test requires env in %r" % envnames) A test file using this local plugin:: @@ -358,9 +352,9 @@ the test needs:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 1 item - + test_someenv.py s [100%] - + ======================== 1 skipped in 0.12 seconds ========================= and here is one that specifies exactly the environment needed:: @@ -370,30 +364,30 @@ and here is one that specifies exactly the environment needed:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 1 item - + test_someenv.py . [100%] - + ========================= 1 passed in 0.12 seconds ========================= The ``--markers`` option always gives you a list of available markers:: $ pytest --markers @pytest.mark.env(name): mark test to run only on named environment - + @pytest.mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test. - + @pytest.mark.skipif(condition): skip the given test function if eval(condition) results in a True value. Evaluation happens within the module global context. Example: skipif('sys.platform == "win32"') skips the test if we are on the win32 platform. see http://pytest.org/latest/skipping.html - + @pytest.mark.xfail(condition, reason=None, run=True, raises=None, strict=False): mark the test function as an expected failure if eval(condition) has a True value. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See http://pytest.org/latest/skipping.html - + @pytest.mark.parametrize(argnames, argvalues): call a test function multiple times passing in different arguments in turn. argvalues generally needs to be a list of values if argnames specifies only one name or a list of tuples of values if argnames specifies multiple names. Example: @parametrize('arg1', [1,2]) would lead to two calls of the decorated test function, one with arg1=1 and another with arg1=2.see http://pytest.org/latest/parametrize.html for more info and examples. - - @pytest.mark.usefixtures(fixturename1, fixturename2, ...): mark tests as needing all of the specified fixtures. see http://pytest.org/latest/fixture.html#usefixtures - + + @pytest.mark.usefixtures(fixturename1, fixturename2, ...): mark tests as needing all of the specified fixtures. see http://pytest.org/latest/fixture.html#usefixtures + @pytest.mark.tryfirst: mark a hook implementation function such that the plugin machinery will try to call it first/as early as possible. - + @pytest.mark.trylast: mark a hook implementation function such that the plugin machinery will try to call it last/as late as possible. - + .. _`passing callables to custom markers`: @@ -408,11 +402,9 @@ Below is the config file that will be used in the next examples:: import sys def pytest_runtest_setup(item): - marker = item.get_marker('my_marker') - if marker is not None: - for info in marker: - print('Marker info name={} args={} kwars={}'.format(info.name, info.args, info.kwargs)) - sys.stdout.flush() + for marker in item.iter_markers(name='my_marker'): + print(marker) + sys.stdout.flush() A custom marker can have its argument set, i.e. ``args`` and ``kwargs`` properties, defined by either invoking it as a callable or using ``pytest.mark.MARKER_NAME.with_args``. These two methods achieve the same effect most of the time. @@ -431,8 +423,8 @@ However, if there is a callable as the single positional argument with no keywor The output is as follows:: $ pytest -q -s - Marker info name=my_marker args=(,) kwars={} - . [100%] + Mark(name='my_marker', args=(,), kwargs={}) + . 1 passed in 0.12 seconds We can see that the custom marker has its argument set extended with the function ``hello_world``. This is the key difference between creating a custom marker as a callable, which invokes ``__call__`` behind the scenes, and using ``with_args``. @@ -465,11 +457,9 @@ test function. From a conftest file we can read it like this:: import sys def pytest_runtest_setup(item): - g = item.get_marker("glob") - if g is not None: - for info in g: - print ("glob args=%s kwargs=%s" %(info.args, info.kwargs)) - sys.stdout.flush() + for mark in item.iter_markers(name='glob'): + print ("glob args=%s kwargs=%s" %(mark.args, mark.kwargs)) + sys.stdout.flush() Let's run this without capturing output and see what we get:: @@ -477,7 +467,7 @@ Let's run this without capturing output and see what we get:: glob args=('function',) kwargs={'x': 3} glob args=('class',) kwargs={'x': 2} glob args=('module',) kwargs={'x': 1} - . [100%] + . 1 passed in 0.12 seconds marking platform specific tests with pytest @@ -499,11 +489,10 @@ for your particular platform, you could use the following plugin:: ALL = set("darwin linux win32".split()) def pytest_runtest_setup(item): - if isinstance(item, item.Function): - plat = sys.platform - if not item.get_marker(plat): - if ALL.intersection(item.keywords): - pytest.skip("cannot run on platform %s" %(plat)) + supported_platforms = ALL.intersection(mark.name for mark in item.iter_markers()) + plat = sys.platform + if supported_platforms and plat not in supported_platforms: + pytest.skip("cannot run on platform %s" % (plat)) then tests will be skipped if they were specified for a different platform. Let's do a little test file to show how this looks like:: @@ -534,11 +523,11 @@ then you will see two tests skipped and two executed tests as expected:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 4 items - + test_plat.py s.s. [100%] ========================= short test summary info ========================== - SKIP [2] $REGENDOC_TMPDIR/conftest.py:13: cannot run on platform linux - + SKIP [2] $REGENDOC_TMPDIR/conftest.py:12: cannot run on platform linux + =================== 2 passed, 2 skipped in 0.12 seconds ==================== Note that if you specify a platform via the marker-command line option like this:: @@ -547,11 +536,10 @@ Note that if you specify a platform via the marker-command line option like this =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: - collected 4 items - + collected 4 items / 3 deselected + test_plat.py . [100%] - - ============================ 3 tests deselected ============================ + ================== 1 passed, 3 deselected in 0.12 seconds ================== then the unmarked-tests will not be run. It is thus a way to restrict the run to the specific tests. @@ -599,10 +587,10 @@ We can now use the ``-m option`` to select one set:: =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: - collected 4 items - + collected 4 items / 2 deselected + test_module.py FF [100%] - + ================================= FAILURES ================================= __________________________ test_interface_simple ___________________________ test_module.py:3: in test_interface_simple @@ -612,7 +600,6 @@ We can now use the ``-m option`` to select one set:: test_module.py:6: in test_interface_complex assert 0 E assert 0 - ============================ 2 tests deselected ============================ ================== 2 failed, 2 deselected in 0.12 seconds ================== or to select both "event" and "interface" tests:: @@ -621,10 +608,10 @@ or to select both "event" and "interface" tests:: =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: - collected 4 items - + collected 4 items / 1 deselected + test_module.py FFF [100%] - + ================================= FAILURES ================================= __________________________ test_interface_simple ___________________________ test_module.py:3: in test_interface_simple @@ -638,5 +625,4 @@ or to select both "event" and "interface" tests:: test_module.py:9: in test_event_simple assert 0 E assert 0 - ============================ 1 tests deselected ============================ ================== 3 failed, 1 deselected in 0.12 seconds ================== diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/multipython.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/multipython.py index 66079be7e37..970800c7e61 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/multipython.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/multipython.py @@ -6,35 +6,48 @@ import py import pytest import _pytest._code -pythonlist = ['python2.7', 'python3.4', 'python3.5'] +pythonlist = ["python2.7", "python3.4", "python3.5"] + + @pytest.fixture(params=pythonlist) def python1(request, tmpdir): picklefile = tmpdir.join("data.pickle") return Python(request.param, picklefile) + @pytest.fixture(params=pythonlist) def python2(request, python1): return Python(request.param, python1.picklefile) + class Python(object): + def __init__(self, version, picklefile): self.pythonpath = py.path.local.sysfind(version) if not self.pythonpath: - pytest.skip("%r not found" %(version,)) + pytest.skip("%r not found" % (version,)) self.picklefile = picklefile + def dumps(self, obj): dumpfile = self.picklefile.dirpath("dump.py") - dumpfile.write(_pytest._code.Source(""" + dumpfile.write( + _pytest._code.Source( + """ import pickle f = open(%r, 'wb') s = pickle.dump(%r, f, protocol=2) f.close() - """ % (str(self.picklefile), obj))) - py.process.cmdexec("%s %s" %(self.pythonpath, dumpfile)) + """ + % (str(self.picklefile), obj) + ) + ) + py.process.cmdexec("%s %s" % (self.pythonpath, dumpfile)) def load_and_is_true(self, expression): loadfile = self.picklefile.dirpath("load.py") - loadfile.write(_pytest._code.Source(""" + loadfile.write( + _pytest._code.Source( + """ import pickle f = open(%r, 'rb') obj = pickle.load(f) @@ -42,11 +55,15 @@ class Python(object): res = eval(%r) if not res: raise SystemExit(1) - """ % (str(self.picklefile), expression))) - print (loadfile) - py.process.cmdexec("%s %s" %(self.pythonpath, loadfile)) + """ + % (str(self.picklefile), expression) + ) + ) + print(loadfile) + py.process.cmdexec("%s %s" % (self.pythonpath, loadfile)) -@pytest.mark.parametrize("obj", [42, {}, {1:3},]) + +@pytest.mark.parametrize("obj", [42, {}, {1: 3}]) def test_basic_objects(python1, python2, obj): python1.dumps(obj) python2.load_and_is_true("obj == %s" % obj) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/nonpython.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/nonpython.rst index cf72c7219e1..4f5adf63fd7 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/nonpython.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/nonpython.rst @@ -10,7 +10,7 @@ A basic example for specifying tests in Yaml files -------------------------------------------------------------- .. _`pytest-yamlwsgi`: http://bitbucket.org/aafshar/pytest-yamlwsgi/src/tip/pytest_yamlwsgi.py -.. _`PyYAML`: http://pypi.python.org/pypi/PyYAML/ +.. _`PyYAML`: https://pypi.org/project/PyYAML/ Here is an example ``conftest.py`` (extracted from Ali Afshnars special purpose `pytest-yamlwsgi`_ plugin). This ``conftest.py`` will collect ``test*.yml`` files and will execute the yaml-formatted content as custom tests: @@ -30,9 +30,9 @@ now execute the test specification:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR/nonpython, inifile: collected 2 items - + test_simple.yml F. [100%] - + ================================= FAILURES ================================= ______________________________ usecase: hello ______________________________ usecase execution failed @@ -60,13 +60,13 @@ consulted when reporting in ``verbose`` mode:: nonpython $ pytest -v =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR/nonpython, inifile: collecting ... collected 2 items - + test_simple.yml::hello FAILED [ 50%] test_simple.yml::ok PASSED [100%] - + ================================= FAILURES ================================= ______________________________ usecase: hello ______________________________ usecase execution failed @@ -87,5 +87,5 @@ interesting to just look at the collection tree:: - + ======================= no tests ran in 0.12 seconds ======================= diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/nonpython/conftest.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/nonpython/conftest.py index baff3001550..8429dd114b1 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/nonpython/conftest.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/nonpython/conftest.py @@ -2,18 +2,24 @@ import pytest + def pytest_collect_file(parent, path): if path.ext == ".yml" and path.basename.startswith("test"): return YamlFile(path, parent) + class YamlFile(pytest.File): + def collect(self): - import yaml # we need a yaml parser, e.g. PyYAML + import yaml # we need a yaml parser, e.g. PyYAML + raw = yaml.safe_load(self.fspath.open()) for name, spec in sorted(raw.items()): yield YamlItem(name, self, spec) + class YamlItem(pytest.Item): + def __init__(self, name, parent, spec): super(YamlItem, self).__init__(name, parent) self.spec = spec @@ -27,14 +33,17 @@ class YamlItem(pytest.Item): def repr_failure(self, excinfo): """ called when self.runtest() raises an exception. """ if isinstance(excinfo.value, YamlException): - return "\n".join([ - "usecase execution failed", - " spec failed: %r: %r" % excinfo.value.args[1:3], - " no further details known at this point." - ]) + return "\n".join( + [ + "usecase execution failed", + " spec failed: %r: %r" % excinfo.value.args[1:3], + " no further details known at this point.", + ] + ) def reportinfo(self): return self.fspath, 0, "usecase: %s" % self.name + class YamlException(Exception): """ custom exception for error reporting. """ diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/parametrize.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/parametrize.rst index dd01b25277a..882700fec11 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/parametrize.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/parametrize.rst @@ -55,13 +55,13 @@ let's run the full monty:: ....F [100%] ================================= FAILURES ================================= _____________________________ test_compute[4] ______________________________ - + param1 = 4 - + def test_compute(param1): > assert param1 < 4 E assert 4 < 4 - + test_compute.py:3: AssertionError 1 failed, 4 passed in 0.12 seconds @@ -151,7 +151,7 @@ objects, they are still using the default pytest representation:: - + ======================= no tests ran in 0.12 seconds ======================= In ``test_timedistance_v3``, we used ``pytest.param`` to specify the test IDs @@ -160,7 +160,7 @@ together with the actual data, instead of listing them separately. A quick port of "testscenarios" ------------------------------------ -.. _`test scenarios`: http://pypi.python.org/pypi/testscenarios/ +.. _`test scenarios`: https://pypi.org/project/testscenarios/ Here is a quick port to run tests configured with `test scenarios`_, an add-on from Robert Collins for the standard unittest framework. We @@ -198,9 +198,9 @@ this is a fully self-contained example which you can run with:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 4 items - + test_scenarios.py .... [100%] - + ========================= 4 passed in 0.12 seconds ========================= If you just collect tests you'll also nicely see 'advanced' and 'basic' as variants for the test function:: @@ -218,7 +218,7 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia - + ======================= no tests ran in 0.12 seconds ======================= Note that we told ``metafunc.parametrize()`` that your scenario values @@ -279,7 +279,7 @@ Let's first see how it looks like at collection time:: - + ======================= no tests ran in 0.12 seconds ======================= And then when we run the test:: @@ -288,15 +288,15 @@ And then when we run the test:: .F [100%] ================================= FAILURES ================================= _________________________ test_db_initialized[d2] __________________________ - + db = - + def test_db_initialized(db): # a dummy test if db.__class__.__name__ == "DB2": > pytest.fail("deliberately failing for demo purposes") E Failed: deliberately failing for demo purposes - + test_backends.py:6: Failed 1 failed, 1 passed in 0.12 seconds @@ -339,7 +339,7 @@ The result of this test will be successful:: collected 1 item - + ======================= no tests ran in 0.12 seconds ======================= .. regendoc:wipe @@ -384,13 +384,13 @@ argument sets to use for each test function. Let's run it:: F.. [100%] ================================= FAILURES ================================= ________________________ TestClass.test_equals[1-2] ________________________ - + self = , a = 1, b = 2 - + def test_equals(self, a, b): > assert a == b E assert 1 == 2 - + test_parametrize.py:18: AssertionError 1 failed, 2 passed in 0.12 seconds @@ -462,14 +462,14 @@ If you run this with reporting for skips enabled:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 2 items - + test_module.py .s [100%] ========================= short test summary info ========================== SKIP [1] $REGENDOC_TMPDIR/conftest.py:11: could not import 'opt2' - + =================== 1 passed, 1 skipped in 0.12 seconds ==================== -You'll see that we don't have a ``opt2`` module and thus the second test run +You'll see that we don't have an ``opt2`` module and thus the second test run of our ``test_func1`` was skipped. A few notes: - the fixture functions in the ``conftest.py`` file are "session-scoped" because we @@ -504,10 +504,10 @@ For example:: ]) def test_eval(test_input, expected): assert eval(test_input) == expected - + In this example, we have 4 parametrized tests. Except for the first test, we mark the rest three parametrized tests with the custom marker ``basic``, -and for the fourth test we also use the built-in mark ``xfail`` to indicate this +and for the fourth test we also use the built-in mark ``xfail`` to indicate this test is expected to fail. For explicitness, we set test ids for some tests. Then run ``pytest`` with verbose mode and with only the ``basic`` marker:: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/py2py3/conftest.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/py2py3/conftest.py index 81cd1fb11ea..5d9a07e3e32 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/py2py3/conftest.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/py2py3/conftest.py @@ -3,14 +3,14 @@ import pytest py3 = sys.version_info[0] >= 3 + class DummyCollector(pytest.collect.File): + def collect(self): return [] + def pytest_pycollect_makemodule(path, parent): bn = path.basename if "py3" in bn and not py3 or ("py2" in bn and py3): return DummyCollector(path, parent=parent) - - - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/py2py3/test_py2.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/py2py3/test_py2.py index e09ed946627..664acf178a0 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/py2py3/test_py2.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/py2py3/test_py2.py @@ -4,4 +4,3 @@ def test_exception_syntax(): 0/0 except ZeroDivisionError, e: pass - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/py2py3/test_py3.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/py2py3/test_py3.py index a811f2bbc55..baf0ffbd822 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/py2py3/test_py3.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/py2py3/test_py3.py @@ -1,7 +1,5 @@ - def test_exception_syntax(): try: - 0/0 + 0 / 0 except ZeroDivisionError as e: pass - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/pythoncollection.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/pythoncollection.py index 9c4bd31cea0..3603361c3dc 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/pythoncollection.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/pythoncollection.py @@ -1,11 +1,15 @@ - # run this with $ pytest --collect-only test_collectonly.py # + + def test_function(): pass + class TestClass(object): + def test_method(self): pass + def test_anothermethod(self): pass diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/pythoncollection.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/pythoncollection.rst index c9d31d7c420..8e9d3ae62a7 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/pythoncollection.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/pythoncollection.rst @@ -39,6 +39,14 @@ you will see that ``pytest`` only collects test-modules, which do not match the ======= 5 passed in 0.02 seconds ======= +Deselect tests during test collection +------------------------------------- + +Tests can individually be deselected during collection by passing the ``--deselect=item`` option. +For example, say ``tests/foobar/test_foobar_01.py`` contains ``test_a`` and ``test_b``. +You can run all of the tests within ``tests/`` *except* for ``tests/foobar/test_foobar_01.py::test_a`` +by invoking ``pytest`` with ``--deselect tests/foobar/test_foobar_01.py::test_a``. +``pytest`` allows multiple ``--deselect`` options. Keeping duplicate paths specified from command line ---------------------------------------------------- @@ -46,7 +54,7 @@ Keeping duplicate paths specified from command line Default behavior of ``pytest`` is to ignore duplicate paths specified from the command line. Example:: - py.test path_a path_a + pytest path_a path_a ... collected 1 item @@ -57,7 +65,7 @@ Just collect tests once. To collect duplicate tests, use the ``--keep-duplicates`` option on the cli. Example:: - py.test --keep-duplicates path_a path_a + pytest --keep-duplicates path_a path_a ... collected 2 items @@ -67,7 +75,7 @@ As the collector just works on directories, if you specify twice a single test f still collect it twice, no matter if the ``--keep-duplicates`` is not specified. Example:: - py.test test_a.py test_a.py + pytest test_a.py test_a.py ... collected 2 items @@ -125,7 +133,7 @@ then the test collection looks like this:: - + ======================= no tests ran in 0.12 seconds ======================= .. note:: @@ -172,7 +180,7 @@ You can always peek at the collection tree without running tests like this:: - + ======================= no tests ran in 0.12 seconds ======================= .. _customizing-test-collection: @@ -235,5 +243,5 @@ file will be left out:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini collected 0 items - + ======================= no tests ran in 0.12 seconds ======================= diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/reportingdemo.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/reportingdemo.rst index 9edc02b3cd4..4691b128bb8 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/reportingdemo.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/reportingdemo.rst @@ -14,111 +14,112 @@ get on the terminal - we are working on that):: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR/assertion, inifile: collected 42 items - + failure_demo.py FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF [100%] - + ================================= FAILURES ================================= ____________________________ test_generative[0] ____________________________ - + param1 = 3, param2 = 6 - + def test_generative(param1, param2): > assert param1 * 2 < param2 E assert (3 * 2) < 6 - - failure_demo.py:16: AssertionError + + failure_demo.py:19: AssertionError _________________________ TestFailing.test_simple __________________________ - + self = - + def test_simple(self): + def f(): return 42 + def g(): return 43 - + > assert f() == g() E assert 42 == 43 E + where 42 = .f at 0xdeadbeef>() E + and 43 = .g at 0xdeadbeef>() - - failure_demo.py:29: AssertionError + + failure_demo.py:37: AssertionError ____________________ TestFailing.test_simple_multiline _____________________ - + self = - + def test_simple_multiline(self): - otherfunc_multi( - 42, - > 6*9) - - failure_demo.py:34: - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - + > otherfunc_multi(42, 6 * 9) + + failure_demo.py:40: + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + a = 42, b = 54 - - def otherfunc_multi(a,b): - > assert (a == - b) + + def otherfunc_multi(a, b): + > assert a == b E assert 42 == 54 - - failure_demo.py:12: AssertionError + + failure_demo.py:15: AssertionError ___________________________ TestFailing.test_not ___________________________ - + self = - + def test_not(self): + def f(): return 42 + > assert not f() E assert not 42 E + where 42 = .f at 0xdeadbeef>() - - failure_demo.py:39: AssertionError + + failure_demo.py:47: AssertionError _________________ TestSpecialisedExplanations.test_eq_text _________________ - + self = - + def test_eq_text(self): - > assert 'spam' == 'eggs' + > assert "spam" == "eggs" E AssertionError: assert 'spam' == 'eggs' E - spam E + eggs - - failure_demo.py:43: AssertionError + + failure_demo.py:53: AssertionError _____________ TestSpecialisedExplanations.test_eq_similar_text _____________ - + self = - + def test_eq_similar_text(self): - > assert 'foo 1 bar' == 'foo 2 bar' + > assert "foo 1 bar" == "foo 2 bar" E AssertionError: assert 'foo 1 bar' == 'foo 2 bar' E - foo 1 bar E ? ^ E + foo 2 bar E ? ^ - - failure_demo.py:46: AssertionError + + failure_demo.py:56: AssertionError ____________ TestSpecialisedExplanations.test_eq_multiline_text ____________ - + self = - + def test_eq_multiline_text(self): - > assert 'foo\nspam\nbar' == 'foo\neggs\nbar' + > assert "foo\nspam\nbar" == "foo\neggs\nbar" E AssertionError: assert 'foo\nspam\nbar' == 'foo\neggs\nbar' E foo E - spam E + eggs E bar - - failure_demo.py:49: AssertionError + + failure_demo.py:59: AssertionError ______________ TestSpecialisedExplanations.test_eq_long_text _______________ - + self = - + def test_eq_long_text(self): - a = '1'*100 + 'a' + '2'*100 - b = '1'*100 + 'b' + '2'*100 + a = "1" * 100 + "a" + "2" * 100 + b = "1" * 100 + "b" + "2" * 100 > assert a == b E AssertionError: assert '111111111111...2222222222222' == '1111111111111...2222222222222' E Skipping 90 identical leading characters in diff, use -v to show @@ -127,15 +128,15 @@ get on the terminal - we are working on that):: E ? ^ E + 1111111111b222222222 E ? ^ - - failure_demo.py:54: AssertionError + + failure_demo.py:64: AssertionError _________ TestSpecialisedExplanations.test_eq_long_text_multiline __________ - + self = - + def test_eq_long_text_multiline(self): - a = '1\n'*100 + 'a' + '2\n'*100 - b = '1\n'*100 + 'b' + '2\n'*100 + a = "1\n" * 100 + "a" + "2\n" * 100 + b = "1\n" * 100 + "b" + "2\n" * 100 > assert a == b E AssertionError: assert '1\n1\n1\n1\n...n2\n2\n2\n2\n' == '1\n1\n1\n1\n1...n2\n2\n2\n2\n' E Skipping 190 identical leading characters in diff, use -v to show @@ -145,40 +146,40 @@ get on the terminal - we are working on that):: E 1 E 1 E 1... - E + E E ...Full output truncated (7 lines hidden), use '-vv' to show - - failure_demo.py:59: AssertionError + + failure_demo.py:69: AssertionError _________________ TestSpecialisedExplanations.test_eq_list _________________ - + self = - + def test_eq_list(self): > assert [0, 1, 2] == [0, 1, 3] E assert [0, 1, 2] == [0, 1, 3] E At index 2 diff: 2 != 3 E Use -v to get the full diff - - failure_demo.py:62: AssertionError + + failure_demo.py:72: AssertionError ______________ TestSpecialisedExplanations.test_eq_list_long _______________ - + self = - + def test_eq_list_long(self): - a = [0]*100 + [1] + [3]*100 - b = [0]*100 + [2] + [3]*100 + a = [0] * 100 + [1] + [3] * 100 + b = [0] * 100 + [2] + [3] * 100 > assert a == b E assert [0, 0, 0, 0, 0, 0, ...] == [0, 0, 0, 0, 0, 0, ...] E At index 100 diff: 1 != 2 E Use -v to get the full diff - - failure_demo.py:67: AssertionError + + failure_demo.py:77: AssertionError _________________ TestSpecialisedExplanations.test_eq_dict _________________ - + self = - + def test_eq_dict(self): - > assert {'a': 0, 'b': 1, 'c': 0} == {'a': 0, 'b': 2, 'd': 0} + > assert {"a": 0, "b": 1, "c": 0} == {"a": 0, "b": 2, "d": 0} E AssertionError: assert {'a': 0, 'b': 1, 'c': 0} == {'a': 0, 'b': 2, 'd': 0} E Omitting 1 identical items, use -vv to show E Differing items: @@ -187,16 +188,16 @@ get on the terminal - we are working on that):: E {'c': 0} E Right contains more items: E {'d': 0}... - E + E E ...Full output truncated (2 lines hidden), use '-vv' to show - - failure_demo.py:70: AssertionError + + failure_demo.py:80: AssertionError _________________ TestSpecialisedExplanations.test_eq_set __________________ - + self = - + def test_eq_set(self): - > assert set([0, 10, 11, 12]) == set([0, 20, 21]) + > assert {0, 10, 11, 12} == {0, 20, 21} E AssertionError: assert {0, 10, 11, 12} == {0, 20, 21} E Extra items in the left set: E 10 @@ -205,37 +206,37 @@ get on the terminal - we are working on that):: E Extra items in the right set: E 20 E 21... - E + E E ...Full output truncated (2 lines hidden), use '-vv' to show - - failure_demo.py:73: AssertionError + + failure_demo.py:83: AssertionError _____________ TestSpecialisedExplanations.test_eq_longer_list ______________ - + self = - + def test_eq_longer_list(self): - > assert [1,2] == [1,2,3] + > assert [1, 2] == [1, 2, 3] E assert [1, 2] == [1, 2, 3] E Right contains more items, first extra item: 3 E Use -v to get the full diff - - failure_demo.py:76: AssertionError + + failure_demo.py:86: AssertionError _________________ TestSpecialisedExplanations.test_in_list _________________ - + self = - + def test_in_list(self): > assert 1 in [0, 2, 3, 4, 5] E assert 1 in [0, 2, 3, 4, 5] - - failure_demo.py:79: AssertionError + + failure_demo.py:89: AssertionError __________ TestSpecialisedExplanations.test_not_in_text_multiline __________ - + self = - + def test_not_in_text_multiline(self): - text = 'some multiline\ntext\nwhich\nincludes foo\nand a\ntail' - > assert 'foo' not in text + text = "some multiline\ntext\nwhich\nincludes foo\nand a\ntail" + > assert "foo" not in text E AssertionError: assert 'foo' not in 'some multiline\ntext\nw...ncludes foo\nand a\ntail' E 'foo' is contained here: E some multiline @@ -244,237 +245,254 @@ get on the terminal - we are working on that):: E includes foo E ? +++ E and a... - E + E E ...Full output truncated (2 lines hidden), use '-vv' to show - - failure_demo.py:83: AssertionError + + failure_demo.py:93: AssertionError ___________ TestSpecialisedExplanations.test_not_in_text_single ____________ - + self = - + def test_not_in_text_single(self): - text = 'single foo line' - > assert 'foo' not in text + text = "single foo line" + > assert "foo" not in text E AssertionError: assert 'foo' not in 'single foo line' E 'foo' is contained here: E single foo line E ? +++ - - failure_demo.py:87: AssertionError + + failure_demo.py:97: AssertionError _________ TestSpecialisedExplanations.test_not_in_text_single_long _________ - + self = - + def test_not_in_text_single_long(self): - text = 'head ' * 50 + 'foo ' + 'tail ' * 20 - > assert 'foo' not in text + text = "head " * 50 + "foo " + "tail " * 20 + > assert "foo" not in text E AssertionError: assert 'foo' not in 'head head head head hea...ail tail tail tail tail ' E 'foo' is contained here: - E head head foo tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail + E head head foo tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail E ? +++ - - failure_demo.py:91: AssertionError + + failure_demo.py:101: AssertionError ______ TestSpecialisedExplanations.test_not_in_text_single_long_term _______ - + self = - + def test_not_in_text_single_long_term(self): - text = 'head ' * 50 + 'f'*70 + 'tail ' * 20 - > assert 'f'*70 not in text + text = "head " * 50 + "f" * 70 + "tail " * 20 + > assert "f" * 70 not in text E AssertionError: assert 'fffffffffff...ffffffffffff' not in 'head head he...l tail tail ' E 'ffffffffffffffffff...fffffffffffffffffff' is contained here: - E head head fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffftail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail + E head head fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffftail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail E ? ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - - failure_demo.py:95: AssertionError + + failure_demo.py:105: AssertionError ______________________________ test_attribute ______________________________ - + def test_attribute(): + class Foo(object): b = 1 + i = Foo() > assert i.b == 2 E assert 1 == 2 E + where 1 = .Foo object at 0xdeadbeef>.b - - failure_demo.py:102: AssertionError + + failure_demo.py:114: AssertionError _________________________ test_attribute_instance __________________________ - + def test_attribute_instance(): + class Foo(object): b = 1 + > assert Foo().b == 2 E AssertionError: assert 1 == 2 E + where 1 = .Foo object at 0xdeadbeef>.b E + where .Foo object at 0xdeadbeef> = .Foo'>() - - failure_demo.py:108: AssertionError + + failure_demo.py:122: AssertionError __________________________ test_attribute_failure __________________________ - + def test_attribute_failure(): + class Foo(object): + def _get_b(self): - raise Exception('Failed to get attrib') + raise Exception("Failed to get attrib") + b = property(_get_b) + i = Foo() > assert i.b == 2 - - failure_demo.py:117: - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - + + failure_demo.py:135: + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + self = .Foo object at 0xdeadbeef> - + def _get_b(self): - > raise Exception('Failed to get attrib') + > raise Exception("Failed to get attrib") E Exception: Failed to get attrib - - failure_demo.py:114: Exception + + failure_demo.py:130: Exception _________________________ test_attribute_multiple __________________________ - + def test_attribute_multiple(): + class Foo(object): b = 1 + class Bar(object): b = 2 + > assert Foo().b == Bar().b E AssertionError: assert 1 == 2 E + where 1 = .Foo object at 0xdeadbeef>.b E + where .Foo object at 0xdeadbeef> = .Foo'>() E + and 2 = .Bar object at 0xdeadbeef>.b E + where .Bar object at 0xdeadbeef> = .Bar'>() - - failure_demo.py:125: AssertionError + + failure_demo.py:146: AssertionError __________________________ TestRaises.test_raises __________________________ - + self = - + def test_raises(self): - s = 'qwe' + s = "qwe" # NOQA > raises(TypeError, "int(s)") - - failure_demo.py:134: - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - + + failure_demo.py:157: + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + > int(s) E ValueError: invalid literal for int() with base 10: 'qwe' - - <0-codegen $PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/python_api.py:580>:1: ValueError + + <0-codegen $PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/python_api.py:634>:1: ValueError ______________________ TestRaises.test_raises_doesnt _______________________ - + self = - + def test_raises_doesnt(self): > raises(IOError, "int('3')") E Failed: DID NOT RAISE - - failure_demo.py:137: Failed + + failure_demo.py:160: Failed __________________________ TestRaises.test_raise ___________________________ - + self = - + def test_raise(self): > raise ValueError("demo error") E ValueError: demo error - - failure_demo.py:140: ValueError + + failure_demo.py:163: ValueError ________________________ TestRaises.test_tupleerror ________________________ - + self = - + def test_tupleerror(self): - > a,b = [1] + > a, b = [1] # NOQA E ValueError: not enough values to unpack (expected 2, got 1) - - failure_demo.py:143: ValueError + + failure_demo.py:166: ValueError ______ TestRaises.test_reinterpret_fails_with_print_for_the_fun_of_it ______ - + self = - + def test_reinterpret_fails_with_print_for_the_fun_of_it(self): - l = [1,2,3] - print ("l is %r" % l) - > a,b = l.pop() + items = [1, 2, 3] + print("items is %r" % items) + > a, b = items.pop() E TypeError: 'int' object is not iterable - - failure_demo.py:148: TypeError + + failure_demo.py:171: TypeError --------------------------- Captured stdout call --------------------------- - l is [1, 2, 3] + items is [1, 2, 3] ________________________ TestRaises.test_some_error ________________________ - + self = - + def test_some_error(self): - > if namenotexi: + > if namenotexi: # NOQA E NameError: name 'namenotexi' is not defined - - failure_demo.py:151: NameError + + failure_demo.py:174: NameError ____________________ test_dynamic_compile_shows_nicely _____________________ - + def test_dynamic_compile_shows_nicely(): - src = 'def foo():\n assert 1 == 0\n' - name = 'abc-123' - module = py.std.imp.new_module(name) - code = _pytest._code.compile(src, name, 'exec') + import imp + import sys + + src = "def foo():\n assert 1 == 0\n" + name = "abc-123" + module = imp.new_module(name) + code = _pytest._code.compile(src, name, "exec") py.builtin.exec_(code, module.__dict__) - py.std.sys.modules[name] = module + sys.modules[name] = module > module.foo() - - failure_demo.py:166: - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - + + failure_demo.py:192: + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + def foo(): > assert 1 == 0 E AssertionError - - <2-codegen 'abc-123' $REGENDOC_TMPDIR/assertion/failure_demo.py:163>:2: AssertionError + + <2-codegen 'abc-123' $REGENDOC_TMPDIR/assertion/failure_demo.py:189>:2: AssertionError ____________________ TestMoreErrors.test_complex_error _____________________ - + self = - + def test_complex_error(self): + def f(): return 44 + def g(): return 43 + > somefunc(f(), g()) - - failure_demo.py:176: - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - failure_demo.py:9: in somefunc - otherfunc(x,y) - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - + + failure_demo.py:205: + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + failure_demo.py:11: in somefunc + otherfunc(x, y) + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + a = 44, b = 43 - - def otherfunc(a,b): - > assert a==b + + def otherfunc(a, b): + > assert a == b E assert 44 == 43 - - failure_demo.py:6: AssertionError + + failure_demo.py:7: AssertionError ___________________ TestMoreErrors.test_z1_unpack_error ____________________ - + self = - + def test_z1_unpack_error(self): - l = [] - > a,b = l + items = [] + > a, b = items E ValueError: not enough values to unpack (expected 2, got 0) - - failure_demo.py:180: ValueError + + failure_demo.py:209: ValueError ____________________ TestMoreErrors.test_z2_type_error _____________________ - + self = - + def test_z2_type_error(self): - l = 3 - > a,b = l + items = 3 + > a, b = items E TypeError: 'int' object is not iterable - - failure_demo.py:184: TypeError + + failure_demo.py:213: TypeError ______________________ TestMoreErrors.test_startswith ______________________ - + self = - + def test_startswith(self): s = "123" g = "456" @@ -482,108 +500,119 @@ get on the terminal - we are working on that):: E AssertionError: assert False E + where False = ('456') E + where = '123'.startswith - - failure_demo.py:189: AssertionError + + failure_demo.py:218: AssertionError __________________ TestMoreErrors.test_startswith_nested ___________________ - + self = - + def test_startswith_nested(self): + def f(): return "123" + def g(): return "456" + > assert f().startswith(g()) E AssertionError: assert False E + where False = ('456') E + where = '123'.startswith E + where '123' = .f at 0xdeadbeef>() E + and '456' = .g at 0xdeadbeef>() - - failure_demo.py:196: AssertionError + + failure_demo.py:228: AssertionError _____________________ TestMoreErrors.test_global_func ______________________ - + self = - + def test_global_func(self): > assert isinstance(globf(42), float) E assert False E + where False = isinstance(43, float) E + where 43 = globf(42) - - failure_demo.py:199: AssertionError + + failure_demo.py:231: AssertionError _______________________ TestMoreErrors.test_instance _______________________ - + self = - + def test_instance(self): - self.x = 6*7 + self.x = 6 * 7 > assert self.x != 42 E assert 42 != 42 E + where 42 = .x - - failure_demo.py:203: AssertionError + + failure_demo.py:235: AssertionError _______________________ TestMoreErrors.test_compare ________________________ - + self = - + def test_compare(self): > assert globf(10) < 5 E assert 11 < 5 E + where 11 = globf(10) - - failure_demo.py:206: AssertionError + + failure_demo.py:238: AssertionError _____________________ TestMoreErrors.test_try_finally ______________________ - + self = - + def test_try_finally(self): x = 1 try: > assert x == 0 E assert 1 == 0 - - failure_demo.py:211: AssertionError + + failure_demo.py:243: AssertionError ___________________ TestCustomAssertMsg.test_single_line ___________________ - + self = - + def test_single_line(self): + class A(object): a = 1 + b = 2 > assert A.a == b, "A.a appears not to be b" E AssertionError: A.a appears not to be b E assert 1 == 2 E + where 1 = .A'>.a - - failure_demo.py:222: AssertionError + + failure_demo.py:256: AssertionError ____________________ TestCustomAssertMsg.test_multiline ____________________ - + self = - + def test_multiline(self): + class A(object): a = 1 + b = 2 - > assert A.a == b, "A.a appears not to be b\n" \ - "or does not appear to be b\none of those" + > assert ( + A.a == b + ), "A.a appears not to be b\n" "or does not appear to be b\none of those" E AssertionError: A.a appears not to be b E or does not appear to be b E one of those E assert 1 == 2 E + where 1 = .A'>.a - - failure_demo.py:228: AssertionError + + failure_demo.py:264: AssertionError ___________________ TestCustomAssertMsg.test_custom_repr ___________________ - + self = - + def test_custom_repr(self): + class JSON(object): a = 1 + def __repr__(self): return "This is JSON\n{\n 'foo': 'bar'\n}" + a = JSON() b = 2 > assert a.a == b, a @@ -593,12 +622,12 @@ get on the terminal - we are working on that):: E } E assert 1 == 2 E + where 1 = This is JSON\n{\n 'foo': 'bar'\n}.a - - failure_demo.py:238: AssertionError + + failure_demo.py:278: AssertionError ============================= warnings summary ============================= - None + Metafunc.addcall is deprecated and scheduled to be removed in pytest 4.0. Please use Metafunc.parametrize instead. - + -- Docs: http://doc.pytest.org/en/latest/warnings.html ================== 42 failed, 1 warnings in 0.12 seconds =================== diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/simple.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/simple.rst index 678a0db0094..180637ae994 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/simple.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/simple.rst @@ -3,6 +3,8 @@ Basic patterns and examples ========================================================== +.. _request example: + Pass different values to a test function, depending on command line options ---------------------------------------------------------------------------- @@ -16,10 +18,10 @@ Here is a basic pattern to achieve this: # content of test_sample.py def test_answer(cmdopt): if cmdopt == "type1": - print ("first") + print("first") elif cmdopt == "type2": - print ("second") - assert 0 # to see what was printed + print("second") + assert 0 # to see what was printed For this to work we need to add a command line option and @@ -30,9 +32,12 @@ provide the ``cmdopt`` through a :ref:`fixture function `: # content of conftest.py import pytest + def pytest_addoption(parser): - parser.addoption("--cmdopt", action="store", default="type1", - help="my option: type1 or type2") + parser.addoption( + "--cmdopt", action="store", default="type1", help="my option: type1 or type2" + ) + @pytest.fixture def cmdopt(request): @@ -44,17 +49,17 @@ Let's run this without supplying our new option:: F [100%] ================================= FAILURES ================================= _______________________________ test_answer ________________________________ - + cmdopt = 'type1' - + def test_answer(cmdopt): if cmdopt == "type1": - print ("first") + print("first") elif cmdopt == "type2": - print ("second") - > assert 0 # to see what was printed + print("second") + > assert 0 # to see what was printed E assert 0 - + test_sample.py:6: AssertionError --------------------------- Captured stdout call --------------------------- first @@ -66,17 +71,17 @@ And now with supplying a command line option:: F [100%] ================================= FAILURES ================================= _______________________________ test_answer ________________________________ - + cmdopt = 'type2' - + def test_answer(cmdopt): if cmdopt == "type1": - print ("first") + print("first") elif cmdopt == "type2": - print ("second") - > assert 0 # to see what was printed + print("second") + > assert 0 # to see what was printed E assert 0 - + test_sample.py:6: AssertionError --------------------------- Captured stdout call --------------------------- second @@ -100,13 +105,16 @@ the command line arguments before they get processed: # content of conftest.py import sys - def pytest_cmdline_preparse(args): - if 'xdist' in sys.modules: # pytest-xdist plugin + + + def pytest_load_initial_conftests(args): + if "xdist" in sys.modules: # pytest-xdist plugin import multiprocessing + num = max(multiprocessing.cpu_count() / 2, 1) args[:] = ["-n", str(num)] + args -If you have the `xdist plugin `_ installed +If you have the `xdist plugin `_ installed you will now always perform test runs using a number of subprocesses close to your CPU. Running in an empty directory with the above conftest.py:: @@ -116,7 +124,7 @@ directory with the above conftest.py:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 0 items - + ======================= no tests ran in 0.12 seconds ======================= .. _`excontrolskip`: @@ -134,9 +142,13 @@ line option to control skipping of ``pytest.mark.slow`` marked tests: # content of conftest.py import pytest + + def pytest_addoption(parser): - parser.addoption("--runslow", action="store_true", - default=False, help="run slow tests") + parser.addoption( + "--runslow", action="store_true", default=False, help="run slow tests" + ) + def pytest_collection_modifyitems(config, items): if config.getoption("--runslow"): @@ -170,11 +182,11 @@ and when running it will see a skipped "slow" test:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 2 items - + test_module.py .s [100%] ========================= short test summary info ========================== SKIP [1] test_module.py:8: need --runslow option to run - + =================== 1 passed, 1 skipped in 0.12 seconds ==================== Or run it including the ``slow`` marked test:: @@ -184,9 +196,9 @@ Or run it including the ``slow`` marked test:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 2 items - + test_module.py .. [100%] - + ========================= 2 passed in 0.12 seconds ========================= Writing well integrated assertion helpers @@ -204,10 +216,13 @@ Example: # content of test_checkconfig.py import pytest + + def checkconfig(x): __tracebackhide__ = True if not hasattr(x, "config"): - pytest.fail("not configured: %s" %(x,)) + pytest.fail("not configured: %s" % (x,)) + def test_something(): checkconfig(42) @@ -221,12 +236,12 @@ Let's run our little function:: F [100%] ================================= FAILURES ================================= ______________________________ test_something ______________________________ - + def test_something(): > checkconfig(42) E Failed: not configured: 42 - - test_checkconfig.py:8: Failed + + test_checkconfig.py:11: Failed 1 failed in 0.12 seconds If you only want to hide certain exceptions, you can set ``__tracebackhide__`` @@ -238,13 +253,16 @@ this to make sure unexpected exception types aren't hidden: import operator import pytest + class ConfigException(Exception): pass + def checkconfig(x): - __tracebackhide__ = operator.methodcaller('errisinstance', ConfigException) + __tracebackhide__ = operator.methodcaller("errisinstance", ConfigException) if not hasattr(x, "config"): - raise ConfigException("not configured: %s" %(x,)) + raise ConfigException("not configured: %s" % (x,)) + def test_something(): checkconfig(42) @@ -267,22 +285,28 @@ running from a test you can do something like this: # content of conftest.py + def pytest_configure(config): import sys + sys._called_from_test = True + def pytest_unconfigure(config): import sys + del sys._called_from_test and then check for the ``sys._called_from_test`` flag: .. code-block:: python - if hasattr(sys, '_called_from_test'): + if hasattr(sys, "_called_from_test"): # called from within a test run + ... else: # called "normally" + ... accordingly in your application. It's also a good idea to use your own application module rather than ``sys`` @@ -299,6 +323,7 @@ It's easy to present extra information in a ``pytest`` run: # content of conftest.py + def pytest_report_header(config): return "project deps: mylib-1.1" @@ -310,7 +335,7 @@ which will add the string to the test header accordingly:: project deps: mylib-1.1 rootdir: $REGENDOC_TMPDIR, inifile: collected 0 items - + ======================= no tests ran in 0.12 seconds ======================= .. regendoc:wipe @@ -323,8 +348,9 @@ display more information if applicable: # content of conftest.py + def pytest_report_header(config): - if config.getoption('verbose') > 0: + if config.getoption("verbose") > 0: return ["info1: did you know that ...", "did you?"] which will add info only when run with "--v":: @@ -332,12 +358,12 @@ which will add info only when run with "--v":: $ pytest -v =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 - cachedir: .cache + cachedir: .pytest_cache info1: did you know that ... did you? rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 0 items - + ======================= no tests ran in 0.12 seconds ======================= and nothing when run plainly:: @@ -347,7 +373,7 @@ and nothing when run plainly:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 0 items - + ======================= no tests ran in 0.12 seconds ======================= profiling test duration @@ -365,12 +391,15 @@ out which tests are the slowest. Let's make an artificial test suite: # content of test_some_are_slow.py import time + def test_funcfast(): time.sleep(0.1) + def test_funcslow1(): time.sleep(0.2) + def test_funcslow2(): time.sleep(0.3) @@ -381,9 +410,9 @@ Now we can profile which test functions execute the slowest:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 3 items - + test_some_are_slow.py ... [100%] - + ========================= slowest 3 test durations ========================= 0.30s call test_some_are_slow.py::test_funcslow2 0.20s call test_some_are_slow.py::test_funcslow1 @@ -407,17 +436,19 @@ an ``incremental`` marker which is to be used on classes: import pytest + def pytest_runtest_makereport(item, call): if "incremental" in item.keywords: if call.excinfo is not None: parent = item.parent parent._previousfailed = item + def pytest_runtest_setup(item): if "incremental" in item.keywords: previousfailed = getattr(item.parent, "_previousfailed", None) if previousfailed is not None: - pytest.xfail("previous test failed (%s)" %previousfailed.name) + pytest.xfail("previous test failed (%s)" % previousfailed.name) These two hook implementations work together to abort incremental-marked tests in a class. Here is a test module example: @@ -428,15 +459,19 @@ tests in a class. Here is a test module example: import pytest + @pytest.mark.incremental class TestUserHandling(object): def test_login(self): pass + def test_modification(self): assert 0 + def test_deletion(self): pass + def test_normal(): pass @@ -447,22 +482,22 @@ If we run this:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 4 items - + test_step.py .Fx. [100%] - ========================= short test summary info ========================== - XFAIL test_step.py::TestUserHandling::()::test_deletion - reason: previous test failed (test_modification) - + ================================= FAILURES ================================= ____________________ TestUserHandling.test_modification ____________________ - + self = - + def test_modification(self): > assert 0 E assert 0 - - test_step.py:9: AssertionError + + test_step.py:11: AssertionError + ========================= short test summary info ========================== + XFAIL test_step.py::TestUserHandling::()::test_deletion + reason: previous test failed (test_modification) ============== 1 failed, 2 passed, 1 xfailed in 0.12 seconds =============== We'll see that ``test_deletion`` was not executed because ``test_modification`` @@ -487,9 +522,11 @@ Here is an example for making a ``db`` fixture available in a directory: # content of a/conftest.py import pytest + class DB(object): pass + @pytest.fixture(scope="session") def db(): return DB() @@ -526,50 +563,50 @@ We can run this:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 7 items - + test_step.py .Fx. [ 57%] a/test_db.py F [ 71%] a/test_db2.py F [ 85%] b/test_error.py E [100%] - + ================================== ERRORS ================================== _______________________ ERROR at setup of test_root ________________________ file $REGENDOC_TMPDIR/b/test_error.py, line 1 def test_root(db): # no db here, will error out E fixture 'db' not found - > available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_xml_property, recwarn, tmpdir, tmpdir_factory + > available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_xml_attribute, record_xml_property, recwarn, tmpdir, tmpdir_factory > use 'pytest --fixtures [testpath]' for help on them. - + $REGENDOC_TMPDIR/b/test_error.py:1 ================================= FAILURES ================================= ____________________ TestUserHandling.test_modification ____________________ - + self = - + def test_modification(self): > assert 0 E assert 0 - - test_step.py:9: AssertionError + + test_step.py:11: AssertionError _________________________________ test_a1 __________________________________ - + db = - + def test_a1(db): > assert 0, db # to show value E AssertionError: E assert 0 - + a/test_db.py:2: AssertionError _________________________________ test_a2 __________________________________ - + db = - + def test_a2(db): > assert 0, db # to show value E AssertionError: E assert 0 - + a/test_db2.py:2: AssertionError ========== 3 failed, 2 passed, 1 xfailed, 1 error in 0.12 seconds ========== @@ -598,6 +635,7 @@ case we just write some information out to a ``failures`` file: import pytest import os.path + @pytest.hookimpl(tryfirst=True, hookwrapper=True) def pytest_runtest_makereport(item, call): # execute all other hooks to obtain the report object @@ -624,6 +662,8 @@ if you then have failing tests: # content of test_module.py def test_fail1(tmpdir): assert 0 + + def test_fail2(): assert 0 @@ -634,26 +674,26 @@ and run them:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 2 items - + test_module.py FF [100%] - + ================================= FAILURES ================================= ________________________________ test_fail1 ________________________________ - + tmpdir = local('PYTEST_TMPDIR/test_fail10') - + def test_fail1(tmpdir): > assert 0 E assert 0 - + test_module.py:2: AssertionError ________________________________ test_fail2 ________________________________ - + def test_fail2(): > assert 0 E assert 0 - - test_module.py:4: AssertionError + + test_module.py:6: AssertionError ========================= 2 failed in 0.12 seconds ========================= you will have a "failures" file which contains the failing test ids:: @@ -676,6 +716,7 @@ here is a little example implemented via a local plugin: import pytest + @pytest.hookimpl(tryfirst=True, hookwrapper=True) def pytest_runtest_makereport(item, call): # execute all other hooks to obtain the report object @@ -694,10 +735,10 @@ here is a little example implemented via a local plugin: # request.node is an "item" because we use the default # "function" scope if request.node.rep_setup.failed: - print ("setting up a test failed!", request.node.nodeid) + print("setting up a test failed!", request.node.nodeid) elif request.node.rep_setup.passed: if request.node.rep_call.failed: - print ("executing test failed", request.node.nodeid) + print("executing test failed", request.node.nodeid) if you then have failing tests: @@ -708,16 +749,20 @@ if you then have failing tests: import pytest + @pytest.fixture def other(): assert 0 + def test_setup_fails(something, other): pass + def test_call_fails(something): assert 0 + def test_fail2(): assert 0 @@ -728,42 +773,44 @@ and run it:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 3 items - + test_module.py Esetting up a test failed! test_module.py::test_setup_fails Fexecuting test failed test_module.py::test_call_fails - F [100%] - + F + ================================== ERRORS ================================== ____________________ ERROR at setup of test_setup_fails ____________________ - + @pytest.fixture def other(): > assert 0 E assert 0 - - test_module.py:6: AssertionError + + test_module.py:7: AssertionError ================================= FAILURES ================================= _____________________________ test_call_fails ______________________________ - + something = None - + def test_call_fails(something): > assert 0 E assert 0 - - test_module.py:12: AssertionError + + test_module.py:15: AssertionError ________________________________ test_fail2 ________________________________ - + def test_fail2(): > assert 0 E assert 0 - - test_module.py:15: AssertionError + + test_module.py:19: AssertionError ==================== 2 failed, 1 error in 0.12 seconds ===================== You'll see that the fixture finalizers could use the precise reporting information. +.. _pytest current test env: + ``PYTEST_CURRENT_TEST`` environment variable -------------------------------------------- @@ -774,7 +821,7 @@ which test got stuck, for example if pytest was run in quiet mode (``-q``) or yo output. This is particularly a problem if the problem helps only sporadically, the famous "flaky" kind of tests. ``pytest`` sets a ``PYTEST_CURRENT_TEST`` environment variable when running tests, which can be inspected -by process monitoring utilities or libraries like `psutil `_ to discover which +by process monitoring utilities or libraries like `psutil `_ to discover which test got stuck if necessary: .. code-block:: python @@ -783,7 +830,7 @@ test got stuck if necessary: for pid in psutil.pids(): environ = psutil.Process(pid).environ() - if 'PYTEST_CURRENT_TEST' in environ: + if "PYTEST_CURRENT_TEST" in environ: print(f'pytest process {pid} running: {environ["PYTEST_CURRENT_TEST"]}') During the test session pytest will set ``PYTEST_CURRENT_TEST`` to the current test @@ -805,7 +852,7 @@ In that order. can be changed between releases (even bug fixes) so it shouldn't be relied on for scripting or automation. -Freezing pytest +Freezing pytest --------------- If you freeze your application using a tool like @@ -817,24 +864,30 @@ while also allowing you to send test files to users so they can run them in thei machines, which can be useful to obtain more information about a hard to reproduce bug. Fortunately recent ``PyInstaller`` releases already have a custom hook -for pytest, but if you are using another tool to freeze executables +for pytest, but if you are using another tool to freeze executables such as ``cx_freeze`` or ``py2exe``, you can use ``pytest.freeze_includes()`` to obtain the full list of internal pytest modules. How to configure the tools to find the internal modules varies from tool to tool, however. -Instead of freezing the pytest runner as a separate executable, you can make +Instead of freezing the pytest runner as a separate executable, you can make your frozen program work as the pytest runner by some clever -argument handling during program startup. This allows you to +argument handling during program startup. This allows you to have a single executable, which is usually more convenient. +Please note that the mechanism for plugin discovery used by pytest +(setupttools entry points) doesn't work with frozen executables so pytest +can't find any third party plugins automatically. To include third party plugins +like ``pytest-timeout`` they must be imported explicitly and passed on to pytest.main. .. code-block:: python # contents of app_main.py import sys + import pytest_timeout # Third party plugin - if len(sys.argv) > 1 and sys.argv[1] == '--pytest': + if len(sys.argv) > 1 and sys.argv[1] == "--pytest": import pytest - sys.exit(pytest.main(sys.argv[2:])) + + sys.exit(pytest.main(sys.argv[2:], plugins=[pytest_timeout])) else: # normal application execution: at this point argv can be parsed # by your argument-parsing library of choice as usual diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/special.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/special.rst index 4437e1cc30e..1fc32f6c817 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/special.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/special.rst @@ -68,5 +68,5 @@ If you run this without output capturing:: .test_method1 called .test other .test_unit1 method called - . [100%] + . 4 passed in 0.12 seconds diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/xfail_demo.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/xfail_demo.py index 5648575e878..01e6da1ad2e 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/xfail_demo.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/xfail_demo.py @@ -1,29 +1,37 @@ import pytest + xfail = pytest.mark.xfail + @xfail def test_hello(): assert 0 + @xfail(run=False) def test_hello2(): assert 0 + @xfail("hasattr(os, 'sep')") def test_hello3(): assert 0 + @xfail(reason="bug 110") def test_hello4(): assert 0 + @xfail('pytest.__version__[0] != "17"') def test_hello5(): assert 0 + def test_hello6(): pytest.xfail("reason") + @xfail(raises=IndexError) def test_hello7(): x = [] diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/faq.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/faq.rst index 27d74e1148c..5b13818ea5e 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/faq.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/faq.rst @@ -30,14 +30,14 @@ and does not handle Deferreds returned from a test in pytest style. If you are using trial's unittest.TestCase chances are that you can just run your tests even if you return Deferreds. In addition, there also is a dedicated `pytest-twisted -`_ plugin which allows you to +`_ plugin which allows you to return deferreds from pytest-style tests, allowing the use of :ref:`fixtures` and other features. how does pytest work with Django? ++++++++++++++++++++++++++++++++++++++++++++++ -In 2012, some work is going into the `pytest-django plugin `_. It substitutes the usage of Django's +In 2012, some work is going into the `pytest-django plugin `_. It substitutes the usage of Django's ``manage.py test`` and allows the use of all pytest features_ most of which are not available from Django directly. diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/fixture.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/fixture.rst index 01a941ddf65..d4d386792e0 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/fixture.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/fixture.rst @@ -73,20 +73,20 @@ marked ``smtp`` fixture function. Running the test looks like this:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 1 item - + test_smtpsimple.py F [100%] - + ================================= FAILURES ================================= ________________________________ test_ehlo _________________________________ - + smtp = - + def test_ehlo(smtp): response, msg = smtp.ehlo() assert response == 250 > assert 0 # for demo purposes E assert 0 - + test_smtpsimple.py:11: AssertionError ========================= 1 failed in 0.12 seconds ========================= @@ -111,11 +111,11 @@ with a list of available function arguments. .. note:: - You can always issue:: + You can always issue :: pytest --fixtures test_simplefactory.py - to see available fixtures. + to see available fixtures (fixtures with leading ``_`` are only shown if you add the ``-v`` option). Fixtures: a prime example of dependency injection --------------------------------------------------- @@ -141,7 +141,7 @@ automatically gets discovered by pytest. The discovery of fixture functions starts at test classes, then test modules, then ``conftest.py`` files and finally builtin and third party plugins. -You can also use the ``conftest.py`` file to implement +You can also use the ``conftest.py`` file to implement :ref:`local per-directory plugins `. Sharing test data @@ -152,9 +152,9 @@ to do this is by loading these data in a fixture for use by your tests. This makes use of the automatic caching mechanisms of pytest. Another good approach is by adding the data files in the ``tests`` folder. -There are also community plugins available to help managing this aspect of -testing, e.g. `pytest-datadir `__ -and `pytest-datafiles `__. +There are also community plugins available to help managing this aspect of +testing, e.g. `pytest-datadir `__ +and `pytest-datafiles `__. .. _smtpshared: @@ -165,14 +165,14 @@ Scope: sharing a fixture instance across tests in a class, module or session Fixtures requiring network access depend on connectivity and are usually time-expensive to create. Extending the previous example, we -can add a ``scope='module'`` parameter to the +can add a ``scope="module"`` parameter to the :py:func:`@pytest.fixture <_pytest.python.fixture>` invocation to cause the decorated ``smtp`` fixture function to only be invoked once per test *module* (the default is to invoke once per test *function*). Multiple test functions in a test module will thus each receive the same ``smtp`` fixture instance, thus saving time. -The next example puts the fixture function into a separate ``conftest.py`` file +The next example puts the fixture function into a separate ``conftest.py`` file so that tests from multiple test modules in the directory can access the fixture function:: @@ -209,32 +209,32 @@ inspect what is going on and can now run the tests:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 2 items - + test_module.py FF [100%] - + ================================= FAILURES ================================= ________________________________ test_ehlo _________________________________ - + smtp = - + def test_ehlo(smtp): response, msg = smtp.ehlo() assert response == 250 assert b"smtp.gmail.com" in msg > assert 0 # for demo purposes E assert 0 - + test_module.py:6: AssertionError ________________________________ test_noop _________________________________ - + smtp = - + def test_noop(smtp): response, msg = smtp.noop() assert response == 250 > assert 0 # for demo purposes E assert 0 - + test_module.py:11: AssertionError ========================= 2 failed in 0.12 seconds ========================= @@ -250,12 +250,61 @@ instance, you can simply declare it: .. code-block:: python @pytest.fixture(scope="session") - def smtp(...): + def smtp(): # the returned fixture value will be shared for # all tests needing it + ... Finally, the ``class`` scope will invoke the fixture once per test *class*. + +Higher-scoped fixtures are instantiated first +--------------------------------------------- + +.. versionadded:: 3.5 + +Within a function request for features, fixture of higher-scopes (such as ``session``) are instantiated first than +lower-scoped fixtures (such as ``function`` or ``class``). The relative order of fixtures of same scope follows +the declared order in the test function and honours dependencies between fixtures. + +Consider the code below: + +.. code-block:: python + + @pytest.fixture(scope="session") + def s1(): + pass + + + @pytest.fixture(scope="module") + def m1(): + pass + + + @pytest.fixture + def f1(tmpdir): + pass + + + @pytest.fixture + def f2(): + pass + + + def test_foo(f1, m1, f2, s1): + ... + + +The fixtures requested by ``test_foo`` will be instantiated in the following order: + +1. ``s1``: is the highest-scoped fixture (``session``). +2. ``m1``: is the second highest-scoped fixture (``module``). +3. ``tmpdir``: is a ``function``-scoped fixture, required by ``f1``: it needs to be instantiated at this point + because it is a dependency of ``f1``. +4. ``f1``: is the first ``function``-scoped fixture in ``test_foo`` parameter list. +5. ``f2``: is the last ``function``-scoped fixture in ``test_foo`` parameter list. + + .. _`finalization`: Fixture finalization / executing teardown code @@ -272,6 +321,7 @@ the code after the *yield* statement serves as the teardown code: import smtplib import pytest + @pytest.fixture(scope="module") def smtp(): smtp = smtplib.SMTP("smtp.gmail.com", 587, timeout=5) @@ -286,8 +336,8 @@ tests. Let's execute it:: $ pytest -s -q --tb=no - FF [100%]teardown smtp - + FFteardown smtp + 2 failed in 0.12 seconds We see that the ``smtp`` instance is finalized after the two @@ -306,6 +356,7 @@ Note that we can also seamlessly use the ``yield`` syntax with ``with`` statemen import smtplib import pytest + @pytest.fixture(scope="module") def smtp(): with smtplib.SMTP("smtp.gmail.com", 587, timeout=5) as smtp: @@ -331,12 +382,15 @@ Here's the ``smtp`` fixture changed to use ``addfinalizer`` for cleanup: import smtplib import pytest + @pytest.fixture(scope="module") def smtp(request): smtp = smtplib.SMTP("smtp.gmail.com", 587, timeout=5) + def fin(): - print ("teardown smtp") + print("teardown smtp") smtp.close() + request.addfinalizer(fin) return smtp # provide the fixture value @@ -369,7 +423,7 @@ ends, but ``addfinalizer`` has two key differences over ``yield``: Fixtures can introspect the requesting test context ------------------------------------------------------------- -Fixture function can accept the :py:class:`request ` object +Fixture functions can accept the :py:class:`request ` object to introspect the "requesting" test function, class or module context. Further extending the previous ``smtp`` fixture example, let's read an optional server URL from the test module which uses our fixture:: @@ -391,8 +445,8 @@ We use the ``request.module`` attribute to optionally obtain an again, nothing much has changed:: $ pytest -s -q --tb=no - FF [100%]finalizing (smtp.gmail.com) - + FFfinalizing (smtp.gmail.com) + 2 failed in 0.12 seconds Let's quickly create another test module that actually sets the @@ -421,6 +475,59 @@ Running it:: voila! The ``smtp`` fixture function picked up our mail server name from the module namespace. +.. _`fixture-factory`: + +Factories as fixtures +------------------------------------------------------------- + +The "factory as fixture" pattern can help in situations where the result +of a fixture is needed multiple times in a single test. Instead of returning +data directly, the fixture instead returns a function which generates the data. +This function can then be called multiple times in the test. + +Factories can have have parameters as needed:: + + @pytest.fixture + def make_customer_record(): + + def _make_customer_record(name): + return { + "name": name, + "orders": [] + } + + return _make_customer_record + + + def test_customer_records(make_customer_record): + customer_1 = make_customer_record("Lisa") + customer_2 = make_customer_record("Mike") + customer_3 = make_customer_record("Meredith") + +If the data created by the factory requires managing, the fixture can take care of that:: + + @pytest.fixture + def make_customer_record(): + + created_records = [] + + def _make_customer_record(name): + record = models.Customer(name=name, orders=[]) + created_records.append(record) + return record + + yield _make_customer_record + + for record in created_records: + record.destroy() + + + def test_customer_records(make_customer_record): + customer_1 = make_customer_record("Lisa") + customer_2 = make_customer_record("Mike") + customer_3 = make_customer_record("Meredith") + + .. _`fixture-parametrize`: Parametrizing fixtures @@ -460,51 +567,51 @@ So let's just do another run:: FFFF [100%] ================================= FAILURES ================================= ________________________ test_ehlo[smtp.gmail.com] _________________________ - + smtp = - + def test_ehlo(smtp): response, msg = smtp.ehlo() assert response == 250 assert b"smtp.gmail.com" in msg > assert 0 # for demo purposes E assert 0 - + test_module.py:6: AssertionError ________________________ test_noop[smtp.gmail.com] _________________________ - + smtp = - + def test_noop(smtp): response, msg = smtp.noop() assert response == 250 > assert 0 # for demo purposes E assert 0 - + test_module.py:11: AssertionError ________________________ test_ehlo[mail.python.org] ________________________ - + smtp = - + def test_ehlo(smtp): response, msg = smtp.ehlo() assert response == 250 > assert b"smtp.gmail.com" in msg E AssertionError: assert b'smtp.gmail.com' in b'mail.python.org\nPIPELINING\nSIZE 51200000\nETRN\nSTARTTLS\nAUTH DIGEST-MD5 NTLM CRAM-MD5\nENHANCEDSTATUSCODES\n8BITMIME\nDSN\nSMTPUTF8' - + test_module.py:5: AssertionError -------------------------- Captured stdout setup --------------------------- finalizing ________________________ test_noop[mail.python.org] ________________________ - + smtp = - + def test_noop(smtp): response, msg = smtp.noop() assert response == 250 > assert 0 # for demo purposes E assert 0 - + test_module.py:11: AssertionError ------------------------- Captured stdout teardown ------------------------- finalizing @@ -576,9 +683,43 @@ Running the above tests results in the following test IDs being used:: - + ======================= no tests ran in 0.12 seconds ======================= +.. _`fixture-parametrize-marks`: + +Using marks with parametrized fixtures +-------------------------------------- + +:func:`pytest.param` can be used to apply marks in values sets of parametrized fixtures in the same way +that they can be used with :ref:`@pytest.mark.parametrize <@pytest.mark.parametrize>`. + +Example:: + + # content of test_fixture_marks.py + import pytest + @pytest.fixture(params=[0, 1, pytest.param(2, marks=pytest.mark.skip)]) + def data_set(request): + return request.param + + def test_data(data_set): + pass + +Running this test will *skip* the invocation of ``data_set`` with value ``2``:: + + $ pytest test_fixture_marks.py -v + =========================== test session starts ============================ + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + cachedir: .pytest_cache + rootdir: $REGENDOC_TMPDIR, inifile: + collecting ... collected 3 items + + test_fixture_marks.py::test_data[0] PASSED [ 33%] + test_fixture_marks.py::test_data[1] PASSED [ 66%] + test_fixture_marks.py::test_data[2] SKIPPED [100%] + + =================== 2 passed, 1 skipped in 0.12 seconds ==================== + .. _`interdependent fixtures`: Modularity: using fixtures from a fixture function @@ -612,13 +753,13 @@ Here we declare an ``app`` fixture which receives the previously defined $ pytest -v test_appsetup.py =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 2 items - + test_appsetup.py::test_smtp_exists[smtp.gmail.com] PASSED [ 50%] test_appsetup.py::test_smtp_exists[mail.python.org] PASSED [100%] - + ========================= 2 passed in 0.12 seconds ========================= Due to the parametrization of ``smtp`` the test will run twice with two @@ -681,43 +822,43 @@ Let's run the tests in verbose mode and with looking at the print-output:: $ pytest -v -s test_module.py =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 8 items - + test_module.py::test_0[1] SETUP otherarg 1 RUN test0 with otherarg 1 - PASSED [ 12%] TEARDOWN otherarg 1 - + PASSED TEARDOWN otherarg 1 + test_module.py::test_0[2] SETUP otherarg 2 RUN test0 with otherarg 2 - PASSED [ 25%] TEARDOWN otherarg 2 - + PASSED TEARDOWN otherarg 2 + test_module.py::test_1[mod1] SETUP modarg mod1 RUN test1 with modarg mod1 - PASSED [ 37%] - test_module.py::test_2[1-mod1] SETUP otherarg 1 + PASSED + test_module.py::test_2[mod1-1] SETUP otherarg 1 RUN test2 with otherarg 1 and modarg mod1 - PASSED [ 50%] TEARDOWN otherarg 1 - - test_module.py::test_2[2-mod1] SETUP otherarg 2 + PASSED TEARDOWN otherarg 1 + + test_module.py::test_2[mod1-2] SETUP otherarg 2 RUN test2 with otherarg 2 and modarg mod1 - PASSED [ 62%] TEARDOWN otherarg 2 - + PASSED TEARDOWN otherarg 2 + test_module.py::test_1[mod2] TEARDOWN modarg mod1 SETUP modarg mod2 RUN test1 with modarg mod2 - PASSED [ 75%] - test_module.py::test_2[1-mod2] SETUP otherarg 1 + PASSED + test_module.py::test_2[mod2-1] SETUP otherarg 1 RUN test2 with otherarg 1 and modarg mod2 - PASSED [ 87%] TEARDOWN otherarg 1 - - test_module.py::test_2[2-mod2] SETUP otherarg 2 + PASSED TEARDOWN otherarg 1 + + test_module.py::test_2[mod2-2] SETUP otherarg 2 RUN test2 with otherarg 2 and modarg mod2 - PASSED [100%] TEARDOWN otherarg 2 + PASSED TEARDOWN otherarg 2 TEARDOWN modarg mod2 - - + + ========================= 8 passed in 0.12 seconds ========================= You can see that the parametrized module-scoped ``modarg`` resource caused an @@ -789,6 +930,8 @@ You can specify multiple fixtures like this: .. code-block:: python @pytest.mark.usefixtures("cleandir", "anotherfixture") + def test(): + ... and you may specify fixture usage at the test module level, using a generic feature of the mark mechanism: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/funcarg_compare.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/funcarg_compare.rst index b857a014d31..c29ba1f3c35 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/funcarg_compare.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/funcarg_compare.rst @@ -5,9 +5,9 @@ pytest-2.3: reasoning for fixture/funcarg evolution ============================================================= -**Target audience**: Reading this document requires basic knowledge of -python testing, xUnit setup methods and the (previous) basic pytest -funcarg mechanism, see http://pytest.org/2.2.4/funcargs.html +**Target audience**: Reading this document requires basic knowledge of +python testing, xUnit setup methods and the (previous) basic pytest +funcarg mechanism, see http://pytest.org/2.2.4/funcargs.html If you are new to pytest, then you can simply ignore this section and read the other sections. @@ -18,12 +18,12 @@ Shortcomings of the previous ``pytest_funcarg__`` mechanism The pre pytest-2.3 funcarg mechanism calls a factory each time a funcarg for a test function is required. If a factory wants to -re-use a resource across different scopes, it often used -the ``request.cached_setup()`` helper to manage caching of -resources. Here is a basic example how we could implement +re-use a resource across different scopes, it often used +the ``request.cached_setup()`` helper to manage caching of +resources. Here is a basic example how we could implement a per-session Database object:: - # content of conftest.py + # content of conftest.py class Database(object): def __init__(self): print ("database instance created") @@ -31,7 +31,7 @@ a per-session Database object:: print ("database instance destroyed") def pytest_funcarg__db(request): - return request.cached_setup(setup=DataBase, + return request.cached_setup(setup=DataBase, teardown=lambda db: db.destroy, scope="session") @@ -40,13 +40,13 @@ There are several limitations and difficulties with this approach: 1. Scoping funcarg resource creation is not straight forward, instead one must understand the intricate cached_setup() method mechanics. -2. parametrizing the "db" resource is not straight forward: +2. parametrizing the "db" resource is not straight forward: you need to apply a "parametrize" decorator or implement a - :py:func:`~hookspec.pytest_generate_tests` hook + :py:func:`~hookspec.pytest_generate_tests` hook calling :py:func:`~python.Metafunc.parametrize` which - performs parametrization at the places where the resource - is used. Moreover, you need to modify the factory to use an - ``extrakey`` parameter containing ``request.param`` to the + performs parametrization at the places where the resource + is used. Moreover, you need to modify the factory to use an + ``extrakey`` parameter containing ``request.param`` to the :py:func:`~python.Request.cached_setup` call. 3. Multiple parametrized session-scoped resources will be active @@ -56,7 +56,7 @@ There are several limitations and difficulties with this approach: 4. there is no way how you can make use of funcarg factories in xUnit setup methods. -5. A non-parametrized fixture function cannot use a parametrized +5. A non-parametrized fixture function cannot use a parametrized funcarg resource if it isn't stated in the test function signature. All of these limitations are addressed with pytest-2.3 and its @@ -72,18 +72,18 @@ the scope:: @pytest.fixture(scope="session") def db(request): - # factory will only be invoked once per session - + # factory will only be invoked once per session - db = DataBase() request.addfinalizer(db.destroy) # destroy when session is finished return db This factory implementation does not need to call ``cached_setup()`` anymore -because it will only be invoked once per session. Moreover, the +because it will only be invoked once per session. Moreover, the ``request.addfinalizer()`` registers a finalizer according to the specified resource scope on which the factory function is operating. -Direct parametrization of funcarg resource factories +Direct parametrization of funcarg resource factories ---------------------------------------------------------- Previously, funcarg factories could not directly cause parametrization. @@ -96,9 +96,9 @@ sets. pytest-2.3 introduces a decorator for use on the factory itself:: def db(request): ... # use request.param -Here the factory will be invoked twice (with the respective "mysql" -and "pg" values set as ``request.param`` attributes) and all of -the tests requiring "db" will run twice as well. The "mysql" and +Here the factory will be invoked twice (with the respective "mysql" +and "pg" values set as ``request.param`` attributes) and all of +the tests requiring "db" will run twice as well. The "mysql" and "pg" values will also be used for reporting the test-invocation variants. This new way of parametrizing funcarg factories should in many cases @@ -136,7 +136,7 @@ argument:: The name under which the funcarg resource can be requested is ``db``. -You can still use the "old" non-decorator way of specifying funcarg factories +You can still use the "old" non-decorator way of specifying funcarg factories aka:: def pytest_funcarg__db(request): @@ -156,10 +156,10 @@ several problems: 1. in distributed testing the master process would setup test resources that are never needed because it only co-ordinates the test run - activities of the slave processes. + activities of the slave processes. -2. if you only perform a collection (with "--collect-only") - resource-setup will still be executed. +2. if you only perform a collection (with "--collect-only") + resource-setup will still be executed. 3. If a pytest_sessionstart is contained in some subdirectories conftest.py file, it will not be called. This stems from the @@ -194,17 +194,17 @@ overview of fixture management in your project. Conclusion and compatibility notes --------------------------------------------------------- -**funcargs** were originally introduced to pytest-2.0. In pytest-2.3 +**funcargs** were originally introduced to pytest-2.0. In pytest-2.3 the mechanism was extended and refined and is now described as fixtures: -* previously funcarg factories were specified with a special - ``pytest_funcarg__NAME`` prefix instead of using the +* previously funcarg factories were specified with a special + ``pytest_funcarg__NAME`` prefix instead of using the ``@pytest.fixture`` decorator. * Factories received a ``request`` object which managed caching through - ``request.cached_setup()`` calls and allowed using other funcargs via - ``request.getfuncargvalue()`` calls. These intricate APIs made it hard + ``request.cached_setup()`` calls and allowed using other funcargs via + ``request.getfuncargvalue()`` calls. These intricate APIs made it hard to do proper parametrization and implement resource caching. The new :py:func:`pytest.fixture` decorator allows to declare the scope and let pytest figure things out for you. @@ -212,7 +212,5 @@ fixtures: * if you used parametrization and funcarg factories which made use of ``request.cached_setup()`` it is recommended to invest a few minutes and simplify your fixture function code to use the :ref:`@pytest.fixture` - decorator instead. This will also allow to take advantage of + decorator instead. This will also allow to take advantage of the automatic per-resource grouping of tests. - - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/funcargs.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/funcargs.rst index bc2c0430239..4173675cddf 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/funcargs.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/funcargs.rst @@ -11,4 +11,3 @@ and you can read on here: - :ref:`fixtures` - :ref:`parametrize` - :ref:`funcargcompare` - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/genapi.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/genapi.py deleted file mode 100644 index 0ede44fa2de..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/genapi.py +++ /dev/null @@ -1,41 +0,0 @@ -import textwrap -import inspect - -class Writer(object): - def __init__(self, clsname): - self.clsname = clsname - - def __enter__(self): - self.file = open("%s.api" % self.clsname, "w") - return self - - def __exit__(self, *args): - self.file.close() - print "wrote", self.file.name - - def line(self, line): - self.file.write(line+"\n") - - def docmethod(self, method): - doc = " ".join(method.__doc__.split()) - indent = " " - w = textwrap.TextWrapper(initial_indent=indent, - subsequent_indent=indent) - - spec = inspect.getargspec(method) - del spec.args[0] - self.line(".. py:method:: " + method.__name__ + - inspect.formatargspec(*spec)) - self.line("") - self.line(w.fill(doc)) - self.line("") - -def pytest_funcarg__a(request): - with Writer("request") as writer: - writer.docmethod(request.getfixturevalue) - writer.docmethod(request.cached_setup) - writer.docmethod(request.addfinalizer) - writer.docmethod(request.applymarker) - -def test_hello(a): - pass diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/getting-started.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/getting-started.rst index 64b0108262d..f2dbec5e932 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/getting-started.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/getting-started.rst @@ -5,34 +5,36 @@ Installation and Getting Started **Platforms**: Unix/Posix and Windows -**PyPI package name**: `pytest `_ +**PyPI package name**: `pytest `_ -**dependencies**: `py `_, -`colorama (Windows) `_, +**Dependencies**: `py `_, +`colorama (Windows) `_, -**documentation as PDF**: `download latest `_ +**Documentation as PDF**: `download latest `_ + +``pytest`` is a framework that makes building simple and scalable tests easy. Tests are expressive and readable—no boilerplate code required. Get started in minutes with a small unit test or complex functional test for your application or library. .. _`getstarted`: -.. _installation: +.. _`installation`: -Installation +Install ``pytest`` ---------------------------------------- -Installation:: +1. Run the following command in your command line:: pip install -U pytest -To check your installation has installed the correct version:: +2. Check that you installed the correct version:: $ pytest --version This is pytest version 3.x.y, imported from $PYTHON_PREFIX/lib/python3.5/site-packages/pytest.py .. _`simpletest`: -Our first test run +Create your first test ---------------------------------------------------------- -Let's create a first test file with a simple test function:: +Create a simple test function with just four lines of code:: # content of test_sample.py def func(x): @@ -41,51 +43,43 @@ Let's create a first test file with a simple test function:: def test_answer(): assert func(3) == 5 -That's it. You can execute the test function now:: +That’s it. You can now execute the test function:: $ pytest =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 1 item - + test_sample.py F [100%] - + ================================= FAILURES ================================= _______________________________ test_answer ________________________________ - + def test_answer(): > assert func(3) == 5 E assert 4 == 5 E + where 4 = func(3) - + test_sample.py:5: AssertionError ========================= 1 failed in 0.12 seconds ========================= -We got a failure report because our little ``func(3)`` call did not return ``5``. +This test returns a failure report because ``func(3)`` does not return ``5``. .. note:: - You can simply use the ``assert`` statement for asserting test - expectations. pytest's :ref:`assert introspection` will intelligently - report intermediate values of the assert expression freeing - you from the need to learn the many names of `JUnit legacy methods`_. + You can use the ``assert`` statement to verify test expectations. pytest’s `Advanced assertion introspection `_ will intelligently report intermediate values of the assert expression so you can avoid the many names `of JUnit legacy methods `_. -.. _`JUnit legacy methods`: http://docs.python.org/library/unittest.html#test-cases - -.. _`assert statement`: http://docs.python.org/reference/simple_stmts.html#the-assert-statement - -Running multiple tests +Run multiple tests ---------------------------------------------------------- -``pytest`` will run all files in the current directory and its subdirectories of the form test_*.py or \*_test.py. More generally, it follows :ref:`standard test discovery rules `. +``pytest`` will run all files of the form test_*.py or \*_test.py in the current directory and its subdirectories. More generally, it follows :ref:`standard test discovery rules `. -Asserting that a certain exception is raised +Assert that a certain exception is raised -------------------------------------------------------------- -If you want to assert that some code raises an exception you can -use the ``raises`` helper:: +Use the ``raises`` helper to assert that some code raises an exception:: # content of test_sysexit.py import pytest @@ -96,18 +90,16 @@ use the ``raises`` helper:: with pytest.raises(SystemExit): f() -Running it with, this time in "quiet" reporting mode:: +Execute the test function with “quiet” reporting mode:: $ pytest -q test_sysexit.py . [100%] 1 passed in 0.12 seconds -Grouping multiple tests in a class +Group multiple tests in a class -------------------------------------------------------------- -Once you start to have more than a few tests it often makes sense -to group tests logically, in classes and modules. Let's write a class -containing two tests:: +Once you develop multiple tests, you may want to group them into a class. pytest makes it easy to create a class containing more than one test:: # content of test_class.py class TestClass(object): @@ -119,80 +111,73 @@ containing two tests:: x = "hello" assert hasattr(x, 'check') -The two tests are found because of the standard :ref:`test discovery`. -There is no need to subclass anything. We can simply -run the module by passing its filename:: +``pytest`` discovers all tests following its :ref:`Conventions for Python test discovery `, so it finds both ``test_`` prefixed functions. There is no need to subclass anything. We can simply run the module by passing its filename:: $ pytest -q test_class.py .F [100%] ================================= FAILURES ================================= ____________________________ TestClass.test_two ____________________________ - + self = - + def test_two(self): x = "hello" > assert hasattr(x, 'check') E AssertionError: assert False E + where False = hasattr('hello', 'check') - + test_class.py:8: AssertionError 1 failed, 1 passed in 0.12 seconds -The first test passed, the second failed. Again we can easily see -the intermediate values used in the assertion, helping us to -understand the reason for the failure. +The first test passed and the second failed. You can easily see the intermediate values in the assertion to help you understand the reason for the failure. -Going functional: requesting a unique temporary directory +Request a unique temporary directory for functional tests -------------------------------------------------------------- -For functional tests one often needs to create some files -and pass them to application objects. pytest provides -:ref:`builtinfixtures` which allow to request arbitrary -resources, for example a unique temporary directory:: +``pytest`` provides `Builtin fixtures/function arguments `_ to request arbitrary resources, like a unique temporary directory:: # content of test_tmpdir.py def test_needsfiles(tmpdir): print (tmpdir) assert 0 -We list the name ``tmpdir`` in the test function signature and -``pytest`` will lookup and call a fixture factory to create the resource -before performing the test function call. Let's just run it:: +List the name ``tmpdir`` in the test function signature and ``pytest`` will lookup and call a fixture factory to create the resource before performing the test function call. Before the test runs, ``pytest`` creates a unique-per-test-invocation temporary directory:: $ pytest -q test_tmpdir.py F [100%] ================================= FAILURES ================================= _____________________________ test_needsfiles ______________________________ - + tmpdir = local('PYTEST_TMPDIR/test_needsfiles0') - + def test_needsfiles(tmpdir): print (tmpdir) > assert 0 E assert 0 - + test_tmpdir.py:3: AssertionError --------------------------- Captured stdout call --------------------------- PYTEST_TMPDIR/test_needsfiles0 1 failed in 0.12 seconds -Before the test runs, a unique-per-test-invocation temporary directory -was created. More info at :ref:`tmpdir handling`. +More info on tmpdir handling is available at :ref:`Temporary directories and files `. -You can find out what kind of builtin :ref:`fixtures` exist by typing:: +Find out what kind of builtin :ref:`pytest fixtures ` exist with the command:: pytest --fixtures # shows builtin and custom fixtures -Where to go next +Note that this command omits fixtures with leading ``_`` unless the ``-v`` option is added. + +Continue reading ------------------------------------- -Here are a few suggestions where to go next: +Check out additional pytest resources to help you customize tests for your unique workflow: -* :ref:`cmdline` for command line invocation examples -* :ref:`good practices ` for virtualenv, test layout -* :ref:`existingtestsuite` for working with pre-existing tests -* :ref:`fixtures` for providing a functional baseline to your tests -* :ref:`plugins` managing and writing plugins +* ":ref:`cmdline`" for command line invocation examples +* ":ref:`existingtestsuite`" for working with pre-existing tests +* ":ref:`mark`" for information on the ``pytest.mark`` mechanism +* ":ref:`fixtures`" for providing a functional baseline to your tests +* ":ref:`plugins`" for managing and writing plugins +* ":ref:`goodpractices`" for virtualenv and test layouts .. include:: links.inc diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/goodpractices.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/goodpractices.rst index 16fdd24c392..2bbd9d0ae58 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/goodpractices.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/goodpractices.rst @@ -145,7 +145,7 @@ Note that this layout also works in conjunction with the ``src`` layout mentione .. note:: - If ``pytest`` finds a "a/b/test_module.py" test file while + If ``pytest`` finds an "a/b/test_module.py" test file while recursing into the filesystem it determines the import name as follows: @@ -168,13 +168,13 @@ Note that this layout also works in conjunction with the ``src`` layout mentione to avoid surprises such as a test module getting imported twice. -.. _`virtualenv`: http://pypi.python.org/pypi/virtualenv +.. _`virtualenv`: https://pypi.org/project/virtualenv/ .. _`buildout`: http://www.buildout.org/ -.. _pip: http://pypi.python.org/pypi/pip +.. _pip: https://pypi.org/project/pip/ .. _`use tox`: -Tox +tox ------ For development, we recommend to use virtualenv_ environments and pip_ @@ -194,7 +194,7 @@ Once you are done with your work and want to make sure that your actual package passes all tests you may want to look into `tox`_, the virtualenv test automation tool and its `pytest support `_. -Tox helps you to setup virtualenv environments with pre-defined +tox helps you to setup virtualenv environments with pre-defined dependencies and then executing a pre-configured test command with options. It will run tests against the installed package and not against your source code checkout, helping to detect packaging @@ -205,7 +205,7 @@ Integrating with setuptools / ``python setup.py test`` / ``pytest-runner`` -------------------------------------------------------------------------- You can integrate test runs into your setuptools based project -with the `pytest-runner `_ plugin. +with the `pytest-runner `_ plugin. Add this to ``setup.py`` file: @@ -214,10 +214,10 @@ Add this to ``setup.py`` file: from setuptools import setup setup( - #..., - setup_requires=['pytest-runner', ...], - tests_require=['pytest', ...], - #..., + # ..., + setup_requires=["pytest-runner", ...], + tests_require=["pytest", ...], + # ..., ) @@ -263,25 +263,27 @@ your own setuptools Test command for invoking pytest. class PyTest(TestCommand): - user_options = [('pytest-args=', 'a', "Arguments to pass to pytest")] + user_options = [("pytest-args=", "a", "Arguments to pass to pytest")] def initialize_options(self): TestCommand.initialize_options(self) - self.pytest_args = '' + self.pytest_args = "" def run_tests(self): import shlex - #import here, cause outside the eggs aren't loaded + + # import here, cause outside the eggs aren't loaded import pytest + errno = pytest.main(shlex.split(self.pytest_args)) sys.exit(errno) setup( - #..., - tests_require=['pytest'], - cmdclass = {'test': PyTest}, - ) + # ..., + tests_require=["pytest"], + cmdclass={"test": PyTest}, + ) Now if you run:: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/index.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/index.rst index 66c59f08d34..6a382e57173 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/index.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/index.rst @@ -17,6 +17,7 @@ An example of a simple test: def inc(x): return x + 1 + def test_answer(): assert inc(3) == 5 @@ -28,18 +29,18 @@ To execute it:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 1 item - + test_sample.py F [100%] - + ================================= FAILURES ================================= _______________________________ test_answer ________________________________ - + def test_answer(): > assert inc(3) == 5 E assert 4 == 5 E + where 4 = inc(3) - - test_sample.py:5: AssertionError + + test_sample.py:6: AssertionError ========================= 1 failed in 0.12 seconds ========================= Due to ``pytest``'s detailed assertion introspection, only plain ``assert`` statements are used. diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/links.inc b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/links.inc index b69390baa84..4d5a4b1eebf 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/links.inc +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/links.inc @@ -7,14 +7,14 @@ .. _`reStructured Text`: http://docutils.sourceforge.net .. _`Python debugger`: http://docs.python.org/lib/module-pdb.html .. _nose: https://nose.readthedocs.io/en/latest/ -.. _pytest: http://pypi.python.org/pypi/pytest +.. _pytest: https://pypi.org/project/pytest/ .. _mercurial: http://mercurial.selenic.com/wiki/ -.. _`setuptools`: http://pypi.python.org/pypi/setuptools +.. _`setuptools`: https://pypi.org/project/setuptools/ .. _`easy_install`: .. _`distribute docs`: -.. _`distribute`: http://pypi.python.org/pypi/distribute -.. _`pip`: http://pypi.python.org/pypi/pip -.. _`virtualenv`: http://pypi.python.org/pypi/virtualenv +.. _`distribute`: https://pypi.org/project/distribute/ +.. _`pip`: https://pypi.org/project/pip/ +.. _`virtualenv`: https://pypi.org/project/virtualenv/ .. _hudson: http://hudson-ci.org/ .. _jenkins: http://jenkins-ci.org/ .. _tox: http://testrun.org/tox diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/logging.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/logging.rst index e3bf5603887..00829c15eef 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/logging.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/logging.rst @@ -3,24 +3,11 @@ Logging ------- -.. versionadded 3.3.0 +.. versionadded:: 3.3 +.. versionchanged:: 3.4 -.. note:: - - This feature is a drop-in replacement for the `pytest-catchlog - `_ plugin and they will conflict - with each other. The backward compatibility API with ``pytest-capturelog`` - has been dropped when this feature was introduced, so if for that reason you - still need ``pytest-catchlog`` you can disable the internal feature by - adding to your ``pytest.ini``: - - .. code-block:: ini - - [pytest] - addopts=-p no:logging - -Log messages are captured by default and for each failed test will be shown in -the same manner as captured stdout and stderr. +pytest captures log messages of level ``WARNING`` or above automatically and displays them in their own section +for each failed test in the same manner as captured stdout and stderr. Running without options:: @@ -29,7 +16,7 @@ Running without options:: Shows failed tests like so:: ----------------------- Captured stdlog call ---------------------- - test_reporting.py 26 INFO text going to logger + test_reporting.py 26 WARNING text going to logger ----------------------- Captured stdout call ---------------------- text going to stdout ----------------------- Captured stderr call ---------------------- @@ -37,11 +24,10 @@ Shows failed tests like so:: ==================== 2 failed in 0.02 seconds ===================== By default each captured log message shows the module, line number, log level -and message. Showing the exact module and line number is useful for testing and -debugging. If desired the log format and date format can be specified to -anything that the logging module supports. +and message. -Running pytest specifying formatting options:: +If desired the log and date format can be specified to +anything that the logging module supports by passing specific formatting options:: pytest --log-format="%(asctime)s %(levelname)s %(message)s" \ --log-date-format="%Y-%m-%d %H:%M:%S" @@ -49,14 +35,14 @@ Running pytest specifying formatting options:: Shows failed tests like so:: ----------------------- Captured stdlog call ---------------------- - 2010-04-10 14:48:44 INFO text going to logger + 2010-04-10 14:48:44 WARNING text going to logger ----------------------- Captured stdout call ---------------------- text going to stdout ----------------------- Captured stderr call ---------------------- text going to stderr ==================== 2 failed in 0.02 seconds ===================== -These options can also be customized through a configuration file: +These options can also be customized through ``pytest.ini`` file: .. code-block:: ini @@ -64,26 +50,14 @@ These options can also be customized through a configuration file: log_format = %(asctime)s %(levelname)s %(message)s log_date_format = %Y-%m-%d %H:%M:%S -Further it is possible to disable reporting logs on failed tests completely -with:: +Further it is possible to disable reporting of captured content (stdout, +stderr and logs) on failed tests completely with:: - pytest --no-print-logs - -Or in you ``pytest.ini``: - -.. code-block:: ini - - [pytest] - log_print = False + pytest --show-capture=no -Shows failed tests in the normal manner as no logs were captured:: - - ----------------------- Captured stdout call ---------------------- - text going to stdout - ----------------------- Captured stderr call ---------------------- - text going to stderr - ==================== 2 failed in 0.02 seconds ===================== +caplog fixture +^^^^^^^^^^^^^^ Inside tests it is possible to change the log level for the captured log messages. This is supported by the ``caplog`` fixture:: @@ -92,7 +66,7 @@ messages. This is supported by the ``caplog`` fixture:: caplog.set_level(logging.INFO) pass -By default the level is set on the handler used to catch the log messages, +By default the level is set on the root logger, however as a convenience it is also possible to set the log level of any logger:: @@ -100,14 +74,16 @@ logger:: caplog.set_level(logging.CRITICAL, logger='root.baz') pass +The log levels set are restored automatically at the end of the test. + It is also possible to use a context manager to temporarily change the log -level:: +level inside a ``with`` block:: def test_bar(caplog): with caplog.at_level(logging.INFO): pass -Again, by default the level of the handler is affected but the level of any +Again, by default the level of the root logger is affected but the level of any logger can be changed instead with:: def test_bar(caplog): @@ -115,7 +91,7 @@ logger can be changed instead with:: pass Lastly all the logs sent to the logger during the test run are made available on -the fixture in the form of both the LogRecord instances and the final log text. +the fixture in the form of both the ``logging.LogRecord`` instances and the final log text. This is useful for when you want to assert on the contents of a message:: def test_baz(caplog): @@ -146,12 +122,43 @@ You can call ``caplog.clear()`` to reset the captured log records in a test:: your_test_method() assert ['Foo'] == [rec.message for rec in caplog.records] + +The ``caplog.records`` attribute contains records from the current stage only, so +inside the ``setup`` phase it contains only setup logs, same with the ``call`` and +``teardown`` phases. + +To access logs from other stages, use the ``caplog.get_records(when)`` method. As an example, +if you want to make sure that tests which use a certain fixture never log any warnings, you can inspect +the records for the ``setup`` and ``call`` stages during teardown like so: + +.. code-block:: python + + + @pytest.fixture + def window(caplog): + window = create_window() + yield window + for when in ("setup", "call"): + messages = [ + x.message for x in caplog.get_records(when) if x.level == logging.WARNING + ] + if messages: + pytest.fail( + "warning messages encountered during testing: {}".format(messages) + ) + + + +The full API is available at :class:`_pytest.logging.LogCaptureFixture`. + + +.. _live_logs: + Live Logs ^^^^^^^^^ -By default, pytest will output any logging records with a level higher or -equal to WARNING. In order to actually see these logs in the console you have to -disable pytest output capture by passing ``-s``. +By setting the :confval:`log_cli` configuration option to ``true``, pytest will output +logging records as they are emitted directly into the console. You can specify the logging level for which log records with equal or higher level are printed to the console by passing ``--log-cli-level``. This setting @@ -190,3 +197,49 @@ option names are: * ``log_file_level`` * ``log_file_format`` * ``log_file_date_format`` + +.. _log_release_notes: + +Release notes +^^^^^^^^^^^^^ + +This feature was introduced as a drop-in replacement for the `pytest-catchlog +`_ plugin and they conflict +with each other. The backward compatibility API with ``pytest-capturelog`` +has been dropped when this feature was introduced, so if for that reason you +still need ``pytest-catchlog`` you can disable the internal feature by +adding to your ``pytest.ini``: + +.. code-block:: ini + + [pytest] + addopts=-p no:logging + + +.. _log_changes_3_4: + +Incompatible changes in pytest 3.4 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This feature was introduced in ``3.3`` and some **incompatible changes** have been +made in ``3.4`` after community feedback: + +* Log levels are no longer changed unless explicitly requested by the :confval:`log_level` configuration + or ``--log-level`` command-line options. This allows users to configure logger objects themselves. +* :ref:`Live Logs ` is now disabled by default and can be enabled setting the + :confval:`log_cli` configuration option to ``true``. When enabled, the verbosity is increased so logging for each + test is visible. +* :ref:`Live Logs ` are now sent to ``sys.stdout`` and no longer require the ``-s`` command-line option + to work. + +If you want to partially restore the logging behavior of version ``3.3``, you can add this options to your ``ini`` +file: + +.. code-block:: ini + + [pytest] + log_cli=true + log_level=NOTSET + +More details about the discussion that lead to this changes can be read in +issue `#3013 `_. diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/mark.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/mark.rst index 0b0e072a09b..aa1210bb6b5 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/mark.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/mark.rst @@ -4,7 +4,6 @@ Marking test functions with attributes ================================================================= -.. currentmodule:: _pytest.mark By using the ``pytest.mark`` helper you can easily set metadata on your test functions. There are @@ -27,15 +26,134 @@ which also serve as documentation. :ref:`fixtures `. -API reference for mark related objects ------------------------------------------------- +Raising errors on unknown marks: --strict +----------------------------------------- -.. autoclass:: MarkGenerator - :members: +When the ``--strict`` command-line flag is passed, any marks not registered in the ``pytest.ini`` file will trigger an error. -.. autoclass:: MarkDecorator - :members: +Marks can be registered like this: -.. autoclass:: MarkInfo - :members: +.. code-block:: ini + [pytest] + markers = + slow + serial + +This can be used to prevent users mistyping mark names by accident. Test suites that want to enforce this +should add ``--strict`` to ``addopts``: + +.. code-block:: ini + + [pytest] + addopts = --strict + markers = + slow + serial + + +.. `marker-iteration` + +Marker revamp and iteration +--------------------------- + +.. versionadded:: 3.6 + +pytest's marker implementation traditionally worked by simply updating the ``__dict__`` attribute of functions to add markers, in a cumulative manner. As a result of the this, markers would unintendely be passed along class hierarchies in surprising ways plus the API for retriving them was inconsistent, as markers from parameterization would be stored differently than markers applied using the ``@pytest.mark`` decorator and markers added via ``node.add_marker``. + +This state of things made it technically next to impossible to use data from markers correctly without having a deep understanding of the internals, leading to subtle and hard to understand bugs in more advanced usages. + +Depending on how a marker got declared/changed one would get either a ``MarkerInfo`` which might contain markers from sibling classes, +``MarkDecorators`` when marks came from parameterization or from a ``node.add_marker`` call, discarding prior marks. Also ``MarkerInfo`` acts like a single mark, when it in fact represents a merged view on multiple marks with the same name. + +On top of that markers where not accessible the same way for modules, classes, and functions/methods, +in fact, markers where only accessible in functions, even if they where declared on classes/modules. + +A new API to access markers has been introduced in pytest 3.6 in order to solve the problems with the initial design, providing :func:`_pytest.nodes.Node.iter_markers` method to iterate over markers in a consistent manner and reworking the internals, which solved great deal of problems with the initial design. + + +.. _update marker code: + +Updating code +~~~~~~~~~~~~~ + +The old ``Node.get_marker(name)`` function is considered deprecated because it returns an internal ``MarkerInfo`` object +which contains the merged name, ``*args`` and ``**kwargs`` of all the markers which apply to that node. + +In general there are two scenarios on how markers should be handled: + +1. Marks overwrite each other. Order matters but you only want to think of your mark as a single item. E.g. +``log_level('info')`` at a module level can be overwritten by ``log_level('debug')`` for a specific test. + + In this case replace use ``Node.get_closest_marker(name)``: + + .. code-block:: python + + # replace this: + marker = item.get_marker("log_level") + if marker: + level = marker.args[0] + + # by this: + marker = item.get_closest_marker("log_level") + if marker: + level = marker.args[0] + +2. Marks compose additive. E.g. ``skipif(condition)`` marks means you just want to evaluate all of them, +order doesn't even matter. You probably want to think of your marks as a set here. + + In this case iterate over each mark and handle their ``*args`` and ``**kwargs`` individually. + + .. code-block:: python + + # replace this + skipif = item.get_marker("skipif") + if skipif: + for condition in skipif.args: + # eval condition + ... + + # by this: + for skipif in item.iter_markers("skipif"): + condition = skipif.args[0] + # eval condition + + +If you are unsure or have any questions, please consider opening +`an issue `_. + +Related issues +~~~~~~~~~~~~~~ + +Here is a non-exhaustive list of issues fixed by the new implementation: + +* Marks don't pick up nested classes (`#199 `_). + +* markers stains on all related classes (`#568 `_). + +* combining marks - args and kwargs calculation (`#2897 `_). + +* ``request.node.get_marker('name')`` returns ``None`` for markers applied in classes (`#902 `_). + +* marks applied in parametrize are stored as markdecorator (`#2400 `_). + +* fix marker interaction in a backward incompatible way (`#1670 `_). + +* Refactor marks to get rid of the current "marks transfer" mechanism (`#2363 `_). + +* Introduce FunctionDefinition node, use it in generate_tests (`#2522 `_). + +* remove named marker attributes and collect markers in items (`#891 `_). + +* skipif mark from parametrize hides module level skipif mark (`#1540 `_). + +* skipif + parametrize not skipping tests (`#1296 `_). + +* marker transfer incompatible with inheritance (`#535 `_). + +More details can be found in the `original PR `_. + +.. note:: + + in a future major relase of pytest we will introduce class based markers, + at which points markers will no longer be limited to instances of :py:class:`Mark` diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/monkeypatch.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/monkeypatch.rst index 0c07b2f44fc..1a69c3a429d 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/monkeypatch.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/monkeypatch.rst @@ -35,7 +35,7 @@ patch this function before calling into a function which uses it:: assert x == '/abc/.ssh' Here our test function monkeypatches ``os.path.expanduser`` and -then calls into a function that calls it. After the test function +then calls into a function that calls it. After the test function finishes the ``os.path.expanduser`` modification will be undone. example: preventing "requests" from remote operations @@ -51,25 +51,39 @@ requests in all your tests, you can do:: monkeypatch.delattr("requests.sessions.Session.request") This autouse fixture will be executed for each test function and it -will delete the method ``request.session.Session.request`` +will delete the method ``request.session.Session.request`` so that any attempts within tests to create http requests will fail. .. note:: - + Be advised that it is not recommended to patch builtin functions such as ``open``, ``compile``, etc., because it might break pytest's internals. If that's - unavoidable, passing ``--tb=native``, ``--assert=plain`` and ``--capture=no`` might + unavoidable, passing ``--tb=native``, ``--assert=plain`` and ``--capture=no`` might help although there's no guarantee. - -Method reference of the monkeypatch fixture -------------------------------------------- +.. note:: -.. autoclass:: MonkeyPatch - :members: + Mind that patching ``stdlib`` functions and some third-party libraries used by pytest + might break pytest itself, therefore in those cases it is recommended to use + :meth:`MonkeyPatch.context` to limit the patching to the block you want tested: -``monkeypatch.setattr/delattr/delitem/delenv()`` all -by default raise an Exception if the target does not exist. -Pass ``raising=False`` if you want to skip this check. + .. code-block:: python + import functools + + + def test_partial(monkeypatch): + with monkeypatch.context() as m: + m.setattr(functools, "partial", 3) + assert functools.partial == 3 + + See issue `#3290 `_ for details. + + +.. currentmodule:: _pytest.monkeypatch + +API Reference +------------- + +Consult the docs for the :class:`MonkeyPatch` class. diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/nose.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/nose.rst index 10a10633ab0..1f7b7b63844 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/nose.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/nose.rst @@ -58,7 +58,7 @@ Unsupported idioms / known issues You may find yourself wanting to do this if you ran ``python setup.py install`` to set up your project, as opposed to ``python setup.py develop`` or any of the package manager equivalents. Installing with develop in a - virtual environment like Tox is recommended over this pattern. + virtual environment like tox is recommended over this pattern. - nose-style doctests are not collected and executed correctly, also doctest fixtures don't work. @@ -70,6 +70,3 @@ Unsupported idioms / known issues There are no plans to fix this currently because ``yield``-tests are deprecated in pytest 3.0, with ``pytest.mark.parametrize`` being the recommended alternative. - - - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/parametrize.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/parametrize.rst index 7a4ac2e1877..693cf1913bf 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/parametrize.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/parametrize.rst @@ -11,13 +11,13 @@ Parametrizing fixtures and test functions pytest enables test parametrization at several levels: -- :py:func:`pytest.fixture` allows one to :ref:`parametrize fixture +- :py:func:`pytest.fixture` allows one to :ref:`parametrize fixture functions `. -* `@pytest.mark.parametrize`_ allows one to define multiple sets of +* `@pytest.mark.parametrize`_ allows one to define multiple sets of arguments and fixtures at the test function or class. -* `pytest_generate_tests`_ allows one to define custom parametrization +* `pytest_generate_tests`_ allows one to define custom parametrization schemes or extensions. .. _parametrizemark: @@ -33,7 +33,7 @@ pytest enables test parametrization at several levels: .. versionchanged:: 2.4 Several improvements. -The builtin ``pytest.mark.parametrize`` decorator enables +The builtin :ref:`pytest.mark.parametrize ref` decorator enables parametrization of arguments for a test function. Here is a typical example of a test function that implements checking that a certain input leads to an expected output:: @@ -57,14 +57,14 @@ them in turn:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 3 items - + test_expectation.py ..F [100%] - + ================================= FAILURES ================================= ____________________________ test_eval[6*9-42] _____________________________ - + test_input = '6*9', expected = 42 - + @pytest.mark.parametrize("test_input,expected", [ ("3+5", 8), ("2+4", 6), @@ -74,7 +74,7 @@ them in turn:: > assert eval(test_input) == expected E AssertionError: assert 54 == 42 E + where 54 = eval('6*9') - + test_expectation.py:8: AssertionError ==================== 1 failed, 2 passed in 0.12 seconds ==================== @@ -106,9 +106,9 @@ Let's run this:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 3 items - + test_expectation.py ..x [100%] - + =================== 2 passed, 1 xfailed in 0.12 seconds ==================== The one parameter set which caused a failure previously now @@ -123,8 +123,8 @@ To get all combinations of multiple parametrized arguments you can stack def test_foo(x, y): pass -This will run the test with the arguments set to ``x=0/y=2``, ``x=0/y=3``, ``x=1/y=2`` and -``x=1/y=3``. +This will run the test with the arguments set to ``x=0/y=2``, ``x=1/y=2``, +``x=0/y=3``, and ``x=1/y=3`` exhausting parameters in the order of the decorators. .. _`pytest_generate_tests`: @@ -174,15 +174,15 @@ Let's also run with a stringinput that will lead to a failing test:: F [100%] ================================= FAILURES ================================= ___________________________ test_valid_string[!] ___________________________ - + stringinput = '!' - + def test_valid_string(stringinput): > assert stringinput.isalpha() E AssertionError: assert False E + where False = () E + where = '!'.isalpha - + test_strings.py:3: AssertionError 1 failed in 0.12 seconds @@ -198,7 +198,7 @@ list:: SKIP [1] test_strings.py: got empty parameter set ['stringinput'], function test_valid_string at $REGENDOC_TMPDIR/test_strings.py:1 1 skipped in 0.12 seconds -Note that when calling ``metafunc.parametrize`` multiple times with different parameter sets, all parameter names across +Note that when calling ``metafunc.parametrize`` multiple times with different parameter sets, all parameter names across those sets cannot be duplicated, otherwise an error will be raised. More examples @@ -206,12 +206,3 @@ More examples For further examples, you might want to look at :ref:`more parametrization examples `. - -.. _`metafunc object`: - -The **metafunc** object -------------------------------------------- - -.. currentmodule:: _pytest.python -.. autoclass:: Metafunc - :members: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/plugins.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/plugins.rst index 400418aee25..9ddba5d38ca 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/plugins.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/plugins.rst @@ -20,39 +20,39 @@ Here is a little annotated list for some popular plugins: .. _`django`: https://www.djangoproject.com/ -* `pytest-django `_: write tests +* `pytest-django `_: write tests for `django`_ apps, using pytest integration. -* `pytest-twisted `_: write tests +* `pytest-twisted `_: write tests for `twisted `_ apps, starting a reactor and processing deferreds from test functions. -* `pytest-cov `_: +* `pytest-cov `_: coverage reporting, compatible with distributed testing -* `pytest-xdist `_: +* `pytest-xdist `_: to distribute tests to CPUs and remote hosts, to run in boxed mode which allows to survive segmentation faults, to run in looponfailing mode, automatically re-running failing tests on file changes. -* `pytest-instafail `_: +* `pytest-instafail `_: to report failures while the test run is happening. -* `pytest-bdd `_ and - `pytest-konira `_ +* `pytest-bdd `_ and + `pytest-konira `_ to write tests using behaviour-driven testing. -* `pytest-timeout `_: +* `pytest-timeout `_: to timeout tests based on function marks or global definitions. -* `pytest-pep8 `_: +* `pytest-pep8 `_: a ``--pep8`` option to enable PEP8 compliance checking. -* `pytest-flakes `_: +* `pytest-flakes `_: check source code with pyflakes. -* `oejskit `_: +* `oejskit `_: a plugin to run javascript unittests in live browsers. To see a complete list of all plugins with their latest testing @@ -61,10 +61,11 @@ status against different pytest and Python versions, please visit You may also discover more plugins through a `pytest- pypi.python.org search`_. -.. _`available installable plugins`: -.. _`pytest- pypi.python.org search`: http://pypi.python.org/pypi?%3Aaction=search&term=pytest-&submit=search +.. _`pytest- pypi.python.org search`: https://pypi.org/search/?q=pytest- +.. _`available installable plugins`: + Requiring/Loading plugins in a test module or conftest file ----------------------------------------------------------- @@ -79,6 +80,12 @@ will be loaded as well. which will import the specified module as a ``pytest`` plugin. +.. note:: + Requiring plugins using a ``pytest_plugins`` variable in non-root + ``conftest.py`` files is deprecated. See + :ref:`full explanation ` + in the Writing plugins section. + .. _`findpluginname`: Finding out which plugins are active @@ -120,35 +127,3 @@ CI server), you can set ``PYTEST_ADDOPTS`` environment variable to See :ref:`findpluginname` for how to obtain the name of a plugin. .. _`builtin plugins`: - -Pytest default plugin reference -------------------------------- - - -You can find the source code for the following plugins -in the `pytest repository `_. - -.. autosummary:: - - _pytest.assertion - _pytest.cacheprovider - _pytest.capture - _pytest.config - _pytest.doctest - _pytest.helpconfig - _pytest.junitxml - _pytest.mark - _pytest.monkeypatch - _pytest.nose - _pytest.pastebin - _pytest.debugging - _pytest.pytester - _pytest.python - _pytest.recwarn - _pytest.resultlog - _pytest.runner - _pytest.main - _pytest.skipping - _pytest.terminal - _pytest.tmpdir - _pytest.unittest diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/projects.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/projects.rst index 86df99ab2c5..606e9d47c16 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/projects.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/projects.rst @@ -32,40 +32,40 @@ Here are some examples of projects using ``pytest`` (please send notes via :ref: * `PyPM `_ ActiveState's package manager * `Fom `_ a fluid object mapper for FluidDB * `applib `_ cross-platform utilities -* `six `_ Python 2 and 3 compatibility utilities +* `six `_ Python 2 and 3 compatibility utilities * `pediapress `_ MediaWiki articles -* `mwlib `_ mediawiki parser and utility library +* `mwlib `_ mediawiki parser and utility library * `The Translate Toolkit `_ for localization and conversion * `execnet `_ rapid multi-Python deployment -* `pylib `_ cross-platform path, IO, dynamic code library +* `pylib `_ cross-platform path, IO, dynamic code library * `Pacha `_ configuration management in five minutes -* `bbfreeze `_ create standalone executables from Python scripts +* `bbfreeze `_ create standalone executables from Python scripts * `pdb++ `_ a fancier version of PDB * `py-s3fuse `_ Amazon S3 FUSE based filesystem * `waskr `_ WSGI Stats Middleware * `guachi `_ global persistent configs for Python modules -* `Circuits `_ lightweight Event Driven Framework +* `Circuits `_ lightweight Event Driven Framework * `pygtk-helpers `_ easy interaction with PyGTK * `QuantumCore `_ statusmessage and repoze openid plugin * `pydataportability `_ libraries for managing the open web * `XIST `_ extensible HTML/XML generator -* `tiddlyweb `_ optionally headless, extensible RESTful datastore +* `tiddlyweb `_ optionally headless, extensible RESTful datastore * `fancycompleter `_ for colorful tab-completion * `Paludis `_ tools for Gentoo Paludis package manager * `Gerald `_ schema comparison tool * `abjad `_ Python API for Formalized Score control * `bu `_ a microscopic build system * `katcp `_ Telescope communication protocol over Twisted -* `kss plugin timer `_ +* `kss plugin timer `_ * `pyudev `_ a pure Python binding to the Linux library libudev * `pytest-localserver `_ a plugin for pytest that provides an httpserver and smtpserver -* `pytest-monkeyplus `_ a plugin that extends monkeypatch +* `pytest-monkeyplus `_ a plugin that extends monkeypatch These projects help integrate ``pytest`` into other Python frameworks: -* `pytest-django `_ for Django +* `pytest-django `_ for Django * `zope.pytest `_ for Zope and Grok -* `pytest_gae `_ for Google App Engine +* `pytest_gae `_ for Google App Engine * There is `some work `_ underway for Kotti, a CMS built in Pyramid/Pylons diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/proposals/parametrize_with_fixtures.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/proposals/parametrize_with_fixtures.rst index 146032aa471..92e7993f390 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/proposals/parametrize_with_fixtures.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/proposals/parametrize_with_fixtures.rst @@ -35,26 +35,29 @@ This is how a functional test could look like: import pytest + @pytest.fixture def default_context(): - return {'extra_context': {}} + return {"extra_context": {}} - @pytest.fixture(params=[ - {'author': 'alice'}, - {'project_slug': 'helloworld'}, - {'author': 'bob', 'project_slug': 'foobar'}, - ]) + @pytest.fixture( + params=[ + {"author": "alice"}, + {"project_slug": "helloworld"}, + {"author": "bob", "project_slug": "foobar"}, + ] + ) def extra_context(request): - return {'extra_context': request.param} + return {"extra_context": request.param} - @pytest.fixture(params=['default', 'extra']) + @pytest.fixture(params=["default", "extra"]) def context(request): - if request.param == 'default': - return request.getfuncargvalue('default_context') + if request.param == "default": + return request.getfuncargvalue("default_context") else: - return request.getfuncargvalue('extra_context') + return request.getfuncargvalue("extra_context") def test_generate_project(cookies, context): @@ -95,8 +98,7 @@ fixtures from existing ones. .. code-block:: python pytest.define_combined_fixture( - name='context', - fixtures=['default_context', 'extra_context'], + name="context", fixtures=["default_context", "extra_context"] ) The new fixture ``context`` inherits the scope from the used fixtures and yield @@ -118,15 +120,17 @@ all parameters marked as a fixture. .. note:: - The `pytest-lazy-fixture `_ plugin implements a very + The `pytest-lazy-fixture `_ plugin implements a very similar solution to the proposal below, make sure to check it out. .. code-block:: python - @pytest.fixture(params=[ - pytest.fixture_request('default_context'), - pytest.fixture_request('extra_context'), - ]) + @pytest.fixture( + params=[ + pytest.fixture_request("default_context"), + pytest.fixture_request("extra_context"), + ] + ) def context(request): """Returns all values for ``default_context``, one-by-one before it does the same for ``extra_context``. @@ -145,10 +149,10 @@ The same helper can be used in combination with ``pytest.mark.parametrize``. @pytest.mark.parametrize( - 'context, expected_response_code', + "context, expected_response_code", [ - (pytest.fixture_request('default_context'), 0), - (pytest.fixture_request('extra_context'), 0), + (pytest.fixture_request("default_context"), 0), + (pytest.fixture_request("extra_context"), 0), ], ) def test_generate_project(cookies, context, exit_code): diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/reference.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/reference.rst new file mode 100644 index 00000000000..fe9e87042f9 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/reference.rst @@ -0,0 +1,1296 @@ + +Reference +========= + +This page contains the full reference to pytest's API. + +.. contents:: + :depth: 3 + :local: + +Functions +--------- + +pytest.approx +~~~~~~~~~~~~~ + +.. autofunction:: _pytest.python_api.approx + +pytest.fail +~~~~~~~~~~~ + +**Tutorial**: :ref:`skipping` + +.. autofunction:: _pytest.outcomes.fail + +pytest.skip +~~~~~~~~~~~ + +.. autofunction:: _pytest.outcomes.skip(msg, [allow_module_level=False]) + +pytest.importorskip +~~~~~~~~~~~~~~~~~~~ + +.. autofunction:: _pytest.outcomes.importorskip + +pytest.xfail +~~~~~~~~~~~~ + +.. autofunction:: _pytest.outcomes.xfail + +pytest.exit +~~~~~~~~~~~ + +.. autofunction:: _pytest.outcomes.exit + +pytest.main +~~~~~~~~~~~ + +.. autofunction:: _pytest.config.main + +pytest.param +~~~~~~~~~~~~~ + +.. autofunction:: pytest.param(*values, [id], [marks]) + +pytest.raises +~~~~~~~~~~~~~ + +**Tutorial**: :ref:`assertraises`. + +.. autofunction:: pytest.raises(expected_exception: Exception, [match], [message]) + :with: excinfo + +pytest.deprecated_call +~~~~~~~~~~~~~~~~~~~~~~ + +**Tutorial**: :ref:`ensuring_function_triggers`. + +.. autofunction:: pytest.deprecated_call() + :with: + +pytest.register_assert_rewrite +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Tutorial**: :ref:`assertion-rewriting`. + +.. autofunction:: pytest.register_assert_rewrite + +pytest.warns +~~~~~~~~~~~~ + +**Tutorial**: :ref:`assertwarnings` + +.. autofunction:: pytest.warns(expected_warning: Exception, [match]) + :with: + + +.. _`marks ref`: + +Marks +----- + +Marks can be used apply meta data to *test functions* (but not fixtures), which can then be accessed by +fixtures or plugins. + + + + +.. _`pytest.mark.filterwarnings ref`: + +pytest.mark.filterwarnings +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Tutorial**: :ref:`filterwarnings`. + +Add warning filters to marked test items. + +.. py:function:: pytest.mark.filterwarnings(filter) + + :keyword str filter: + A *warning specification string*, which is composed of contents of the tuple ``(action, message, category, module, lineno)`` + as specified in `The Warnings filter `_ section of + the Python documentation, separated by ``":"``. Optional fields can be omitted. + + For example: + + .. code-block:: python + + @pytest.mark.warnings("ignore:.*usage will be deprecated.*:DeprecationWarning") + def test_foo(): + ... + + +.. _`pytest.mark.parametrize ref`: + +pytest.mark.parametrize +~~~~~~~~~~~~~~~~~~~~~~~ + +**Tutorial**: :doc:`parametrize`. + +.. automethod:: _pytest.python.Metafunc.parametrize + + +.. _`pytest.mark.skip ref`: + +pytest.mark.skip +~~~~~~~~~~~~~~~~ + +**Tutorial**: :ref:`skip`. + +Unconditionally skip a test function. + +.. py:function:: pytest.mark.skip(*, reason=None) + + :keyword str reason: Reason why the test function is being skipped. + + +.. _`pytest.mark.skipif ref`: + +pytest.mark.skipif +~~~~~~~~~~~~~~~~~~ + +**Tutorial**: :ref:`skipif`. + +Skip a test function if a condition is ``True``. + +.. py:function:: pytest.mark.skipif(condition, *, reason=None) + + :type condition: bool or str + :param condition: ``True/False`` if the condition should be skipped or a :ref:`condition string `. + :keyword str reason: Reason why the test function is being skipped. + + +.. _`pytest.mark.xfail ref`: + +pytest.mark.xfail +~~~~~~~~~~~~~~~~~~ + +**Tutorial**: :ref:`xfail`. + +Marks a test function as *expected to fail*. + +.. py:function:: pytest.mark.xfail(condition=None, *, reason=None, raises=None, run=True, strict=False) + + :type condition: bool or str + :param condition: ``True/False`` if the condition should be marked as xfail or a :ref:`condition string `. + :keyword str reason: Reason why the test function is marked as xfail. + :keyword Exception raises: Exception subclass expected to be raised by the test function; other exceptions will fail the test. + :keyword bool run: + If the test function should actually be executed. If ``False``, the function will always xfail and will + not be executed (useful a function is segfaulting). + :keyword bool strict: + * If ``False`` (the default) the function will be shown in the terminal output as ``xfailed`` if it fails + and as ``xpass`` if it passes. In both cases this will not cause the test suite to fail as a whole. This + is particularly useful to mark *flaky* tests (tests that random at fail) to be tackled later. + * If ``True``, the function will be shown in the terminal output as ``xfailed`` if it fails, but if it + unexpectedly passes then it will **fail** the test suite. This is particularly useful to mark functions + that are always failing and there should be a clear indication if they unexpectedly start to pass (for example + a new release of a library fixes a known bug). + + +custom marks +~~~~~~~~~~~~ + +Marks are created dynamically using the factory object ``pytest.mark`` and applied as a decorator. + +For example: + +.. code-block:: python + + @pytest.mark.timeout(10, "slow", method="thread") + def test_function(): + ... + +Will create and attach a :class:`Mark <_pytest.mark.structures.Mark>` object to the collected +:class:`Item <_pytest.nodes.Item>`, which can then be accessed by fixtures or hooks with +:meth:`Node.iter_markers <_pytest.nodes.Node.iter_markers>`. The ``mark`` object will have the following attributes: + +.. code-block:: python + + mark.args == (10, "slow") + mark.kwargs == {"method": "thread"} + + +Fixtures +-------- + +**Tutorial**: :ref:`fixture`. + +Fixtures are requested by test functions or other fixtures by declaring them as argument names. + + +Example of a test requiring a fixture: + +.. code-block:: python + + def test_output(capsys): + print("hello") + out, err = capsys.readouterr() + assert out == "hello\n" + + +Example of a fixture requiring another fixture: + +.. code-block:: python + + @pytest.fixture + def db_session(tmpdir): + fn = tmpdir / "db.file" + return connect(str(fn)) + +For more details, consult the full :ref:`fixtures docs `. + + +@pytest.fixture +~~~~~~~~~~~~~~~ + +.. autofunction:: pytest.fixture + :decorator: + + +.. _`cache-api`: + +config.cache +~~~~~~~~~~~~ + +**Tutorial**: :ref:`cache`. + +The ``config.cache`` object allows other plugins and fixtures +to store and retrieve values across test runs. To access it from fixtures +request ``pytestconfig`` into your fixture and get it with ``pytestconfig.cache``. + +Under the hood, the cache plugin uses the simple +``dumps``/``loads`` API of the :py:mod:`json` stdlib module. + +.. currentmodule:: _pytest.cacheprovider + +.. automethod:: Cache.get +.. automethod:: Cache.set +.. automethod:: Cache.makedir + + +capsys +~~~~~~ + +**Tutorial**: :doc:`capture`. + +.. currentmodule:: _pytest.capture + +.. autofunction:: capsys() + :no-auto-options: + + Returns an instance of :py:class:`CaptureFixture`. + + Example: + + .. code-block:: python + + def test_output(capsys): + print("hello") + captured = capsys.readouterr() + assert captured.out == "hello\n" + +.. autoclass:: CaptureFixture() + :members: + + +capsysbinary +~~~~~~~~~~~~ + +**Tutorial**: :doc:`capture`. + +.. autofunction:: capsysbinary() + :no-auto-options: + + Returns an instance of :py:class:`CaptureFixture`. + + Example: + + .. code-block:: python + + def test_output(capsysbinary): + print("hello") + captured = capsysbinary.readouterr() + assert captured.out == b"hello\n" + + +capfd +~~~~~~ + +**Tutorial**: :doc:`capture`. + +.. autofunction:: capfd() + :no-auto-options: + + Returns an instance of :py:class:`CaptureFixture`. + + Example: + + .. code-block:: python + + def test_system_echo(capfd): + os.system('echo "hello"') + captured = capsys.readouterr() + assert captured.out == "hello\n" + + +capfdbinary +~~~~~~~~~~~~ + +**Tutorial**: :doc:`capture`. + +.. autofunction:: capfdbinary() + :no-auto-options: + + Returns an instance of :py:class:`CaptureFixture`. + + Example: + + .. code-block:: python + + def test_system_echo(capfdbinary): + os.system('echo "hello"') + captured = capfdbinary.readouterr() + assert captured.out == b"hello\n" + + +doctest_namespace +~~~~~~~~~~~~~~~~~ + +**Tutorial**: :doc:`doctest`. + +.. autofunction:: _pytest.doctest.doctest_namespace() + + Usually this fixture is used in conjunction with another ``autouse`` fixture: + + .. code-block:: python + + @pytest.fixture(autouse=True) + def add_np(doctest_namespace): + doctest_namespace["np"] = numpy + + For more details: :ref:`doctest_namespace`. + + +request +~~~~~~~ + +**Tutorial**: :ref:`request example`. + +The ``request`` fixture is a special fixture providing information of the requesting test function. + +.. autoclass:: _pytest.fixtures.FixtureRequest() + :members: + + +pytestconfig +~~~~~~~~~~~~ + +.. autofunction:: _pytest.fixtures.pytestconfig() + + +record_property +~~~~~~~~~~~~~~~~~~~ + +**Tutorial**: :ref:`record_property example`. + +.. autofunction:: _pytest.junitxml.record_property() + +caplog +~~~~~~ + +**Tutorial**: :doc:`logging`. + +.. autofunction:: _pytest.logging.caplog() + :no-auto-options: + + This returns a :class:`_pytest.logging.LogCaptureFixture` instance. + +.. autoclass:: _pytest.logging.LogCaptureFixture + :members: + + +monkeypatch +~~~~~~~~~~~ + +.. currentmodule:: _pytest.monkeypatch + +**Tutorial**: :doc:`monkeypatch`. + +.. autofunction:: _pytest.monkeypatch.monkeypatch() + :no-auto-options: + + This returns a :class:`MonkeyPatch` instance. + +.. autoclass:: _pytest.monkeypatch.MonkeyPatch + :members: + +testdir +~~~~~~~ + +.. currentmodule:: _pytest.pytester + +This fixture provides a :class:`Testdir` instance useful for black-box testing of test files, making it ideal to +test plugins. + +To use it, include in your top-most ``conftest.py`` file:: + + pytest_plugins = 'pytester' + + + +.. autoclass:: Testdir() + :members: runpytest,runpytest_subprocess,runpytest_inprocess,makeconftest,makepyfile + +.. autoclass:: RunResult() + :members: + +.. autoclass:: LineMatcher() + :members: + + +recwarn +~~~~~~~ + +**Tutorial**: :ref:`assertwarnings` + +.. currentmodule:: _pytest.recwarn + +.. autofunction:: recwarn() + :no-auto-options: + +.. autoclass:: _pytest.recwarn.WarningsRecorder() + :members: + +Each recorded warning is an instance of :class:`warnings.WarningMessage`. + +.. note:: + :class:`RecordedWarning` was changed from a plain class to a namedtuple in pytest 3.1 + +.. note:: + ``DeprecationWarning`` and ``PendingDeprecationWarning`` are treated + differently; see :ref:`ensuring_function_triggers`. + + +tmpdir +~~~~~~ + +**Tutorial**: :doc:`tmpdir` + +.. currentmodule:: _pytest.tmpdir + +.. autofunction:: tmpdir() + :no-auto-options: + + +tmpdir_factory +~~~~~~~~~~~~~~ + +**Tutorial**: :ref:`tmpdir factory example` + +.. _`tmpdir factory api`: + +``tmpdir_factory`` instances have the following methods: + +.. currentmodule:: _pytest.tmpdir + +.. automethod:: TempdirFactory.mktemp +.. automethod:: TempdirFactory.getbasetemp + + +.. _`hook-reference`: + +Hooks +----- + +**Tutorial**: :doc:`writing_plugins`. + +.. currentmodule:: _pytest.hookspec + +Reference to all hooks which can be implemented by :ref:`conftest.py files ` and :ref:`plugins `. + +Bootstrapping hooks +~~~~~~~~~~~~~~~~~~~ + +Bootstrapping hooks called for plugins registered early enough (internal and setuptools plugins). + +.. autofunction:: pytest_load_initial_conftests +.. autofunction:: pytest_cmdline_preparse +.. autofunction:: pytest_cmdline_parse +.. autofunction:: pytest_cmdline_main + +Initialization hooks +~~~~~~~~~~~~~~~~~~~~ + +Initialization hooks called for plugins and ``conftest.py`` files. + +.. autofunction:: pytest_addoption +.. autofunction:: pytest_addhooks +.. autofunction:: pytest_configure +.. autofunction:: pytest_unconfigure +.. autofunction:: pytest_sessionstart +.. autofunction:: pytest_sessionfinish + +Test running hooks +~~~~~~~~~~~~~~~~~~ + +All runtest related hooks receive a :py:class:`pytest.Item <_pytest.main.Item>` object. + +.. autofunction:: pytest_runtestloop +.. autofunction:: pytest_runtest_protocol +.. autofunction:: pytest_runtest_logstart +.. autofunction:: pytest_runtest_logfinish +.. autofunction:: pytest_runtest_setup +.. autofunction:: pytest_runtest_call +.. autofunction:: pytest_runtest_teardown +.. autofunction:: pytest_runtest_makereport + +For deeper understanding you may look at the default implementation of +these hooks in :py:mod:`_pytest.runner` and maybe also +in :py:mod:`_pytest.pdb` which interacts with :py:mod:`_pytest.capture` +and its input/output capturing in order to immediately drop +into interactive debugging when a test failure occurs. + +The :py:mod:`_pytest.terminal` reported specifically uses +the reporting hook to print information about a test run. + +Collection hooks +~~~~~~~~~~~~~~~~ + +``pytest`` calls the following hooks for collecting files and directories: + +.. autofunction:: pytest_collection +.. autofunction:: pytest_ignore_collect +.. autofunction:: pytest_collect_directory +.. autofunction:: pytest_collect_file + +For influencing the collection of objects in Python modules +you can use the following hook: + +.. autofunction:: pytest_pycollect_makeitem +.. autofunction:: pytest_generate_tests +.. autofunction:: pytest_make_parametrize_id + +After collection is complete, you can modify the order of +items, delete or otherwise amend the test items: + +.. autofunction:: pytest_collection_modifyitems + +Reporting hooks +~~~~~~~~~~~~~~~ + +Session related reporting hooks: + +.. autofunction:: pytest_collectstart +.. autofunction:: pytest_itemcollected +.. autofunction:: pytest_collectreport +.. autofunction:: pytest_deselected +.. autofunction:: pytest_report_header +.. autofunction:: pytest_report_collectionfinish +.. autofunction:: pytest_report_teststatus +.. autofunction:: pytest_terminal_summary +.. autofunction:: pytest_fixture_setup +.. autofunction:: pytest_fixture_post_finalizer + +And here is the central hook for reporting about +test execution: + +.. autofunction:: pytest_runtest_logreport + +You can also use this hook to customize assertion representation for some +types: + +.. autofunction:: pytest_assertrepr_compare + + +Debugging/Interaction hooks +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There are few hooks which can be used for special +reporting or interaction with exceptions: + +.. autofunction:: pytest_internalerror +.. autofunction:: pytest_keyboard_interrupt +.. autofunction:: pytest_exception_interact +.. autofunction:: pytest_enter_pdb + + +Objects +------- + +Full reference to objects accessible from :ref:`fixtures ` or :ref:`hooks `. + + +CallInfo +~~~~~~~~ + +.. autoclass:: _pytest.runner.CallInfo() + :members: + + +Class +~~~~~ + +.. autoclass:: _pytest.python.Class() + :members: + :show-inheritance: + +Collector +~~~~~~~~~ + +.. autoclass:: _pytest.nodes.Collector() + :members: + :show-inheritance: + +Config +~~~~~~ + +.. autoclass:: _pytest.config.Config() + :members: + +ExceptionInfo +~~~~~~~~~~~~~ + +.. autoclass:: _pytest._code.ExceptionInfo + :members: + +FixtureDef +~~~~~~~~~~ + +.. autoclass:: _pytest.fixtures.FixtureDef() + :members: + :show-inheritance: + +FSCollector +~~~~~~~~~~~ + +.. autoclass:: _pytest.nodes.FSCollector() + :members: + :show-inheritance: + +Function +~~~~~~~~ + +.. autoclass:: _pytest.python.Function() + :members: + :show-inheritance: + +Item +~~~~ + +.. autoclass:: _pytest.nodes.Item() + :members: + :show-inheritance: + +MarkDecorator +~~~~~~~~~~~~~ + +.. autoclass:: _pytest.mark.MarkDecorator + :members: + + +MarkGenerator +~~~~~~~~~~~~~ + +.. autoclass:: _pytest.mark.MarkGenerator + :members: + + +MarkInfo +~~~~~~~~ + +.. autoclass:: _pytest.mark.MarkInfo + :members: + + +Mark +~~~~ + +.. autoclass:: _pytest.mark.structures.Mark + :members: + + +Metafunc +~~~~~~~~ + +.. autoclass:: _pytest.python.Metafunc + :members: + +Module +~~~~~~ + +.. autoclass:: _pytest.python.Module() + :members: + :show-inheritance: + +Node +~~~~ + +.. autoclass:: _pytest.nodes.Node() + :members: + +Parser +~~~~~~ + +.. autoclass:: _pytest.config.argparsing.Parser() + :members: + +PluginManager +~~~~~~~~~~~~~ + +.. autoclass:: pluggy.PluginManager() + :members: + + +PytestPluginManager +~~~~~~~~~~~~~~~~~~~ + +.. autoclass:: _pytest.config.PytestPluginManager() + :members: + :undoc-members: + :show-inheritance: + +Session +~~~~~~~ + +.. autoclass:: _pytest.main.Session() + :members: + :show-inheritance: + +TestReport +~~~~~~~~~~ + +.. autoclass:: _pytest.runner.TestReport() + :members: + :inherited-members: + +_Result +~~~~~~~ + +.. autoclass:: pluggy._Result + :members: + +Special Variables +----------------- + +pytest treats some global variables in a special manner when defined in a test module. + + +pytest_plugins +~~~~~~~~~~~~~~ + +**Tutorial**: :ref:`available installable plugins` + +Can be declared at the **global** level in *test modules* and *conftest.py files* to register additional plugins. +Can be either a ``str`` or ``Sequence[str]``. + +.. code-block:: python + + pytest_plugins = "myapp.testsupport.myplugin" + +.. code-block:: python + + pytest_plugins = ("myapp.testsupport.tools", "myapp.testsupport.regression") + + +pytest_mark +~~~~~~~~~~~ + +**Tutorial**: :ref:`scoped-marking` + +Can be declared at the **global** level in *test modules* to apply one or more :ref:`marks ` to all +test functions and methods. Can be either a single mark or a sequence of marks. + +.. code-block:: python + + import pytest + + pytestmark = pytest.mark.webtest + + +.. code-block:: python + + import pytest + + pytestmark = (pytest.mark.integration, pytest.mark.slow) + +PYTEST_DONT_REWRITE (module docstring) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The text ``PYTEST_DONT_REWRITE`` can be add to any **module docstring** to disable +:ref:`assertion rewriting ` for that module. + + +Environment Variables +--------------------- + +Environment variables that can be used to change pytest's behavior. + +PYTEST_ADDOPTS +~~~~~~~~~~~~~~ + +This contains a command-line (parsed by the py:mod:`shlex` module) that will be **prepended** to the command line given +by the user, see :ref:`adding default options` for more information. + +PYTEST_DEBUG +~~~~~~~~~~~~ + +When set, pytest will print tracing and debug information. + +PYTEST_PLUGINS +~~~~~~~~~~~~~~ + +Contains comma-separated list of modules that should be loaded as plugins: + +.. code-block:: bash + + export PYTEST_PLUGINS=mymodule.plugin,xdist + + +PYTEST_CURRENT_TEST +~~~~~~~~~~~~~~~~~~~ + +This is not meant to be set by users, but is set by pytest internally with the name of the current test so other +processes can inspect it, see :ref:`pytest current test env` for more information. + + +.. _`ini options ref`: + +Configuration Options +--------------------- + +Here is a list of builtin configuration options that may be written in a ``pytest.ini``, ``tox.ini`` or ``setup.cfg`` +file, usually located at the root of your repository. All options must be under a ``[pytest]`` section +(``[tool:pytest]`` for ``setup.cfg`` files). + +Configuration file options may be overwritten in the command-line by using ``-o/--override``, which can also be +passed multiple times. The expected format is ``name=value``. For example:: + + pytest -o console_output_style=classic -o cache_dir=/tmp/mycache + + +.. confval:: addopts + + Add the specified ``OPTS`` to the set of command line arguments as if they + had been specified by the user. Example: if you have this ini file content: + + .. code-block:: ini + + # content of pytest.ini + [pytest] + addopts = --maxfail=2 -rf # exit after 2 failures, report fail info + + issuing ``pytest test_hello.py`` actually means:: + + pytest --maxfail=2 -rf test_hello.py + + Default is to add no options. + + +.. confval:: cache_dir + + .. versionadded:: 3.2 + + Sets a directory where stores content of cache plugin. Default directory is + ``.pytest_cache`` which is created in :ref:`rootdir `. Directory may be + relative or absolute path. If setting relative path, then directory is created + relative to :ref:`rootdir `. Additionally path may contain environment + variables, that will be expanded. For more information about cache plugin + please refer to :ref:`cache_provider`. + + +.. confval:: confcutdir + + Sets a directory where search upwards for ``conftest.py`` files stops. + By default, pytest will stop searching for ``conftest.py`` files upwards + from ``pytest.ini``/``tox.ini``/``setup.cfg`` of the project if any, + or up to the file-system root. + + +.. confval:: console_output_style + + .. versionadded:: 3.3 + + Sets the console output style while running tests: + + * ``classic``: classic pytest output. + * ``progress``: like classic pytest output, but with a progress indicator. + + The default is ``progress``, but you can fallback to ``classic`` if you prefer or + the new mode is causing unexpected problems: + + .. code-block:: ini + + # content of pytest.ini + [pytest] + console_output_style = classic + + +.. confval:: doctest_encoding + + .. versionadded:: 3.1 + + Default encoding to use to decode text files with docstrings. + :doc:`See how pytest handles doctests `. + + +.. confval:: doctest_optionflags + + One or more doctest flag names from the standard ``doctest`` module. + :doc:`See how pytest handles doctests `. + + +.. confval:: empty_parameter_set_mark + + .. versionadded:: 3.4 + + Allows to pick the action for empty parametersets in parameterization + + * ``skip`` skips tests with an empty parameterset (default) + * ``xfail`` marks tests with an empty parameterset as xfail(run=False) + + .. code-block:: ini + + # content of pytest.ini + [pytest] + empty_parameter_set_mark = xfail + + .. note:: + + The default value of this option is planned to change to ``xfail`` in future releases + as this is considered less error prone, see `#3155 `_ + for more details. + + +.. confval:: filterwarnings + + .. versionadded:: 3.1 + + Sets a list of filters and actions that should be taken for matched + warnings. By default all warnings emitted during the test session + will be displayed in a summary at the end of the test session. + + .. code-block:: ini + + # content of pytest.ini + [pytest] + filterwarnings = + error + ignore::DeprecationWarning + + This tells pytest to ignore deprecation warnings and turn all other warnings + into errors. For more information please refer to :ref:`warnings`. + + +.. confval:: junit_suite_name + + .. versionadded:: 3.1 + + To set the name of the root test suite xml item, you can configure the ``junit_suite_name`` option in your config file: + + .. code-block:: ini + + [pytest] + junit_suite_name = my_suite + + +.. confval:: log_cli_date_format + + .. versionadded:: 3.3 + + Sets a :py:func:`time.strftime`-compatible string that will be used when formatting dates for live logging. + + .. code-block:: ini + + [pytest] + log_cli_date_format = %Y-%m-%d %H:%M:%S + + For more information, see :ref:`live_logs`. + +.. confval:: log_cli_format + + .. versionadded:: 3.3 + + Sets a :py:mod:`logging`-compatible string used to format live logging messages. + + .. code-block:: ini + + [pytest] + log_cli_format = %(asctime)s %(levelname)s %(message)s + + For more information, see :ref:`live_logs`. + + +.. confval:: log_cli_level + + .. versionadded:: 3.3 + + Sets the minimum log message level that should be captured for live logging. The integer value or + the names of the levels can be used. + + .. code-block:: ini + + [pytest] + log_cli_level = INFO + + For more information, see :ref:`live_logs`. + + +.. confval:: log_date_format + + .. versionadded:: 3.3 + + Sets a :py:func:`time.strftime`-compatible string that will be used when formatting dates for logging capture. + + .. code-block:: ini + + [pytest] + log_date_format = %Y-%m-%d %H:%M:%S + + For more information, see :ref:`logging`. + + +.. confval:: log_file + + .. versionadded:: 3.3 + + Sets a file name relative to the ``pytest.ini`` file where log messages should be written to, in addition + to the other logging facilities that are active. + + .. code-block:: ini + + [pytest] + log_file = logs/pytest-logs.txt + + For more information, see :ref:`logging`. + + +.. confval:: log_file_date_format + + .. versionadded:: 3.3 + + Sets a :py:func:`time.strftime`-compatible string that will be used when formatting dates for the logging file. + + .. code-block:: ini + + [pytest] + log_file_date_format = %Y-%m-%d %H:%M:%S + + For more information, see :ref:`logging`. + +.. confval:: log_file_format + + .. versionadded:: 3.3 + + Sets a :py:mod:`logging`-compatible string used to format logging messages redirected to the logging file. + + .. code-block:: ini + + [pytest] + log_file_format = %(asctime)s %(levelname)s %(message)s + + For more information, see :ref:`logging`. + +.. confval:: log_file_level + + .. versionadded:: 3.3 + + Sets the minimum log message level that should be captured for the logging file. The integer value or + the names of the levels can be used. + + .. code-block:: ini + + [pytest] + log_file_level = INFO + + For more information, see :ref:`logging`. + + +.. confval:: log_format + + .. versionadded:: 3.3 + + Sets a :py:mod:`logging`-compatible string used to format captured logging messages. + + .. code-block:: ini + + [pytest] + log_format = %(asctime)s %(levelname)s %(message)s + + For more information, see :ref:`logging`. + + +.. confval:: log_level + + .. versionadded:: 3.3 + + Sets the minimum log message level that should be captured for logging capture. The integer value or + the names of the levels can be used. + + .. code-block:: ini + + [pytest] + log_level = INFO + + For more information, see :ref:`logging`. + + +.. confval:: log_print + + .. versionadded:: 3.3 + + If set to ``False``, will disable displaying captured logging messages for failed tests. + + .. code-block:: ini + + [pytest] + log_print = False + + For more information, see :ref:`logging`. + + +.. confval:: markers + + List of markers that are allowed in test functions, enforced when ``--strict`` command-line argument is used. + You can use a marker name per line, indented from the option name. + + .. code-block:: ini + + [pytest] + markers = + slow + serial + +.. confval:: minversion + + Specifies a minimal pytest version required for running tests. + + .. code-block:: ini + + # content of pytest.ini + [pytest] + minversion = 3.0 # will fail if we run with pytest-2.8 + + +.. confval:: norecursedirs + + Set the directory basename patterns to avoid when recursing + for test discovery. The individual (fnmatch-style) patterns are + applied to the basename of a directory to decide if to recurse into it. + Pattern matching characters:: + + * matches everything + ? matches any single character + [seq] matches any character in seq + [!seq] matches any char not in seq + + Default patterns are ``'.*', 'build', 'dist', 'CVS', '_darcs', '{arch}', '*.egg', 'venv'``. + Setting a ``norecursedirs`` replaces the default. Here is an example of + how to avoid certain directories: + + .. code-block:: ini + + [pytest] + norecursedirs = .svn _build tmp* + + This would tell ``pytest`` to not look into typical subversion or + sphinx-build directories or into any ``tmp`` prefixed directory. + + Additionally, ``pytest`` will attempt to intelligently identify and ignore a + virtualenv by the presence of an activation script. Any directory deemed to + be the root of a virtual environment will not be considered during test + collection unless ``‑‑collect‑in‑virtualenv`` is given. Note also that + ``norecursedirs`` takes precedence over ``‑‑collect‑in‑virtualenv``; e.g. if + you intend to run tests in a virtualenv with a base directory that matches + ``'.*'`` you *must* override ``norecursedirs`` in addition to using the + ``‑‑collect‑in‑virtualenv`` flag. + + +.. confval:: python_classes + + One or more name prefixes or glob-style patterns determining which classes + are considered for test collection. By default, pytest will consider any + class prefixed with ``Test`` as a test collection. Here is an example of how + to collect tests from classes that end in ``Suite``: + + .. code-block:: ini + + [pytest] + python_classes = *Suite + + Note that ``unittest.TestCase`` derived classes are always collected + regardless of this option, as ``unittest``'s own collection framework is used + to collect those tests. + + +.. confval:: python_files + + One or more Glob-style file patterns determining which python files + are considered as test modules. By default, pytest will consider + any file matching with ``test_*.py`` and ``*_test.py`` globs as a test + module. + + +.. confval:: python_functions + + One or more name prefixes or glob-patterns determining which test functions + and methods are considered tests. By default, pytest will consider any + function prefixed with ``test`` as a test. Here is an example of how + to collect test functions and methods that end in ``_test``: + + .. code-block:: ini + + [pytest] + python_functions = *_test + + Note that this has no effect on methods that live on a ``unittest + .TestCase`` derived class, as ``unittest``'s own collection framework is used + to collect those tests. + + See :ref:`change naming conventions` for more detailed examples. + + +.. confval:: testpaths + + .. versionadded:: 2.8 + + Sets list of directories that should be searched for tests when + no specific directories, files or test ids are given in the command line when + executing pytest from the :ref:`rootdir ` directory. + Useful when all project tests are in a known location to speed up + test collection and to avoid picking up undesired tests by accident. + + .. code-block:: ini + + [pytest] + testpaths = testing doc + + This tells pytest to only look for tests in ``testing`` and ``doc`` + directories when executing from the root directory. + + +.. confval:: usefixtures + + List of fixtures that will be applied to all test functions; this is semantically the same to apply + the ``@pytest.mark.usefixtures`` marker to all test functions. + + + .. code-block:: ini + + [pytest] + usefixtures = + clean_db + + +.. confval:: xfail_strict + + If set to ``True``, tests marked with ``@pytest.mark.xfail`` that actually succeed will by default fail the + test suite. + For more information, see :ref:`xfail strict tutorial`. + + + .. code-block:: ini + + [pytest] + xfail_strict = True diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/requirements.txt b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/requirements.txt index 72bb60a811f..e3cc47ed5a5 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/requirements.txt +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/requirements.txt @@ -1,3 +1,4 @@ # pinning sphinx to 1.4.* due to search issues with rtd: # https://github.com/rtfd/readthedocs-sphinx-ext/issues/25 sphinx ==1.4.* +sphinxcontrib-trio diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/skipping.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/skipping.rst index 7e001929b23..bfa6f3e75a6 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/skipping.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/skipping.rst @@ -71,6 +71,8 @@ It is also possible to skip the whole module using The imperative method is useful when it is not possible to evaluate the skip condition during import time. +**Reference**: :ref:`pytest.mark.skip ref` + ``skipif`` ~~~~~~~~~~ @@ -116,6 +118,8 @@ Alternatively, you can use :ref:`condition strings ` instead of booleans, but they can't be shared between modules easily so they are supported mainly for backward compatibility reasons. +**Reference**: :ref:`pytest.mark.skipif ref` + Skip all test functions of a class or module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -188,19 +192,19 @@ Here's a quick guide on how to skip tests in a module in different situations: .. code-block:: python - pytestmark = pytest.mark.skip('all tests still WIP') + pytestmark = pytest.mark.skip("all tests still WIP") 2. Skip all tests in a module based on some condition: .. code-block:: python - pytestmark = pytest.mark.skipif(sys.platform == 'win32', 'tests for linux only') + pytestmark = pytest.mark.skipif(sys.platform == "win32", "tests for linux only") 3. Skip all tests in a module if some import is missing: .. code-block:: python - pexpect = pytest.importorskip('pexpect') + pexpect = pytest.importorskip("pexpect") .. _xfail: @@ -232,15 +236,10 @@ This will unconditionally make ``test_function`` ``XFAIL``. Note that no other c after ``pytest.xfail`` call, differently from the marker. That's because it is implemented internally by raising a known exception. -Here's the signature of the ``xfail`` **marker** (not the function), using Python 3 keyword-only -arguments syntax: - -.. code-block:: python - - def xfail(condition=None, *, reason=None, raises=None, run=True, strict=False): - +**Reference**: :ref:`pytest.mark.xfail ref` +.. _`xfail strict tutorial`: ``strict`` parameter ~~~~~~~~~~~~~~~~~~~~ @@ -335,12 +334,12 @@ Running it with the report-on-xfail option gives this output:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR/example, inifile: collected 7 items - + xfail_demo.py xxxxxxx [100%] ========================= short test summary info ========================== XFAIL xfail_demo.py::test_hello XFAIL xfail_demo.py::test_hello2 - reason: [NOTRUN] + reason: [NOTRUN] XFAIL xfail_demo.py::test_hello3 condition: hasattr(os, 'sep') XFAIL xfail_demo.py::test_hello4 @@ -350,7 +349,7 @@ Running it with the report-on-xfail option gives this output:: XFAIL xfail_demo.py::test_hello6 reason: reason XFAIL xfail_demo.py::test_hello7 - + ======================== 7 xfailed in 0.12 seconds ========================= .. _`skip/xfail with parametrize`: @@ -365,14 +364,20 @@ test instances when using parametrize: import pytest - @pytest.mark.parametrize(("n", "expected"), [ - (1, 2), - pytest.param(1, 0, marks=pytest.mark.xfail), - pytest.param(1, 3, marks=pytest.mark.xfail(reason="some bug")), - (2, 3), - (3, 4), - (4, 5), - pytest.param(10, 11, marks=pytest.mark.skipif(sys.version_info >= (3, 0), reason="py2k")), - ]) + + @pytest.mark.parametrize( + ("n", "expected"), + [ + (1, 2), + pytest.param(1, 0, marks=pytest.mark.xfail), + pytest.param(1, 3, marks=pytest.mark.xfail(reason="some bug")), + (2, 3), + (3, 4), + (4, 5), + pytest.param( + 10, 11, marks=pytest.mark.skipif(sys.version_info >= (3, 0), reason="py2k") + ), + ], + ) def test_increment(n, expected): assert n + 1 == expected diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/talks.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/talks.rst index bf593db4b4b..79534ea6e9a 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/talks.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/talks.rst @@ -98,8 +98,3 @@ Plugin specific examples: .. _`parametrizing tests, generalized`: http://tetamap.wordpress.com/2009/05/13/parametrizing-python-tests-generalized/ .. _`generating parametrized tests with fixtures`: parametrize.html#test-generators .. _`test generators and cached setup`: http://bruynooghe.blogspot.com/2010/06/pytest-test-generators-and-cached-setup.html - - - - - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/attic.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/attic.rst deleted file mode 100644 index 06944661cb5..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/attic.rst +++ /dev/null @@ -1,117 +0,0 @@ -=============================================== -ATTIC documentation -=============================================== - -XXX REVIEW and remove the below XXX - -Customizing the testing process -=============================== - -writing conftest.py files ------------------------------------ - -You may put conftest.py files containing project-specific -configuration in your project's root directory, it's usually -best to put it just into the same directory level as your -topmost ``__init__.py``. In fact, ``pytest`` performs -an "upwards" search starting from the directory that you specify -to be tested and will lookup configuration values right-to-left. -You may have options that reside e.g. in your home directory -but note that project specific settings will be considered -first. There is a flag that helps you debugging your -conftest.py configurations:: - - pytest --trace-config - - -customizing the collecting and running process ------------------------------------------------ - -To introduce different test items you can create -one or more ``conftest.py`` files in your project. -When the collection process traverses directories -and modules the default collectors will produce -custom Collectors and Items if they are found -in a local ``conftest.py`` file. - - -Customizing the collection process in a module ----------------------------------------------- - -If you have a module where you want to take responsibility for -collecting your own test Items and possibly even for executing -a test then you can provide `generative tests`_ that yield -callables and possibly arguments as a tuple. This is especially -useful for calling application test machinery with different -parameter sets but counting each of the calls as a separate -tests. - -.. _`generative tests`: features.html#generative-tests - -The other extension possibility is about -specifying a custom test ``Item`` class which -is responsible for setting up and executing an underlying -test. Or you can extend the collection process for a whole -directory tree by putting Items in a ``conftest.py`` configuration file. -The collection process dynamically consults the *chain of conftest.py* -modules to determine collectors and items at ``Directory``, ``Module``, -``Class``, ``Function`` or ``Generator`` level respectively. - -Customizing execution of Items and Functions ----------------------------------------------------- - -- ``pytest.Function`` test items control execution - of a test function through its ``function.runtest()`` method. - This method is responsible for performing setup and teardown - ("Test Fixtures") for a test Function. - -- ``Function.execute(target, *args)`` methods are invoked by - the default ``Function.run()`` to actually execute a python - function with the given (usually empty set of) arguments. - -.. _`py-dev mailing list`: http://codespeak.net/mailman/listinfo/py-dev - - -.. _`test generators`: funcargs.html#test-generators - -.. _`generative tests`: - -generative tests: yielding parametrized tests -==================================================== - -Deprecated since 1.0 in favour of `test generators`_. - -*Generative tests* are test methods that are *generator functions* which -``yield`` callables and their arguments. This is useful for running a -test function multiple times against different parameters. Example:: - - def test_generative(): - for x in (42,17,49): - yield check, x - - def check(arg): - assert arg % 7 == 0 # second generated tests fails! - -Note that ``test_generative()`` will cause three tests -to get run, notably ``check(42)``, ``check(17)`` and ``check(49)`` -of which the middle one will obviously fail. - -To make it easier to distinguish the generated tests it is possible to specify an explicit name for them, like for example:: - - def test_generative(): - for x in (42,17,49): - yield "case %d" % x, check, x - - -disabling a test class ----------------------- - -If you want to disable a complete test class you -can set the class-level attribute ``disabled``. -For example, in order to avoid running some tests on Win32:: - - class TestPosixOnly(object): - disabled = sys.platform == 'win32' - - def test_xxx(self): - ... diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/config.html b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/config.html deleted file mode 100644 index cba5a46f982..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/config.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/dist.html b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/dist.html deleted file mode 100644 index e328550a85c..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/dist.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/extend.html b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/extend.html deleted file mode 100644 index cba5a46f982..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/extend.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/index.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/index.rst deleted file mode 100644 index 1a3b5a54da0..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/index.rst +++ /dev/null @@ -1,35 +0,0 @@ -======================================= -pytest documentation index -======================================= - - -features_: overview and discussion of features. - -quickstart_: getting started with writing a simple test. - -`talks, tutorials, examples`_: tutorial examples, slides - -funcargs_: powerful parametrized test function setup - -`plugins`_: list of available plugins with usage examples and feature details. - -customize_: configuration, customization, extensions - -changelog_: history of changes covering last releases - -**Continuous Integration of pytest's own tests and plugins with Hudson**: - - `http://hudson.testrun.org/view/pytest`_ - -.. _`http://hudson.testrun.org/view/pytest`: http://hudson.testrun.org/view/pytest/ - - -.. _changelog: ../changelog.html -.. _`plugins`: plugin/index.html -.. _`talks, tutorials, examples`: talks.html -.. _quickstart: quickstart.html -.. _features: features.html -.. _funcargs: funcargs.html -.. _customize: customize.html - - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/mission.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/mission.rst deleted file mode 100644 index 51c252dc0d8..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/mission.rst +++ /dev/null @@ -1,13 +0,0 @@ - -Mission -==================================== - -``pytest`` strives to make testing a fun and no-boilerplate effort. - -The tool is distributed as a `pytest` package. Its project independent -``pytest`` command line tool helps you to: - -* rapidly collect and run tests -* run unit- or doctests, functional or integration tests -* distribute tests to multiple environments -* use local or global plugins for custom test types and setup diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/cov.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/cov.rst deleted file mode 100644 index 541c7ef9479..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/cov.rst +++ /dev/null @@ -1,230 +0,0 @@ - -produce code coverage reports using the 'coverage' package, including support for distributed testing. -====================================================================================================== - - -.. contents:: - :local: - -This plugin produces coverage reports. It supports centralised testing and distributed testing in -both load and each modes. It also supports coverage of subprocesses. - -All features offered by the coverage package should be available, either through pytest-cov or -through coverage's config file. - - -Installation ------------- - -The `pytest-cov`_ package may be installed with pip or easy_install:: - - pip install pytest-cov - easy_install pytest-cov - -.. _`pytest-cov`: http://pypi.python.org/pypi/pytest-cov/ - - -Uninstallation --------------- - -Uninstalling packages is supported by pip:: - - pip uninstall pytest-cov - -However easy_install does not provide an uninstall facility. - -.. IMPORTANT:: - - Ensure that you manually delete the init_covmain.pth file in your - site-packages directory. - - This file starts coverage collection of subprocesses if appropriate during - site initialization at python startup. - - -Usage ------ - -Centralised Testing -~~~~~~~~~~~~~~~~~~~ - -Centralised testing will report on the combined coverage of the main process and all of it's -subprocesses. - -Running centralised testing:: - - pytest --cov myproj tests/ - -Shows a terminal report:: - - -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- - Name Stmts Miss Cover - ---------------------------------------- - myproj/__init__ 2 0 100% - myproj/myproj 257 13 94% - myproj/feature4286 94 7 92% - ---------------------------------------- - TOTAL 353 20 94% - - -Distributed Testing: Load -~~~~~~~~~~~~~~~~~~~~~~~~~ - -Distributed testing with dist mode set to load will report on the combined coverage of all slaves. -The slaves may be spread out over any number of hosts and each slave may be located anywhere on the -file system. Each slave will have it's subprocesses measured. - -Running distributed testing with dist mode set to load:: - - pytest --cov myproj -n 2 tests/ - -Shows a terminal report:: - - -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- - Name Stmts Miss Cover - ---------------------------------------- - myproj/__init__ 2 0 100% - myproj/myproj 257 13 94% - myproj/feature4286 94 7 92% - ---------------------------------------- - TOTAL 353 20 94% - - -Again but spread over different hosts and different directories:: - - pytest --cov myproj --dist load - --tx ssh=memedough@host1//chdir=testenv1 - --tx ssh=memedough@host2//chdir=/tmp/testenv2//python=/tmp/env1/bin/python - --rsyncdir myproj --rsyncdir tests --rsync examples - tests/ - -Shows a terminal report:: - - -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- - Name Stmts Miss Cover - ---------------------------------------- - myproj/__init__ 2 0 100% - myproj/myproj 257 13 94% - myproj/feature4286 94 7 92% - ---------------------------------------- - TOTAL 353 20 94% - - -Distributed Testing: Each -~~~~~~~~~~~~~~~~~~~~~~~~~ - -Distributed testing with dist mode set to each will report on the combined coverage of all slaves. -Since each slave is running all tests this allows generating a combined coverage report for multiple -environments. - -Running distributed testing with dist mode set to each:: - - pytest --cov myproj --dist each - --tx popen//chdir=/tmp/testenv3//python=/usr/local/python27/bin/python - --tx ssh=memedough@host2//chdir=/tmp/testenv4//python=/tmp/env2/bin/python - --rsyncdir myproj --rsyncdir tests --rsync examples - tests/ - -Shows a terminal report:: - - ---------------------------------------- coverage ---------------------------------------- - platform linux2, python 2.6.5-final-0 - platform linux2, python 2.7.0-final-0 - Name Stmts Miss Cover - ---------------------------------------- - myproj/__init__ 2 0 100% - myproj/myproj 257 13 94% - myproj/feature4286 94 7 92% - ---------------------------------------- - TOTAL 353 20 94% - - -Reporting ---------- - -It is possible to generate any combination of the reports for a single test run. - -The available reports are terminal (with or without missing line numbers shown), HTML, XML and -annotated source code. - -The terminal report without line numbers (default):: - - pytest --cov-report term --cov myproj tests/ - - -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- - Name Stmts Miss Cover - ---------------------------------------- - myproj/__init__ 2 0 100% - myproj/myproj 257 13 94% - myproj/feature4286 94 7 92% - ---------------------------------------- - TOTAL 353 20 94% - - -The terminal report with line numbers:: - - pytest --cov-report term-missing --cov myproj tests/ - - -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- - Name Stmts Miss Cover Missing - -------------------------------------------------- - myproj/__init__ 2 0 100% - myproj/myproj 257 13 94% 24-26, 99, 149, 233-236, 297-298, 369-370 - myproj/feature4286 94 7 92% 183-188, 197 - -------------------------------------------------- - TOTAL 353 20 94% - - -The remaining three reports output to files without showing anything on the terminal (useful for -when the output is going to a continuous integration server):: - - pytest --cov-report html --cov-report xml --cov-report annotate --cov myproj tests/ - - -Coverage Data File ------------------- - -The data file is erased at the beginning of testing to ensure clean data for each test run. - -The data file is left at the end of testing so that it is possible to use normal coverage tools to -examine it. - - -Limitations ------------ - -For distributed testing the slaves must have the pytest-cov package installed. This is needed since -the plugin must be registered through setuptools / distribute for pytest to start the plugin on the -slave. - -For subprocess measurement environment variables must make it from the main process to the -subprocess. The python used by the subprocess must have pytest-cov installed. The subprocess must -do normal site initialization so that the environment variables can be detected and coverage -started. - - -Acknowledgments ----------------- - -Holger Krekel for pytest with its distributed testing support. - -Ned Batchelder for coverage and its ability to combine the coverage results of parallel runs. - -Whilst this plugin has been built fresh from the ground up to support distributed testing it has -been influenced by the work done on pytest-coverage (Ross Lawley, James Mills, Holger Krekel) and -nose-cover (Jason Pellerin) which are other coverage plugins for pytest and nose respectively. - -No doubt others have contributed to these tools as well. - -command line options --------------------- - - -``--cov=path`` - measure coverage for filesystem path (multi-allowed) -``--cov-report=type`` - type of report to generate: term, term-missing, annotate, html, xml (multi-allowed) -``--cov-config=path`` - config file for coverage, default: .coveragerc - -.. include:: links.txt diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/coverage.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/coverage.rst deleted file mode 100644 index 71139d008ba..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/coverage.rst +++ /dev/null @@ -1,51 +0,0 @@ - -Write and report coverage data with the 'coverage' package. -=========================================================== - - -.. contents:: - :local: - -Note: Original code by Ross Lawley. - -Install --------------- - -Use pip to (un)install:: - - pip install pytest-coverage - pip uninstall pytest-coverage - -or alternatively use easy_install to install:: - - easy_install pytest-coverage - - -Usage -------------- - -To get full test coverage reports for a particular package type:: - - pytest --cover-report=report - -command line options --------------------- - - -``--cover=COVERPACKAGES`` - (multi allowed) only include info from specified package. -``--cover-report=REPORT_TYPE`` - html: Directory for html output. - report: Output a text report. - annotate: Annotate your source code for which lines were executed and which were not. - xml: Output an xml report compatible with the cobertura plugin for hudson. -``--cover-directory=DIRECTORY`` - Directory for the reports (html / annotate results) defaults to ./coverage -``--cover-xml-file=XML_FILE`` - File for the xml report defaults to ./coverage.xml -``--cover-show-missing`` - Show missing files -``--cover-ignore-errors=IGNORE_ERRORS`` - Ignore errors of finding source files for code. - -.. include:: links.txt diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/django.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/django.rst deleted file mode 100644 index 061497b385e..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/django.rst +++ /dev/null @@ -1,7 +0,0 @@ -pytest_django plugin (EXTERNAL) -========================================== - -pytest_django is a plugin for ``pytest`` that provides a set of useful tools for testing Django applications, checkout Ben Firshman's `pytest_django github page`_. - -.. _`pytest_django github page`: http://github.com/bfirsh/pytest_django/tree/master - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/figleaf.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/figleaf.rst deleted file mode 100644 index 0c1603ade9f..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/figleaf.rst +++ /dev/null @@ -1,44 +0,0 @@ - -report test coverage using the 'figleaf' package. -================================================= - - -.. contents:: - :local: - -Install ---------------- - -To install the plugin issue:: - - easy_install pytest-figleaf # or - pip install pytest-figleaf - -and if you are using pip you can also uninstall:: - - pip uninstall pytest-figleaf - - -Usage ---------------- - -After installation you can simply type:: - - pytest --figleaf [...] - -to enable figleaf coverage in your test run. A default ".figleaf" data file -and "html" directory will be created. You can use command line options -to control where data and html files are created. - -command line options --------------------- - - -``--figleaf`` - trace python coverage with figleaf and write HTML for files below the current working dir -``--fig-data=dir`` - set tracing file, default: ".figleaf". -``--fig-html=dir`` - set html reporting dir, default "html". - -.. include:: links.txt diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/helpconfig.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/helpconfig.rst deleted file mode 100644 index 326b75c4552..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/helpconfig.rst +++ /dev/null @@ -1,36 +0,0 @@ - -provide version info, conftest/environment config names. -======================================================== - - -.. contents:: - :local: - - - -command line options --------------------- - - -``--version`` - display py lib version and import information. -``-p name`` - early-load given plugin (multi-allowed). -``--trace-config`` - trace considerations of conftest.py files. -``--debug`` - generate and show internal debugging information. -``--help-config`` - show available conftest.py and ENV-variable names. - -Start improving this plugin in 30 seconds -========================================= - - -1. Download `pytest_helpconfig.py`_ plugin source code -2. put it somewhere as ``pytest_helpconfig.py`` into your import path -3. a subsequent ``pytest`` run will use your local version - -Checkout customize_, other plugins_ or `get in contact`_. - -.. include:: links.txt diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/index.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/index.rst deleted file mode 100644 index 853a4dce681..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/index.rst +++ /dev/null @@ -1,68 +0,0 @@ - -advanced python testing -======================= - -skipping_ advanced skipping for python test functions, classes or modules. - -mark_ generic mechanism for marking python functions. - -pdb_ interactive debugging with the Python Debugger. - -figleaf_ (external) report test coverage using the 'figleaf' package. - -monkeypatch_ safely patch object attributes, dicts and environment variables. - -coverage_ (external) Write and report coverage data with the 'coverage' package. - -cov_ (external) produce code coverage reports using the 'coverage' package, including support for distributed testing. - -capture_ configurable per-test stdout/stderr capturing mechanisms. - -capturelog_ (external) capture output of logging module. - -recwarn_ helpers for asserting deprecation and other warnings. - -tmpdir_ provide temporary directories to test functions. - - -distributed testing, CI and deployment -====================================== - -xdist_ (external) loop on failing tests, distribute test runs to CPUs and hosts. - -pastebin_ submit failure or test session information to a pastebin service. - -junitxml_ logging of test results in JUnit-XML format, for use with Hudson - -resultlog_ non-xml machine-readable logging of test results. - -genscript_ generate standalone test script to be distributed along with an application. - - -testing domains and conventions codecheckers -============================================ - -oejskit_ (external) run javascript tests in real life browsers - -django_ (external) for testing django applications - -unittest_ automatically discover and run traditional "unittest.py" style tests. - -nose_ nose-compatibility plugin: allow to run nose test suites natively. - -doctest_ collect and execute doctests from modules and test files. - -restdoc_ perform ReST syntax, local and remote reference tests on .rst/.txt files. - - -internal, debugging, help functionality -======================================= - -helpconfig_ provide version info, conftest/environment config names. - -terminal_ Implements terminal reporting of the full testing process. - -hooklog_ log invocations of extension hooks to a file. - - -.. include:: links.txt diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/links.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/links.rst deleted file mode 100644 index 6dec2b4848a..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/links.rst +++ /dev/null @@ -1,45 +0,0 @@ -.. _`helpconfig`: helpconfig.html -.. _`pytest_recwarn.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_recwarn.py -.. _`unittest`: unittest.html -.. _`pytest_monkeypatch.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_monkeypatch.py -.. _`pastebin`: pastebin.html -.. _`skipping`: skipping.html -.. _`plugins`: index.html -.. _`mark`: mark.html -.. _`tmpdir`: tmpdir.html -.. _`pytest_doctest.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_doctest.py -.. _`capture`: capture.html -.. _`pytest_nose.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_nose.py -.. _`pytest_restdoc.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_restdoc.py -.. _`restdoc`: restdoc.html -.. _`xdist`: xdist.html -.. _`pytest_pastebin.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_pastebin.py -.. _`pytest_tmpdir.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_tmpdir.py -.. _`terminal`: terminal.html -.. _`pytest_hooklog.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_hooklog.py -.. _`capturelog`: capturelog.html -.. _`junitxml`: junitxml.html -.. _`pytest_skipping.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_skipping.py -.. _`checkout the pytest development version`: ../../install.html#checkout -.. _`pytest_helpconfig.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_helpconfig.py -.. _`oejskit`: oejskit.html -.. _`doctest`: doctest.html -.. _`pytest_mark.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_mark.py -.. _`get in contact`: ../../contact.html -.. _`pytest_capture.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_capture.py -.. _`figleaf`: figleaf.html -.. _`customize`: ../customize.html -.. _`hooklog`: hooklog.html -.. _`pytest_terminal.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_terminal.py -.. _`recwarn`: recwarn.html -.. _`pytest_pdb.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_pdb.py -.. _`monkeypatch`: monkeypatch.html -.. _`coverage`: coverage.html -.. _`resultlog`: resultlog.html -.. _`cov`: cov.html -.. _`pytest_junitxml.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_junitxml.py -.. _`django`: django.html -.. _`pytest_unittest.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_unittest.py -.. _`nose`: nose.html -.. _`pytest_resultlog.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_resultlog.py -.. _`pdb`: pdb.html diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/nose.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/nose.rst deleted file mode 100644 index 9eeae5ff697..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/nose.rst +++ /dev/null @@ -1,56 +0,0 @@ - -nose-compatibility plugin: allow to run nose test suites natively. -================================================================== - - -.. contents:: - :local: - -This is an experimental plugin for allowing to run tests written -in 'nosetests' style with ``pytest``. - -Usage -------------- - -type:: - - pytest # instead of 'nosetests' - -and you should be able to run nose style tests and at the same -time can make full use of pytest's capabilities. - -Supported nose Idioms ----------------------- - -* setup and teardown at module/class/method level -* SkipTest exceptions and markers -* setup/teardown decorators -* yield-based tests and their setup -* general usage of nose utilities - -Unsupported idioms / issues ----------------------------------- - -- nose-style doctests are not collected and executed correctly, - also fixtures don't work. - -- no nose-configuration is recognized - -If you find other issues or have suggestions please run:: - - pytest --pastebin=all - -and send the resulting URL to a ``pytest`` contact channel, -at best to the mailing list. - -Start improving this plugin in 30 seconds -========================================= - - -1. Download `pytest_nose.py`_ plugin source code -2. put it somewhere as ``pytest_nose.py`` into your import path -3. a subsequent ``pytest`` run will use your local version - -Checkout customize_, other plugins_ or `get in contact`_. - -.. include:: links.txt diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/oejskit.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/oejskit.rst deleted file mode 100644 index 4995aa17c72..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/oejskit.rst +++ /dev/null @@ -1,12 +0,0 @@ -pytest_oejskit plugin (EXTERNAL) -========================================== - -The `oejskit`_ offers a ``pytest`` plugin for running Javascript tests in live browsers. Running inside the browsers comes with some speed cost, on the other hand it means for example the code is tested against the real-word DOM implementations. -The approach enables to write integration tests such that the JavaScript code is tested against server-side Python code mocked as necessary. Any server-side framework that can already be exposed through WSGI (or for which a subset of WSGI can be written to accommodate the jskit own needs) can play along. - -For more info and download please visit the `oejskit PyPI`_ page. - -.. _`oejskit`: -.. _`oejskit PyPI`: http://pypi.python.org/pypi/oejskit - -.. source link 'http://bitbucket.org/pedronis/js-infrastructure/src/tip/pytest_jstests.py', diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/terminal.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/terminal.rst deleted file mode 100644 index e07d4f72183..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/terminal.rst +++ /dev/null @@ -1,38 +0,0 @@ - -Implements terminal reporting of the full testing process. -========================================================== - - -.. contents:: - :local: - -This is a good source for looking at the various reporting hooks. - -command line options --------------------- - - -``-v, --verbose`` - increase verbosity. -``-r chars`` - show extra test summary info as specified by chars (f)ailed, (s)skipped, (x)failed, (X)passed. -``-l, --showlocals`` - show locals in tracebacks (disabled by default). -``--tb=style`` - traceback print mode (long/short/line/no). -``--full-trace`` - don't cut any tracebacks (default is to cut). -``--fixtures`` - show available function arguments, sorted by plugin - -Start improving this plugin in 30 seconds -========================================= - - -1. Download `pytest_terminal.py`_ plugin source code -2. put it somewhere as ``pytest_terminal.py`` into your import path -3. a subsequent ``pytest`` run will use your local version - -Checkout customize_, other plugins_ or `get in contact`_. - -.. include:: links.txt diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/xdist.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/xdist.rst deleted file mode 100644 index 506d240aee1..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/plugin/xdist.rst +++ /dev/null @@ -1,172 +0,0 @@ - -loop on failing tests, distribute test runs to CPUs and hosts. -============================================================== - - -.. contents:: - :local: - -The `pytest-xdist`_ plugin extends ``pytest`` with some unique -test execution modes: - -* Looponfail: run your tests repeatedly in a subprocess. After each run - ``pytest`` waits until a file in your project changes and then re-runs the - previously failing tests. This is repeated until all tests pass after which - again a full run is performed. - -* Load-balancing: if you have multiple CPUs or hosts you can use - those for a combined test run. This allows to speed up - development or to use special resources of remote machines. - -* Multi-Platform coverage: you can specify different Python interpreters - or different platforms and run tests in parallel on all of them. - -Before running tests remotely, ``pytest`` efficiently synchronizes your -program source code to the remote place. All test results -are reported back and displayed to your local test session. -You may specify different Python versions and interpreters. - -.. _`pytest-xdist`: http://pypi.python.org/pypi/pytest-xdist - -Usage examples ---------------------- - -Speed up test runs by sending tests to multiple CPUs -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -To send tests to multiple CPUs, type:: - - pytest -n NUM - -Especially for longer running tests or tests requiring -a lot of IO this can lead to considerable speed ups. - - -Running tests in a Python subprocess -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -To instantiate a python2.4 sub process and send tests to it, you may type:: - - pytest -d --tx popen//python=python2.4 - -This will start a subprocess which is run with the "python2.4" -Python interpreter, found in your system binary lookup path. - -If you prefix the --tx option value like this:: - - --tx 3*popen//python=python2.4 - -then three subprocesses would be created and tests -will be load-balanced across these three processes. - - -Sending tests to remote SSH accounts -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Suppose you have a package ``mypkg`` which contains some -tests that you can successfully run locally. And you -have a ssh-reachable machine ``myhost``. Then -you can ad-hoc distribute your tests by typing:: - - pytest -d --tx ssh=myhostpopen --rsyncdir mypkg mypkg - -This will synchronize your ``mypkg`` package directory -to a remote ssh account and then locally collect tests -and send them to remote places for execution. - -You can specify multiple ``--rsyncdir`` directories -to be sent to the remote side. - -**NOTE:** For ``pytest`` to collect and send tests correctly -you not only need to make sure all code and tests -directories are rsynced, but that any test (sub) directory -also has an ``__init__.py`` file because internally -``pytest`` references tests using their fully qualified python -module path. **You will otherwise get strange errors** -during setup of the remote side. - -Sending tests to remote Socket Servers -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Download the single-module `socketserver.py`_ Python program -and run it like this:: - - python socketserver.py - -It will tell you that it starts listening on the default -port. You can now on your home machine specify this -new socket host with something like this:: - - pytest -d --tx socket=192.168.1.102:8888 --rsyncdir mypkg mypkg - - -.. _`atonce`: - -Running tests on many platforms at once -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -The basic command to run tests on multiple platforms is:: - - pytest --dist=each --tx=spec1 --tx=spec2 - -If you specify a windows host, an OSX host and a Linux -environment this command will send each tests to all -platforms - and report back failures from all platforms -at once. The specifications strings use the `xspec syntax`_. - -.. _`xspec syntax`: http://codespeak.net/execnet/trunk/basics.html#xspec - -.. _`socketserver.py`: http://codespeak.net/svn/py/dist/py/execnet/script/socketserver.py - -.. _`execnet`: http://codespeak.net/execnet - -Specifying test exec environments in a conftest.py -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Instead of specifying command line options, you can -put options values in a ``conftest.py`` file like this:: - - option_tx = ['ssh=myhost//python=python2.7', 'popen//python=python2.7'] - option_dist = True - -Any commandline ``--tx`` specifications will add to the list of -available execution environments. - -Specifying "rsync" dirs in a conftest.py -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -In your ``mypkg/conftest.py`` you may specify directories to synchronise -or to exclude:: - - rsyncdirs = ['.', '../plugins'] - rsyncignore = ['_cache'] - -These directory specifications are relative to the directory -where the ``conftest.py`` is found. - -command line options --------------------- - - -``-f, --looponfail`` - run tests in subprocess, wait for modified files and re-run failing test set until all pass. -``-n numprocesses`` - shortcut for '--dist=load --tx=NUM*popen' -``--boxed`` - box each test run in a separate process (unix) -``--dist=distmode`` - set mode for distributing tests to exec environments. - - each: send each test to each available environment. - - load: send each test to one available environment so it is run only once. - - (default) no: run tests inprocess, don't distribute. -``--tx=xspec`` - add a test execution environment. some examples: --tx popen//python=python2.7 --tx socket=192.168.1.102:8888 --tx ssh=user@codespeak.net//chdir=testcache -``-d`` - load-balance tests. shortcut for '--dist=load' -``--rsyncdir=dir1`` - add directory for rsyncing to remote tx nodes. - -.. include:: links.txt diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/test.html b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/test.html deleted file mode 100644 index 7d00f718a67..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/test/test.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/tmpdir.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/tmpdir.rst index b8174484e1d..421b4c898c5 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/tmpdir.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/tmpdir.rst @@ -32,14 +32,14 @@ Running this would result in a passed test except for the last platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 1 item - + test_tmpdir.py F [100%] - + ================================= FAILURES ================================= _____________________________ test_create_file _____________________________ - + tmpdir = local('PYTEST_TMPDIR/test_create_file0') - + def test_create_file(tmpdir): p = tmpdir.mkdir("sub").join("hello.txt") p.write("content") @@ -47,10 +47,12 @@ Running this would result in a passed test except for the last assert len(tmpdir.listdir()) == 1 > assert 0 E assert 0 - + test_tmpdir.py:7: AssertionError ========================= 1 failed in 0.12 seconds ========================= +.. _`tmpdir factory example`: + The 'tmpdir_factory' fixture ---------------------------- @@ -69,24 +71,22 @@ to save time: # contents of conftest.py import pytest - @pytest.fixture(scope='session') + + @pytest.fixture(scope="session") def image_file(tmpdir_factory): img = compute_expensive_image() - fn = tmpdir_factory.mktemp('data').join('img.png') + fn = tmpdir_factory.mktemp("data").join("img.png") img.save(str(fn)) return fn + # contents of test_image.py def test_histogram(image_file): img = load_image(image_file) # compute and test histogram -``tmpdir_factory`` instances have the following methods: +See :ref:`tmpdir_factory API ` for details. -.. currentmodule:: _pytest.tmpdir - -.. automethod:: TempdirFactory.mktemp -.. automethod:: TempdirFactory.getbasetemp .. _`base temporary directory`: @@ -106,6 +106,4 @@ When distributing tests on the local machine, ``pytest`` takes care to configure a basetemp directory for the sub processes such that all temporary data lands below a single per-test run basetemp directory. -.. _`py.path.local`: http://py.rtfd.org/en/latest/path.html - - +.. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/unittest.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/unittest.rst index b44bda44fa8..53192b3469d 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/unittest.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/unittest.rst @@ -46,9 +46,9 @@ in most cases without having to modify existing code: * :ref:`maxfail`; * :ref:`--pdb ` command-line option for debugging on test failures (see :ref:`note ` below); -* Distribute tests to multiple CPUs using the `pytest-xdist `_ plugin; +* Distribute tests to multiple CPUs using the `pytest-xdist `_ plugin; * Use :ref:`plain assert-statements ` instead of ``self.assert*`` functions (`unittest2pytest - `__ is immensely helpful in this); + `__ is immensely helpful in this); pytest features in ``unittest.TestCase`` subclasses @@ -92,18 +92,18 @@ it from a unittest-style test:: def db_class(request): class DummyDB(object): pass - # set a class attribute on the invoking test context + # set a class attribute on the invoking test context request.cls.db = DummyDB() -This defines a fixture function ``db_class`` which - if used - is -called once for each test class and which sets the class-level +This defines a fixture function ``db_class`` which - if used - is +called once for each test class and which sets the class-level ``db`` attribute to a ``DummyDB`` instance. The fixture function achieves this by receiving a special ``request`` object which gives access to :ref:`the requesting test context ` such -as the ``cls`` attribute, denoting the class from which the fixture +as the ``cls`` attribute, denoting the class from which the fixture is used. This architecture de-couples fixture writing from actual test code and allows re-use of the fixture by a minimal reference, the fixture -name. So let's write an actual ``unittest.TestCase`` class using our +name. So let's write an actual ``unittest.TestCase`` class using our fixture definition:: # content of test_unittest_db.py @@ -120,7 +120,7 @@ fixture definition:: def test_method2(self): assert 0, self.db # fail for demo purposes -The ``@pytest.mark.usefixtures("db_class")`` class-decorator makes sure that +The ``@pytest.mark.usefixtures("db_class")`` class-decorator makes sure that the pytest fixture function ``db_class`` is called once per class. Due to the deliberately failing assert statements, we can take a look at the ``self.db`` values in the traceback:: @@ -130,30 +130,30 @@ the ``self.db`` values in the traceback:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 2 items - + test_unittest_db.py FF [100%] - + ================================= FAILURES ================================= ___________________________ MyTest.test_method1 ____________________________ - + self = - + def test_method1(self): assert hasattr(self, "db") > assert 0, self.db # fail for demo purposes E AssertionError: .DummyDB object at 0xdeadbeef> E assert 0 - + test_unittest_db.py:9: AssertionError ___________________________ MyTest.test_method2 ____________________________ - + self = - + def test_method2(self): > assert 0, self.db # fail for demo purposes E AssertionError: .DummyDB object at 0xdeadbeef> E assert 0 - + test_unittest_db.py:12: AssertionError ========================= 2 failed in 0.12 seconds ========================= @@ -166,10 +166,10 @@ Using autouse fixtures and accessing other fixtures --------------------------------------------------- Although it's usually better to explicitly declare use of fixtures you need -for a given test, you may sometimes want to have fixtures that are -automatically used in a given context. After all, the traditional +for a given test, you may sometimes want to have fixtures that are +automatically used in a given context. After all, the traditional style of unittest-setup mandates the use of this implicit fixture writing -and chances are, you are used to it or like it. +and chances are, you are used to it or like it. You can flag fixture functions with ``@pytest.fixture(autouse=True)`` and define the fixture function in the context where you want it used. diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/usage.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/usage.rst index 6091db8be38..25be54395af 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/usage.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/usage.rst @@ -111,9 +111,9 @@ For more information see :ref:`marks `. :: pytest --pyargs pkg.testing - + This will import ``pkg.testing`` and use its filesystem location to find and run tests from. - + Modifying Python traceback printing ---------------------------------------------- @@ -152,9 +152,9 @@ allows one to drop into the PDB_ prompt via a command line option:: pytest --pdb -This will invoke the Python debugger on every failure. Often you might -only want to do this for the first failing test to understand a certain -failure situation:: +This will invoke the Python debugger on every failure (or KeyboardInterrupt). +Often you might only want to do this for the first failing test to understand +a certain failure situation:: pytest -x --pdb # drop to PDB on first failure, then end test session pytest --pdb --maxfail=3 # drop to PDB for first three failures @@ -189,6 +189,20 @@ in your code and pytest automatically disables its output capture for that test: for test output occurring after you exit the interactive PDB_ tracing session and continue with the regular test run. + +.. _`breakpoint-builtin`: + +Using the builtin breakpoint function +------------------------------------- + +Python 3.7 introduces a builtin ``breakpoint()`` function. +Pytest supports the use of ``breakpoint()`` with the following behaviours: + + - When ``breakpoint()`` is called and ``PYTHONBREAKPOINT`` is set to the default value, pytest will use the custom internal PDB trace UI instead of the system default ``Pdb``. + - When tests are complete, the system will default back to the system ``Pdb`` trace UI. + - If ``--pdb`` is called on execution of pytest, the custom internal Pdb trace UI is used on ``bothbreakpoint()`` and failed tests/unhandled exceptions. + - If ``--pdbcls`` is used, the custom class debugger will be executed when a test fails (as expected within existing behaviour), but also when ``breakpoint()`` is called from within a test, the custom class debugger will be instantiated. + .. _durations: Profiling test execution duration @@ -220,19 +234,26 @@ To set the name of the root test suite xml item, you can configure the ``junit_s [pytest] junit_suite_name = my_suite -record_xml_property -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. _record_property example: + +record_property +^^^^^^^^^^^^^^^ .. versionadded:: 2.8 +.. versionchanged:: 3.5 + + Fixture renamed from ``record_xml_property`` to ``record_property`` as user + properties are now available to all reporters. + ``record_xml_property`` is now deprecated. If you want to log additional information for a test, you can use the -``record_xml_property`` fixture: +``record_property`` fixture: .. code-block:: python - def test_function(record_xml_property): - record_xml_property("example_key", 1) - assert 0 + def test_function(record_property): + record_property("example_key", 1) + assert True This will add an extra property ``example_key="1"`` to the generated ``testcase`` tag: @@ -245,17 +266,108 @@ This will add an extra property ``example_key="1"`` to the generated
+Alternatively, you can integrate this functionality with custom markers: + +.. code-block:: python + + # content of conftest.py + + + def pytest_collection_modifyitems(session, config, items): + for item in items: + for marker in item.iter_markers(name="test_id"): + test_id = marker.args[0] + item.user_properties.append(("test_id", test_id)) + +And in your tests: + +.. code-block:: python + + # content of test_function.py + import pytest + + + @pytest.mark.test_id(1501) + def test_function(): + assert True + +Will result in: + +.. code-block:: xml + + + + + + + .. warning:: - ``record_xml_property`` is an experimental feature, and its interface might be replaced - by something more powerful and general in future versions. The - functionality per-se will be kept, however. - - Currently it does not work when used with the ``pytest-xdist`` plugin. + ``record_property`` is an experimental feature and may change in the future. Also please note that using this feature will break any schema verification. This might be a problem when used with some CI servers. +record_xml_attribute +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. versionadded:: 3.4 + +To add an additional xml attribute to a testcase element, you can use +``record_xml_attribute`` fixture. This can also be used to override existing values: + +.. code-block:: python + + def test_function(record_xml_attribute): + record_xml_attribute("assertions", "REQ-1234") + record_xml_attribute("classname", "custom_classname") + print("hello world") + assert True + +Unlike ``record_property``, this will not add a new child element. +Instead, this will add an attribute ``assertions="REQ-1234"`` inside the generated +``testcase`` tag and override the default ``classname`` with ``"classname=custom_classname"``: + +.. code-block:: xml + + + + hello world + + + +.. warning:: + + ``record_xml_attribute`` is an experimental feature, and its interface might be replaced + by something more powerful and general in future versions. The + functionality per-se will be kept, however. + + Using this over ``record_xml_property`` can help when using ci tools to parse the xml report. + However, some parsers are quite strict about the elements and attributes that are allowed. + Many tools use an xsd schema (like the example below) to validate incoming xml. + Make sure you are using attribute names that are allowed by your parser. + + Below is the Scheme used by Jenkins to validate the XML report: + + .. code-block:: xml + + + + + + + + + + + + + + + + + + LogXML: add_global_property ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -268,19 +380,22 @@ to all testcases you can use ``LogXML.add_global_properties`` import pytest + @pytest.fixture(scope="session") def log_global_env_facts(f): - if pytest.config.pluginmanager.hasplugin('junitxml'): - my_junit = getattr(pytest.config, '_xml', None) + if pytest.config.pluginmanager.hasplugin("junitxml"): + my_junit = getattr(pytest.config, "_xml", None) - my_junit.add_global_property('ARCH', 'PPC') - my_junit.add_global_property('STORAGE_TYPE', 'CEPH') + my_junit.add_global_property("ARCH", "PPC") + my_junit.add_global_property("STORAGE_TYPE", "CEPH") - @pytest.mark.usefixtures(log_global_env_facts) + + @pytest.mark.usefixtures(log_global_env_facts.__name__) def start_and_prepare_env(): pass + class TestMe(object): def test_foo(self): assert True @@ -311,7 +426,7 @@ Creating resultlog format files This option is rarely used and is scheduled for removal in 4.0. An alternative for users which still need similar functionality is to use the - `pytest-tap `_ plugin which provides + `pytest-tap `_ plugin which provides a stream of test data. If you have any concerns, please don't hesitate to @@ -386,7 +501,17 @@ Running it will show that ``MyPlugin`` was added and its hook was invoked:: $ python myinvoke.py - *** test run reporting finishing - + . [100%]*** test run reporting finishing + + +.. note:: + + Calling ``pytest.main()`` will result in importing your tests and any modules + that they import. Due to the caching mechanism of python's import system, + making subsequent calls to ``pytest.main()`` from the same process will not + reflect changes to those files between the calls. For this reason, making + multiple calls to ``pytest.main()`` from the same process (in order to re-run + tests, for example) is not recommended. + .. include:: links.inc diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/warnings.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/warnings.rst index f249d7e3b2f..df93a02b540 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/warnings.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/warnings.rst @@ -25,14 +25,14 @@ Running pytest now produces this output:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: collected 1 item - + test_show_warnings.py . [100%] - + ============================= warnings summary ============================= test_show_warnings.py::test_one $REGENDOC_TMPDIR/test_show_warnings.py:4: UserWarning: api v1, should use functions from v2 warnings.warn(UserWarning("api v1, should use functions from v2")) - + -- Docs: http://doc.pytest.org/en/latest/warnings.html =================== 1 passed, 1 warnings in 0.12 seconds =================== @@ -45,17 +45,17 @@ them into errors:: F [100%] ================================= FAILURES ================================= _________________________________ test_one _________________________________ - + def test_one(): > assert api_v1() == 1 - - test_show_warnings.py:8: - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - + + test_show_warnings.py:8: + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + def api_v1(): > warnings.warn(UserWarning("api v1, should use functions from v2")) E UserWarning: api v1, should use functions from v2 - + test_show_warnings.py:4: UserWarning 1 failed in 0.12 seconds @@ -78,6 +78,9 @@ Both ``-W`` command-line option and ``filterwarnings`` ini option are based on P `-W option`_ and `warnings.simplefilter`_, so please refer to those sections in the Python documentation for other examples and advanced usage. + +.. _`filterwarnings`: + ``@pytest.mark.filterwarnings`` ------------------------------- @@ -91,11 +94,13 @@ even module level: import warnings + def api_v1(): warnings.warn(UserWarning("api v1, should use functions from v2")) return 1 - @pytest.mark.filterwarnings('ignore:api v1') + + @pytest.mark.filterwarnings("ignore:api v1") def test_one(): assert api_v1() == 1 @@ -109,9 +114,15 @@ decorator or to all tests in a module by setting the ``pytestmark`` variable: .. code-block:: python # turns all warnings into errors for this module - pytestmark = pytest.mark.filterwarnings('error') + pytestmark = pytest.mark.filterwarnings("error") +.. note:: + + Except for these features, pytest does not change the python warning filter; it only captures + and displays the warnings which are issued with respect to the currently configured filter, + including changes to the filter made by test functions or by the system under test. + .. note:: ``DeprecationWarning`` and ``PendingDeprecationWarning`` are hidden by the standard library @@ -244,23 +255,11 @@ The ``recwarn`` fixture will record warnings for the whole function:: Both ``recwarn`` and ``pytest.warns`` return the same interface for recorded warnings: a WarningsRecorder instance. To view the recorded warnings, you can iterate over this instance, call ``len`` on it to get the number of recorded -warnings, or index into it to get a particular recorded warning. It also -provides these methods: +warnings, or index into it to get a particular recorded warning. -.. autoclass:: _pytest.recwarn.WarningsRecorder() - :members: +.. currentmodule:: _pytest.warnings -Each recorded warning has the attributes ``message``, ``category``, -``filename``, ``lineno``, ``file``, and ``line``. The ``category`` is the -class of the warning. The ``message`` is the warning itself; calling -``str(message)`` will return the actual message of the warning. - -.. note:: - :class:`RecordedWarning` was changed from a plain class to a namedtuple in pytest 3.1 - -.. note:: - ``DeprecationWarning`` and ``PendingDeprecationWarning`` are treated - differently; see :ref:`ensuring_function_triggers`. +Full API: :class:`WarningsRecorder`. .. _`ensuring a function triggers a deprecation warning`: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/writing_plugins.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/writing_plugins.rst index eb525583000..95b810bcb36 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/writing_plugins.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/writing_plugins.rst @@ -12,9 +12,9 @@ only want to use but not write plugins. A plugin contains one or multiple hook functions. :ref:`Writing hooks ` explains the basics and details of how you can write a hook function yourself. ``pytest`` implements all aspects of configuration, collection, running and -reporting by calling `well specified hooks`_ of the following plugins: +reporting by calling :ref:`well specified hooks ` of the following plugins: -* :ref:`builtin plugins`: loaded from pytest's internal ``_pytest`` directory. +* builtin plugins: loaded from pytest's internal ``_pytest`` directory. * :ref:`external plugins `: modules discovered through `setuptools entry points`_ @@ -85,8 +85,8 @@ sub directory but not for other directories:: Here is how you might run it:: - pytest test_flat.py # will not show "setting up" - pytest a/test_sub.py # will show "setting up" +     pytest test_flat.py --capture=no # will not show "setting up" + pytest a/test_sub.py --capture=no # will show "setting up" .. note:: If you have ``conftest.py`` files which do not reside in a @@ -103,16 +103,16 @@ Here is how you might run it:: Writing your own plugin ----------------------- -.. _`setuptools`: http://pypi.python.org/pypi/setuptools +.. _`setuptools`: https://pypi.org/project/setuptools/ If you want to write a plugin, there are many real-life examples you can copy from: * a custom collection example plugin: :ref:`yaml plugin` -* around 20 :ref:`builtin plugins` which provide pytest's own functionality +* builtin plugins which provide pytest's own functionality * many `external plugins `_ providing additional features -All of these plugins implement the documented `well specified hooks`_ +All of these plugins implement :ref:`hooks ` and/or :ref:`fixtures ` to extend and add functionality. .. note:: @@ -150,24 +150,16 @@ it in your setuptools-invocation: setup( name="myproject", - packages = ['myproject'] - + packages=["myproject"], # the following makes a plugin available to pytest - entry_points = { - 'pytest11': [ - 'name_of_plugin = myproject.pluginmodule', - ] - }, - + entry_points={"pytest11": ["name_of_plugin = myproject.pluginmodule"]}, # custom PyPI classifier for pytest plugins - classifiers=[ - "Framework :: Pytest", - ], + classifiers=["Framework :: Pytest"], ) If a package is installed this way, ``pytest`` will load ``myproject.pluginmodule`` as a plugin which can define -`well specified hooks`_. +:ref:`hooks `. .. note:: @@ -176,6 +168,8 @@ If a package is installed this way, ``pytest`` will load to make it easy for users to find your plugin. +.. _assertion-rewriting: + Assertion Rewriting ------------------- @@ -196,6 +190,7 @@ assertion rewriting to be enabled you need to ask ``pytest`` explicitly to rewrite this module before it gets imported. .. autofunction:: pytest.register_assert_rewrite + :noindex: This is especially important when you write a pytest plugin which is created using a package. The import hook only treats ``conftest.py`` @@ -210,11 +205,7 @@ With the following typical ``setup.py`` extract: .. code-block:: python - setup( - ... - entry_points={'pytest11': ['foo = pytest_foo.plugin']}, - ... - ) + setup(..., entry_points={"pytest11": ["foo = pytest_foo.plugin"]}, ...) In this case only ``pytest_foo/plugin.py`` will be rewritten. If the helper module also contains assert statements which need to be @@ -229,7 +220,7 @@ import ``helper.py`` normally. The contents of import pytest - pytest.register_assert_rewrite('pytest_foo.helper') + pytest.register_assert_rewrite("pytest_foo.helper") @@ -254,6 +245,18 @@ application modules: if ``myapp.testsupport.myplugin`` also declares ``pytest_plugins``, the contents of the variable will also be loaded as plugins, and so on. +.. _`requiring plugins in non-root conftests`: + +.. note:: + Requiring plugins using a ``pytest_plugins`` variable in non-root + ``conftest.py`` files is deprecated. + + This is important because ``conftest.py`` files implement per-directory + hook implementations, but once a plugin is imported, it will affect the + entire directory tree. In order to avoid confusion, defining + ``pytest_plugins`` in any ``conftest.py`` file which is not located in the + tests root directory is deprecated, and will raise a warning. + This mechanism makes it easy to share fixtures within applications or even external applications without the need to create external plugins using the ``setuptools``'s entry point technique. @@ -278,7 +281,7 @@ the plugin manager like this: .. sourcecode:: python - plugin = config.pluginmanager.getplugin("name_of_plugin") + plugin = config.pluginmanager.get_plugin("name_of_plugin") If you want to look at the names of existing plugins, use the ``--trace-config`` option. @@ -317,23 +320,25 @@ string value of ``Hello World!`` if we do not supply a value or ``Hello import pytest + def pytest_addoption(parser): - group = parser.getgroup('helloworld') + group = parser.getgroup("helloworld") group.addoption( - '--name', - action='store', - dest='name', - default='World', - help='Default "name" for hello().' + "--name", + action="store", + dest="name", + default="World", + help='Default "name" for hello().', ) + @pytest.fixture def hello(request): - name = request.config.getoption('name') + name = request.config.getoption("name") def _hello(name=None): if not name: - name = request.config.getoption('name') + name = request.config.getoption("name") return "Hello {name}!".format(name=name) return _hello @@ -349,7 +354,8 @@ return a result object, with which we can assert the tests' outcomes. """Make sure that our plugin works.""" # create a temporary conftest.py file - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture(params=[ @@ -359,16 +365,19 @@ return a result object, with which we can assert the tests' outcomes. ]) def name(request): return request.param - """) + """ + ) # create a temporary pytest test file - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_hello_default(hello): assert hello() == "Hello World!" def test_hello_name(hello, name): assert hello(name) == "Hello {0}!".format(name) - """) + """ + ) # run all tests with pytest result = testdir.runpytest() @@ -410,6 +419,7 @@ Let's look at a possible implementation: def pytest_collection_modifyitems(config, items): # called after collection is completed # you can modify the ``items`` list + ... Here, ``pytest`` will pass in ``config`` (the pytest config object) and ``items`` (the list of collected test items) but will not pass @@ -462,19 +472,24 @@ Here is an example definition of a hook wrapper:: @pytest.hookimpl(hookwrapper=True) def pytest_pyfunc_call(pyfuncitem): - # do whatever you want before the next hook executes + do_something_before_next_hook_executes() outcome = yield # outcome.excinfo may be None or a (cls, val, tb) tuple res = outcome.get_result() # will raise if outcome was exception - # postprocess result + + post_process_result(res) + + outcome.force_result(new_res) # to override the return value to the plugin system Note that hook wrappers don't return results themselves, they merely perform tracing or other side effects around the actual hook implementations. If the result of the underlying hook is a mutable object, they may modify that result but it's probably better to avoid it. +For more information, consult the `pluggy documentation `_. + Hook function ordering / call example ------------------------------------- @@ -491,11 +506,15 @@ after others, i.e. the position in the ``N``-sized list of functions: @pytest.hookimpl(tryfirst=True) def pytest_collection_modifyitems(items): # will execute as early as possible + ... + # Plugin 2 @pytest.hookimpl(trylast=True) def pytest_collection_modifyitems(items): # will execute as late as possible + ... + # Plugin 3 @pytest.hookimpl(hookwrapper=True) @@ -535,6 +554,7 @@ implemented by other plugins in order to alter behaviour or interact with the new plugin: .. autofunction:: pytest_addhooks + :noindex: Hooks are usually declared as do-nothing functions that contain only documentation describing when the hook will be called and what return values @@ -571,169 +591,3 @@ declaring the hook functions directly in your plugin module, for example:: This has the added benefit of allowing you to conditionally install hooks depending on which plugins are installed. - -.. _`well specified hooks`: - -.. currentmodule:: _pytest.hookspec - -pytest hook reference -===================== - - -Initialization, command line and configuration hooks ----------------------------------------------------- - -.. autofunction:: pytest_load_initial_conftests -.. autofunction:: pytest_cmdline_preparse -.. autofunction:: pytest_cmdline_parse -.. autofunction:: pytest_addoption -.. autofunction:: pytest_cmdline_main -.. autofunction:: pytest_configure -.. autofunction:: pytest_unconfigure - -Generic "runtest" hooks ------------------------ - -All runtest related hooks receive a :py:class:`pytest.Item <_pytest.main.Item>` object. - -.. autofunction:: pytest_runtest_protocol -.. autofunction:: pytest_runtest_setup -.. autofunction:: pytest_runtest_call -.. autofunction:: pytest_runtest_teardown -.. autofunction:: pytest_runtest_makereport - -For deeper understanding you may look at the default implementation of -these hooks in :py:mod:`_pytest.runner` and maybe also -in :py:mod:`_pytest.pdb` which interacts with :py:mod:`_pytest.capture` -and its input/output capturing in order to immediately drop -into interactive debugging when a test failure occurs. - -The :py:mod:`_pytest.terminal` reported specifically uses -the reporting hook to print information about a test run. - -Collection hooks ----------------- - -``pytest`` calls the following hooks for collecting files and directories: - -.. autofunction:: pytest_ignore_collect -.. autofunction:: pytest_collect_directory -.. autofunction:: pytest_collect_file - -For influencing the collection of objects in Python modules -you can use the following hook: - -.. autofunction:: pytest_pycollect_makeitem -.. autofunction:: pytest_generate_tests -.. autofunction:: pytest_make_parametrize_id - -After collection is complete, you can modify the order of -items, delete or otherwise amend the test items: - -.. autofunction:: pytest_collection_modifyitems - -Reporting hooks ---------------- - -Session related reporting hooks: - -.. autofunction:: pytest_collectstart -.. autofunction:: pytest_itemcollected -.. autofunction:: pytest_collectreport -.. autofunction:: pytest_deselected -.. autofunction:: pytest_report_header -.. autofunction:: pytest_report_collectionfinish -.. autofunction:: pytest_report_teststatus -.. autofunction:: pytest_terminal_summary -.. autofunction:: pytest_fixture_setup -.. autofunction:: pytest_fixture_post_finalizer - -And here is the central hook for reporting about -test execution: - -.. autofunction:: pytest_runtest_logreport - -You can also use this hook to customize assertion representation for some -types: - -.. autofunction:: pytest_assertrepr_compare - - -Debugging/Interaction hooks ---------------------------- - -There are few hooks which can be used for special -reporting or interaction with exceptions: - -.. autofunction:: pytest_internalerror -.. autofunction:: pytest_keyboard_interrupt -.. autofunction:: pytest_exception_interact -.. autofunction:: pytest_enter_pdb - - -Reference of objects involved in hooks -====================================== - -.. autoclass:: _pytest.config.Config() - :members: - -.. autoclass:: _pytest.config.Parser() - :members: - -.. autoclass:: _pytest.main.Node() - :members: - -.. autoclass:: _pytest.main.Collector() - :members: - :show-inheritance: - -.. autoclass:: _pytest.main.Item() - :members: - :show-inheritance: - -.. autoclass:: _pytest.python.Module() - :members: - :show-inheritance: - -.. autoclass:: _pytest.python.Class() - :members: - :show-inheritance: - -.. autoclass:: _pytest.python.Function() - :members: - :show-inheritance: - -.. autoclass:: _pytest.fixtures.FixtureDef() - :members: - :show-inheritance: - -.. autoclass:: _pytest.runner.CallInfo() - :members: - -.. autoclass:: _pytest.runner.TestReport() - :members: - :inherited-members: - -.. autoclass:: pluggy._Result - :members: - -.. autofunction:: _pytest.config.get_plugin_manager() - -.. autoclass:: _pytest.config.PytestPluginManager() - :members: - :undoc-members: - :show-inheritance: - -.. autoclass:: pluggy.PluginManager() - :members: - -.. currentmodule:: _pytest.pytester - -.. autoclass:: Testdir() - :members: runpytest,runpytest_subprocess,runpytest_inprocess,makeconftest,makepyfile - -.. autoclass:: RunResult() - :members: - -.. autoclass:: LineMatcher() - :members: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/xunit_setup.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/xunit_setup.rst index 148fb1209ea..7a6c099f559 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/xunit_setup.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/xunit_setup.rst @@ -6,7 +6,7 @@ classic xunit-style setup ======================================== This section describes a classic and popular way how you can implement -fixtures (setup and teardown test state) on a per-module/class/function basis. +fixtures (setup and teardown test state) on a per-module/class/function basis. .. note:: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/extra/get_issues.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/extra/get_issues.py index 2a8f8c31606..c026972b145 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/extra/get_issues.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/extra/get_issues.py @@ -1,11 +1,9 @@ import json import py -import textwrap +import requests issues_url = "https://api.github.com/repos/pytest-dev/pytest/issues" -import requests - def get_issues(): issues = [] @@ -16,16 +14,16 @@ def get_issues(): data = r.json() if r.status_code == 403: # API request limit exceeded - print(data['message']) + print(data["message"]) exit(1) issues.extend(data) # Look for next page - links = requests.utils.parse_header_links(r.headers['Link']) + links = requests.utils.parse_header_links(r.headers["Link"]) another_page = False for link in links: - if link['rel'] == 'next': - url = link['url'] + if link["rel"] == "next": + url = link["url"] another_page = True if not another_page: return issues @@ -46,17 +44,17 @@ def main(args): def _get_kind(issue): - labels = [l['name'] for l in issue['labels']] - for key in ('bug', 'enhancement', 'proposal'): + labels = [l["name"] for l in issue["labels"]] + for key in ("bug", "enhancement", "proposal"): if key in labels: return key - return 'issue' + return "issue" def report(issues): for issue in issues: title = issue["title"] - body = issue["body"] + # body = issue["body"] kind = _get_kind(issue) status = issue["state"] number = issue["number"] @@ -64,21 +62,23 @@ def report(issues): print("----") print(status, kind, link) print(title) - #print() - #lines = body.split("\n") - #print ("\n".join(lines[:3])) - #if len(lines) > 3 or len(body) > 240: + # print() + # lines = body.split("\n") + # print ("\n".join(lines[:3])) + # if len(lines) > 3 or len(body) > 240: # print ("...") print("\n\nFound %s open issues" % len(issues)) if __name__ == "__main__": import argparse + parser = argparse.ArgumentParser("process bitbucket issues") - parser.add_argument("--refresh", action="store_true", - help="invalidate cache, refresh issues") - parser.add_argument("--cache", action="store", default="issues.json", - help="cache file") + parser.add_argument( + "--refresh", action="store_true", help="invalidate cache, refresh issues" + ) + parser.add_argument( + "--cache", action="store", default="issues.json", help="cache file" + ) args = parser.parse_args() main(args) - diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/pyproject.toml b/tests/wpt/web-platform-tests/tools/third_party/pytest/pyproject.toml index 88571e208b9..65e6bf59bf1 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/pyproject.toml +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/pyproject.toml @@ -1,5 +1,13 @@ +[build-system] +requires = [ + "setuptools", + "setuptools-scm", + "wheel", +] + [tool.towncrier] package = "pytest" +package_dir = "src" filename = "CHANGELOG.rst" directory = "changelog/" template = "changelog/_template.rst" diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/scripts/check-rst.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/scripts/check-rst.py deleted file mode 100644 index 57f717501af..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/scripts/check-rst.py +++ /dev/null @@ -1,11 +0,0 @@ - -from __future__ import print_function - -import subprocess -import glob -import sys - -sys.exit(subprocess.call([ - 'rst-lint', '--encoding', 'utf-8', - 'CHANGELOG.rst', 'HOWTORELEASE.rst', 'README.rst', -] + glob.glob('changelog/[0-9]*.*'))) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/setup.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/setup.py index 3eb38efe655..3d60d6becf8 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/setup.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/setup.py @@ -2,113 +2,123 @@ import os import sys import setuptools import pkg_resources -from setuptools import setup, Command +from setuptools import setup classifiers = [ - 'Development Status :: 6 - Mature', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: POSIX', - 'Operating System :: Microsoft :: Windows', - 'Operating System :: MacOS :: MacOS X', - 'Topic :: Software Development :: Testing', - 'Topic :: Software Development :: Libraries', - 'Topic :: Utilities', + "Development Status :: 6 - Mature", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: POSIX", + "Operating System :: Microsoft :: Windows", + "Operating System :: MacOS :: MacOS X", + "Topic :: Software Development :: Testing", + "Topic :: Software Development :: Libraries", + "Topic :: Utilities", ] + [ - ('Programming Language :: Python :: %s' % x) - for x in '2 2.7 3 3.4 3.5 3.6'.split() + ("Programming Language :: Python :: %s" % x) + for x in "2 2.7 3 3.4 3.5 3.6 3.7".split() ] -with open('README.rst') as fd: +with open("README.rst") as fd: long_description = fd.read() -def has_environment_marker_support(): +def get_environment_marker_support_level(): """ - Tests that setuptools has support for PEP-426 environment marker support. + Tests how well setuptools supports PEP-426 environment marker. The first known release to support it is 0.7 (and the earliest on PyPI seems to be 0.7.2 - so we're using that), see: http://pythonhosted.org/setuptools/history.html#id142 + so we're using that), see: https://setuptools.readthedocs.io/en/latest/history.html#id350 + + The support is later enhanced to allow direct conditional inclusions inside install_requires, + which is now recommended by setuptools. It first appeared in 36.2.0, went broken with 36.2.1, and + again worked since 36.2.2, so we're using that. See: + https://setuptools.readthedocs.io/en/latest/history.html#v36-2-2 + https://github.com/pypa/setuptools/issues/1099 References: * https://wheel.readthedocs.io/en/latest/index.html#defining-conditional-dependencies * https://www.python.org/dev/peps/pep-0426/#environment-markers + * https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-platform-specific-dependencies """ try: - return pkg_resources.parse_version(setuptools.__version__) >= pkg_resources.parse_version('0.7.2') + version = pkg_resources.parse_version(setuptools.__version__) + if version >= pkg_resources.parse_version("36.2.2"): + return 2 + if version >= pkg_resources.parse_version("0.7.2"): + return 1 except Exception as exc: sys.stderr.write("Could not test setuptool's version: %s\n" % exc) - return False + + # as of testing on 2018-05-26 fedora was on version 37* and debian was on version 33+ + # we should consider erroring on those + return 0 def main(): extras_require = {} install_requires = [ - 'py>=1.5.0', - 'six>=1.10.0', - 'setuptools', - 'attrs>=17.2.0', + "py>=1.5.0", + "six>=1.10.0", + "setuptools", + "attrs>=17.4.0", + "more-itertools>=4.0.0", + "atomicwrites>=1.0", ] # if _PYTEST_SETUP_SKIP_PLUGGY_DEP is set, skip installing pluggy; # used by tox.ini to test with pluggy master - if '_PYTEST_SETUP_SKIP_PLUGGY_DEP' not in os.environ: - install_requires.append('pluggy>=0.5,<0.7') - if has_environment_marker_support(): - extras_require[':python_version<"3.0"'] = ['funcsigs'] - extras_require[':sys_platform=="win32"'] = ['colorama'] + if "_PYTEST_SETUP_SKIP_PLUGGY_DEP" not in os.environ: + install_requires.append("pluggy>=0.5,<0.7") + environment_marker_support_level = get_environment_marker_support_level() + if environment_marker_support_level >= 2: + install_requires.append('funcsigs;python_version<"3.0"') + install_requires.append('colorama;sys_platform=="win32"') + elif environment_marker_support_level == 1: + extras_require[':python_version<"3.0"'] = ["funcsigs"] + extras_require[':sys_platform=="win32"'] = ["colorama"] else: - if sys.platform == 'win32': - install_requires.append('colorama') + if sys.platform == "win32": + install_requires.append("colorama") if sys.version_info < (3, 0): - install_requires.append('funcsigs') + install_requires.append("funcsigs") setup( - name='pytest', - description='pytest: simple powerful testing with Python', + name="pytest", + description="pytest: simple powerful testing with Python", long_description=long_description, - use_scm_version={ - 'write_to': '_pytest/_version.py', + use_scm_version={"write_to": "src/_pytest/_version.py"}, + url="http://pytest.org", + project_urls={ + "Source": "https://github.com/pytest-dev/pytest", + "Tracker": "https://github.com/pytest-dev/pytest/issues", }, - url='http://pytest.org', - license='MIT license', - platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], + license="MIT license", + platforms=["unix", "linux", "osx", "cygwin", "win32"], author=( - 'Holger Krekel, Bruno Oliveira, Ronny Pfannschmidt, ' - 'Floris Bruynooghe, Brianna Laugher, Florian Bruhin and others'), - entry_points={'console_scripts': [ - 'pytest=pytest:main', 'py.test=pytest:main']}, + "Holger Krekel, Bruno Oliveira, Ronny Pfannschmidt, " + "Floris Bruynooghe, Brianna Laugher, Florian Bruhin and others" + ), + entry_points={"console_scripts": ["pytest=pytest:main", "py.test=pytest:main"]}, classifiers=classifiers, keywords="test unittest", - cmdclass={'test': PyTest}, # the following should be enabled for release - setup_requires=['setuptools-scm'], - python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', + setup_requires=["setuptools-scm"], + package_dir={"": "src"}, + python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", install_requires=install_requires, extras_require=extras_require, - packages=['_pytest', '_pytest.assertion', '_pytest._code'], - py_modules=['pytest'], + packages=[ + "_pytest", + "_pytest.assertion", + "_pytest._code", + "_pytest.mark", + "_pytest.config", + ], + py_modules=["pytest"], zip_safe=False, ) -class PyTest(Command): - user_options = [] - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - import subprocess - PPATH = [x for x in os.environ.get('PYTHONPATH', '').split(':') if x] - PPATH.insert(0, os.getcwd()) - os.environ['PYTHONPATH'] = ':'.join(PPATH) - errno = subprocess.call([sys.executable, 'pytest.py', '--ignore=doc']) - raise SystemExit(errno) - - -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/__init__.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/__init__.py similarity index 77% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/__init__.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/__init__.py index 6e41f0504e4..46c7827ed5e 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/__init__.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/__init__.py @@ -1,8 +1,8 @@ -__all__ = ['__version__'] +__all__ = ["__version__"] try: from ._version import version as __version__ except ImportError: # broken installation, we don't even try # unknown only works because we do poor mans version compare - __version__ = 'unknown' + __version__ = "unknown" diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/_argcomplete.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/_argcomplete.py similarity index 92% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/_argcomplete.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/_argcomplete.py index 0625a75f9f1..8f480d71d79 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/_argcomplete.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/_argcomplete.py @@ -60,8 +60,8 @@ import os from glob import glob -class FastFilesCompleter: - 'Fast file completer class' +class FastFilesCompleter(object): + "Fast file completer class" def __init__(self, directories=True): self.directories = directories @@ -74,21 +74,21 @@ class FastFilesCompleter: prefix_dir = 0 completion = [] globbed = [] - if '*' not in prefix and '?' not in prefix: + if "*" not in prefix and "?" not in prefix: # we are on unix, otherwise no bash if not prefix or prefix[-1] == os.path.sep: - globbed.extend(glob(prefix + '.*')) - prefix += '*' + globbed.extend(glob(prefix + ".*")) + prefix += "*" globbed.extend(glob(prefix)) for x in sorted(globbed): if os.path.isdir(x): - x += '/' + x += "/" # append stripping the prefix (like bash, not like compgen) completion.append(x[prefix_dir:]) return completion -if os.environ.get('_ARGCOMPLETE'): +if os.environ.get("_ARGCOMPLETE"): try: import argcomplete.completers except ImportError: @@ -97,7 +97,11 @@ if os.environ.get('_ARGCOMPLETE'): def try_argcomplete(parser): argcomplete.autocomplete(parser, always_complete_options=False) + + else: + def try_argcomplete(parser): pass + filescompleter = None diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/_code/__init__.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/_code/__init__.py similarity index 100% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/_code/__init__.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/_code/__init__.py diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/_code/_py2traceback.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/_code/_py2traceback.py similarity index 80% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/_code/_py2traceback.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/_code/_py2traceback.py index 5aacf0a428d..2dd100c33bd 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/_code/_py2traceback.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/_code/_py2traceback.py @@ -4,6 +4,7 @@ # from __future__ import absolute_import, division, print_function import types +from six import text_type def format_exception_only(etype, value): @@ -29,9 +30,12 @@ def format_exception_only(etype, value): # # Clear these out first because issubtype(string1, SyntaxError) # would throw another exception and mask the original problem. - if (isinstance(etype, BaseException) or - isinstance(etype, types.InstanceType) or - etype is None or type(etype) is str): + if ( + isinstance(etype, BaseException) + or isinstance(etype, types.InstanceType) + or etype is None + or type(etype) is str + ): return [_format_final_exc_line(etype, value)] stype = etype.__name__ @@ -50,14 +54,14 @@ def format_exception_only(etype, value): lines.append(' File "%s", line %d\n' % (filename, lineno)) if badline is not None: if isinstance(badline, bytes): # python 2 only - badline = badline.decode('utf-8', 'replace') - lines.append(u' %s\n' % badline.strip()) + badline = badline.decode("utf-8", "replace") + lines.append(u" %s\n" % badline.strip()) if offset is not None: - caretspace = badline.rstrip('\n')[:offset].lstrip() + caretspace = badline.rstrip("\n")[:offset].lstrip() # non-space whitespace (likes tabs) must be kept for alignment - caretspace = ((c.isspace() and c or ' ') for c in caretspace) + caretspace = ((c.isspace() and c or " ") for c in caretspace) # only three spaces to account for offset1 == pos 0 - lines.append(' %s^\n' % ''.join(caretspace)) + lines.append(" %s^\n" % "".join(caretspace)) value = msg lines.append(_format_final_exc_line(stype, value)) @@ -76,10 +80,10 @@ def _format_final_exc_line(etype, value): def _some_str(value): try: - return unicode(value) + return text_type(value) except Exception: try: return str(value) except Exception: pass - return '' % type(value).__name__ + return "" % type(value).__name__ diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/_code/code.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/_code/code.py similarity index 85% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/_code/code.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/_code/code.py index 3fb232bd430..cb788c17f04 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/_code/code.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/_code/code.py @@ -1,11 +1,16 @@ from __future__ import absolute_import, division, print_function +import inspect import sys +import traceback from inspect import CO_VARARGS, CO_VARKEYWORDS + +import attr import re from weakref import ref from _pytest.compat import _PY2, _PY3, PY35, safe_str - +from six import text_type import py + builtin_repr = repr if _PY3: @@ -57,6 +62,7 @@ class Code(object): """ return a _pytest._code.Source object for the full source file of the code """ from _pytest._code import source + full, _ = source.findsource(self.raw) return full @@ -65,6 +71,7 @@ class Code(object): """ # return source only for that part of code import _pytest._code + return _pytest._code.Source(self.raw) def getargs(self, var=False): @@ -97,6 +104,7 @@ class Frame(object): def statement(self): """ statement this frame is at """ import _pytest._code + if self.code.fullsource is None: return _pytest._code.Source("") return self.code.fullsource.getstatement(self.lineno) @@ -140,7 +148,7 @@ class Frame(object): try: retval.append((arg, self.f_locals[arg])) except KeyError: - pass # this can occur when using Psyco + pass # this can occur when using Psyco return retval @@ -162,6 +170,7 @@ class TracebackEntry(object): @property def frame(self): import _pytest._code + return _pytest._code.Frame(self._rawentry.tb_frame) @property @@ -184,6 +193,7 @@ class TracebackEntry(object): def getlocals(self): return self.frame.f_locals + locals = property(getlocals, None, None, "locals of underlaying frame") def getfirstlinesource(self): @@ -195,6 +205,7 @@ class TracebackEntry(object): # we use the passed in astcache to not reparse asttrees # within exception info printing from _pytest._code.source import getstatementrange_ast + source = self.frame.code.fullsource if source is None: return None @@ -205,8 +216,9 @@ class TracebackEntry(object): astnode = astcache.get(key, None) start = self.getfirstlinesource() try: - astnode, _, end = getstatementrange_ast(self.lineno, source, - astnode=astnode) + astnode, _, end = getstatementrange_ast( + self.lineno, source, astnode=astnode + ) except SyntaxError: end = self.lineno + 1 else: @@ -226,10 +238,10 @@ class TracebackEntry(object): mostly for internal use """ try: - tbh = self.frame.f_locals['__tracebackhide__'] + tbh = self.frame.f_locals["__tracebackhide__"] except KeyError: try: - tbh = self.frame.f_globals['__tracebackhide__'] + tbh = self.frame.f_globals["__tracebackhide__"] except KeyError: return False @@ -242,7 +254,7 @@ class TracebackEntry(object): try: fn = str(self.path) except py.error.Error: - fn = '???' + fn = "???" name = self.frame.code.name try: line = str(self.statement).lstrip() @@ -254,6 +266,7 @@ class TracebackEntry(object): def name(self): return self.frame.code.raw.co_name + name = property(name, None, None, "co_name of underlaying code") @@ -266,11 +279,13 @@ class Traceback(list): def __init__(self, tb, excinfo=None): """ initialize from given python traceback object and ExceptionInfo """ self._excinfo = excinfo - if hasattr(tb, 'tb_next'): + if hasattr(tb, "tb_next"): + def f(cur): while cur is not None: yield self.Entry(cur, excinfo=excinfo) cur = cur.tb_next + list.__init__(self, f(tb)) else: list.__init__(self, tb) @@ -288,11 +303,16 @@ class Traceback(list): for x in self: code = x.frame.code codepath = code.path - if ((path is None or codepath == path) and - (excludepath is None or not hasattr(codepath, 'relto') or - not codepath.relto(excludepath)) and - (lineno is None or x.lineno == lineno) and - (firstlineno is None or x.frame.code.firstlineno == firstlineno)): + if ( + (path is None or codepath == path) + and ( + excludepath is None + or not hasattr(codepath, "relto") + or not codepath.relto(excludepath) + ) + and (lineno is None or x.lineno == lineno) + and (firstlineno is None or x.frame.code.firstlineno == firstlineno) + ): return Traceback(x._rawentry, self._excinfo) return self @@ -341,35 +361,41 @@ class Traceback(list): f = entry.frame loc = f.f_locals for otherloc in values: - if f.is_true(f.eval(co_equal, - __recursioncache_locals_1=loc, - __recursioncache_locals_2=otherloc)): + if f.is_true( + f.eval( + co_equal, + __recursioncache_locals_1=loc, + __recursioncache_locals_2=otherloc, + ) + ): return i values.append(entry.frame.f_locals) return None -co_equal = compile('__recursioncache_locals_1 == __recursioncache_locals_2', - '?', 'eval') +co_equal = compile( + "__recursioncache_locals_1 == __recursioncache_locals_2", "?", "eval" +) class ExceptionInfo(object): """ wraps sys.exc_info() objects and offers help for navigating the traceback. """ - _striptext = '' - _assert_start_repr = "AssertionError(u\'assert " if _PY2 else "AssertionError(\'assert " + _striptext = "" + _assert_start_repr = "AssertionError(u'assert " if _PY2 else "AssertionError('assert " def __init__(self, tup=None, exprinfo=None): import _pytest._code + if tup is None: tup = sys.exc_info() if exprinfo is None and isinstance(tup[1], AssertionError): - exprinfo = getattr(tup[1], 'msg', None) + exprinfo = getattr(tup[1], "msg", None) if exprinfo is None: exprinfo = py.io.saferepr(tup[1]) if exprinfo and exprinfo.startswith(self._assert_start_repr): - self._striptext = 'AssertionError: ' + self._striptext = "AssertionError: " self._excinfo = tup #: the exception class self.type = tup[0] @@ -394,7 +420,7 @@ class ExceptionInfo(object): removed from the beginning) """ lines = format_exception_only(self.type, self.value) - text = ''.join(lines) + text = "".join(lines) text = text.rstrip() if tryshort: if text.startswith(self._striptext): @@ -411,8 +437,14 @@ class ExceptionInfo(object): path, lineno = entry.frame.code.raw.co_filename, entry.lineno return ReprFileLocation(path, lineno + 1, exconly) - def getrepr(self, showlocals=False, style="long", - abspath=False, tbfilter=True, funcargs=False): + def getrepr( + self, + showlocals=False, + style="long", + abspath=False, + tbfilter=True, + funcargs=False, + ): """ return str()able representation of this exception info. showlocals: show locals per traceback entry style: long|short|no|native traceback style @@ -420,16 +452,23 @@ class ExceptionInfo(object): in case of style==native, tbfilter and showlocals is ignored. """ - if style == 'native': - return ReprExceptionInfo(ReprTracebackNative( - py.std.traceback.format_exception( - self.type, - self.value, - self.traceback[0]._rawentry, - )), self._getreprcrash()) + if style == "native": + return ReprExceptionInfo( + ReprTracebackNative( + traceback.format_exception( + self.type, self.value, self.traceback[0]._rawentry + ) + ), + self._getreprcrash(), + ) - fmt = FormattedExcinfo(showlocals=showlocals, style=style, - abspath=abspath, tbfilter=tbfilter, funcargs=funcargs) + fmt = FormattedExcinfo( + showlocals=showlocals, + style=style, + abspath=abspath, + tbfilter=tbfilter, + funcargs=funcargs, + ) return fmt.repr_excinfo(self) def __str__(self): @@ -440,7 +479,7 @@ class ExceptionInfo(object): def __unicode__(self): entry = self.traceback[-1] loc = ReprFileLocation(entry.path, entry.lineno + 1, self.exconly()) - return unicode(loc) + return text_type(loc) def match(self, regexp): """ @@ -451,24 +490,23 @@ class ExceptionInfo(object): """ __tracebackhide__ = True if not re.search(regexp, str(self.value)): - assert 0, "Pattern '{0!s}' not found in '{1!s}'".format( - regexp, self.value) + assert 0, "Pattern '{!s}' not found in '{!s}'".format(regexp, self.value) return True +@attr.s class FormattedExcinfo(object): """ presenting information about failing Functions and Generators. """ # for traceback entries flow_marker = ">" fail_marker = "E" - def __init__(self, showlocals=False, style="long", abspath=True, tbfilter=True, funcargs=False): - self.showlocals = showlocals - self.style = style - self.tbfilter = tbfilter - self.funcargs = funcargs - self.abspath = abspath - self.astcache = {} + showlocals = attr.ib(default=False) + style = attr.ib(default="long") + abspath = attr.ib(default=True) + tbfilter = attr.ib(default=True) + funcargs = attr.ib(default=False) + astcache = attr.ib(default=attr.Factory(dict), init=False, repr=False) def _getindent(self, source): # figure out indent for given source @@ -504,6 +542,7 @@ class FormattedExcinfo(object): def get_source(self, source, line_index=-1, excinfo=None, short=False): """ return formatted and marked up source lines. """ import _pytest._code + lines = [] if source is None or line_index >= len(source.lines): source = _pytest._code.Source("???") @@ -528,7 +567,7 @@ class FormattedExcinfo(object): lines = [] indent = " " * indent # get the real exception information out - exlines = excinfo.exconly(tryshort=True).split('\n') + exlines = excinfo.exconly(tryshort=True).split("\n") failindent = self.fail_marker + indent[1:] for line in exlines: lines.append(failindent + line) @@ -543,7 +582,7 @@ class FormattedExcinfo(object): keys.sort() for name in keys: value = locals[name] - if name == '__builtins__': + if name == "__builtins__": lines.append("__builtins__ = ") else: # This formatting could all be handled by the @@ -556,11 +595,12 @@ class FormattedExcinfo(object): # else: # self._line("%-10s =\\" % (name,)) # # XXX - # py.std.pprint.pprint(value, stream=self.excinfowriter) + # pprint.pprint(value, stream=self.excinfowriter) return ReprLocals(lines) def repr_traceback_entry(self, entry, excinfo=None): import _pytest._code + source = self._getentrysource(entry) if source is None: source = _pytest._code.Source("???") @@ -637,11 +677,16 @@ class FormattedExcinfo(object): except Exception as e: max_frames = 10 extraline = ( - '!!! Recursion error detected, but an error occurred locating the origin of recursion.\n' - ' The following exception happened when comparing locals in the stack frame:\n' - ' {exc_type}: {exc_msg}\n' - ' Displaying first and last {max_frames} stack frames out of {total}.' - ).format(exc_type=type(e).__name__, exc_msg=safe_str(e), max_frames=max_frames, total=len(traceback)) + "!!! Recursion error detected, but an error occurred locating the origin of recursion.\n" + " The following exception happened when comparing locals in the stack frame:\n" + " {exc_type}: {exc_msg}\n" + " Displaying first and last {max_frames} stack frames out of {total}." + ).format( + exc_type=type(e).__name__, + exc_msg=safe_str(e), + max_frames=max_frames, + total=len(traceback), + ) traceback = traceback[:max_frames] + traceback[-max_frames:] else: if recursionindex is not None: @@ -669,18 +714,24 @@ class FormattedExcinfo(object): else: # fallback to native repr if the exception doesn't have a traceback: # ExceptionInfo objects require a full traceback to work - reprtraceback = ReprTracebackNative(py.std.traceback.format_exception(type(e), e, None)) + reprtraceback = ReprTracebackNative( + traceback.format_exception(type(e), e, None) + ) reprcrash = None repr_chain += [(reprtraceback, reprcrash, descr)] if e.__cause__ is not None: e = e.__cause__ - excinfo = ExceptionInfo((type(e), e, e.__traceback__)) if e.__traceback__ else None - descr = 'The above exception was the direct cause of the following exception:' + excinfo = ExceptionInfo( + (type(e), e, e.__traceback__) + ) if e.__traceback__ else None + descr = "The above exception was the direct cause of the following exception:" elif (e.__context__ is not None and not e.__suppress_context__): e = e.__context__ - excinfo = ExceptionInfo((type(e), e, e.__traceback__)) if e.__traceback__ else None - descr = 'During handling of the above exception, another exception occurred:' + excinfo = ExceptionInfo( + (type(e), e, e.__traceback__) + ) if e.__traceback__ else None + descr = "During handling of the above exception, another exception occurred:" else: e = None repr_chain.reverse() @@ -688,10 +739,11 @@ class FormattedExcinfo(object): class TerminalRepr(object): + def __str__(self): s = self.__unicode__() if _PY2: - s = s.encode('utf-8') + s = s.encode("utf-8") return s def __unicode__(self): @@ -707,6 +759,7 @@ class TerminalRepr(object): class ExceptionRepr(TerminalRepr): + def __init__(self): self.sections = [] @@ -720,6 +773,7 @@ class ExceptionRepr(TerminalRepr): class ExceptionChainRepr(ExceptionRepr): + def __init__(self, chain): super(ExceptionChainRepr, self).__init__() self.chain = chain @@ -738,6 +792,7 @@ class ExceptionChainRepr(ExceptionRepr): class ReprExceptionInfo(ExceptionRepr): + def __init__(self, reprtraceback, reprcrash): super(ReprExceptionInfo, self).__init__() self.reprtraceback = reprtraceback @@ -764,8 +819,11 @@ class ReprTraceback(TerminalRepr): entry.toterminal(tw) if i < len(self.reprentries) - 1: next_entry = self.reprentries[i + 1] - if entry.style == "long" or \ - entry.style == "short" and next_entry.style == "long": + if ( + entry.style == "long" + or entry.style == "short" + and next_entry.style == "long" + ): tw.sep(self.entrysep) if self.extraline: @@ -773,6 +831,7 @@ class ReprTraceback(TerminalRepr): class ReprTracebackNative(ReprTraceback): + def __init__(self, tblines): self.style = "native" self.reprentries = [ReprEntryNative(tblines)] @@ -822,12 +881,11 @@ class ReprEntry(TerminalRepr): self.reprfileloc.toterminal(tw) def __str__(self): - return "%s\n%s\n%s" % ("\n".join(self.lines), - self.reprlocals, - self.reprfileloc) + return "%s\n%s\n%s" % ("\n".join(self.lines), self.reprlocals, self.reprfileloc) class ReprFileLocation(TerminalRepr): + def __init__(self, path, lineno, message): self.path = str(path) self.lineno = lineno @@ -845,6 +903,7 @@ class ReprFileLocation(TerminalRepr): class ReprLocals(TerminalRepr): + def __init__(self, lines): self.lines = lines @@ -854,6 +913,7 @@ class ReprLocals(TerminalRepr): class ReprFuncArgs(TerminalRepr): + def __init__(self, args): self.args = args @@ -881,22 +941,26 @@ def getrawcode(obj, trycall=True): try: return obj.__code__ except AttributeError: - obj = getattr(obj, 'im_func', obj) - obj = getattr(obj, 'func_code', obj) - obj = getattr(obj, 'f_code', obj) - obj = getattr(obj, '__code__', obj) - if trycall and not hasattr(obj, 'co_firstlineno'): - if hasattr(obj, '__call__') and not py.std.inspect.isclass(obj): + obj = getattr(obj, "im_func", obj) + obj = getattr(obj, "func_code", obj) + obj = getattr(obj, "f_code", obj) + obj = getattr(obj, "__code__", obj) + if trycall and not hasattr(obj, "co_firstlineno"): + if hasattr(obj, "__call__") and not inspect.isclass(obj): x = getrawcode(obj.__call__, trycall=False) - if hasattr(x, 'co_firstlineno'): + if hasattr(x, "co_firstlineno"): return x return obj if PY35: # RecursionError introduced in 3.5 + def is_recursion_error(excinfo): return excinfo.errisinstance(RecursionError) # noqa + + else: + def is_recursion_error(excinfo): if not excinfo.errisinstance(RuntimeError): return False diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/_code/source.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/_code/source.py similarity index 72% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/_code/source.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/_code/source.py index 2638c598b74..6b982a4cac4 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/_code/source.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/_code/source.py @@ -1,40 +1,37 @@ from __future__ import absolute_import, division, generators, print_function +import ast +from ast import PyCF_ONLY_AST as _AST_FLAG from bisect import bisect_right +import linecache import sys import six import inspect import tokenize import py -cpy_compile = compile -try: - import _ast - from _ast import PyCF_ONLY_AST as _AST_FLAG -except ImportError: - _AST_FLAG = 0 - _ast = None +cpy_compile = compile class Source(object): - """ a immutable object holding a source code fragment, + """ an immutable object holding a source code fragment, possibly deindenting it. """ _compilecounter = 0 def __init__(self, *parts, **kwargs): self.lines = lines = [] - de = kwargs.get('deindent', True) - rstrip = kwargs.get('rstrip', True) + de = kwargs.get("deindent", True) + rstrip = kwargs.get("rstrip", True) for part in parts: if not part: partlines = [] - if isinstance(part, Source): + elif isinstance(part, Source): partlines = part.lines elif isinstance(part, (tuple, list)): partlines = [x.rstrip("\n") for x in part] elif isinstance(part, six.string_types): - partlines = part.split('\n') + partlines = part.split("\n") if rstrip: while partlines: if partlines[-1].strip(): @@ -82,7 +79,7 @@ class Source(object): source.lines[:] = self.lines[start:end] return source - def putaround(self, before='', after='', indent=' ' * 4): + def putaround(self, before="", after="", indent=" " * 4): """ return a copy of the source object with 'before' and 'after' wrapped around it. """ @@ -93,7 +90,7 @@ class Source(object): newsource.lines = before.lines + lines + after.lines return newsource - def indent(self, indent=' ' * 4): + def indent(self, indent=" " * 4): """ return a copy of the source object with all lines indented by the given indent-string. """ @@ -101,14 +98,14 @@ class Source(object): newsource.lines = [(indent + line) for line in self.lines] return newsource - def getstatement(self, lineno, assertion=False): + def getstatement(self, lineno): """ return Source statement which contains the given linenumber (counted from 0). """ - start, end = self.getstatementrange(lineno, assertion) + start, end = self.getstatementrange(lineno) return self[start:end] - def getstatementrange(self, lineno, assertion=False): + def getstatementrange(self, lineno): """ return (start, end) tuple which spans the minimal statement region which containing the given lineno. """ @@ -134,13 +131,7 @@ class Source(object): """ return True if source is parseable, heuristically deindenting it by default. """ - try: - import parser - except ImportError: - def syntax_checker(x): - return compile(x, 'asd', 'exec') - else: - syntax_checker = parser.suite + from parser import suite as syntax_checker if deindent: source = str(self.deindent()) @@ -148,7 +139,7 @@ class Source(object): source = str(self) try: # compile(source+'\n', "x", "exec") - syntax_checker(source + '\n') + syntax_checker(source + "\n") except KeyboardInterrupt: raise except Exception: @@ -159,9 +150,14 @@ class Source(object): def __str__(self): return "\n".join(self.lines) - def compile(self, filename=None, mode='exec', - flag=generators.compiler_flag, - dont_inherit=0, _genframe=None): + def compile( + self, + filename=None, + mode="exec", + flag=generators.compiler_flag, + dont_inherit=0, + _genframe=None, + ): """ return compiled code object. if filename is None invent an artificial filename which displays the source/line position of the caller frame. @@ -173,10 +169,10 @@ class Source(object): base = "<%d-codegen " % self._compilecounter self.__class__._compilecounter += 1 if not filename: - filename = base + '%s:%d>' % (fn, lineno) + filename = base + "%s:%d>" % (fn, lineno) else: - filename = base + '%r %s:%d>' % (filename, fn, lineno) - source = "\n".join(self.lines) + '\n' + filename = base + "%r %s:%d>" % (filename, fn, lineno) + source = "\n".join(self.lines) + "\n" try: co = cpy_compile(source, filename, mode, flag) except SyntaxError: @@ -184,9 +180,9 @@ class Source(object): # re-represent syntax errors from parsing python strings msglines = self.lines[:ex.lineno] if ex.offset: - msglines.append(" " * ex.offset + '^') + msglines.append(" " * ex.offset + "^") msglines.append("(code was compiled probably from here: %s)" % filename) - newex = SyntaxError('\n'.join(msglines)) + newex = SyntaxError("\n".join(msglines)) newex.offset = ex.offset newex.lineno = ex.lineno newex.text = ex.text @@ -195,21 +191,24 @@ class Source(object): if flag & _AST_FLAG: return co lines = [(x + "\n") for x in self.lines] - py.std.linecache.cache[filename] = (1, None, lines, filename) + linecache.cache[filename] = (1, None, lines, filename) return co + # # public API shortcut functions # -def compile_(source, filename=None, mode='exec', flags=generators.compiler_flag, dont_inherit=0): +def compile_( + source, filename=None, mode="exec", flags=generators.compiler_flag, dont_inherit=0 +): """ compile the given source to a raw code object, and maintain an internal cache which allows later retrieval of the source code for the code object and any recursively created code objects. """ - if _ast is not None and isinstance(source, _ast.AST): + if isinstance(source, ast.AST): # XXX should Source support having AST? return cpy_compile(source, filename, mode, flags, dont_inherit) _genframe = sys._getframe(1) # the caller @@ -222,13 +221,13 @@ def getfslineno(obj): """ Return source location (path, lineno) for the given object. If the source cannot be determined return ("", -1) """ - import _pytest._code + from .code import Code + try: - code = _pytest._code.Code(obj) + code = Code(obj) except TypeError: try: - fn = (py.std.inspect.getsourcefile(obj) or - py.std.inspect.getfile(obj)) + fn = inspect.getsourcefile(obj) or inspect.getfile(obj) except TypeError: return "", -1 @@ -245,6 +244,7 @@ def getfslineno(obj): assert isinstance(lineno, int) return fspath, lineno + # # helper functions # @@ -252,7 +252,7 @@ def getfslineno(obj): def findsource(obj): try: - sourcelines, lineno = py.std.inspect.findsource(obj) + sourcelines, lineno = inspect.findsource(obj) except py.builtin._sysex: raise except: # noqa @@ -263,12 +263,13 @@ def findsource(obj): def getsource(obj, **kwargs): - import _pytest._code - obj = _pytest._code.getrawcode(obj) + from .code import getrawcode + + obj = getrawcode(obj) try: strsrc = inspect.getsource(obj) except IndentationError: - strsrc = "\"Buggy python version consider upgrading, cannot get source\"" + strsrc = '"Buggy python version consider upgrading, cannot get source"' assert isinstance(strsrc, str) return Source(strsrc, **kwargs) @@ -289,14 +290,14 @@ def deindent(lines, offset=None): def readline_generator(lines): for line in lines: - yield line + '\n' - while True: - yield '' + yield line + "\n" it = readline_generator(lines) try: - for _, _, (sline, _), (eline, _), _ in tokenize.generate_tokens(lambda: next(it)): + for _, _, (sline, _), (eline, _), _ in tokenize.generate_tokens( + lambda: next(it) + ): if sline > len(lines): break # End of input reached if sline > len(newlines): @@ -318,13 +319,14 @@ def deindent(lines, offset=None): def get_statement_startend2(lineno, node): import ast + # flatten all statements and except handlers into one lineno-list # AST's line numbers start indexing at 1 values = [] for x in ast.walk(node): - if isinstance(x, _ast.stmt) or isinstance(x, _ast.ExceptHandler): + if isinstance(x, (ast.stmt, ast.ExceptHandler)): values.append(x.lineno - 1) - for name in "finalbody", "orelse": + for name in ("finalbody", "orelse"): val = getattr(x, name, None) if val: # treat the finally/orelse part as its own statement @@ -342,11 +344,8 @@ def get_statement_startend2(lineno, node): def getstatementrange_ast(lineno, source, assertion=False, astnode=None): if astnode is None: content = str(source) - try: - astnode = compile(content, "source", "exec", 1024) # 1024 for AST - except ValueError: - start, end = getstatementrange_old(lineno, source, assertion) - return None, start, end + astnode = compile(content, "source", "exec", 1024) # 1024 for AST + start, end = get_statement_startend2(lineno, astnode) # we need to correct the end: # - ast-parsing strips comments @@ -378,38 +377,3 @@ def getstatementrange_ast(lineno, source, assertion=False, astnode=None): else: break return astnode, start, end - - -def getstatementrange_old(lineno, source, assertion=False): - """ return (start, end) tuple which spans the minimal - statement region which containing the given lineno. - raise an IndexError if no such statementrange can be found. - """ - # XXX this logic is only used on python2.4 and below - # 1. find the start of the statement - from codeop import compile_command - for start in range(lineno, -1, -1): - if assertion: - line = source.lines[start] - # the following lines are not fully tested, change with care - if 'super' in line and 'self' in line and '__init__' in line: - raise IndexError("likely a subclass") - if "assert" not in line and "raise" not in line: - continue - trylines = source.lines[start:lineno + 1] - # quick hack to prepare parsing an indented line with - # compile_command() (which errors on "return" outside defs) - trylines.insert(0, 'def xxx():') - trysource = '\n '.join(trylines) - # ^ space here - try: - compile_command(trysource) - except (SyntaxError, OverflowError, ValueError): - continue - - # 2. find the end of the statement - for end in range(lineno + 1, len(source) + 1): - trysource = source[start:end] - if trysource.isparseable(): - return start, end - raise SyntaxError("no valid source range around line %d " % (lineno,)) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/assertion/__init__.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/assertion/__init__.py similarity index 83% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/assertion/__init__.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/assertion/__init__.py index a48e98c85aa..2c9a8890c9a 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/assertion/__init__.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/assertion/__init__.py @@ -12,17 +12,19 @@ from _pytest.assertion import truncate def pytest_addoption(parser): group = parser.getgroup("debugconfig") - group.addoption('--assert', - action="store", - dest="assertmode", - choices=("rewrite", "plain",), - default="rewrite", - metavar="MODE", - help="""Control assertion debugging tools. 'plain' + group.addoption( + "--assert", + action="store", + dest="assertmode", + choices=("rewrite", "plain"), + default="rewrite", + metavar="MODE", + help="""Control assertion debugging tools. 'plain' performs no assertion debugging. 'rewrite' (the default) rewrites assert statements in test modules on import to provide assert - expression information.""") + expression information.""", + ) def register_assert_rewrite(*names): @@ -38,7 +40,7 @@ def register_assert_rewrite(*names): """ for name in names: if not isinstance(name, str): - msg = 'expected module names as *args, got {0} instead' + msg = "expected module names as *args, got {0} instead" raise TypeError(msg.format(repr(names))) for hook in sys.meta_path: if isinstance(hook, rewrite.AssertionRewritingHook): @@ -56,7 +58,7 @@ class DummyRewriteHook(object): pass -class AssertionState: +class AssertionState(object): """State for the assertion plugin.""" def __init__(self, config, mode): @@ -68,13 +70,13 @@ class AssertionState: def install_importhook(config): """Try to install the rewrite hook, raise SystemError if it fails.""" # Jython has an AST bug that make the assertion rewriting hook malfunction. - if (sys.platform.startswith('java')): - raise SystemError('rewrite not supported') + if sys.platform.startswith("java"): + raise SystemError("rewrite not supported") - config._assertstate = AssertionState(config, 'rewrite') + config._assertstate = AssertionState(config, "rewrite") config._assertstate.hook = hook = rewrite.AssertionRewritingHook(config) sys.meta_path.insert(0, hook) - config._assertstate.trace('installed rewrite import hook') + config._assertstate.trace("installed rewrite import hook") def undo(): hook = config._assertstate.hook @@ -89,7 +91,7 @@ def pytest_collection(session): # this hook is only called when test modules are collected # so for example not in the master process of pytest-xdist # (which does not collect test modules) - assertstate = getattr(session.config, '_assertstate', None) + assertstate = getattr(session.config, "_assertstate", None) if assertstate: if assertstate.hook is not None: assertstate.hook.set_session(session) @@ -103,6 +105,7 @@ def pytest_runtest_setup(item): pytest_assertrepr_compare hook. This sets up this custom comparison for the test. """ + def callbinrepr(op, left, right): """Call the pytest_assertrepr_compare hook and prepare the result @@ -119,7 +122,8 @@ def pytest_runtest_setup(item): pretty printing. """ hook_result = item.ihook.pytest_assertrepr_compare( - config=item.config, op=op, left=left, right=right) + config=item.config, op=op, left=left, right=right + ) for new_expl in hook_result: if new_expl: new_expl = truncate.truncate_if_required(new_expl, item) @@ -128,6 +132,7 @@ def pytest_runtest_setup(item): if item.config.getvalue("assertmode") == "rewrite": res = res.replace("%", "%%") return res + util._reprcompare = callbinrepr @@ -136,7 +141,7 @@ def pytest_runtest_teardown(item): def pytest_sessionfinish(session): - assertstate = getattr(session.config, '_assertstate', None) + assertstate = getattr(session.config, "_assertstate", None) if assertstate: if assertstate.hook is not None: assertstate.hook.set_session(None) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/assertion/rewrite.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/assertion/rewrite.py similarity index 88% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/assertion/rewrite.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/assertion/rewrite.py index f64358f490b..eceed611ffb 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/assertion/rewrite.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/assertion/rewrite.py @@ -1,7 +1,6 @@ """Rewrite assertion AST to produce nice error messages""" from __future__ import absolute_import, division, print_function import ast -import _ast import errno import itertools import imp @@ -13,7 +12,9 @@ import struct import sys import types +import atomicwrites import py + from _pytest.assertion import util @@ -39,6 +40,7 @@ ASCII_IS_DEFAULT_ENCODING = sys.version_info[0] < 3 if sys.version_info >= (3, 5): ast_Call = ast.Call else: + def ast_Call(a, b, c): return ast.Call(a, b, c, None, None) @@ -141,7 +143,7 @@ class AssertionRewritingHook(object): # Probably a SyntaxError in the test. return None if write: - _make_rewritten_pyc(state, source_stat, pyc, co) + _write_pyc(state, co, source_stat, pyc) else: state.trace("found cached rewritten pyc for %r" % (fn,)) self.modules[name] = co, pyc @@ -150,14 +152,13 @@ class AssertionRewritingHook(object): def _should_rewrite(self, name, fn_pypath, state): # always rewrite conftest files fn = str(fn_pypath) - if fn_pypath.basename == 'conftest.py': + if fn_pypath.basename == "conftest.py": state.trace("rewriting conftest file: %r" % (fn,)) return True if self.session is not None: if self.session.isinitpath(fn): - state.trace("matched test file (was specified on cmdline): %r" % - (fn,)) + state.trace("matched test file (was specified on cmdline): %r" % (fn,)) return True # modules not passed explicitly on the command line are only @@ -168,7 +169,7 @@ class AssertionRewritingHook(object): return True for marked in self._must_rewrite: - if name == marked or name.startswith(marked + '.'): + if name == marked or name.startswith(marked + "."): state.trace("matched marked file %r (from %r)" % (name, marked)) return True @@ -180,17 +181,20 @@ class AssertionRewritingHook(object): The named module or package as well as any nested modules will be rewritten on import. """ - already_imported = set(names).intersection(set(sys.modules)) - if already_imported: - for name in already_imported: - if name not in self._rewritten_names: - self._warn_already_imported(name) + already_imported = ( + set(names).intersection(sys.modules).difference(self._rewritten_names) + ) + for name in already_imported: + if not AssertionRewriter.is_rewrite_disabled( + sys.modules[name].__doc__ or "" + ): + self._warn_already_imported(name) self._must_rewrite.update(names) def _warn_already_imported(self, name): self.config.warn( - 'P1', - 'Module already imported so cannot be rewritten: %s' % name) + "P1", "Module already imported so cannot be rewritten: %s" % name + ) def load_module(self, name): # If there is an existing module object named 'fullname' in @@ -234,6 +238,7 @@ class AssertionRewritingHook(object): """ try: import pkg_resources + # access an attribute in case a deferred importer is present pkg_resources.__name__ except ImportError: @@ -246,7 +251,7 @@ class AssertionRewritingHook(object): def get_data(self, pathname): """Optional PEP302 get_data API. """ - with open(pathname, 'rb') as f: + with open(pathname, "rb") as f: return f.read() @@ -257,22 +262,18 @@ def _write_pyc(state, co, source_stat, pyc): # sometime to be able to use imp.load_compiled to load them. (See # the comment in load_module above.) try: - fp = open(pyc, "wb") - except IOError: - err = sys.exc_info()[1].errno - state.trace("error writing pyc file at %s: errno=%s" % (pyc, err)) + with atomicwrites.atomic_write(pyc, mode="wb", overwrite=True) as fp: + fp.write(imp.get_magic()) + mtime = int(source_stat.mtime) + size = source_stat.size & 0xFFFFFFFF + fp.write(struct.pack(" 0 or - item.module != "__future__"): + elif ( + not isinstance(item, ast.ImportFrom) + or item.level > 0 + or item.module != "__future__" + ): lineno = item.lineno break pos += 1 else: lineno = item.lineno - imports = [ast.Import([alias], lineno=lineno, col_offset=0) - for alias in aliases] + imports = [ + ast.Import([alias], lineno=lineno, col_offset=0) for alias in aliases + ] mod.body[pos:pos] = imports # Collect asserts. nodes = [mod] @@ -630,13 +629,17 @@ class AssertionRewriter(ast.NodeVisitor): if isinstance(child, ast.AST): nodes.append(child) setattr(node, name, new) - elif (isinstance(field, ast.AST) and - # Don't recurse into expressions as they can't contain - # asserts. - not isinstance(field, ast.expr)): + elif ( + isinstance(field, ast.AST) + and + # Don't recurse into expressions as they can't contain + # asserts. + not isinstance(field, ast.expr) + ): nodes.append(field) - def is_rewrite_disabled(self, docstring): + @staticmethod + def is_rewrite_disabled(docstring): return "PYTEST_DONT_REWRITE" in docstring def variable(self): @@ -730,8 +733,11 @@ class AssertionRewriter(ast.NodeVisitor): """ if isinstance(assert_.test, ast.Tuple) and self.config is not None: fslocation = (self.module_path, assert_.lineno) - self.config.warn('R1', 'assertion is always true, perhaps ' - 'remove parentheses?', fslocation=fslocation) + self.config.warn( + "R1", + "assertion is always true, perhaps " "remove parentheses?", + fslocation=fslocation, + ) self.statements = [] self.variables = [] self.variable_counter = itertools.count() @@ -745,7 +751,7 @@ class AssertionRewriter(ast.NodeVisitor): negation = ast.UnaryOp(ast.Not(), top_condition) self.statements.append(ast.If(negation, body, [])) if assert_.msg: - assertmsg = self.helper('format_assertmsg', assert_.msg) + assertmsg = self.helper("format_assertmsg", assert_.msg) explanation = "\n>assert " + explanation else: assertmsg = ast.Str("") @@ -762,8 +768,7 @@ class AssertionRewriter(ast.NodeVisitor): body.append(raise_) # Clear temporary variables by setting them to None. if self.variables: - variables = [ast.Name(name, ast.Store()) - for name in self.variables] + variables = [ast.Name(name, ast.Store()) for name in self.variables] clear = ast.Assign(variables, _NameConstant(None)) self.statements.append(clear) # Fix line numbers. @@ -850,7 +855,7 @@ class AssertionRewriter(ast.NodeVisitor): else: # **args have `arg` keywords with an .arg of None arg_expls.append("**" + expl) - expl = "%s(%s)" % (func_expl, ', '.join(arg_expls)) + expl = "%s(%s)" % (func_expl, ", ".join(arg_expls)) new_call = ast.Call(new_func, new_args, new_kwargs) res = self.assign(new_call) res_expl = self.explanation_param(self.display(res)) @@ -860,7 +865,7 @@ class AssertionRewriter(ast.NodeVisitor): def visit_Starred(self, starred): # From Python 3.5, a Starred node can appear in a function call res, expl = self.visit(starred.value) - return starred, '*' + expl + return starred, "*" + expl def visit_Call_legacy(self, call): """ @@ -885,9 +890,8 @@ class AssertionRewriter(ast.NodeVisitor): if call.kwargs: new_kwarg, expl = self.visit(call.kwargs) arg_expls.append("**" + expl) - expl = "%s(%s)" % (func_expl, ', '.join(arg_expls)) - new_call = ast.Call(new_func, new_args, new_kwargs, - new_star, new_kwarg) + expl = "%s(%s)" % (func_expl, ", ".join(arg_expls)) + new_call = ast.Call(new_func, new_args, new_kwargs, new_star, new_kwarg) res = self.assign(new_call) res_expl = self.explanation_param(self.display(res)) outer_expl = "%s\n{%s = %s\n}" % (res_expl, res_expl, expl) @@ -914,8 +918,8 @@ class AssertionRewriter(ast.NodeVisitor): def visit_Compare(self, comp): self.push_format_context() left_res, left_expl = self.visit(comp.left) - if isinstance(comp.left, (_ast.Compare, _ast.BoolOp)): - left_expl = "({0})".format(left_expl) + if isinstance(comp.left, (ast.Compare, ast.BoolOp)): + left_expl = "({})".format(left_expl) res_variables = [self.variable() for i in range(len(comp.ops))] load_names = [ast.Name(v, ast.Load()) for v in res_variables] store_names = [ast.Name(v, ast.Store()) for v in res_variables] @@ -925,8 +929,8 @@ class AssertionRewriter(ast.NodeVisitor): results = [left_res] for i, op, next_operand in it: next_res, next_expl = self.visit(next_operand) - if isinstance(next_operand, (_ast.Compare, _ast.BoolOp)): - next_expl = "({0})".format(next_expl) + if isinstance(next_operand, (ast.Compare, ast.BoolOp)): + next_expl = "({})".format(next_expl) results.append(next_res) sym = binop_map[op.__class__] syms.append(ast.Str(sym)) @@ -936,11 +940,13 @@ class AssertionRewriter(ast.NodeVisitor): self.statements.append(ast.Assign([store_names[i]], res_expr)) left_res, left_expl = next_res, next_expl # Use pytest.assertion.util._reprcompare if that's available. - expl_call = self.helper("call_reprcompare", - ast.Tuple(syms, ast.Load()), - ast.Tuple(load_names, ast.Load()), - ast.Tuple(expls, ast.Load()), - ast.Tuple(results, ast.Load())) + expl_call = self.helper( + "call_reprcompare", + ast.Tuple(syms, ast.Load()), + ast.Tuple(load_names, ast.Load()), + ast.Tuple(expls, ast.Load()), + ast.Tuple(results, ast.Load()), + ) if len(comp.ops) > 1: res = ast.BoolOp(ast.And(), load_names) else: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/assertion/truncate.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/assertion/truncate.py similarity index 89% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/assertion/truncate.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/assertion/truncate.py index 2ed12e2e5a9..79adeca6a9a 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/assertion/truncate.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/assertion/truncate.py @@ -34,7 +34,7 @@ def _should_truncate_item(item): def _running_on_ci(): """Check if we're currently running on a CI system.""" - env_vars = ['CI', 'BUILD_NUMBER'] + env_vars = ["CI", "BUILD_NUMBER"] return any(var in os.environ for var in env_vars) @@ -67,16 +67,13 @@ def _truncate_explanation(input_lines, max_lines=None, max_chars=None): # Append useful message to explanation truncated_line_count = len(input_lines) - len(truncated_explanation) truncated_line_count += 1 # Account for the part-truncated final line - msg = '...Full output truncated' + msg = "...Full output truncated" if truncated_line_count == 1: - msg += ' ({0} line hidden)'.format(truncated_line_count) + msg += " ({} line hidden)".format(truncated_line_count) else: - msg += ' ({0} lines hidden)'.format(truncated_line_count) - msg += ", {0}" .format(USAGE_MSG) - truncated_explanation.extend([ - six.text_type(""), - six.text_type(msg), - ]) + msg += " ({} lines hidden)".format(truncated_line_count) + msg += ", {}".format(USAGE_MSG) + truncated_explanation.extend([six.text_type(""), six.text_type(msg)]) return truncated_explanation diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/assertion/util.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/assertion/util.py similarity index 63% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/assertion/util.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/assertion/util.py index 511d98ef1fd..bcb800a4a07 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/assertion/util.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/assertion/util.py @@ -5,11 +5,7 @@ import pprint import _pytest._code import py import six -try: - from collections import Sequence -except ImportError: - Sequence = list - +from ..compat import Sequence u = six.text_type @@ -24,7 +20,7 @@ _reprcompare = None # with non-ascii characters (see issue 877 and 1379) def ecu(s): try: - return u(s, 'utf-8', 'replace') + return u(s, "utf-8", "replace") except TypeError: return s @@ -42,7 +38,7 @@ def format_explanation(explanation): explanation = ecu(explanation) lines = _split_explanation(explanation) result = _format_lines(lines) - return u('\n').join(result) + return u("\n").join(result) def _split_explanation(explanation): @@ -52,13 +48,13 @@ def _split_explanation(explanation): Any other newlines will be escaped and appear in the line as the literal '\n' characters. """ - raw_lines = (explanation or u('')).split('\n') + raw_lines = (explanation or u("")).split("\n") lines = [raw_lines[0]] for values in raw_lines[1:]: - if values and values[0] in ['{', '}', '~', '>']: + if values and values[0] in ["{", "}", "~", ">"]: lines.append(values) else: - lines[-1] += '\\n' + values + lines[-1] += "\\n" + values return lines @@ -75,24 +71,24 @@ def _format_lines(lines): stack = [0] stackcnt = [0] for line in lines[1:]: - if line.startswith('{'): + if line.startswith("{"): if stackcnt[-1]: - s = u('and ') + s = u("and ") else: - s = u('where ') + s = u("where ") stack.append(len(result)) stackcnt[-1] += 1 stackcnt.append(0) - result.append(u(' +') + u(' ') * (len(stack) - 1) + s + line[1:]) - elif line.startswith('}'): + result.append(u(" +") + u(" ") * (len(stack) - 1) + s + line[1:]) + elif line.startswith("}"): stack.pop() stackcnt.pop() result[stack[-1]] += line[1:] else: - assert line[0] in ['~', '>'] + assert line[0] in ["~", ">"] stack[-1] += 1 - indent = len(stack) if line.startswith('~') else len(stack) - 1 - result.append(u(' ') * indent + line[1:]) + indent = len(stack) if line.startswith("~") else len(stack) - 1 + result.append(u(" ") * indent + line[1:]) assert len(stack) == 1 return result @@ -110,10 +106,10 @@ def assertrepr_compare(config, op, left, right): left_repr = py.io.saferepr(left, maxsize=int(width // 2)) right_repr = py.io.saferepr(right, maxsize=width - len(left_repr)) - summary = u('%s %s %s') % (ecu(left_repr), op, ecu(right_repr)) + summary = u("%s %s %s") % (ecu(left_repr), op, ecu(right_repr)) def issequence(x): - return (isinstance(x, (list, tuple, Sequence)) and not isinstance(x, basestring)) + return isinstance(x, Sequence) and not isinstance(x, basestring) def istext(x): return isinstance(x, basestring) @@ -131,10 +127,10 @@ def assertrepr_compare(config, op, left, right): except TypeError: return False - verbose = config.getoption('verbose') + verbose = config.getoption("verbose") explanation = None try: - if op == '==': + if op == "==": if istext(left) and istext(right): explanation = _diff_text(left, right, verbose) else: @@ -150,14 +146,17 @@ def assertrepr_compare(config, op, left, right): explanation.extend(expl) else: explanation = expl - elif op == 'not in': + elif op == "not in": if istext(left) and istext(right): explanation = _notin_text(left, right, verbose) except Exception: explanation = [ - u('(pytest_assertion plugin: representation of details failed. ' - 'Probably an object has a faulty __repr__.)'), - u(_pytest._code.ExceptionInfo())] + u( + "(pytest_assertion plugin: representation of details failed. " + "Probably an object has a faulty __repr__.)" + ), + u(_pytest._code.ExceptionInfo()), + ] if not explanation: return None @@ -174,20 +173,35 @@ def _diff_text(left, right, verbose=False): If the input are bytes they will be safely converted to text. """ from difflib import ndiff + explanation = [] + + def escape_for_readable_diff(binary_text): + """ + Ensures that the internal string is always valid unicode, converting any bytes safely to valid unicode. + This is done using repr() which then needs post-processing to fix the encompassing quotes and un-escape + newlines and carriage returns (#429). + """ + r = six.text_type(repr(binary_text)[1:-1]) + r = r.replace(r"\n", "\n") + r = r.replace(r"\r", "\r") + return r + if isinstance(left, six.binary_type): - left = u(repr(left)[1:-1]).replace(r'\n', '\n') + left = escape_for_readable_diff(left) if isinstance(right, six.binary_type): - right = u(repr(right)[1:-1]).replace(r'\n', '\n') + right = escape_for_readable_diff(right) if not verbose: i = 0 # just in case left or right has zero length for i in range(min(len(left), len(right))): if left[i] != right[i]: break if i > 42: - i -= 10 # Provide some context - explanation = [u('Skipping %s identical leading ' - 'characters in diff, use -v to show') % i] + i -= 10 # Provide some context + explanation = [ + u("Skipping %s identical leading " "characters in diff, use -v to show") + % i + ] left = left[i:] right = right[i:] if len(left) == len(right): @@ -195,36 +209,48 @@ def _diff_text(left, right, verbose=False): if left[-i] != right[-i]: break if i > 42: - i -= 10 # Provide some context - explanation += [u('Skipping %s identical trailing ' - 'characters in diff, use -v to show') % i] + i -= 10 # Provide some context + explanation += [ + u( + "Skipping %s identical trailing " + "characters in diff, use -v to show" + ) + % i + ] left = left[:-i] right = right[:-i] keepends = True - explanation += [line.strip('\n') - for line in ndiff(left.splitlines(keepends), - right.splitlines(keepends))] + if left.isspace() or right.isspace(): + left = repr(str(left)) + right = repr(str(right)) + explanation += [u"Strings contain only whitespace, escaping them using repr()"] + explanation += [ + line.strip("\n") + for line in ndiff(left.splitlines(keepends), right.splitlines(keepends)) + ] return explanation def _compare_eq_iterable(left, right, verbose=False): if not verbose: - return [u('Use -v to get the full diff')] + return [u("Use -v to get the full diff")] # dynamic import to speedup pytest import difflib try: left_formatting = pprint.pformat(left).splitlines() right_formatting = pprint.pformat(right).splitlines() - explanation = [u('Full diff:')] + explanation = [u("Full diff:")] except Exception: # hack: PrettyPrinter.pformat() in python 2 fails when formatting items that can't be sorted(), ie, calling # sorted() on a list would raise. See issue #718. # As a workaround, the full diff is generated by using the repr() string of each item of each container. left_formatting = sorted(repr(x) for x in left) right_formatting = sorted(repr(x) for x in right) - explanation = [u('Full diff (fallback to calling repr on each item):')] - explanation.extend(line.strip() for line in difflib.ndiff(left_formatting, right_formatting)) + explanation = [u("Full diff (fallback to calling repr on each item):")] + explanation.extend( + line.strip() for line in difflib.ndiff(left_formatting, right_formatting) + ) return explanation @@ -232,16 +258,18 @@ def _compare_eq_sequence(left, right, verbose=False): explanation = [] for i in range(min(len(left), len(right))): if left[i] != right[i]: - explanation += [u('At index %s diff: %r != %r') - % (i, left[i], right[i])] + explanation += [u("At index %s diff: %r != %r") % (i, left[i], right[i])] break if len(left) > len(right): - explanation += [u('Left contains more items, first extra item: %s') - % py.io.saferepr(left[len(right)],)] + explanation += [ + u("Left contains more items, first extra item: %s") + % py.io.saferepr(left[len(right)]) + ] elif len(left) < len(right): explanation += [ - u('Right contains more items, first extra item: %s') % - py.io.saferepr(right[len(left)],)] + u("Right contains more items, first extra item: %s") + % py.io.saferepr(right[len(left)]) + ] return explanation @@ -250,11 +278,11 @@ def _compare_eq_set(left, right, verbose=False): diff_left = left - right diff_right = right - left if diff_left: - explanation.append(u('Extra items in the left set:')) + explanation.append(u("Extra items in the left set:")) for item in diff_left: explanation.append(py.io.saferepr(item)) if diff_right: - explanation.append(u('Extra items in the right set:')) + explanation.append(u("Extra items in the right set:")) for item in diff_right: explanation.append(py.io.saferepr(item)) return explanation @@ -263,29 +291,31 @@ def _compare_eq_set(left, right, verbose=False): def _compare_eq_dict(left, right, verbose=False): explanation = [] common = set(left).intersection(set(right)) - same = dict((k, left[k]) for k in common if left[k] == right[k]) + same = {k: left[k] for k in common if left[k] == right[k]} if same and verbose < 2: - explanation += [u('Omitting %s identical items, use -vv to show') % - len(same)] + explanation += [u("Omitting %s identical items, use -vv to show") % len(same)] elif same: - explanation += [u('Common items:')] + explanation += [u("Common items:")] explanation += pprint.pformat(same).splitlines() - diff = set(k for k in common if left[k] != right[k]) + diff = {k for k in common if left[k] != right[k]} if diff: - explanation += [u('Differing items:')] + explanation += [u("Differing items:")] for k in diff: - explanation += [py.io.saferepr({k: left[k]}) + ' != ' + - py.io.saferepr({k: right[k]})] + explanation += [ + py.io.saferepr({k: left[k]}) + " != " + py.io.saferepr({k: right[k]}) + ] extra_left = set(left) - set(right) if extra_left: - explanation.append(u('Left contains more items:')) - explanation.extend(pprint.pformat( - dict((k, left[k]) for k in extra_left)).splitlines()) + explanation.append(u("Left contains more items:")) + explanation.extend( + pprint.pformat({k: left[k] for k in extra_left}).splitlines() + ) extra_right = set(right) - set(left) if extra_right: - explanation.append(u('Right contains more items:')) - explanation.extend(pprint.pformat( - dict((k, right[k]) for k in extra_right)).splitlines()) + explanation.append(u("Right contains more items:")) + explanation.extend( + pprint.pformat({k: right[k] for k in extra_right}).splitlines() + ) return explanation @@ -295,14 +325,14 @@ def _notin_text(term, text, verbose=False): tail = text[index + len(term):] correct_text = head + tail diff = _diff_text(correct_text, text, verbose) - newdiff = [u('%s is contained here:') % py.io.saferepr(term, maxsize=42)] + newdiff = [u("%s is contained here:") % py.io.saferepr(term, maxsize=42)] for line in diff: - if line.startswith(u('Skipping')): + if line.startswith(u("Skipping")): continue - if line.startswith(u('- ')): + if line.startswith(u("- ")): continue - if line.startswith(u('+ ')): - newdiff.append(u(' ') + line[2:]) + if line.startswith(u("+ ")): + newdiff.append(u(" ") + line[2:]) else: newdiff.append(line) return newdiff diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/cacheprovider.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/cacheprovider.py similarity index 58% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/cacheprovider.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/cacheprovider.py index c537c14472b..eb0fcc06f9b 100755 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/cacheprovider.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/cacheprovider.py @@ -5,7 +5,12 @@ the name cache was not chosen to ensure pluggy automatically ignores the external pytest-cache """ from __future__ import absolute_import, division, print_function + +from collections import OrderedDict + import py +import six + import pytest import json import os @@ -13,11 +18,12 @@ from os.path import sep as _sep, altsep as _altsep class Cache(object): + def __init__(self, config): self.config = config self._cachedir = Cache.cache_dir_from_config(config) self.trace = config.trace.root.get("cache") - if config.getvalue("cacheclear"): + if config.getoption("cacheclear"): self.trace("clearing cachedir") if self._cachedir.check(): self._cachedir.remove() @@ -48,7 +54,7 @@ class Cache(object): return self._cachedir.ensure_dir("d", name) def _getvaluepath(self, key): - return self._cachedir.join('v', *key.split('/')) + return self._cachedir.join("v", *key.split("/")) def get(self, key, default): """ return cached value for the given key. If no value @@ -84,82 +90,88 @@ class Cache(object): path.dirpath().ensure_dir() except (py.error.EEXIST, py.error.EACCES): self.config.warn( - code='I9', message='could not create cache path %s' % (path,) + code="I9", message="could not create cache path %s" % (path,) ) return try: - f = path.open('w') + f = path.open("w") except py.error.ENOTDIR: self.config.warn( - code='I9', message='cache could not write path %s' % (path,)) + code="I9", message="cache could not write path %s" % (path,) + ) else: with f: - self.trace("cache-write %s: %r" % (key, value,)) + self.trace("cache-write %s: %r" % (key, value)) json.dump(value, f, indent=2, sort_keys=True) -class LFPlugin: +class LFPlugin(object): """ Plugin which implements the --lf (run last-failing) option """ def __init__(self, config): self.config = config - active_keys = 'lf', 'failedfirst' - self.active = any(config.getvalue(key) for key in active_keys) + active_keys = "lf", "failedfirst" + self.active = any(config.getoption(key) for key in active_keys) self.lastfailed = config.cache.get("cache/lastfailed", {}) self._previously_failed_count = None + self._no_failures_behavior = self.config.getoption("last_failed_no_failures") def pytest_report_collectionfinish(self): if self.active: if not self._previously_failed_count: - mode = "run all (no recorded failures)" + mode = "run {} (no recorded failures)".format( + self._no_failures_behavior + ) else: - noun = 'failure' if self._previously_failed_count == 1 else 'failures' - suffix = " first" if self.config.getvalue("failedfirst") else "" + noun = "failure" if self._previously_failed_count == 1 else "failures" + suffix = " first" if self.config.getoption("failedfirst") else "" mode = "rerun previous {count} {noun}{suffix}".format( count=self._previously_failed_count, suffix=suffix, noun=noun ) return "run-last-failure: %s" % mode def pytest_runtest_logreport(self, report): - if (report.when == 'call' and report.passed) or report.skipped: + if (report.when == "call" and report.passed) or report.skipped: self.lastfailed.pop(report.nodeid, None) elif report.failed: self.lastfailed[report.nodeid] = True def pytest_collectreport(self, report): - passed = report.outcome in ('passed', 'skipped') + passed = report.outcome in ("passed", "skipped") if passed: if report.nodeid in self.lastfailed: self.lastfailed.pop(report.nodeid) - self.lastfailed.update( - (item.nodeid, True) - for item in report.result) + self.lastfailed.update((item.nodeid, True) for item in report.result) else: self.lastfailed[report.nodeid] = True def pytest_collection_modifyitems(self, session, config, items): - if self.active and self.lastfailed: - previously_failed = [] - previously_passed = [] - for item in items: - if item.nodeid in self.lastfailed: - previously_failed.append(item) + if self.active: + if self.lastfailed: + previously_failed = [] + previously_passed = [] + for item in items: + if item.nodeid in self.lastfailed: + previously_failed.append(item) + else: + previously_passed.append(item) + self._previously_failed_count = len(previously_failed) + if not previously_failed: + # running a subset of all tests with recorded failures outside + # of the set of tests currently executing + return + if self.config.getoption("lf"): + items[:] = previously_failed + config.hook.pytest_deselected(items=previously_passed) else: - previously_passed.append(item) - self._previously_failed_count = len(previously_failed) - if not previously_failed: - # running a subset of all tests with recorded failures outside - # of the set of tests currently executing - return - if self.config.getvalue("lf"): - items[:] = previously_failed - config.hook.pytest_deselected(items=previously_passed) - else: - items[:] = previously_failed + previously_passed + items[:] = previously_failed + previously_passed + elif self._no_failures_behavior == "none": + config.hook.pytest_deselected(items=items) + items[:] = [] def pytest_sessionfinish(self, session): config = self.config - if config.getvalue("cacheshow") or hasattr(config, "slaveinput"): + if config.getoption("cacheshow") or hasattr(config, "slaveinput"): return saved_lastfailed = config.cache.get("cache/lastfailed", {}) @@ -167,31 +179,98 @@ class LFPlugin: config.cache.set("cache/lastfailed", self.lastfailed) +class NFPlugin(object): + """ Plugin which implements the --nf (run new-first) option """ + + def __init__(self, config): + self.config = config + self.active = config.option.newfirst + self.cached_nodeids = config.cache.get("cache/nodeids", []) + + def pytest_collection_modifyitems(self, session, config, items): + if self.active: + new_items = OrderedDict() + other_items = OrderedDict() + for item in items: + if item.nodeid not in self.cached_nodeids: + new_items[item.nodeid] = item + else: + other_items[item.nodeid] = item + + items[:] = self._get_increasing_order( + six.itervalues(new_items) + ) + self._get_increasing_order( + six.itervalues(other_items) + ) + self.cached_nodeids = [x.nodeid for x in items if isinstance(x, pytest.Item)] + + def _get_increasing_order(self, items): + return sorted(items, key=lambda item: item.fspath.mtime(), reverse=True) + + def pytest_sessionfinish(self, session): + config = self.config + if config.getoption("cacheshow") or hasattr(config, "slaveinput"): + return + + config.cache.set("cache/nodeids", self.cached_nodeids) + + def pytest_addoption(parser): group = parser.getgroup("general") group.addoption( - '--lf', '--last-failed', action='store_true', dest="lf", + "--lf", + "--last-failed", + action="store_true", + dest="lf", help="rerun only the tests that failed " - "at the last run (or all if none failed)") + "at the last run (or all if none failed)", + ) group.addoption( - '--ff', '--failed-first', action='store_true', dest="failedfirst", + "--ff", + "--failed-first", + action="store_true", + dest="failedfirst", help="run all tests but run the last failures first. " - "This may re-order tests and thus lead to " - "repeated fixture setup/teardown") + "This may re-order tests and thus lead to " + "repeated fixture setup/teardown", + ) group.addoption( - '--cache-show', action='store_true', dest="cacheshow", - help="show cache contents, don't perform collection or tests") + "--nf", + "--new-first", + action="store_true", + dest="newfirst", + help="run tests from new files first, then the rest of the tests " + "sorted by file mtime", + ) group.addoption( - '--cache-clear', action='store_true', dest="cacheclear", - help="remove all cache contents at start of test run.") - parser.addini( - "cache_dir", default='.cache', - help="cache directory path.") + "--cache-show", + action="store_true", + dest="cacheshow", + help="show cache contents, don't perform collection or tests", + ) + group.addoption( + "--cache-clear", + action="store_true", + dest="cacheclear", + help="remove all cache contents at start of test run.", + ) + parser.addini("cache_dir", default=".pytest_cache", help="cache directory path.") + group.addoption( + "--lfnf", + "--last-failed-no-failures", + action="store", + dest="last_failed_no_failures", + choices=("all", "none"), + default="all", + help="change the behavior when no test failed in the last run or no " + "information about the last failures was found in the cache", + ) def pytest_cmdline_main(config): if config.option.cacheshow: from _pytest.main import wrap_session + return wrap_session(config, cacheshow) @@ -199,6 +278,7 @@ def pytest_cmdline_main(config): def pytest_configure(config): config.cache = Cache(config) config.pluginmanager.register(LFPlugin(config), "lfplugin") + config.pluginmanager.register(NFPlugin(config), "nfplugin") @pytest.fixture @@ -225,6 +305,7 @@ def pytest_report_header(config): def cacheshow(config, session): from pprint import pprint + tw = py.io.TerminalWriter() tw.line("cachedir: " + str(config.cache._cachedir)) if not config.cache._cachedir.check(): @@ -238,8 +319,7 @@ def cacheshow(config, session): key = valpath.relto(vdir).replace(valpath.sep, "/") val = config.cache.get(key, dummy) if val is dummy: - tw.line("%s contains unreadable content, " - "will be ignored" % key) + tw.line("%s contains unreadable content, " "will be ignored" % key) else: tw.line("%s contains:" % key) stream = py.io.TextIO() @@ -255,6 +335,5 @@ def cacheshow(config, session): # print("%s/" % p.relto(basedir)) if p.isfile(): key = p.relto(basedir) - tw.line("%s is a file of length %d" % ( - key, p.size())) + tw.line("%s is a file of length %d" % (key, p.size())) return 0 diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/capture.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/capture.py similarity index 84% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/capture.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/capture.py index f2ebe38c8c0..7a57adb752a 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/capture.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/capture.py @@ -17,19 +17,26 @@ import pytest from _pytest.compat import CaptureIO -patchsysdict = {0: 'stdin', 1: 'stdout', 2: 'stderr'} +patchsysdict = {0: "stdin", 1: "stdout", 2: "stderr"} def pytest_addoption(parser): group = parser.getgroup("general") group._addoption( - '--capture', action="store", + "--capture", + action="store", default="fd" if hasattr(os, "dup") else "sys", - metavar="method", choices=['fd', 'sys', 'no'], - help="per-test capturing method: one of fd|sys|no.") + metavar="method", + choices=["fd", "sys", "no"], + help="per-test capturing method: one of fd|sys|no.", + ) group._addoption( - '-s', action="store_const", const="no", dest="capture", - help="shortcut for --capture=no.") + "-s", + action="store_const", + const="no", + dest="capture", + help="shortcut for --capture=no.", + ) @pytest.hookimpl(hookwrapper=True) @@ -50,6 +57,7 @@ def pytest_load_initial_conftests(early_config, parser, args): def silence_logging_at_shutdown(): if "logging" in sys.modules: sys.modules["logging"].raiseExceptions = False + early_config.add_cleanup(silence_logging_at_shutdown) # finally trigger conftest loading but while capturing (issue93) @@ -61,7 +69,7 @@ def pytest_load_initial_conftests(early_config, parser, args): sys.stderr.write(err) -class CaptureManager: +class CaptureManager(object): """ Capture plugin, manages that the appropriate capture method is enabled/disabled during collection and each test phase (setup, call, teardown). After each of those points, the captured output is obtained and @@ -180,59 +188,59 @@ class CaptureManager: item.add_report_section(when, "stderr", err) -capture_fixtures = {'capfd', 'capfdbinary', 'capsys', 'capsysbinary'} +capture_fixtures = {"capfd", "capfdbinary", "capsys", "capsysbinary"} def _ensure_only_one_capture_fixture(request, name): - fixtures = set(request.fixturenames) & capture_fixtures - set((name,)) + fixtures = set(request.fixturenames) & capture_fixtures - {name} if fixtures: fixtures = sorted(fixtures) fixtures = fixtures[0] if len(fixtures) == 1 else fixtures raise request.raiseerror( - "cannot use {0} and {1} at the same time".format( - fixtures, name, - ), + "cannot use {} and {} at the same time".format(fixtures, name) ) @pytest.fixture def capsys(request): - """Enable capturing of writes to sys.stdout/sys.stderr and make + """Enable capturing of writes to ``sys.stdout`` and ``sys.stderr`` and make captured output available via ``capsys.readouterr()`` method calls - which return a ``(out, err)`` tuple. ``out`` and ``err`` will be ``text`` + which return a ``(out, err)`` namedtuple. ``out`` and ``err`` will be ``text`` objects. """ - _ensure_only_one_capture_fixture(request, 'capsys') + _ensure_only_one_capture_fixture(request, "capsys") with _install_capture_fixture_on_item(request, SysCapture) as fixture: yield fixture @pytest.fixture def capsysbinary(request): - """Enable capturing of writes to sys.stdout/sys.stderr and make + """Enable capturing of writes to ``sys.stdout`` and ``sys.stderr`` and make captured output available via ``capsys.readouterr()`` method calls which return a ``(out, err)`` tuple. ``out`` and ``err`` will be ``bytes`` objects. """ - _ensure_only_one_capture_fixture(request, 'capsysbinary') + _ensure_only_one_capture_fixture(request, "capsysbinary") # Currently, the implementation uses the python3 specific `.buffer` # property of CaptureIO. if sys.version_info < (3,): - raise request.raiseerror('capsysbinary is only supported on python 3') + raise request.raiseerror("capsysbinary is only supported on python 3") with _install_capture_fixture_on_item(request, SysCaptureBinary) as fixture: yield fixture @pytest.fixture def capfd(request): - """Enable capturing of writes to file descriptors 1 and 2 and make + """Enable capturing of writes to file descriptors ``1`` and ``2`` and make captured output available via ``capfd.readouterr()`` method calls which return a ``(out, err)`` tuple. ``out`` and ``err`` will be ``text`` objects. """ - _ensure_only_one_capture_fixture(request, 'capfd') - if not hasattr(os, 'dup'): - pytest.skip("capfd fixture needs os.dup function which is not available in this system") + _ensure_only_one_capture_fixture(request, "capfd") + if not hasattr(os, "dup"): + pytest.skip( + "capfd fixture needs os.dup function which is not available in this system" + ) with _install_capture_fixture_on_item(request, FDCapture) as fixture: yield fixture @@ -244,9 +252,11 @@ def capfdbinary(request): which return a ``(out, err)`` tuple. ``out`` and ``err`` will be ``bytes`` objects. """ - _ensure_only_one_capture_fixture(request, 'capfdbinary') - if not hasattr(os, 'dup'): - pytest.skip("capfdbinary fixture needs os.dup function which is not available in this system") + _ensure_only_one_capture_fixture(request, "capfdbinary") + if not hasattr(os, "dup"): + pytest.skip( + "capfdbinary fixture needs os.dup function which is not available in this system" + ) with _install_capture_fixture_on_item(request, FDCaptureBinary) as fixture: yield fixture @@ -261,7 +271,7 @@ def _install_capture_fixture_on_item(request, capture_class): by ``CaptureManager`` during its ``pytest_runtest_*`` hooks. """ request.node._capture_fixture = fixture = CaptureFixture(capture_class, request) - capmanager = request.config.pluginmanager.getplugin('capturemanager') + capmanager = request.config.pluginmanager.getplugin("capturemanager") # need to active this fixture right away in case it is being used by another fixture (setup phase) # if this fixture is being used only by a test function (call phase), then we wouldn't need this # activation, but it doesn't hurt @@ -271,14 +281,20 @@ def _install_capture_fixture_on_item(request, capture_class): del request.node._capture_fixture -class CaptureFixture: +class CaptureFixture(object): + """ + Object returned by :py:func:`capsys`, :py:func:`capsysbinary`, :py:func:`capfd` and :py:func:`capfdbinary` + fixtures. + """ + def __init__(self, captureclass, request): self.captureclass = captureclass self.request = request def _start(self): - self._capture = MultiCapture(out=True, err=True, in_=False, - Capture=self.captureclass) + self._capture = MultiCapture( + out=True, err=True, in_=False, Capture=self.captureclass + ) self._capture.start_capturing() def close(self): @@ -288,6 +304,10 @@ class CaptureFixture: cap.stop_capturing() def readouterr(self): + """Read and return the captured output so far, resetting the internal buffer. + + :return: captured content as a namedtuple with ``out`` and ``err`` string attributes + """ try: return self._capture.readouterr() except AttributeError: @@ -295,8 +315,9 @@ class CaptureFixture: @contextlib.contextmanager def disabled(self): + """Temporarily disables capture while inside the 'with' block.""" self._capture.suspend_capturing() - capmanager = self.request.config.pluginmanager.getplugin('capturemanager') + capmanager = self.request.config.pluginmanager.getplugin("capturemanager") capmanager.suspend_global_capture(item=None, in_=False) try: yield @@ -306,7 +327,7 @@ class CaptureFixture: def safe_text_dupfile(f, mode, default_encoding="UTF8"): - """ return a open text file object that's a duplicate of f on the + """ return an open text file object that's a duplicate of f on the FD-level if possible. """ encoding = getattr(f, "encoding", None) @@ -337,7 +358,7 @@ class EncodedFile(object): self.buffer.write(obj) def writelines(self, linelist): - data = ''.join(linelist) + data = "".join(linelist) self.write(data) @property @@ -400,7 +421,7 @@ class MultiCapture(object): def stop_capturing(self): """ stop capturing and reset capturing streams """ - if hasattr(self, '_reset'): + if hasattr(self, "_reset"): raise ValueError("was already stopped") self._reset = True if self.out: @@ -412,15 +433,17 @@ class MultiCapture(object): def readouterr(self): """ return snapshot unicode value of stdout/stderr capturings. """ - return CaptureResult(self.out.snap() if self.out is not None else "", - self.err.snap() if self.err is not None else "") + return CaptureResult( + self.out.snap() if self.out is not None else "", + self.err.snap() if self.err is not None else "", + ) -class NoCapture: +class NoCapture(object): __init__ = start = done = suspend = resume = lambda *args: None -class FDCaptureBinary: +class FDCaptureBinary(object): """Capture IO to/from a given os-level filedescriptor. snap() produces `bytes` @@ -476,7 +499,7 @@ class FDCaptureBinary: os.dup2(targetfd_save, self.targetfd) os.close(targetfd_save) self.syscapture.done() - self.tmpfile.close() + _attempt_to_close_capture_file(self.tmpfile) def suspend(self): self.syscapture.suspend() @@ -498,6 +521,7 @@ class FDCapture(FDCaptureBinary): snap() produces text """ + def snap(self): res = FDCaptureBinary.snap(self) enc = getattr(self.tmpfile, "encoding", None) @@ -506,7 +530,8 @@ class FDCapture(FDCaptureBinary): return res -class SysCapture: +class SysCapture(object): + def __init__(self, fd, tmpfile=None): name = patchsysdict[fd] self._old = getattr(sys, name) @@ -530,7 +555,7 @@ class SysCapture: def done(self): setattr(sys, self.name, self._old) del self._old - self.tmpfile.close() + _attempt_to_close_capture_file(self.tmpfile) def suspend(self): setattr(sys, self.name, self._old) @@ -544,6 +569,7 @@ class SysCapture: class SysCaptureBinary(SysCapture): + def snap(self): res = self.tmpfile.buffer.getvalue() self.tmpfile.seek(0) @@ -551,7 +577,7 @@ class SysCaptureBinary(SysCapture): return res -class DontReadFromInput: +class DontReadFromInput(six.Iterator): """Temporary stub class. Ideally when stdin is accessed, the capturing should be turned off, with possibly all data captured so far sent to the screen. This should be configurable, though, @@ -563,13 +589,16 @@ class DontReadFromInput: def read(self, *args): raise IOError("reading from stdin while output is captured") + readline = read readlines = read - __iter__ = read + __next__ = read + + def __iter__(self): + return self def fileno(self): - raise UnsupportedOperation("redirected stdin is pseudofile, " - "has no fileno()") + raise UnsupportedOperation("redirected stdin is pseudofile, " "has no fileno()") def isatty(self): return False @@ -582,7 +611,7 @@ class DontReadFromInput: if sys.version_info >= (3, 0): return self else: - raise AttributeError('redirected stdin has no attribute buffer') + raise AttributeError("redirected stdin has no attribute buffer") def _colorama_workaround(): @@ -595,7 +624,7 @@ def _colorama_workaround(): fail in various ways. """ - if not sys.platform.startswith('win32'): + if not sys.platform.startswith("win32"): return try: import colorama # noqa @@ -622,7 +651,7 @@ def _readline_workaround(): See https://github.com/pytest-dev/pytest/pull/1281 """ - if not sys.platform.startswith('win32'): + if not sys.platform.startswith("win32"): return try: import readline # noqa @@ -652,21 +681,21 @@ def _py36_windowsconsoleio_workaround(stream): See https://github.com/pytest-dev/py/issues/103 """ - if not sys.platform.startswith('win32') or sys.version_info[:2] < (3, 6): + if not sys.platform.startswith("win32") or sys.version_info[:2] < (3, 6): return # bail out if ``stream`` doesn't seem like a proper ``io`` stream (#2666) - if not hasattr(stream, 'buffer'): + if not hasattr(stream, "buffer"): return - buffered = hasattr(stream.buffer, 'raw') + buffered = hasattr(stream.buffer, "raw") raw_stdout = stream.buffer.raw if buffered else stream.buffer if not isinstance(raw_stdout, io._WindowsConsoleIO): return def _reopen_stdio(f, mode): - if not buffered and mode[0] == 'w': + if not buffered and mode[0] == "w": buffering = 0 else: buffering = -1 @@ -676,8 +705,20 @@ def _py36_windowsconsoleio_workaround(stream): f.encoding, f.errors, f.newlines, - f.line_buffering) + f.line_buffering, + ) - sys.__stdin__ = sys.stdin = _reopen_stdio(sys.stdin, 'rb') - sys.__stdout__ = sys.stdout = _reopen_stdio(sys.stdout, 'wb') - sys.__stderr__ = sys.stderr = _reopen_stdio(sys.stderr, 'wb') + sys.__stdin__ = sys.stdin = _reopen_stdio(sys.stdin, "rb") + sys.__stdout__ = sys.stdout = _reopen_stdio(sys.stdout, "wb") + sys.__stderr__ = sys.stderr = _reopen_stdio(sys.stderr, "wb") + + +def _attempt_to_close_capture_file(f): + """Suppress IOError when closing the temporary file used for capturing streams in py27 (#2370)""" + if six.PY2: + try: + f.close() + except IOError: + pass + else: + f.close() diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/compat.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/compat.py similarity index 69% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/compat.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/compat.py index 7560fbec397..7abd3d53ff9 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/compat.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/compat.py @@ -13,6 +13,8 @@ import py import _pytest from _pytest.outcomes import TEST_OUTCOME +from six import text_type +import six try: import enum @@ -36,7 +38,15 @@ NOTSET = object() PY35 = sys.version_info[:2] >= (3, 5) PY36 = sys.version_info[:2] >= (3, 6) -MODULE_NOT_FOUND_ERROR = 'ModuleNotFoundError' if PY36 else 'ImportError' +MODULE_NOT_FOUND_ERROR = "ModuleNotFoundError" if PY36 else "ImportError" + +if _PY3: + from collections.abc import MutableMapping as MappingMixin # noqa + from collections.abc import Mapping, Sequence # noqa +else: + # those raise DeprecationWarnings in Python >=3.7 + from collections import MutableMapping as MappingMixin # noqa + from collections import Mapping, Sequence # noqa def _format_args(func): @@ -46,9 +56,9 @@ def _format_args(func): isfunction = inspect.isfunction isclass = inspect.isclass # used to work around a python2 exception info leak -exc_clear = getattr(sys, 'exc_clear', lambda: None) +exc_clear = getattr(sys, "exc_clear", lambda: None) # The type of re.compile objects is not exposed in Python. -REGEX_TYPE = type(re.compile('')) +REGEX_TYPE = type(re.compile("")) def is_generator(func): @@ -62,13 +72,18 @@ def iscoroutinefunction(func): Note: copied and modified from Python 3.5's builtin couroutines.py to avoid import asyncio directly, which in turns also initializes the "logging" module as side-effect (see issue #8). """ - return (getattr(func, '_is_coroutine', False) or - (hasattr(inspect, 'iscoroutinefunction') and inspect.iscoroutinefunction(func))) + return ( + getattr(func, "_is_coroutine", False) + or ( + hasattr(inspect, "iscoroutinefunction") + and inspect.iscoroutinefunction(func) + ) + ) def getlocation(function, curdir): fn = py.path.local(inspect.getfile(function)) - lineno = py.builtin._getcode(function).co_firstlineno + lineno = function.__code__.co_firstlineno if fn.relto(curdir): fn = fn.relto(curdir) return "%s:%d" % (fn, lineno + 1) @@ -79,10 +94,12 @@ def num_mock_patch_args(function): patchings = getattr(function, "patchings", None) if not patchings: return 0 - mock = sys.modules.get("mock", sys.modules.get("unittest.mock", None)) - if mock is not None: - return len([p for p in patchings - if not p.attribute_name and p.new is mock.DEFAULT]) + mock_modules = [sys.modules.get("mock"), sys.modules.get("unittest.mock")] + if any(mock_modules): + sentinels = [m.DEFAULT for m in mock_modules if m is not None] + return len( + [p for p in patchings if not p.attribute_name and p.new in sentinels] + ) return len(patchings) @@ -109,16 +126,25 @@ def getfuncargnames(function, is_method=False, cls=None): # ordered mapping of parameter names to Parameter instances. This # creates a tuple of the names of the parameters that don't have # defaults. - arg_names = tuple(p.name for p in signature(function).parameters.values() - if (p.kind is Parameter.POSITIONAL_OR_KEYWORD or - p.kind is Parameter.KEYWORD_ONLY) and - p.default is Parameter.empty) + arg_names = tuple( + p.name + for p in signature(function).parameters.values() + if ( + p.kind is Parameter.POSITIONAL_OR_KEYWORD + or p.kind is Parameter.KEYWORD_ONLY + ) + and p.default is Parameter.empty + ) # If this function should be treated as a bound method even though # it's passed as an unbound method or function, remove the first # parameter name. - if (is_method or - (cls and not isinstance(cls.__dict__.get(function.__name__, None), - staticmethod))): + if ( + is_method + or ( + cls + and not isinstance(cls.__dict__.get(function.__name__, None), staticmethod) + ) + ): arg_names = arg_names[1:] # Remove any names that will be replaced with mocks. if hasattr(function, "__wrapped__"): @@ -126,22 +152,36 @@ def getfuncargnames(function, is_method=False, cls=None): return arg_names +def get_default_arg_names(function): + # Note: this code intentionally mirrors the code at the beginning of getfuncargnames, + # to get the arguments which were excluded from its result because they had default values + return tuple( + p.name + for p in signature(function).parameters.values() + if p.kind in (Parameter.POSITIONAL_OR_KEYWORD, Parameter.KEYWORD_ONLY) + and p.default is not Parameter.empty + ) + + if _PY3: STRING_TYPES = bytes, str - UNICODE_TYPES = str, + UNICODE_TYPES = six.text_type if PY35: + def _bytes_to_ascii(val): - return val.decode('ascii', 'backslashreplace') + return val.decode("ascii", "backslashreplace") + else: + def _bytes_to_ascii(val): if val: # source: http://goo.gl/bGsnwC encoded_bytes, _ = codecs.escape_encode(val) - return encoded_bytes.decode('ascii') + return encoded_bytes.decode("ascii") else: # empty bytes crashes codecs.escape_encode (#1087) - return '' + return "" def ascii_escaped(val): """If val is pure ascii, returns it as a str(). Otherwise, escapes @@ -164,10 +204,12 @@ if _PY3: if isinstance(val, bytes): return _bytes_to_ascii(val) else: - return val.encode('unicode_escape').decode('ascii') + return val.encode("unicode_escape").decode("ascii") + + else: - STRING_TYPES = bytes, str, unicode - UNICODE_TYPES = unicode, + STRING_TYPES = six.string_types + UNICODE_TYPES = six.text_type def ascii_escaped(val): """In py2 bytes and str are the same type, so return if it's a bytes @@ -180,11 +222,11 @@ else: """ if isinstance(val, bytes): try: - return val.encode('ascii') + return val.encode("ascii") except UnicodeDecodeError: - return val.encode('string-escape') + return val.encode("string-escape") else: - return val.encode('unicode-escape') + return val.encode("unicode-escape") def get_real_func(obj): @@ -193,16 +235,16 @@ def get_real_func(obj): """ start_obj = obj for i in range(100): - new_obj = getattr(obj, '__wrapped__', None) + new_obj = getattr(obj, "__wrapped__", None) if new_obj is None: break obj = new_obj else: raise ValueError( - ("could not find real function of {start}" - "\nstopped at {current}").format( - start=py.io.saferepr(start_obj), - current=py.io.saferepr(obj))) + ("could not find real function of {start}" "\nstopped at {current}").format( + start=py.io.saferepr(start_obj), current=py.io.saferepr(obj) + ) + ) if isinstance(obj, functools.partial): obj = obj.func return obj @@ -211,7 +253,7 @@ def get_real_func(obj): def getfslineno(obj): # xxx let decorators etc specify a sane ordering obj = get_real_func(obj) - if hasattr(obj, 'place_as'): + if hasattr(obj, "place_as"): obj = obj.place_as fslineno = _pytest._code.getfslineno(obj) assert isinstance(fslineno[1], int), obj @@ -240,7 +282,7 @@ def safe_getattr(object, name, default): def _is_unittest_unexpected_success_a_failure(): - """Return if the test suite should fail if a @expectedFailure unittest test PASSES. + """Return if the test suite should fail if an @expectedFailure unittest test PASSES. From https://docs.python.org/3/library/unittest.html?highlight=unittest#unittest.TestResult.wasSuccessful: Changed in version 3.4: Returns False if there were any @@ -250,39 +292,44 @@ def _is_unittest_unexpected_success_a_failure(): if _PY3: + def safe_str(v): """returns v as string""" return str(v) + + else: + def safe_str(v): """returns v as string, converting to ascii if necessary""" try: return str(v) except UnicodeError: - if not isinstance(v, unicode): - v = unicode(v) - errors = 'replace' - return v.encode('utf-8', errors) + if not isinstance(v, text_type): + v = text_type(v) + errors = "replace" + return v.encode("utf-8", errors) COLLECT_FAKEMODULE_ATTRIBUTES = ( - 'Collector', - 'Module', - 'Generator', - 'Function', - 'Instance', - 'Session', - 'Item', - 'Class', - 'File', - '_fillfuncargs', + "Collector", + "Module", + "Generator", + "Function", + "Instance", + "Session", + "Item", + "Class", + "File", + "_fillfuncargs", ) def _setup_collect_fakemodule(): from types import ModuleType import pytest - pytest.collect = ModuleType('pytest.collect') + + pytest.collect = ModuleType("pytest.collect") pytest.collect.__all__ = [] # used for setns for attr in COLLECT_FAKEMODULE_ATTRIBUTES: setattr(pytest.collect, attr, getattr(pytest, attr)) @@ -296,26 +343,28 @@ if _PY2: @property def encoding(self): - return getattr(self, '_encoding', 'UTF-8') + return getattr(self, "_encoding", "UTF-8") + else: import io class CaptureIO(io.TextIOWrapper): + def __init__(self): super(CaptureIO, self).__init__( - io.BytesIO(), - encoding='UTF-8', newline='', write_through=True, + io.BytesIO(), encoding="UTF-8", newline="", write_through=True ) def getvalue(self): - return self.buffer.getvalue().decode('UTF-8') + return self.buffer.getvalue().decode("UTF-8") class FuncargnamesCompatAttr(object): """ helper class so that Metafunc, Function and FixtureRequest don't need to each define the "funcargnames" compatibility attribute. """ + @property def funcargnames(self): """ alias attribute for ``fixturenames`` for pre-2.3 compatibility""" diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/config.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/config/__init__.py similarity index 50% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/config.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/config/__init__.py index 499c8079d41..11348b80d0f 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/config.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/config/__init__.py @@ -5,17 +5,22 @@ import shlex import traceback import types import warnings - +import copy import six import py + # DON't import pytest here because it causes import cycle troubles import sys import os +from _pytest.outcomes import Skipped + import _pytest._code import _pytest.hookspec # the extension point definitions import _pytest.assertion from pluggy import PluginManager, HookimplMarker, HookspecMarker from _pytest.compat import safe_str +from .exceptions import UsageError, PrintHelp +from .findpaths import determine_setup, exists hookimpl = HookimplMarker("pytest") hookspec = HookspecMarker("pytest") @@ -25,6 +30,7 @@ hookspec = HookspecMarker("pytest") class ConftestImportFailure(Exception): + def __init__(self, path, excinfo): Exception.__init__(self, path, excinfo) self.path = path @@ -34,7 +40,7 @@ class ConftestImportFailure(Exception): etype, evalue, etb = self.excinfo formatted = traceback.format_tb(etb) # The level of the tracebacks we want to print is hand crafted :( - return repr(evalue) + '\n' + ''.join(formatted[2:]) + return repr(evalue) + "\n" + "".join(formatted[2:]) def main(args=None, plugins=None): @@ -52,7 +58,7 @@ def main(args=None, plugins=None): tw = py.io.TerminalWriter(sys.stderr) for line in traceback.format_exception(*e.excinfo): tw.line(line.rstrip(), red=True) - tw.line("ERROR: could not load %s\n" % (e.path), red=True) + tw.line("ERROR: could not load %s\n" % (e.path,), red=True) return 4 else: try: @@ -60,25 +66,16 @@ def main(args=None, plugins=None): finally: config._ensure_unconfigure() except UsageError as e: + tw = py.io.TerminalWriter(sys.stderr) for msg in e.args: - sys.stderr.write("ERROR: %s\n" % (msg,)) + tw.line("ERROR: {}\n".format(msg), red=True) return 4 -class cmdline: # compatibility namespace +class cmdline(object): # NOQA compatibility namespace main = staticmethod(main) -class UsageError(Exception): - """ error in pytest usage or invocation""" - - -class PrintHelp(Exception): - """Raised when pytest should print it's help to skip the rest of the - argument parsing and validation.""" - pass - - def filename_arg(path, optname): """ Argparse type validator for filename arguments. @@ -86,7 +83,7 @@ def filename_arg(path, optname): :optname: name of the option """ if os.path.isdir(path): - raise UsageError("{0} must be a filename, given: {1}".format(optname, path)) + raise UsageError("{} must be a filename, given: {}".format(optname, path)) return path @@ -97,15 +94,38 @@ def directory_arg(path, optname): :optname: name of the option """ if not os.path.isdir(path): - raise UsageError("{0} must be a directory, given: {1}".format(optname, path)) + raise UsageError("{} must be a directory, given: {}".format(optname, path)) return path default_plugins = ( - "mark main terminal runner python fixtures debugging unittest capture skipping " - "tmpdir monkeypatch recwarn pastebin helpconfig nose assertion " - "junitxml resultlog doctest cacheprovider freeze_support " - "setuponly setupplan warnings logging").split() + "mark", + "main", + "terminal", + "runner", + "python", + "fixtures", + "debugging", + "unittest", + "capture", + "skipping", + "tmpdir", + "monkeypatch", + "recwarn", + "pastebin", + "helpconfig", + "nose", + "assertion", + "junitxml", + "resultlog", + "doctest", + "cacheprovider", + "freeze_support", + "setuponly", + "setupplan", + "warnings", + "logging", +) builtin_plugins = set(default_plugins) @@ -144,6 +164,7 @@ def _prepareconfig(args=None, plugins=None): raise ValueError("not a string or argument list: %r" % (args,)) args = shlex.split(args, posix=sys.platform != "win32") from _pytest import deprecated + warning = deprecated.MAIN_STR_ARGS config = get_config() pluginmanager = config.pluginmanager @@ -155,9 +176,10 @@ def _prepareconfig(args=None, plugins=None): else: pluginmanager.register(plugin) if warning: - config.warn('C1', warning) + config.warn("C1", warning) return pluginmanager.hook.pytest_cmdline_parse( - pluginmanager=pluginmanager, args=args) + pluginmanager=pluginmanager, args=args + ) except BaseException: config._ensure_unconfigure() raise @@ -168,13 +190,13 @@ class PytestPluginManager(PluginManager): Overwrites :py:class:`pluggy.PluginManager ` to add pytest-specific functionality: - * loading plugins from the command line, ``PYTEST_PLUGIN`` env variable and + * loading plugins from the command line, ``PYTEST_PLUGINS`` env variable and ``pytest_plugins`` global variables found in plugins being loaded; * ``conftest.py`` loading during start-up; """ def __init__(self): - super(PytestPluginManager, self).__init__("pytest", implprefix="pytest_") + super(PytestPluginManager, self).__init__("pytest") self._conftest_plugins = set() # state related to local conftest plugins @@ -186,9 +208,9 @@ class PytestPluginManager(PluginManager): self.add_hookspecs(_pytest.hookspec) self.register(self) - if os.environ.get('PYTEST_DEBUG'): + if os.environ.get("PYTEST_DEBUG"): err = sys.stderr - encoding = getattr(err, 'encoding', 'utf8') + encoding = getattr(err, "encoding", "utf8") try: err = py.io.dupfile(err, encoding=encoding) except Exception: @@ -198,6 +220,8 @@ class PytestPluginManager(PluginManager): # Config._consider_importhook will set a real object if required. self.rewrite_hook = _pytest.assertion.DummyRewriteHook() + # Used to know when we are importing conftests after the pytest_configure stage + self._configured = False def addhooks(self, module_or_class): """ @@ -206,11 +230,13 @@ class PytestPluginManager(PluginManager): Use :py:meth:`pluggy.PluginManager.add_hookspecs ` instead. """ - warning = dict(code="I2", - fslocation=_pytest._code.getfslineno(sys._getframe(1)), - nodeid=None, - message="use pluginmanager.add_hookspecs instead of " - "deprecated addhooks() method.") + warning = dict( + code="I2", + fslocation=_pytest._code.getfslineno(sys._getframe(1)), + nodeid=None, + message="use pluginmanager.add_hookspecs instead of " + "deprecated addhooks() method.", + ) self._warn(warning) return self.add_hookspecs(module_or_class) @@ -226,6 +252,11 @@ class PytestPluginManager(PluginManager): method = getattr(plugin, name) opts = super(PytestPluginManager, self).parse_hookimpl_opts(plugin, name) + + # collect unmarked hooks as long as they have the `pytest_' prefix + if opts is None and name.startswith("pytest_"): + opts = {} + if opts is not None: for name in ("tryfirst", "trylast", "optionalhook", "hookwrapper"): opts.setdefault(name, hasattr(method, name)) @@ -233,23 +264,31 @@ class PytestPluginManager(PluginManager): def parse_hookspec_opts(self, module_or_class, name): opts = super(PytestPluginManager, self).parse_hookspec_opts( - module_or_class, name) + module_or_class, name + ) if opts is None: method = getattr(module_or_class, name) if name.startswith("pytest_"): - opts = {"firstresult": hasattr(method, "firstresult"), - "historic": hasattr(method, "historic")} + opts = { + "firstresult": hasattr(method, "firstresult"), + "historic": hasattr(method, "historic"), + } return opts def register(self, plugin, name=None): - if name == 'pytest_catchlog': - self._warn('pytest-catchlog plugin has been merged into the core, ' - 'please remove it from your requirements.') + if name in ["pytest_catchlog", "pytest_capturelog"]: + self._warn( + "{} plugin has been merged into the core, " + "please remove it from your requirements.".format( + name.replace("_", "-") + ) + ) return ret = super(PytestPluginManager, self).register(plugin, name) if ret: self.hook.pytest_plugin_registered.call_historic( - kwargs=dict(plugin=plugin, manager=self)) + kwargs=dict(plugin=plugin, manager=self) + ) if isinstance(plugin, types.ModuleType): self.consider_module(plugin) @@ -266,19 +305,21 @@ class PytestPluginManager(PluginManager): def pytest_configure(self, config): # XXX now that the pluginmanager exposes hookimpl(tryfirst...) # we should remove tryfirst/trylast as markers - config.addinivalue_line("markers", - "tryfirst: mark a hook implementation function such that the " - "plugin machinery will try to call it first/as early as possible.") - config.addinivalue_line("markers", - "trylast: mark a hook implementation function such that the " - "plugin machinery will try to call it last/as late as possible.") + config.addinivalue_line( + "markers", + "tryfirst: mark a hook implementation function such that the " + "plugin machinery will try to call it first/as early as possible.", + ) + config.addinivalue_line( + "markers", + "trylast: mark a hook implementation function such that the " + "plugin machinery will try to call it last/as late as possible.", + ) + self._configured = True def _warn(self, message): kwargs = message if isinstance(message, dict) else { - 'code': 'I1', - 'message': message, - 'fslocation': None, - 'nodeid': None, + "code": "I1", "message": message, "fslocation": None, "nodeid": None } self.hook.pytest_logwarning.call_historic(kwargs=kwargs) @@ -294,8 +335,9 @@ class PytestPluginManager(PluginManager): here. """ current = py.path.local() - self._confcutdir = current.join(namespace.confcutdir, abs=True) \ - if namespace.confcutdir else None + self._confcutdir = current.join( + namespace.confcutdir, abs=True + ) if namespace.confcutdir else None self._noconftest = namespace.noconftest testpaths = namespace.file_or_dir foundanchor = False @@ -362,6 +404,10 @@ class PytestPluginManager(PluginManager): _ensure_removed_sysmodule(conftestpath.purebasename) try: mod = conftestpath.pyimport() + if hasattr(mod, "pytest_plugins") and self._configured: + from _pytest.deprecated import PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST + + warnings.warn(PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST) except Exception: raise ConftestImportFailure(conftestpath, sys.exc_info()) @@ -403,7 +449,7 @@ class PytestPluginManager(PluginManager): self._import_plugin_specs(os.environ.get("PYTEST_PLUGINS")) def consider_module(self, mod): - self._import_plugin_specs(getattr(mod, 'pytest_plugins', [])) + self._import_plugin_specs(getattr(mod, "pytest_plugins", [])) def _import_plugin_specs(self, spec): plugins = _get_plugin_specs_as_list(spec) @@ -415,7 +461,9 @@ class PytestPluginManager(PluginManager): # "terminal" or "capture". Those plugins are registered under their # basename for historic purposes but must be imported with the # _pytest prefix. - assert isinstance(modname, (six.text_type, str)), "module name as text required, got %r" % modname + assert isinstance(modname, (six.text_type, str)), ( + "module name as text required, got %r" % modname + ) modname = str(modname) if self.is_blocked(modname) or self.get_plugin(modname) is not None: return @@ -428,15 +476,14 @@ class PytestPluginManager(PluginManager): __import__(importspec) except ImportError as e: new_exc_type = ImportError - new_exc_message = 'Error importing plugin "%s": %s' % (modname, safe_str(e.args[0])) + new_exc_message = 'Error importing plugin "%s": %s' % ( + modname, safe_str(e.args[0]) + ) new_exc = new_exc_type(new_exc_message) six.reraise(new_exc_type, new_exc, sys.exc_info()[2]) - except Exception as e: - import pytest - if not hasattr(pytest, 'skip') or not isinstance(e, pytest.skip.Exception): - raise + except Skipped as e: self._warn("skipped plugin %r: %s" % ((modname, e.msg))) else: mod = sys.modules[importspec] @@ -453,390 +500,16 @@ def _get_plugin_specs_as_list(specs): """ if specs is not None: if isinstance(specs, str): - specs = specs.split(',') if specs else [] + specs = specs.split(",") if specs else [] if not isinstance(specs, (list, tuple)): - raise UsageError("Plugin specs must be a ','-separated string or a " - "list/tuple of strings for plugin names. Given: %r" % specs) + raise UsageError( + "Plugin specs must be a ','-separated string or a " + "list/tuple of strings for plugin names. Given: %r" % specs + ) return list(specs) return [] -class Parser: - """ Parser for command line arguments and ini-file values. - - :ivar extra_info: dict of generic param -> value to display in case - there's an error processing the command line arguments. - """ - - def __init__(self, usage=None, processopt=None): - self._anonymous = OptionGroup("custom options", parser=self) - self._groups = [] - self._processopt = processopt - self._usage = usage - self._inidict = {} - self._ininames = [] - self.extra_info = {} - - def processoption(self, option): - if self._processopt: - if option.dest: - self._processopt(option) - - def getgroup(self, name, description="", after=None): - """ get (or create) a named option Group. - - :name: name of the option group. - :description: long description for --help output. - :after: name of other group, used for ordering --help output. - - The returned group object has an ``addoption`` method with the same - signature as :py:func:`parser.addoption - <_pytest.config.Parser.addoption>` but will be shown in the - respective group in the output of ``pytest. --help``. - """ - for group in self._groups: - if group.name == name: - return group - group = OptionGroup(name, description, parser=self) - i = 0 - for i, grp in enumerate(self._groups): - if grp.name == after: - break - self._groups.insert(i + 1, group) - return group - - def addoption(self, *opts, **attrs): - """ register a command line option. - - :opts: option names, can be short or long options. - :attrs: same attributes which the ``add_option()`` function of the - `argparse library - `_ - accepts. - - After command line parsing options are available on the pytest config - object via ``config.option.NAME`` where ``NAME`` is usually set - by passing a ``dest`` attribute, for example - ``addoption("--long", dest="NAME", ...)``. - """ - self._anonymous.addoption(*opts, **attrs) - - def parse(self, args, namespace=None): - from _pytest._argcomplete import try_argcomplete - self.optparser = self._getparser() - try_argcomplete(self.optparser) - return self.optparser.parse_args([str(x) for x in args], namespace=namespace) - - def _getparser(self): - from _pytest._argcomplete import filescompleter - optparser = MyOptionParser(self, self.extra_info) - groups = self._groups + [self._anonymous] - for group in groups: - if group.options: - desc = group.description or group.name - arggroup = optparser.add_argument_group(desc) - for option in group.options: - n = option.names() - a = option.attrs() - arggroup.add_argument(*n, **a) - # bash like autocompletion for dirs (appending '/') - optparser.add_argument(FILE_OR_DIR, nargs='*').completer = filescompleter - return optparser - - def parse_setoption(self, args, option, namespace=None): - parsedoption = self.parse(args, namespace=namespace) - for name, value in parsedoption.__dict__.items(): - setattr(option, name, value) - return getattr(parsedoption, FILE_OR_DIR) - - def parse_known_args(self, args, namespace=None): - """parses and returns a namespace object with known arguments at this - point. - """ - return self.parse_known_and_unknown_args(args, namespace=namespace)[0] - - def parse_known_and_unknown_args(self, args, namespace=None): - """parses and returns a namespace object with known arguments, and - the remaining arguments unknown at this point. - """ - optparser = self._getparser() - args = [str(x) for x in args] - return optparser.parse_known_args(args, namespace=namespace) - - def addini(self, name, help, type=None, default=None): - """ register an ini-file option. - - :name: name of the ini-variable - :type: type of the variable, can be ``pathlist``, ``args``, ``linelist`` - or ``bool``. - :default: default value if no ini-file option exists but is queried. - - The value of ini-variables can be retrieved via a call to - :py:func:`config.getini(name) <_pytest.config.Config.getini>`. - """ - assert type in (None, "pathlist", "args", "linelist", "bool") - self._inidict[name] = (help, type, default) - self._ininames.append(name) - - -class ArgumentError(Exception): - """ - Raised if an Argument instance is created with invalid or - inconsistent arguments. - """ - - def __init__(self, msg, option): - self.msg = msg - self.option_id = str(option) - - def __str__(self): - if self.option_id: - return "option %s: %s" % (self.option_id, self.msg) - else: - return self.msg - - -class Argument: - """class that mimics the necessary behaviour of optparse.Option - - its currently a least effort implementation - and ignoring choices and integer prefixes - https://docs.python.org/3/library/optparse.html#optparse-standard-option-types - """ - _typ_map = { - 'int': int, - 'string': str, - 'float': float, - 'complex': complex, - } - - def __init__(self, *names, **attrs): - """store parms in private vars for use in add_argument""" - self._attrs = attrs - self._short_opts = [] - self._long_opts = [] - self.dest = attrs.get('dest') - if '%default' in (attrs.get('help') or ''): - warnings.warn( - 'pytest now uses argparse. "%default" should be' - ' changed to "%(default)s" ', - DeprecationWarning, - stacklevel=3) - try: - typ = attrs['type'] - except KeyError: - pass - else: - # this might raise a keyerror as well, don't want to catch that - if isinstance(typ, six.string_types): - if typ == 'choice': - warnings.warn( - 'type argument to addoption() is a string %r.' - ' For parsearg this is optional and when supplied' - ' should be a type.' - ' (options: %s)' % (typ, names), - DeprecationWarning, - stacklevel=3) - # argparse expects a type here take it from - # the type of the first element - attrs['type'] = type(attrs['choices'][0]) - else: - warnings.warn( - 'type argument to addoption() is a string %r.' - ' For parsearg this should be a type.' - ' (options: %s)' % (typ, names), - DeprecationWarning, - stacklevel=3) - attrs['type'] = Argument._typ_map[typ] - # used in test_parseopt -> test_parse_defaultgetter - self.type = attrs['type'] - else: - self.type = typ - try: - # attribute existence is tested in Config._processopt - self.default = attrs['default'] - except KeyError: - pass - self._set_opt_strings(names) - if not self.dest: - if self._long_opts: - self.dest = self._long_opts[0][2:].replace('-', '_') - else: - try: - self.dest = self._short_opts[0][1:] - except IndexError: - raise ArgumentError( - 'need a long or short option', self) - - def names(self): - return self._short_opts + self._long_opts - - def attrs(self): - # update any attributes set by processopt - attrs = 'default dest help'.split() - if self.dest: - attrs.append(self.dest) - for attr in attrs: - try: - self._attrs[attr] = getattr(self, attr) - except AttributeError: - pass - if self._attrs.get('help'): - a = self._attrs['help'] - a = a.replace('%default', '%(default)s') - # a = a.replace('%prog', '%(prog)s') - self._attrs['help'] = a - return self._attrs - - def _set_opt_strings(self, opts): - """directly from optparse - - might not be necessary as this is passed to argparse later on""" - for opt in opts: - if len(opt) < 2: - raise ArgumentError( - "invalid option string %r: " - "must be at least two characters long" % opt, self) - elif len(opt) == 2: - if not (opt[0] == "-" and opt[1] != "-"): - raise ArgumentError( - "invalid short option string %r: " - "must be of the form -x, (x any non-dash char)" % opt, - self) - self._short_opts.append(opt) - else: - if not (opt[0:2] == "--" and opt[2] != "-"): - raise ArgumentError( - "invalid long option string %r: " - "must start with --, followed by non-dash" % opt, - self) - self._long_opts.append(opt) - - def __repr__(self): - args = [] - if self._short_opts: - args += ['_short_opts: ' + repr(self._short_opts)] - if self._long_opts: - args += ['_long_opts: ' + repr(self._long_opts)] - args += ['dest: ' + repr(self.dest)] - if hasattr(self, 'type'): - args += ['type: ' + repr(self.type)] - if hasattr(self, 'default'): - args += ['default: ' + repr(self.default)] - return 'Argument({0})'.format(', '.join(args)) - - -class OptionGroup: - def __init__(self, name, description="", parser=None): - self.name = name - self.description = description - self.options = [] - self.parser = parser - - def addoption(self, *optnames, **attrs): - """ add an option to this group. - - if a shortened version of a long option is specified it will - be suppressed in the help. addoption('--twowords', '--two-words') - results in help showing '--two-words' only, but --twowords gets - accepted **and** the automatic destination is in args.twowords - """ - conflict = set(optnames).intersection( - name for opt in self.options for name in opt.names()) - if conflict: - raise ValueError("option names %s already added" % conflict) - option = Argument(*optnames, **attrs) - self._addoption_instance(option, shortupper=False) - - def _addoption(self, *optnames, **attrs): - option = Argument(*optnames, **attrs) - self._addoption_instance(option, shortupper=True) - - def _addoption_instance(self, option, shortupper=False): - if not shortupper: - for opt in option._short_opts: - if opt[0] == '-' and opt[1].islower(): - raise ValueError("lowercase shortoptions reserved") - if self.parser: - self.parser.processoption(option) - self.options.append(option) - - -class MyOptionParser(argparse.ArgumentParser): - def __init__(self, parser, extra_info=None): - if not extra_info: - extra_info = {} - self._parser = parser - argparse.ArgumentParser.__init__(self, usage=parser._usage, - add_help=False, formatter_class=DropShorterLongHelpFormatter) - # extra_info is a dict of (param -> value) to display if there's - # an usage error to provide more contextual information to the user - self.extra_info = extra_info - - def parse_args(self, args=None, namespace=None): - """allow splitting of positional arguments""" - args, argv = self.parse_known_args(args, namespace) - if argv: - for arg in argv: - if arg and arg[0] == '-': - lines = ['unrecognized arguments: %s' % (' '.join(argv))] - for k, v in sorted(self.extra_info.items()): - lines.append(' %s: %s' % (k, v)) - self.error('\n'.join(lines)) - getattr(args, FILE_OR_DIR).extend(argv) - return args - - -class DropShorterLongHelpFormatter(argparse.HelpFormatter): - """shorten help for long options that differ only in extra hyphens - - - collapse **long** options that are the same except for extra hyphens - - special action attribute map_long_option allows surpressing additional - long options - - shortcut if there are only two options and one of them is a short one - - cache result on action object as this is called at least 2 times - """ - - def _format_action_invocation(self, action): - orgstr = argparse.HelpFormatter._format_action_invocation(self, action) - if orgstr and orgstr[0] != '-': # only optional arguments - return orgstr - res = getattr(action, '_formatted_action_invocation', None) - if res: - return res - options = orgstr.split(', ') - if len(options) == 2 and (len(options[0]) == 2 or len(options[1]) == 2): - # a shortcut for '-h, --help' or '--abc', '-a' - action._formatted_action_invocation = orgstr - return orgstr - return_list = [] - option_map = getattr(action, 'map_long_option', {}) - if option_map is None: - option_map = {} - short_long = {} - for option in options: - if len(option) == 2 or option[2] == ' ': - continue - if not option.startswith('--'): - raise ArgumentError('long optional argument without "--": [%s]' - % (option), self) - xxoption = option[2:] - if xxoption.split()[0] not in option_map: - shortened = xxoption.replace('-', '') - if shortened not in short_long or \ - len(short_long[shortened]) < len(xxoption): - short_long[shortened] = xxoption - # now short_long has been filled out to the longest with dashes - # **and** we keep the right option ordering from add_argument - for option in options: - if len(option) == 2 or option[2] == ' ': - return_list.append(option) - if option[2:] == short_long.get(option.replace('-', '')): - return_list.append(option.replace(' ', '=', 1)) - action._formatted_action_invocation = ', '.join(return_list) - return action._formatted_action_invocation - - def _ensure_removed_sysmodule(modname): try: del sys.modules[modname] @@ -844,32 +517,19 @@ def _ensure_removed_sysmodule(modname): pass -class CmdOptions(object): - """ holds cmdline options as attributes.""" +class Notset(object): - def __init__(self, values=()): - self.__dict__.update(values) - - def __repr__(self): - return "" % (self.__dict__,) - - def copy(self): - return CmdOptions(self.__dict__) - - -class Notset: def __repr__(self): return "" notset = Notset() -FILE_OR_DIR = 'file_or_dir' def _iter_rewritable_modules(package_files): for fn in package_files: - is_simple_module = '/' not in fn and fn.endswith('.py') - is_package = fn.count('/') == 1 and fn.endswith('__init__.py') + is_simple_module = "/" not in fn and fn.endswith(".py") + is_package = fn.count("/") == 1 and fn.endswith("__init__.py") if is_simple_module: module_name, _ = os.path.splitext(fn) yield module_name @@ -884,7 +544,9 @@ class Config(object): def __init__(self, pluginmanager): #: access to command line option as attributes. #: (deprecated), use :py:func:`getoption() <_pytest.config.Config.getoption>` instead - self.option = CmdOptions() + self.option = argparse.Namespace() + from .argparsing import Parser, FILE_OR_DIR + _a = FILE_OR_DIR self._parser = Parser( usage="%%(prog)s [options] [%s] [%s] [...]" % (_a, _a), @@ -904,6 +566,7 @@ class Config(object): def do_setns(dic): import pytest + setns(pytest, dic) self.hook.pytest_namespace.call_historic(do_setns, {}) @@ -930,9 +593,11 @@ class Config(object): def warn(self, code, message, fslocation=None, nodeid=None): """ generate a warning for this test session. """ - self.hook.pytest_logwarning.call_historic(kwargs=dict( - code=code, message=message, - fslocation=fslocation, nodeid=nodeid)) + self.hook.pytest_logwarning.call_historic( + kwargs=dict( + code=code, message=message, fslocation=fslocation, nodeid=nodeid + ) + ) def get_terminal_writer(self): return self.pluginmanager.get_plugin("terminalreporter")._tw @@ -947,12 +612,10 @@ class Config(object): style = "long" else: style = "native" - excrepr = excinfo.getrepr(funcargs=True, - showlocals=getattr(option, 'showlocals', False), - style=style, - ) - res = self.hook.pytest_internalerror(excrepr=excrepr, - excinfo=excinfo) + excrepr = excinfo.getrepr( + funcargs=True, showlocals=getattr(option, "showlocals", False), style=style + ) + res = self.hook.pytest_internalerror(excrepr=excrepr, excinfo=excinfo) if not any(res): for line in str(excrepr).split("\n"): sys.stderr.write("INTERNALERROR> %s\n" % line) @@ -979,7 +642,7 @@ class Config(object): for name in opt._short_opts + opt._long_opts: self._opt2dest[name] = opt.dest - if hasattr(opt, 'default') and opt.dest: + if hasattr(opt, "default") and opt.dest: if not hasattr(self.option, opt.dest): setattr(self.option, opt.dest, opt.default) @@ -988,14 +651,21 @@ class Config(object): self.pluginmanager._set_initial_conftests(early_config.known_args_namespace) def _initini(self, args): - ns, unknown_args = self._parser.parse_known_and_unknown_args(args, namespace=self.option.copy()) - r = determine_setup(ns.inifilename, ns.file_or_dir + unknown_args, warnfunc=self.warn) + ns, unknown_args = self._parser.parse_known_and_unknown_args( + args, namespace=copy.copy(self.option) + ) + r = determine_setup( + ns.inifilename, + ns.file_or_dir + unknown_args, + warnfunc=self.warn, + rootdir_cmd_arg=ns.rootdir or None, + ) self.rootdir, self.inifile, self.inicfg = r - self._parser.extra_info['rootdir'] = self.rootdir - self._parser.extra_info['inifile'] = self.inifile + self._parser.extra_info["rootdir"] = self.rootdir + self._parser.extra_info["inifile"] = self.inifile self.invocation_dir = py.path.local() - self._parser.addini('addopts', 'extra command line options', 'args') - self._parser.addini('minversion', 'minimally required pytest version') + self._parser.addini("addopts", "extra command line options", "args") + self._parser.addini("minversion", "minimally required pytest version") self._override_ini = ns.override_ini or () def _consider_importhook(self, args): @@ -1007,14 +677,14 @@ class Config(object): """ ns, unknown_args = self._parser.parse_known_and_unknown_args(args) mode = ns.assertmode - if mode == 'rewrite': + if mode == "rewrite": try: hook = _pytest.assertion.install_importhook(self) except SystemError: - mode = 'plain' + mode = "plain" else: self._mark_plugins_for_rewrite(hook) - self._warn_about_missing_assertion(mode) + _warn_about_missing_assertion(mode) def _mark_plugins_for_rewrite(self, hook): """ @@ -1023,17 +693,18 @@ class Config(object): all pytest plugins. """ import pkg_resources + self.pluginmanager.rewrite_hook = hook # 'RECORD' available for plugins installed normally (pip install) # 'SOURCES.txt' available for plugins installed in dev mode (pip install -e) # for installed plugins 'SOURCES.txt' returns an empty list, and vice-versa # so it shouldn't be an issue - metadata_files = 'RECORD', 'SOURCES.txt' + metadata_files = "RECORD", "SOURCES.txt" package_files = ( - entry.split(',')[0] - for entrypoint in pkg_resources.iter_entry_points('pytest11') + entry.split(",")[0] + for entrypoint in pkg_resources.iter_entry_points("pytest11") for metadata in metadata_files for entry in entrypoint.dist._get_metadata(metadata) ) @@ -1041,41 +712,27 @@ class Config(object): for name in _iter_rewritable_modules(package_files): hook.mark_rewrite(name) - def _warn_about_missing_assertion(self, mode): - try: - assert False - except AssertionError: - pass - else: - if mode == 'plain': - sys.stderr.write("WARNING: ASSERTIONS ARE NOT EXECUTED" - " and FAILING TESTS WILL PASS. Are you" - " using python -O?") - else: - sys.stderr.write("WARNING: assertions not in test modules or" - " plugins will be ignored" - " because assert statements are not executed " - "by the underlying Python interpreter " - "(are you using python -O?)\n") - def _preparse(self, args, addopts=True): if addopts: - args[:] = shlex.split(os.environ.get('PYTEST_ADDOPTS', '')) + args + args[:] = shlex.split(os.environ.get("PYTEST_ADDOPTS", "")) + args self._initini(args) if addopts: args[:] = self.getini("addopts") + args self._checkversion() self._consider_importhook(args) self.pluginmanager.consider_preparse(args) - self.pluginmanager.load_setuptools_entrypoints('pytest11') + self.pluginmanager.load_setuptools_entrypoints("pytest11") self.pluginmanager.consider_env() - self.known_args_namespace = ns = self._parser.parse_known_args(args, namespace=self.option.copy()) + self.known_args_namespace = ns = self._parser.parse_known_args( + args, namespace=copy.copy(self.option) + ) if self.known_args_namespace.confcutdir is None and self.inifile: confcutdir = py.path.local(self.inifile).dirname self.known_args_namespace.confcutdir = confcutdir try: - self.hook.pytest_load_initial_conftests(early_config=self, - args=args, parser=self._parser) + self.hook.pytest_load_initial_conftests( + early_config=self, args=args, parser=self._parser + ) except ConftestImportFailure: e = sys.exc_info()[1] if ns.help or ns.version: @@ -1087,33 +744,43 @@ class Config(object): def _checkversion(self): import pytest - minver = self.inicfg.get('minversion', None) + + minver = self.inicfg.get("minversion", None) if minver: ver = minver.split(".") myver = pytest.__version__.split(".") if myver < ver: raise pytest.UsageError( - "%s:%d: requires pytest-%s, actual pytest-%s'" % ( - self.inicfg.config.path, self.inicfg.lineof('minversion'), - minver, pytest.__version__)) + "%s:%d: requires pytest-%s, actual pytest-%s'" + % ( + self.inicfg.config.path, + self.inicfg.lineof("minversion"), + minver, + pytest.__version__, + ) + ) def parse(self, args, addopts=True): # parse given cmdline arguments into this config object. - assert not hasattr(self, 'args'), ( - "can only parse cmdline args at most once per Config object") + assert not hasattr( + self, "args" + ), "can only parse cmdline args at most once per Config object" self._origargs = args self.hook.pytest_addhooks.call_historic( - kwargs=dict(pluginmanager=self.pluginmanager)) + kwargs=dict(pluginmanager=self.pluginmanager) + ) self._preparse(args, addopts=addopts) # XXX deprecated hook: self.hook.pytest_cmdline_preparse(config=self, args=args) self._parser.after_preparse = True try: - args = self._parser.parse_setoption(args, self.option, namespace=self.option) + args = self._parser.parse_setoption( + args, self.option, namespace=self.option + ) if not args: cwd = os.getcwd() if cwd == self.rootdir: - args = self.getini('testpaths') + args = self.getini("testpaths") if not args: args = [cwd] self.args = args @@ -1152,7 +819,7 @@ class Config(object): if default is not None: return default if type is None: - return '' + return "" return [] if type == "pathlist": dp = py.path.local(self.inicfg.config.path).dirpath() @@ -1186,16 +853,15 @@ class Config(object): def _get_override_ini_value(self, name): value = None - # override_ini is a list of list, to support both -o foo1=bar1 foo2=bar2 and - # and -o foo1=bar1 -o foo2=bar2 options - # always use the last item if multiple value set for same ini-name, + # override_ini is a list of "ini=value" options + # always use the last item if multiple values are set for same ini-name, # e.g. -o foo=bar1 -o foo=bar2 will set foo to bar2 - for ini_config_list in self._override_ini: - for ini_config in ini_config_list: - try: - (key, user_ini_value) = ini_config.split("=", 1) - except ValueError: - raise UsageError("-o/--override-ini expects option=value style.") + for ini_config in self._override_ini: + try: + key, user_ini_value = ini_config.split("=", 1) + except ValueError: + raise UsageError("-o/--override-ini expects option=value style.") + else: if key == name: value = user_ini_value return value @@ -1220,6 +886,7 @@ class Config(object): return default if skip: import pytest + pytest.skip("no %r option found" % (name,)) raise ValueError("no option named %r" % (name,)) @@ -1232,124 +899,36 @@ class Config(object): return self.getoption(name, skip=True) -def exists(path, ignore=EnvironmentError): +def _assertion_supported(): try: - return path.check() - except ignore: + assert False + except AssertionError: + return True + else: return False -def getcfg(args, warnfunc=None): - """ - Search the list of arguments for a valid ini-file for pytest, - and return a tuple of (rootdir, inifile, cfg-dict). - - note: warnfunc is an optional function used to warn - about ini-files that use deprecated features. - This parameter should be removed when pytest - adopts standard deprecation warnings (#1804). - """ - from _pytest.deprecated import SETUP_CFG_PYTEST - inibasenames = ["pytest.ini", "tox.ini", "setup.cfg"] - args = [x for x in args if not str(x).startswith("-")] - if not args: - args = [py.path.local()] - for arg in args: - arg = py.path.local(arg) - for base in arg.parts(reverse=True): - for inibasename in inibasenames: - p = base.join(inibasename) - if exists(p): - iniconfig = py.iniconfig.IniConfig(p) - if 'pytest' in iniconfig.sections: - if inibasename == 'setup.cfg' and warnfunc: - warnfunc('C1', SETUP_CFG_PYTEST) - return base, p, iniconfig['pytest'] - if inibasename == 'setup.cfg' and 'tool:pytest' in iniconfig.sections: - return base, p, iniconfig['tool:pytest'] - elif inibasename == "pytest.ini": - # allowed to be empty - return base, p, {} - return None, None, None - - -def get_common_ancestor(paths): - common_ancestor = None - for path in paths: - if not path.exists(): - continue - if common_ancestor is None: - common_ancestor = path +def _warn_about_missing_assertion(mode): + if not _assertion_supported(): + if mode == "plain": + sys.stderr.write( + "WARNING: ASSERTIONS ARE NOT EXECUTED" + " and FAILING TESTS WILL PASS. Are you" + " using python -O?" + ) else: - if path.relto(common_ancestor) or path == common_ancestor: - continue - elif common_ancestor.relto(path): - common_ancestor = path - else: - shared = path.common(common_ancestor) - if shared is not None: - common_ancestor = shared - if common_ancestor is None: - common_ancestor = py.path.local() - elif common_ancestor.isfile(): - common_ancestor = common_ancestor.dirpath() - return common_ancestor - - -def get_dirs_from_args(args): - def is_option(x): - return str(x).startswith('-') - - def get_file_part_from_node_id(x): - return str(x).split('::')[0] - - def get_dir_from_path(path): - if path.isdir(): - return path - return py.path.local(path.dirname) - - # These look like paths but may not exist - possible_paths = ( - py.path.local(get_file_part_from_node_id(arg)) - for arg in args - if not is_option(arg) - ) - - return [ - get_dir_from_path(path) - for path in possible_paths - if path.exists() - ] - - -def determine_setup(inifile, args, warnfunc=None): - dirs = get_dirs_from_args(args) - if inifile: - iniconfig = py.iniconfig.IniConfig(inifile) - try: - inicfg = iniconfig["pytest"] - except KeyError: - inicfg = None - rootdir = get_common_ancestor(dirs) - else: - ancestor = get_common_ancestor(dirs) - rootdir, inifile, inicfg = getcfg([ancestor], warnfunc=warnfunc) - if rootdir is None: - for rootdir in ancestor.parts(reverse=True): - if rootdir.join("setup.py").exists(): - break - else: - rootdir, inifile, inicfg = getcfg(dirs, warnfunc=warnfunc) - if rootdir is None: - rootdir = get_common_ancestor([py.path.local(), ancestor]) - is_fs_root = os.path.splitdrive(str(rootdir))[1] == '/' - if is_fs_root: - rootdir = ancestor - return rootdir, inifile, inicfg or {} + sys.stderr.write( + "WARNING: assertions not in test modules or" + " plugins will be ignored" + " because assert statements are not executed " + "by the underlying Python interpreter " + "(are you using python -O?)\n" + ) def setns(obj, dic): import pytest + for name, value in dic.items(): if isinstance(value, dict): mod = getattr(obj, name, None) @@ -1375,9 +954,9 @@ def create_terminal_writer(config, *args, **kwargs): and has access to a config object should use this function. """ tw = py.io.TerminalWriter(*args, **kwargs) - if config.option.color == 'yes': + if config.option.color == "yes": tw.hasmarkup = True - if config.option.color == 'no': + if config.option.color == "no": tw.hasmarkup = False return tw @@ -1392,9 +971,9 @@ def _strtobool(val): .. note:: copied from distutils.util """ val = val.lower() - if val in ('y', 'yes', 't', 'true', 'on', '1'): + if val in ("y", "yes", "t", "true", "on", "1"): return 1 - elif val in ('n', 'no', 'f', 'false', 'off', '0'): + elif val in ("n", "no", "f", "false", "off", "0"): return 0 else: raise ValueError("invalid truth value %r" % (val,)) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/config/argparsing.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/config/argparsing.py new file mode 100644 index 00000000000..781d8e8c4ee --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/config/argparsing.py @@ -0,0 +1,394 @@ +import six +import warnings +import argparse + +FILE_OR_DIR = "file_or_dir" + + +class Parser(object): + """ Parser for command line arguments and ini-file values. + + :ivar extra_info: dict of generic param -> value to display in case + there's an error processing the command line arguments. + """ + + def __init__(self, usage=None, processopt=None): + self._anonymous = OptionGroup("custom options", parser=self) + self._groups = [] + self._processopt = processopt + self._usage = usage + self._inidict = {} + self._ininames = [] + self.extra_info = {} + + def processoption(self, option): + if self._processopt: + if option.dest: + self._processopt(option) + + def getgroup(self, name, description="", after=None): + """ get (or create) a named option Group. + + :name: name of the option group. + :description: long description for --help output. + :after: name of other group, used for ordering --help output. + + The returned group object has an ``addoption`` method with the same + signature as :py:func:`parser.addoption + <_pytest.config.Parser.addoption>` but will be shown in the + respective group in the output of ``pytest. --help``. + """ + for group in self._groups: + if group.name == name: + return group + group = OptionGroup(name, description, parser=self) + i = 0 + for i, grp in enumerate(self._groups): + if grp.name == after: + break + self._groups.insert(i + 1, group) + return group + + def addoption(self, *opts, **attrs): + """ register a command line option. + + :opts: option names, can be short or long options. + :attrs: same attributes which the ``add_option()`` function of the + `argparse library + `_ + accepts. + + After command line parsing options are available on the pytest config + object via ``config.option.NAME`` where ``NAME`` is usually set + by passing a ``dest`` attribute, for example + ``addoption("--long", dest="NAME", ...)``. + """ + self._anonymous.addoption(*opts, **attrs) + + def parse(self, args, namespace=None): + from _pytest._argcomplete import try_argcomplete + + self.optparser = self._getparser() + try_argcomplete(self.optparser) + return self.optparser.parse_args([str(x) for x in args], namespace=namespace) + + def _getparser(self): + from _pytest._argcomplete import filescompleter + + optparser = MyOptionParser(self, self.extra_info) + groups = self._groups + [self._anonymous] + for group in groups: + if group.options: + desc = group.description or group.name + arggroup = optparser.add_argument_group(desc) + for option in group.options: + n = option.names() + a = option.attrs() + arggroup.add_argument(*n, **a) + # bash like autocompletion for dirs (appending '/') + optparser.add_argument(FILE_OR_DIR, nargs="*").completer = filescompleter + return optparser + + def parse_setoption(self, args, option, namespace=None): + parsedoption = self.parse(args, namespace=namespace) + for name, value in parsedoption.__dict__.items(): + setattr(option, name, value) + return getattr(parsedoption, FILE_OR_DIR) + + def parse_known_args(self, args, namespace=None): + """parses and returns a namespace object with known arguments at this + point. + """ + return self.parse_known_and_unknown_args(args, namespace=namespace)[0] + + def parse_known_and_unknown_args(self, args, namespace=None): + """parses and returns a namespace object with known arguments, and + the remaining arguments unknown at this point. + """ + optparser = self._getparser() + args = [str(x) for x in args] + return optparser.parse_known_args(args, namespace=namespace) + + def addini(self, name, help, type=None, default=None): + """ register an ini-file option. + + :name: name of the ini-variable + :type: type of the variable, can be ``pathlist``, ``args``, ``linelist`` + or ``bool``. + :default: default value if no ini-file option exists but is queried. + + The value of ini-variables can be retrieved via a call to + :py:func:`config.getini(name) <_pytest.config.Config.getini>`. + """ + assert type in (None, "pathlist", "args", "linelist", "bool") + self._inidict[name] = (help, type, default) + self._ininames.append(name) + + +class ArgumentError(Exception): + """ + Raised if an Argument instance is created with invalid or + inconsistent arguments. + """ + + def __init__(self, msg, option): + self.msg = msg + self.option_id = str(option) + + def __str__(self): + if self.option_id: + return "option %s: %s" % (self.option_id, self.msg) + else: + return self.msg + + +class Argument(object): + """class that mimics the necessary behaviour of optparse.Option + + its currently a least effort implementation + and ignoring choices and integer prefixes + https://docs.python.org/3/library/optparse.html#optparse-standard-option-types + """ + _typ_map = {"int": int, "string": str, "float": float, "complex": complex} + + def __init__(self, *names, **attrs): + """store parms in private vars for use in add_argument""" + self._attrs = attrs + self._short_opts = [] + self._long_opts = [] + self.dest = attrs.get("dest") + if "%default" in (attrs.get("help") or ""): + warnings.warn( + 'pytest now uses argparse. "%default" should be' + ' changed to "%(default)s" ', + DeprecationWarning, + stacklevel=3, + ) + try: + typ = attrs["type"] + except KeyError: + pass + else: + # this might raise a keyerror as well, don't want to catch that + if isinstance(typ, six.string_types): + if typ == "choice": + warnings.warn( + "type argument to addoption() is a string %r." + " For parsearg this is optional and when supplied" + " should be a type." + " (options: %s)" % (typ, names), + DeprecationWarning, + stacklevel=3, + ) + # argparse expects a type here take it from + # the type of the first element + attrs["type"] = type(attrs["choices"][0]) + else: + warnings.warn( + "type argument to addoption() is a string %r." + " For parsearg this should be a type." + " (options: %s)" % (typ, names), + DeprecationWarning, + stacklevel=3, + ) + attrs["type"] = Argument._typ_map[typ] + # used in test_parseopt -> test_parse_defaultgetter + self.type = attrs["type"] + else: + self.type = typ + try: + # attribute existence is tested in Config._processopt + self.default = attrs["default"] + except KeyError: + pass + self._set_opt_strings(names) + if not self.dest: + if self._long_opts: + self.dest = self._long_opts[0][2:].replace("-", "_") + else: + try: + self.dest = self._short_opts[0][1:] + except IndexError: + raise ArgumentError("need a long or short option", self) + + def names(self): + return self._short_opts + self._long_opts + + def attrs(self): + # update any attributes set by processopt + attrs = "default dest help".split() + if self.dest: + attrs.append(self.dest) + for attr in attrs: + try: + self._attrs[attr] = getattr(self, attr) + except AttributeError: + pass + if self._attrs.get("help"): + a = self._attrs["help"] + a = a.replace("%default", "%(default)s") + # a = a.replace('%prog', '%(prog)s') + self._attrs["help"] = a + return self._attrs + + def _set_opt_strings(self, opts): + """directly from optparse + + might not be necessary as this is passed to argparse later on""" + for opt in opts: + if len(opt) < 2: + raise ArgumentError( + "invalid option string %r: " + "must be at least two characters long" % opt, + self, + ) + elif len(opt) == 2: + if not (opt[0] == "-" and opt[1] != "-"): + raise ArgumentError( + "invalid short option string %r: " + "must be of the form -x, (x any non-dash char)" % opt, + self, + ) + self._short_opts.append(opt) + else: + if not (opt[0:2] == "--" and opt[2] != "-"): + raise ArgumentError( + "invalid long option string %r: " + "must start with --, followed by non-dash" % opt, + self, + ) + self._long_opts.append(opt) + + def __repr__(self): + args = [] + if self._short_opts: + args += ["_short_opts: " + repr(self._short_opts)] + if self._long_opts: + args += ["_long_opts: " + repr(self._long_opts)] + args += ["dest: " + repr(self.dest)] + if hasattr(self, "type"): + args += ["type: " + repr(self.type)] + if hasattr(self, "default"): + args += ["default: " + repr(self.default)] + return "Argument({})".format(", ".join(args)) + + +class OptionGroup(object): + + def __init__(self, name, description="", parser=None): + self.name = name + self.description = description + self.options = [] + self.parser = parser + + def addoption(self, *optnames, **attrs): + """ add an option to this group. + + if a shortened version of a long option is specified it will + be suppressed in the help. addoption('--twowords', '--two-words') + results in help showing '--two-words' only, but --twowords gets + accepted **and** the automatic destination is in args.twowords + """ + conflict = set(optnames).intersection( + name for opt in self.options for name in opt.names() + ) + if conflict: + raise ValueError("option names %s already added" % conflict) + option = Argument(*optnames, **attrs) + self._addoption_instance(option, shortupper=False) + + def _addoption(self, *optnames, **attrs): + option = Argument(*optnames, **attrs) + self._addoption_instance(option, shortupper=True) + + def _addoption_instance(self, option, shortupper=False): + if not shortupper: + for opt in option._short_opts: + if opt[0] == "-" and opt[1].islower(): + raise ValueError("lowercase shortoptions reserved") + if self.parser: + self.parser.processoption(option) + self.options.append(option) + + +class MyOptionParser(argparse.ArgumentParser): + + def __init__(self, parser, extra_info=None): + if not extra_info: + extra_info = {} + self._parser = parser + argparse.ArgumentParser.__init__( + self, + usage=parser._usage, + add_help=False, + formatter_class=DropShorterLongHelpFormatter, + ) + # extra_info is a dict of (param -> value) to display if there's + # an usage error to provide more contextual information to the user + self.extra_info = extra_info + + def parse_args(self, args=None, namespace=None): + """allow splitting of positional arguments""" + args, argv = self.parse_known_args(args, namespace) + if argv: + for arg in argv: + if arg and arg[0] == "-": + lines = ["unrecognized arguments: %s" % (" ".join(argv))] + for k, v in sorted(self.extra_info.items()): + lines.append(" %s: %s" % (k, v)) + self.error("\n".join(lines)) + getattr(args, FILE_OR_DIR).extend(argv) + return args + + +class DropShorterLongHelpFormatter(argparse.HelpFormatter): + """shorten help for long options that differ only in extra hyphens + + - collapse **long** options that are the same except for extra hyphens + - special action attribute map_long_option allows surpressing additional + long options + - shortcut if there are only two options and one of them is a short one + - cache result on action object as this is called at least 2 times + """ + + def _format_action_invocation(self, action): + orgstr = argparse.HelpFormatter._format_action_invocation(self, action) + if orgstr and orgstr[0] != "-": # only optional arguments + return orgstr + res = getattr(action, "_formatted_action_invocation", None) + if res: + return res + options = orgstr.split(", ") + if len(options) == 2 and (len(options[0]) == 2 or len(options[1]) == 2): + # a shortcut for '-h, --help' or '--abc', '-a' + action._formatted_action_invocation = orgstr + return orgstr + return_list = [] + option_map = getattr(action, "map_long_option", {}) + if option_map is None: + option_map = {} + short_long = {} + for option in options: + if len(option) == 2 or option[2] == " ": + continue + if not option.startswith("--"): + raise ArgumentError( + 'long optional argument without "--": [%s]' % (option), self + ) + xxoption = option[2:] + if xxoption.split()[0] not in option_map: + shortened = xxoption.replace("-", "") + if ( + shortened not in short_long + or len(short_long[shortened]) < len(xxoption) + ): + short_long[shortened] = xxoption + # now short_long has been filled out to the longest with dashes + # **and** we keep the right option ordering from add_argument + for option in options: + if len(option) == 2 or option[2] == " ": + return_list.append(option) + if option[2:] == short_long.get(option.replace("-", "")): + return_list.append(option.replace(" ", "=", 1)) + action._formatted_action_invocation = ", ".join(return_list) + return action._formatted_action_invocation diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/config/exceptions.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/config/exceptions.py new file mode 100644 index 00000000000..64bae834d1c --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/config/exceptions.py @@ -0,0 +1,8 @@ +class UsageError(Exception): + """ error in pytest usage or invocation""" + + +class PrintHelp(Exception): + """Raised when pytest should print it's help to skip the rest of the + argument parsing and validation.""" + pass diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/config/findpaths.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/config/findpaths.py new file mode 100644 index 00000000000..fde7bddb939 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/config/findpaths.py @@ -0,0 +1,140 @@ +import py +import os +from .exceptions import UsageError + + +def exists(path, ignore=EnvironmentError): + try: + return path.check() + except ignore: + return False + + +def getcfg(args, warnfunc=None): + """ + Search the list of arguments for a valid ini-file for pytest, + and return a tuple of (rootdir, inifile, cfg-dict). + + note: warnfunc is an optional function used to warn + about ini-files that use deprecated features. + This parameter should be removed when pytest + adopts standard deprecation warnings (#1804). + """ + from _pytest.deprecated import CFG_PYTEST_SECTION + + inibasenames = ["pytest.ini", "tox.ini", "setup.cfg"] + args = [x for x in args if not str(x).startswith("-")] + if not args: + args = [py.path.local()] + for arg in args: + arg = py.path.local(arg) + for base in arg.parts(reverse=True): + for inibasename in inibasenames: + p = base.join(inibasename) + if exists(p): + iniconfig = py.iniconfig.IniConfig(p) + if "pytest" in iniconfig.sections: + if inibasename == "setup.cfg" and warnfunc: + warnfunc( + "C1", CFG_PYTEST_SECTION.format(filename=inibasename) + ) + return base, p, iniconfig["pytest"] + if ( + inibasename == "setup.cfg" + and "tool:pytest" in iniconfig.sections + ): + return base, p, iniconfig["tool:pytest"] + elif inibasename == "pytest.ini": + # allowed to be empty + return base, p, {} + return None, None, None + + +def get_common_ancestor(paths): + common_ancestor = None + for path in paths: + if not path.exists(): + continue + if common_ancestor is None: + common_ancestor = path + else: + if path.relto(common_ancestor) or path == common_ancestor: + continue + elif common_ancestor.relto(path): + common_ancestor = path + else: + shared = path.common(common_ancestor) + if shared is not None: + common_ancestor = shared + if common_ancestor is None: + common_ancestor = py.path.local() + elif common_ancestor.isfile(): + common_ancestor = common_ancestor.dirpath() + return common_ancestor + + +def get_dirs_from_args(args): + + def is_option(x): + return str(x).startswith("-") + + def get_file_part_from_node_id(x): + return str(x).split("::")[0] + + def get_dir_from_path(path): + if path.isdir(): + return path + return py.path.local(path.dirname) + + # These look like paths but may not exist + possible_paths = ( + py.path.local(get_file_part_from_node_id(arg)) + for arg in args + if not is_option(arg) + ) + + return [get_dir_from_path(path) for path in possible_paths if path.exists()] + + +def determine_setup(inifile, args, warnfunc=None, rootdir_cmd_arg=None): + dirs = get_dirs_from_args(args) + if inifile: + iniconfig = py.iniconfig.IniConfig(inifile) + is_cfg_file = str(inifile).endswith(".cfg") + # TODO: [pytest] section in *.cfg files is depricated. Need refactoring. + sections = ["tool:pytest", "pytest"] if is_cfg_file else ["pytest"] + for section in sections: + try: + inicfg = iniconfig[section] + if is_cfg_file and section == "pytest" and warnfunc: + from _pytest.deprecated import CFG_PYTEST_SECTION + + warnfunc("C1", CFG_PYTEST_SECTION.format(filename=str(inifile))) + break + except KeyError: + inicfg = None + rootdir = get_common_ancestor(dirs) + else: + ancestor = get_common_ancestor(dirs) + rootdir, inifile, inicfg = getcfg([ancestor], warnfunc=warnfunc) + if rootdir is None: + for rootdir in ancestor.parts(reverse=True): + if rootdir.join("setup.py").exists(): + break + else: + rootdir, inifile, inicfg = getcfg(dirs, warnfunc=warnfunc) + if rootdir is None: + rootdir = get_common_ancestor([py.path.local(), ancestor]) + is_fs_root = os.path.splitdrive(str(rootdir))[1] == "/" + if is_fs_root: + rootdir = ancestor + if rootdir_cmd_arg: + rootdir_abs_path = py.path.local(os.path.expandvars(rootdir_cmd_arg)) + if not os.path.isdir(str(rootdir_abs_path)): + raise UsageError( + "Directory '{}' not found. Check your '--rootdir' option.".format( + rootdir_abs_path + ) + ) + rootdir = rootdir_abs_path + return rootdir, inifile, inicfg or {} diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/debugging.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/debugging.py similarity index 69% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/debugging.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/debugging.py index d7dca780956..2e253aaa2af 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/debugging.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/debugging.py @@ -2,17 +2,32 @@ from __future__ import absolute_import, division, print_function import pdb import sys +import os +from doctest import UnexpectedException + +try: + from builtins import breakpoint # noqa + + SUPPORTS_BREAKPOINT_BUILTIN = True +except ImportError: + SUPPORTS_BREAKPOINT_BUILTIN = False def pytest_addoption(parser): group = parser.getgroup("general") group._addoption( - '--pdb', dest="usepdb", action="store_true", - help="start the interactive Python debugger on errors.") + "--pdb", + dest="usepdb", + action="store_true", + help="start the interactive Python debugger on errors or KeyboardInterrupt.", + ) group._addoption( - '--pdbcls', dest="usepdb_cls", metavar="modulename:classname", + "--pdbcls", + dest="usepdb_cls", + metavar="modulename:classname", help="start a custom interactive Python debugger on errors. " - "For example: --pdbcls=IPython.terminal.debugger:TerminalPdb") + "For example: --pdbcls=IPython.terminal.debugger:TerminalPdb", + ) def pytest_configure(config): @@ -24,7 +39,13 @@ def pytest_configure(config): pdb_cls = pdb.Pdb if config.getvalue("usepdb"): - config.pluginmanager.register(PdbInvoke(), 'pdbinvoke') + config.pluginmanager.register(PdbInvoke(), "pdbinvoke") + + # Use custom Pdb class set_trace instead of default Pdb on breakpoint() call + if SUPPORTS_BREAKPOINT_BUILTIN: + _environ_pythonbreakpoint = os.environ.get("PYTHONBREAKPOINT", "") + if _environ_pythonbreakpoint == "": + sys.breakpointhook = pytestPDB.set_trace old = (pdb.set_trace, pytestPDB._pluginmanager) @@ -32,6 +53,8 @@ def pytest_configure(config): pdb.set_trace, pytestPDB._pluginmanager = old pytestPDB._config = None pytestPDB._pdb_cls = pdb.Pdb + if SUPPORTS_BREAKPOINT_BUILTIN: + sys.breakpointhook = sys.__breakpointhook__ pdb.set_trace = pytestPDB.set_trace pytestPDB._pluginmanager = config.pluginmanager @@ -40,7 +63,7 @@ def pytest_configure(config): config._cleanup.append(fin) -class pytestPDB: +class pytestPDB(object): """ Pseudo PDB that defers to the real pdb. """ _pluginmanager = None _config = None @@ -50,6 +73,7 @@ class pytestPDB: def set_trace(cls): """ invoke PDB set_trace debugging, dropping any IO capturing. """ import _pytest.config + frame = sys._getframe().f_back if cls._pluginmanager is not None: capman = cls._pluginmanager.getplugin("capturemanager") @@ -62,7 +86,8 @@ class pytestPDB: cls._pdb_cls().set_trace(frame) -class PdbInvoke: +class PdbInvoke(object): + def pytest_exception_interact(self, node, call, report): capman = node.config.pluginmanager.getplugin("capturemanager") if capman: @@ -85,6 +110,18 @@ def _enter_pdb(node, excinfo, rep): # for not completely clear reasons. tw = node.config.pluginmanager.getplugin("terminalreporter")._tw tw.line() + + showcapture = node.config.option.showcapture + + for sectionname, content in ( + ("stdout", rep.capstdout), ("stderr", rep.capstderr), ("log", rep.caplog) + ): + if showcapture in (sectionname, "all") and content: + tw.sep(">", "captured " + sectionname) + if content[-1:] == "\n": + content = content[:-1] + tw.line(content) + tw.sep(">", "traceback") rep.toterminal(tw) tw.sep(">", "entering PDB") @@ -95,10 +132,9 @@ def _enter_pdb(node, excinfo, rep): def _postmortem_traceback(excinfo): - # A doctest.UnexpectedException is not useful for post_mortem. - # Use the underlying exception instead: - from doctest import UnexpectedException if isinstance(excinfo.value, UnexpectedException): + # A doctest.UnexpectedException is not useful for post_mortem. + # Use the underlying exception instead: return excinfo.value.exc_info[2] else: return excinfo._excinfo[2] @@ -112,12 +148,15 @@ def _find_last_non_hidden_frame(stack): def post_mortem(t): + class Pdb(pytestPDB._pdb_cls): + def get_stack(self, f, t): stack, i = pdb.Pdb.get_stack(self, f, t) if f is None: i = _find_last_non_hidden_frame(stack) return stack, i + p = Pdb() p.reset() p.interaction(None, t) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/deprecated.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/deprecated.py new file mode 100644 index 00000000000..7ebdcf99972 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/deprecated.py @@ -0,0 +1,65 @@ +""" +This module contains deprecation messages and bits of code used elsewhere in the codebase +that is planned to be removed in the next pytest release. + +Keeping it in a central location makes it easy to track what is deprecated and should +be removed when the time comes. +""" +from __future__ import absolute_import, division, print_function + + +class RemovedInPytest4Warning(DeprecationWarning): + """warning class for features removed in pytest 4.0""" + + +MAIN_STR_ARGS = "passing a string to pytest.main() is deprecated, " "pass a list of arguments instead." + +YIELD_TESTS = "yield tests are deprecated, and scheduled to be removed in pytest 4.0" + +FUNCARG_PREFIX = ( + '{name}: declaring fixtures using "pytest_funcarg__" prefix is deprecated ' + "and scheduled to be removed in pytest 4.0. " + "Please remove the prefix and use the @pytest.fixture decorator instead." +) + +CFG_PYTEST_SECTION = "[pytest] section in {filename} files is deprecated, use [tool:pytest] instead." + +GETFUNCARGVALUE = "use of getfuncargvalue is deprecated, use getfixturevalue" + +RESULT_LOG = ( + "--result-log is deprecated and scheduled for removal in pytest 4.0.\n" + "See https://docs.pytest.org/en/latest/usage.html#creating-resultlog-format-files for more information." +) + +MARK_INFO_ATTRIBUTE = RemovedInPytest4Warning( + "MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly.\n" + "Please use node.get_closest_marker(name) or node.iter_markers(name).\n" + "Docs: https://docs.pytest.org/en/latest/mark.html#updating-code" +) + +MARK_PARAMETERSET_UNPACKING = RemovedInPytest4Warning( + "Applying marks directly to parameters is deprecated," + " please use pytest.param(..., marks=...) instead.\n" + "For more details, see: https://docs.pytest.org/en/latest/parametrize.html" +) + +RECORD_XML_PROPERTY = ( + 'Fixture renamed from "record_xml_property" to "record_property" as user ' + "properties are now available to all reporters.\n" + '"record_xml_property" is now deprecated.' +) + +COLLECTOR_MAKEITEM = RemovedInPytest4Warning( + "pycollector makeitem was removed " "as it is an accidentially leaked internal api" +) + +METAFUNC_ADD_CALL = ( + "Metafunc.addcall is deprecated and scheduled to be removed in pytest 4.0.\n" + "Please use Metafunc.parametrize instead." +) + +PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST = RemovedInPytest4Warning( + "Defining pytest_plugins in a non-top-level conftest is deprecated, " + "because it affects the entire directory tree in a non-explicit way.\n" + "Please move it to the top level conftest file instead." +) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/doctest.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/doctest.py new file mode 100644 index 00000000000..b0a3ad08dfc --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/doctest.py @@ -0,0 +1,520 @@ +""" discover and run doctests in modules and test files.""" +from __future__ import absolute_import, division, print_function + +import traceback +import sys +import platform + +import pytest +from _pytest._code.code import ExceptionInfo, ReprFileLocation, TerminalRepr +from _pytest.fixtures import FixtureRequest + + +DOCTEST_REPORT_CHOICE_NONE = "none" +DOCTEST_REPORT_CHOICE_CDIFF = "cdiff" +DOCTEST_REPORT_CHOICE_NDIFF = "ndiff" +DOCTEST_REPORT_CHOICE_UDIFF = "udiff" +DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE = "only_first_failure" + +DOCTEST_REPORT_CHOICES = ( + DOCTEST_REPORT_CHOICE_NONE, + DOCTEST_REPORT_CHOICE_CDIFF, + DOCTEST_REPORT_CHOICE_NDIFF, + DOCTEST_REPORT_CHOICE_UDIFF, + DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE, +) + +# Lazy definition of runner class +RUNNER_CLASS = None + + +def pytest_addoption(parser): + parser.addini( + "doctest_optionflags", + "option flags for doctests", + type="args", + default=["ELLIPSIS"], + ) + parser.addini( + "doctest_encoding", "encoding used for doctest files", default="utf-8" + ) + group = parser.getgroup("collect") + group.addoption( + "--doctest-modules", + action="store_true", + default=False, + help="run doctests in all .py modules", + dest="doctestmodules", + ) + group.addoption( + "--doctest-report", + type=str.lower, + default="udiff", + help="choose another output format for diffs on doctest failure", + choices=DOCTEST_REPORT_CHOICES, + dest="doctestreport", + ) + group.addoption( + "--doctest-glob", + action="append", + default=[], + metavar="pat", + help="doctests file matching pattern, default: test*.txt", + dest="doctestglob", + ) + group.addoption( + "--doctest-ignore-import-errors", + action="store_true", + default=False, + help="ignore doctest ImportErrors", + dest="doctest_ignore_import_errors", + ) + group.addoption( + "--doctest-continue-on-failure", + action="store_true", + default=False, + help="for a given doctest, continue to run after the first failure", + dest="doctest_continue_on_failure", + ) + + +def pytest_collect_file(path, parent): + config = parent.config + if path.ext == ".py": + if config.option.doctestmodules and not _is_setup_py(config, path, parent): + return DoctestModule(path, parent) + elif _is_doctest(config, path, parent): + return DoctestTextfile(path, parent) + + +def _is_setup_py(config, path, parent): + if path.basename != "setup.py": + return False + contents = path.read() + return "setuptools" in contents or "distutils" in contents + + +def _is_doctest(config, path, parent): + if path.ext in (".txt", ".rst") and parent.session.isinitpath(path): + return True + globs = config.getoption("doctestglob") or ["test*.txt"] + for glob in globs: + if path.check(fnmatch=glob): + return True + return False + + +class ReprFailDoctest(TerminalRepr): + + def __init__(self, reprlocation_lines): + # List of (reprlocation, lines) tuples + self.reprlocation_lines = reprlocation_lines + + def toterminal(self, tw): + for reprlocation, lines in self.reprlocation_lines: + for line in lines: + tw.line(line) + reprlocation.toterminal(tw) + + +class MultipleDoctestFailures(Exception): + + def __init__(self, failures): + super(MultipleDoctestFailures, self).__init__() + self.failures = failures + + +def _init_runner_class(): + import doctest + + class PytestDoctestRunner(doctest.DebugRunner): + """ + Runner to collect failures. Note that the out variable in this case is + a list instead of a stdout-like object + """ + + def __init__( + self, checker=None, verbose=None, optionflags=0, continue_on_failure=True + ): + doctest.DebugRunner.__init__( + self, checker=checker, verbose=verbose, optionflags=optionflags + ) + self.continue_on_failure = continue_on_failure + + def report_failure(self, out, test, example, got): + failure = doctest.DocTestFailure(test, example, got) + if self.continue_on_failure: + out.append(failure) + else: + raise failure + + def report_unexpected_exception(self, out, test, example, exc_info): + failure = doctest.UnexpectedException(test, example, exc_info) + if self.continue_on_failure: + out.append(failure) + else: + raise failure + + return PytestDoctestRunner + + +def _get_runner(checker=None, verbose=None, optionflags=0, continue_on_failure=True): + # We need this in order to do a lazy import on doctest + global RUNNER_CLASS + if RUNNER_CLASS is None: + RUNNER_CLASS = _init_runner_class() + return RUNNER_CLASS( + checker=checker, + verbose=verbose, + optionflags=optionflags, + continue_on_failure=continue_on_failure, + ) + + +class DoctestItem(pytest.Item): + + def __init__(self, name, parent, runner=None, dtest=None): + super(DoctestItem, self).__init__(name, parent) + self.runner = runner + self.dtest = dtest + self.obj = None + self.fixture_request = None + + def setup(self): + if self.dtest is not None: + self.fixture_request = _setup_fixtures(self) + globs = dict(getfixture=self.fixture_request.getfixturevalue) + for name, value in self.fixture_request.getfixturevalue( + "doctest_namespace" + ).items(): + globs[name] = value + self.dtest.globs.update(globs) + + def runtest(self): + _check_all_skipped(self.dtest) + self._disable_output_capturing_for_darwin() + failures = [] + self.runner.run(self.dtest, out=failures) + if failures: + raise MultipleDoctestFailures(failures) + + def _disable_output_capturing_for_darwin(self): + """ + Disable output capturing. Otherwise, stdout is lost to doctest (#985) + """ + if platform.system() != "Darwin": + return + capman = self.config.pluginmanager.getplugin("capturemanager") + if capman: + out, err = capman.suspend_global_capture(in_=True) + sys.stdout.write(out) + sys.stderr.write(err) + + def repr_failure(self, excinfo): + import doctest + + failures = None + if excinfo.errisinstance((doctest.DocTestFailure, doctest.UnexpectedException)): + failures = [excinfo.value] + elif excinfo.errisinstance(MultipleDoctestFailures): + failures = excinfo.value.failures + + if failures is not None: + reprlocation_lines = [] + for failure in failures: + example = failure.example + test = failure.test + filename = test.filename + if test.lineno is None: + lineno = None + else: + lineno = test.lineno + example.lineno + 1 + message = type(failure).__name__ + reprlocation = ReprFileLocation(filename, lineno, message) + checker = _get_checker() + report_choice = _get_report_choice( + self.config.getoption("doctestreport") + ) + if lineno is not None: + lines = failure.test.docstring.splitlines(False) + # add line numbers to the left of the error message + lines = [ + "%03d %s" % (i + test.lineno + 1, x) + for (i, x) in enumerate(lines) + ] + # trim docstring error lines to 10 + lines = lines[max(example.lineno - 9, 0):example.lineno + 1] + else: + lines = [ + "EXAMPLE LOCATION UNKNOWN, not showing all tests of that example" + ] + indent = ">>>" + for line in example.source.splitlines(): + lines.append("??? %s %s" % (indent, line)) + indent = "..." + if isinstance(failure, doctest.DocTestFailure): + lines += checker.output_difference( + example, failure.got, report_choice + ).split( + "\n" + ) + else: + inner_excinfo = ExceptionInfo(failure.exc_info) + lines += ["UNEXPECTED EXCEPTION: %s" % repr(inner_excinfo.value)] + lines += traceback.format_exception(*failure.exc_info) + reprlocation_lines.append((reprlocation, lines)) + return ReprFailDoctest(reprlocation_lines) + else: + return super(DoctestItem, self).repr_failure(excinfo) + + def reportinfo(self): + return self.fspath, self.dtest.lineno, "[doctest] %s" % self.name + + +def _get_flag_lookup(): + import doctest + + return dict( + DONT_ACCEPT_TRUE_FOR_1=doctest.DONT_ACCEPT_TRUE_FOR_1, + DONT_ACCEPT_BLANKLINE=doctest.DONT_ACCEPT_BLANKLINE, + NORMALIZE_WHITESPACE=doctest.NORMALIZE_WHITESPACE, + ELLIPSIS=doctest.ELLIPSIS, + IGNORE_EXCEPTION_DETAIL=doctest.IGNORE_EXCEPTION_DETAIL, + COMPARISON_FLAGS=doctest.COMPARISON_FLAGS, + ALLOW_UNICODE=_get_allow_unicode_flag(), + ALLOW_BYTES=_get_allow_bytes_flag(), + ) + + +def get_optionflags(parent): + optionflags_str = parent.config.getini("doctest_optionflags") + flag_lookup_table = _get_flag_lookup() + flag_acc = 0 + for flag in optionflags_str: + flag_acc |= flag_lookup_table[flag] + return flag_acc + + +def _get_continue_on_failure(config): + continue_on_failure = config.getvalue("doctest_continue_on_failure") + if continue_on_failure: + # We need to turn off this if we use pdb since we should stop at + # the first failure + if config.getvalue("usepdb"): + continue_on_failure = False + return continue_on_failure + + +class DoctestTextfile(pytest.Module): + obj = None + + def collect(self): + import doctest + + # inspired by doctest.testfile; ideally we would use it directly, + # but it doesn't support passing a custom checker + encoding = self.config.getini("doctest_encoding") + text = self.fspath.read_text(encoding) + filename = str(self.fspath) + name = self.fspath.basename + globs = {"__name__": "__main__"} + + optionflags = get_optionflags(self) + + runner = _get_runner( + verbose=0, + optionflags=optionflags, + checker=_get_checker(), + continue_on_failure=_get_continue_on_failure(self.config), + ) + _fix_spoof_python2(runner, encoding) + + parser = doctest.DocTestParser() + test = parser.get_doctest(text, globs, name, filename, 0) + if test.examples: + yield DoctestItem(test.name, self, runner, test) + + +def _check_all_skipped(test): + """raises pytest.skip() if all examples in the given DocTest have the SKIP + option set. + """ + import doctest + + all_skipped = all(x.options.get(doctest.SKIP, False) for x in test.examples) + if all_skipped: + pytest.skip("all tests skipped by +SKIP option") + + +class DoctestModule(pytest.Module): + + def collect(self): + import doctest + + if self.fspath.basename == "conftest.py": + module = self.config.pluginmanager._importconftest(self.fspath) + else: + try: + module = self.fspath.pyimport() + except ImportError: + if self.config.getvalue("doctest_ignore_import_errors"): + pytest.skip("unable to import module %r" % self.fspath) + else: + raise + # uses internal doctest module parsing mechanism + finder = doctest.DocTestFinder() + optionflags = get_optionflags(self) + runner = _get_runner( + verbose=0, + optionflags=optionflags, + checker=_get_checker(), + continue_on_failure=_get_continue_on_failure(self.config), + ) + + for test in finder.find(module, module.__name__): + if test.examples: # skip empty doctests + yield DoctestItem(test.name, self, runner, test) + + +def _setup_fixtures(doctest_item): + """ + Used by DoctestTextfile and DoctestItem to setup fixture information. + """ + + def func(): + pass + + doctest_item.funcargs = {} + fm = doctest_item.session._fixturemanager + doctest_item._fixtureinfo = fm.getfixtureinfo( + node=doctest_item, func=func, cls=None, funcargs=False + ) + fixture_request = FixtureRequest(doctest_item) + fixture_request._fillfixtures() + return fixture_request + + +def _get_checker(): + """ + Returns a doctest.OutputChecker subclass that takes in account the + ALLOW_UNICODE option to ignore u'' prefixes in strings and ALLOW_BYTES + to strip b'' prefixes. + Useful when the same doctest should run in Python 2 and Python 3. + + An inner class is used to avoid importing "doctest" at the module + level. + """ + if hasattr(_get_checker, "LiteralsOutputChecker"): + return _get_checker.LiteralsOutputChecker() + + import doctest + import re + + class LiteralsOutputChecker(doctest.OutputChecker): + """ + Copied from doctest_nose_plugin.py from the nltk project: + https://github.com/nltk/nltk + + Further extended to also support byte literals. + """ + + _unicode_literal_re = re.compile(r"(\W|^)[uU]([rR]?[\'\"])", re.UNICODE) + _bytes_literal_re = re.compile(r"(\W|^)[bB]([rR]?[\'\"])", re.UNICODE) + + def check_output(self, want, got, optionflags): + res = doctest.OutputChecker.check_output(self, want, got, optionflags) + if res: + return True + + allow_unicode = optionflags & _get_allow_unicode_flag() + allow_bytes = optionflags & _get_allow_bytes_flag() + if not allow_unicode and not allow_bytes: + return False + + else: # pragma: no cover + + def remove_prefixes(regex, txt): + return re.sub(regex, r"\1\2", txt) + + if allow_unicode: + want = remove_prefixes(self._unicode_literal_re, want) + got = remove_prefixes(self._unicode_literal_re, got) + if allow_bytes: + want = remove_prefixes(self._bytes_literal_re, want) + got = remove_prefixes(self._bytes_literal_re, got) + res = doctest.OutputChecker.check_output(self, want, got, optionflags) + return res + + _get_checker.LiteralsOutputChecker = LiteralsOutputChecker + return _get_checker.LiteralsOutputChecker() + + +def _get_allow_unicode_flag(): + """ + Registers and returns the ALLOW_UNICODE flag. + """ + import doctest + + return doctest.register_optionflag("ALLOW_UNICODE") + + +def _get_allow_bytes_flag(): + """ + Registers and returns the ALLOW_BYTES flag. + """ + import doctest + + return doctest.register_optionflag("ALLOW_BYTES") + + +def _get_report_choice(key): + """ + This function returns the actual `doctest` module flag value, we want to do it as late as possible to avoid + importing `doctest` and all its dependencies when parsing options, as it adds overhead and breaks tests. + """ + import doctest + + return { + DOCTEST_REPORT_CHOICE_UDIFF: doctest.REPORT_UDIFF, + DOCTEST_REPORT_CHOICE_CDIFF: doctest.REPORT_CDIFF, + DOCTEST_REPORT_CHOICE_NDIFF: doctest.REPORT_NDIFF, + DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE: doctest.REPORT_ONLY_FIRST_FAILURE, + DOCTEST_REPORT_CHOICE_NONE: 0, + }[ + key + ] + + +def _fix_spoof_python2(runner, encoding): + """ + Installs a "SpoofOut" into the given DebugRunner so it properly deals with unicode output. This + should patch only doctests for text files because they don't have a way to declare their + encoding. Doctests in docstrings from Python modules don't have the same problem given that + Python already decoded the strings. + + This fixes the problem related in issue #2434. + """ + from _pytest.compat import _PY2 + + if not _PY2: + return + + from doctest import _SpoofOut + + class UnicodeSpoof(_SpoofOut): + + def getvalue(self): + result = _SpoofOut.getvalue(self) + if encoding and isinstance(result, bytes): + result = result.decode(encoding) + return result + + runner._fakeout = UnicodeSpoof() + + +@pytest.fixture(scope="session") +def doctest_namespace(): + """ + Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests. + """ + return dict() diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/fixtures.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/fixtures.py similarity index 80% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/fixtures.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/fixtures.py index e09ffaddba7..495e6b9b332 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/fixtures.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/fixtures.py @@ -4,7 +4,8 @@ import functools import inspect import sys import warnings -from collections import OrderedDict +from collections import OrderedDict, deque, defaultdict +from more_itertools import flatten import attr import py @@ -14,25 +15,42 @@ import _pytest from _pytest import nodes from _pytest._code.code import TerminalRepr from _pytest.compat import ( - NOTSET, exc_clear, _format_args, - getfslineno, get_real_func, - is_generator, isclass, getimfunc, - getlocation, getfuncargnames, + NOTSET, + exc_clear, + _format_args, + getfslineno, + get_real_func, + is_generator, + isclass, + getimfunc, + getlocation, + getfuncargnames, safe_getattr, FuncargnamesCompatAttr, ) from _pytest.outcomes import fail, TEST_OUTCOME +FIXTURE_MSG = 'fixtures cannot have "pytest_funcarg__" prefix and be decorated with @pytest.fixture:\n{}' + + +@attr.s(frozen=True) +class PseudoFixtureDef(object): + cached_result = attr.ib() + scope = attr.ib() + def pytest_sessionstart(session): import _pytest.python + import _pytest.nodes - scopename2class.update({ - 'class': _pytest.python.Class, - 'module': _pytest.python.Module, - 'function': _pytest.main.Item, - 'session': _pytest.main.Session, - }) + scopename2class.update( + { + "class": _pytest.python.Class, + "module": _pytest.python.Module, + "function": _pytest.nodes.Item, + "session": _pytest.main.Session, + } + ) session._fixturemanager = FixtureManager(session) @@ -42,21 +60,24 @@ scopename2class = {} scope2props = dict(session=()) scope2props["module"] = ("fspath", "module") scope2props["class"] = scope2props["module"] + ("cls",) -scope2props["instance"] = scope2props["class"] + ("instance", ) +scope2props["instance"] = scope2props["class"] + ("instance",) scope2props["function"] = scope2props["instance"] + ("function", "keywords") def scopeproperty(name=None, doc=None): + def decoratescope(func): scopename = name or func.__name__ def provide(self): if func.__name__ in scope2props[self.scope]: return func(self) - raise AttributeError("%s not available in %s-scoped context" % ( - scopename, self.scope)) + raise AttributeError( + "%s not available in %s-scoped context" % (scopename, self.scope) + ) return property(provide, None, None, func.__doc__) + return decoratescope @@ -87,8 +108,7 @@ def add_funcarg_pseudo_fixture_def(collector, metafunc, fixturemanager): callspec.indices[argname] = len(arg2params_list) arg2params_list.append(argvalue) if argname not in arg2scope: - scopenum = callspec._arg2scopenum.get(argname, - scopenum_function) + scopenum = callspec._arg2scopenum.get(argname, scopenum_function) arg2scope[argname] = scopes[scopenum] callspec.funcargs.clear() @@ -111,10 +131,16 @@ def add_funcarg_pseudo_fixture_def(collector, metafunc, fixturemanager): if node and argname in node._name2pseudofixturedef: arg2fixturedefs[argname] = [node._name2pseudofixturedef[argname]] else: - fixturedef = FixtureDef(fixturemanager, '', argname, - get_direct_param_fixture_func, - arg2scope[argname], - valuelist, False, False) + fixturedef = FixtureDef( + fixturemanager, + "", + argname, + get_direct_param_fixture_func, + arg2scope[argname], + valuelist, + False, + False, + ) arg2fixturedefs[argname] = [fixturedef] if node is not None: node._name2pseudofixturedef[argname] = fixturedef @@ -146,7 +172,7 @@ def get_parametrized_fixture_keys(item, scopenum): for argname, param_index in sorted(cs.indices.items()): if cs._arg2scopenum[argname] != scopenum: continue - if scopenum == 0: # session + if scopenum == 0: # session key = (argname, param_index) elif scopenum == 1: # module key = (argname, param_index, item.fspath) @@ -160,64 +186,67 @@ def get_parametrized_fixture_keys(item, scopenum): # down to the lower scopes such as to minimize number of "high scope" # setups and teardowns + def reorder_items(items): argkeys_cache = {} + items_by_argkey = {} for scopenum in range(0, scopenum_function): argkeys_cache[scopenum] = d = {} + items_by_argkey[scopenum] = item_d = defaultdict(deque) for item in items: keys = OrderedDict.fromkeys(get_parametrized_fixture_keys(item, scopenum)) if keys: d[item] = keys - return reorder_items_atscope(items, set(), argkeys_cache, 0) + for key in keys: + item_d[key].append(item) + items = OrderedDict.fromkeys(items) + return list(reorder_items_atscope(items, argkeys_cache, items_by_argkey, 0)) -def reorder_items_atscope(items, ignore, argkeys_cache, scopenum): +def fix_cache_order(item, argkeys_cache, items_by_argkey): + for scopenum in range(0, scopenum_function): + for key in argkeys_cache[scopenum].get(item, []): + items_by_argkey[scopenum][key].appendleft(item) + + +def reorder_items_atscope(items, argkeys_cache, items_by_argkey, scopenum): if scopenum >= scopenum_function or len(items) < 3: return items - items_done = [] - while 1: - items_before, items_same, items_other, newignore = \ - slice_items(items, ignore, argkeys_cache[scopenum]) - items_before = reorder_items_atscope( - items_before, ignore, argkeys_cache, scopenum + 1) - if items_same is None: - # nothing to reorder in this scope - assert items_other is None - return items_done + items_before - items_done.extend(items_before) - items = items_same + items_other - ignore = newignore - - -def slice_items(items, ignore, scoped_argkeys_cache): - # we pick the first item which uses a fixture instance in the - # requested scope and which we haven't seen yet. We slice the input - # items list into a list of items_nomatch, items_same and - # items_other - if scoped_argkeys_cache: # do we need to do work at all? - it = iter(items) - # first find a slicing key - for i, item in enumerate(it): - argkeys = scoped_argkeys_cache.get(item) - if argkeys is not None: - newargkeys = OrderedDict.fromkeys(k for k in argkeys if k not in ignore) - if newargkeys: # found a slicing key - slicing_argkey, _ = newargkeys.popitem() - items_before = items[:i] - items_same = [item] - items_other = [] - # now slice the remainder of the list - for item in it: - argkeys = scoped_argkeys_cache.get(item) - if argkeys and slicing_argkey in argkeys and \ - slicing_argkey not in ignore: - items_same.append(item) - else: - items_other.append(item) - newignore = ignore.copy() - newignore.add(slicing_argkey) - return (items_before, items_same, items_other, newignore) - return items, None, None, None + ignore = set() + items_deque = deque(items) + items_done = OrderedDict() + scoped_items_by_argkey = items_by_argkey[scopenum] + scoped_argkeys_cache = argkeys_cache[scopenum] + while items_deque: + no_argkey_group = OrderedDict() + slicing_argkey = None + while items_deque: + item = items_deque.popleft() + if item in items_done or item in no_argkey_group: + continue + argkeys = OrderedDict.fromkeys( + k for k in scoped_argkeys_cache.get(item, []) if k not in ignore + ) + if not argkeys: + no_argkey_group[item] = None + else: + slicing_argkey, _ = argkeys.popitem() + # we don't have to remove relevant items from later in the deque because they'll just be ignored + matching_items = [ + i for i in scoped_items_by_argkey[slicing_argkey] if i in items + ] + for i in reversed(matching_items): + fix_cache_order(i, argkeys_cache, items_by_argkey) + items_deque.appendleft(i) + break + if no_argkey_group: + no_argkey_group = reorder_items_atscope( + no_argkey_group, argkeys_cache, items_by_argkey, scopenum + 1 + ) + for item in no_argkey_group: + items_done[item] = None + ignore.add(slicing_argkey) + return items_done def fillfixtures(function): @@ -246,7 +275,8 @@ def get_direct_param_fixture_func(request): return request.param -class FuncFixtureInfo: +class FuncFixtureInfo(object): + def __init__(self, argnames, names_closure, name2fixturedefs): self.argnames = argnames self.names_closure = names_closure @@ -267,7 +297,6 @@ class FixtureRequest(FuncargnamesCompatAttr): self.fixturename = None #: Scope string, one of "function", "class", "module", "session" self.scope = "function" - self._fixture_values = {} # argname -> fixture value self._fixture_defs = {} # argname -> FixtureDef fixtureinfo = pyfuncitem._fixtureinfo self._arg2fixturedefs = fixtureinfo.name2fixturedefs.copy() @@ -287,7 +316,7 @@ class FixtureRequest(FuncargnamesCompatAttr): def _getnextfixturedef(self, argname): fixturedefs = self._arg2fixturedefs.get(argname, None) if fixturedefs is None: - # we arrive here because of a a dynamic call to + # we arrive here because of a dynamic call to # getfixturevalue(argname) usage which was naturally # not known at parsing/collection time parentid = self._pyfuncitem.parent.nodeid @@ -325,8 +354,7 @@ class FixtureRequest(FuncargnamesCompatAttr): return self._pyfuncitem._testcase except AttributeError: function = getattr(self, "function", None) - if function is not None: - return py.builtin._getimself(function) + return getattr(function, "__self__", None) @scopeproperty() def module(self): @@ -358,7 +386,8 @@ class FixtureRequest(FuncargnamesCompatAttr): def _addfinalizer(self, finalizer, scope): colitem = self._getscopeitem(scope) self._pyfuncitem.session._setupstate.addfinalizer( - finalizer=finalizer, colitem=colitem) + finalizer=finalizer, colitem=colitem + ) def applymarker(self, marker): """ Apply a marker to a single test function invocation. @@ -368,10 +397,7 @@ class FixtureRequest(FuncargnamesCompatAttr): :arg marker: a :py:class:`_pytest.mark.MarkDecorator` object created by a call to ``pytest.mark.NAME(...)``. """ - try: - self.node.keywords[marker.markname] = marker - except AttributeError: - raise ValueError(marker) + self.node.add_marker(marker) def raiseerror(self, msg): """ raise a FixtureLookupError with the given message. """ @@ -399,7 +425,7 @@ class FixtureRequest(FuncargnamesCompatAttr): or ``session`` indicating the caching lifecycle of the resource. :arg extrakey: added to internal caching key of (funcargname, scope). """ - if not hasattr(self.config, '_setupcache'): + if not hasattr(self.config, "_setupcache"): self.config._setupcache = {} # XXX weakref? cachekey = (self.fixturename, self._getscopeitem(scope), extrakey) cache = self.config._setupcache @@ -410,9 +436,11 @@ class FixtureRequest(FuncargnamesCompatAttr): val = setup() cache[cachekey] = val if teardown is not None: + def finalizer(): del cache[cachekey] teardown(val) + self._addfinalizer(finalizer, scope=scope) return val @@ -429,10 +457,8 @@ class FixtureRequest(FuncargnamesCompatAttr): def getfuncargvalue(self, argname): """ Deprecated, use getfixturevalue. """ from _pytest import deprecated - warnings.warn( - deprecated.GETFUNCARGVALUE, - DeprecationWarning, - stacklevel=2) + + warnings.warn(deprecated.GETFUNCARGVALUE, DeprecationWarning, stacklevel=2) return self.getfixturevalue(argname) def _get_active_fixturedef(self, argname): @@ -443,15 +469,13 @@ class FixtureRequest(FuncargnamesCompatAttr): fixturedef = self._getnextfixturedef(argname) except FixtureLookupError: if argname == "request": - class PseudoFixtureDef: - cached_result = (self, [0], None) - scope = "function" - return PseudoFixtureDef + cached_result = (self, [0], None) + scope = "function" + return PseudoFixtureDef(cached_result, scope) raise # remove indent to prevent the python3 exception # from leaking into the call - result = self._getfixturevalue(fixturedef) - self._fixture_values[argname] = result + self._compute_fixture_value(fixturedef) self._fixture_defs[argname] = fixturedef return fixturedef @@ -466,7 +490,14 @@ class FixtureRequest(FuncargnamesCompatAttr): values.append(fixturedef) current = current._parent_request - def _getfixturevalue(self, fixturedef): + def _compute_fixture_value(self, fixturedef): + """ + Creates a SubRequest based on "self" and calls the execute method of the given fixturedef object. This will + force the FixtureDef object to throw away any previous results and compute a new fixture value, which + will be stored into the FixtureDef object itself. + + :param FixtureDef fixturedef: + """ # prepare a subrequest object before calling fixture function # (latter managed by fixturedef) argname = fixturedef.argname @@ -487,8 +518,8 @@ class FixtureRequest(FuncargnamesCompatAttr): source_path = source_path.relto(funcitem.config.rootdir) msg = ( "The requested fixture has no parameter defined for the " - "current test.\n\nRequested fixture '{0}' defined in:\n{1}" - "\n\nRequested here:\n{2}:{3}".format( + "current test.\n\nRequested fixture '{}' defined in:\n{}" + "\n\nRequested here:\n{}:{}".format( fixturedef.argname, getlocation(fixturedef.func, funcitem.config.rootdir), source_path, @@ -515,12 +546,13 @@ class FixtureRequest(FuncargnamesCompatAttr): exc_clear() try: # call the fixture function - val = fixturedef.execute(request=subrequest) + fixturedef.execute(request=subrequest) finally: # if fixture function failed it might have registered finalizers - self.session._setupstate.addfinalizer(functools.partial(fixturedef.finish, request=subrequest), - subrequest.node) - return val + self.session._setupstate.addfinalizer( + functools.partial(fixturedef.finish, request=subrequest), + subrequest.node, + ) def _check_scope(self, argname, invoking_scope, requested_scope): if argname == "request": @@ -528,11 +560,13 @@ class FixtureRequest(FuncargnamesCompatAttr): if scopemismatch(invoking_scope, requested_scope): # try to report something helpful lines = self._factorytraceback() - fail("ScopeMismatch: You tried to access the %r scoped " - "fixture %r with a %r scoped request object, " - "involved factories\n%s" % ( - (requested_scope, argname, invoking_scope, "\n".join(lines))), - pytrace=False) + fail( + "ScopeMismatch: You tried to access the %r scoped " + "fixture %r with a %r scoped request object, " + "involved factories\n%s" + % ((requested_scope, argname, invoking_scope, "\n".join(lines))), + pytrace=False, + ) def _factorytraceback(self): lines = [] @@ -541,8 +575,7 @@ class FixtureRequest(FuncargnamesCompatAttr): fs, lineno = getfslineno(factory) p = self._pyfuncitem.session.fspath.bestrelpath(fs) args = _format_args(factory) - lines.append("%s:%d: def %s%s" % ( - p, lineno, factory.__name__, args)) + lines.append("%s:%d: def %s%s" % (p, lineno, factory.__name__, args)) return lines def _getscopeitem(self, scope): @@ -553,7 +586,9 @@ class FixtureRequest(FuncargnamesCompatAttr): if node is None and scope == "class": # fallback to function item itself node = self._pyfuncitem - assert node, 'Could not obtain a node for scope "{}" for function {!r}'.format(scope, self._pyfuncitem) + assert node, 'Could not obtain a node for scope "{}" for function {!r}'.format( + scope, self._pyfuncitem + ) return node def __repr__(self): @@ -573,7 +608,6 @@ class SubRequest(FixtureRequest): self.scope = scope self._fixturedef = fixturedef self._pyfuncitem = request._pyfuncitem - self._fixture_values = request._fixture_values self._fixture_defs = request._fixture_defs self._arg2fixturedefs = request._arg2fixturedefs self._arg2index = request._arg2index @@ -608,9 +642,9 @@ def scope2index(scope, descr, where=None): return scopes.index(scope) except ValueError: raise ValueError( - "{0} {1}has an unsupported scope value '{2}'".format( - descr, 'from {0} '.format(where) if where else '', - scope) + "{} {}has an unsupported scope value '{}'".format( + descr, "from {} ".format(where) if where else "", scope + ) ) @@ -645,7 +679,7 @@ class FixtureLookupError(LookupError): for i, line in enumerate(lines): line = line.rstrip() addline(" " + line) - if line.lstrip().startswith('def'): + if line.lstrip().startswith("def"): break if msg is None: @@ -664,6 +698,7 @@ class FixtureLookupError(LookupError): class FixtureLookupErrorRepr(TerminalRepr): + def __init__(self, filename, firstlineno, tblines, errorstring, argname): self.tblines = tblines self.errorstring = errorstring @@ -677,11 +712,15 @@ class FixtureLookupErrorRepr(TerminalRepr): tw.line(tbline.rstrip()) lines = self.errorstring.split("\n") if lines: - tw.line('{0} {1}'.format(FormattedExcinfo.fail_marker, - lines[0].strip()), red=True) + tw.line( + "{} {}".format(FormattedExcinfo.fail_marker, lines[0].strip()), + red=True, + ) for line in lines[1:]: - tw.line('{0} {1}'.format(FormattedExcinfo.flow_marker, - line.strip()), red=True) + tw.line( + "{} {}".format(FormattedExcinfo.flow_marker, line.strip()), + red=True, + ) tw.line() tw.line("%s:%d" % (self.filename, self.firstlineno + 1)) @@ -690,8 +729,7 @@ def fail_fixturefunc(fixturefunc, msg): fs, lineno = getfslineno(fixturefunc) location = "%s:%s" % (fs, lineno + 1) source = _pytest._code.Source(fixturefunc) - fail(msg + ":\n\n" + str(source.indent()) + "\n" + location, - pytrace=False) + fail(msg + ":\n\n" + str(source.indent()) + "\n" + location, pytrace=False) def call_fixture_func(fixturefunc, request, kwargs): @@ -706,8 +744,9 @@ def call_fixture_func(fixturefunc, request, kwargs): except StopIteration: pass else: - fail_fixturefunc(fixturefunc, - "yield_fixture function has more than one 'yield'") + fail_fixturefunc( + fixturefunc, "yield_fixture function has more than one 'yield'" + ) request.addfinalizer(teardown) else: @@ -715,21 +754,28 @@ def call_fixture_func(fixturefunc, request, kwargs): return res -class FixtureDef: +class FixtureDef(object): """ A container for a factory definition. """ - def __init__(self, fixturemanager, baseid, argname, func, scope, params, - unittest=False, ids=None): + def __init__( + self, + fixturemanager, + baseid, + argname, + func, + scope, + params, + unittest=False, + ids=None, + ): self._fixturemanager = fixturemanager - self.baseid = baseid or '' + self.baseid = baseid or "" self.has_location = baseid is not None self.func = func self.argname = argname self.scope = scope self.scopenum = scope2index( - scope or "function", - descr='fixture {0}'.format(func.__name__), - where=baseid + scope or "function", descr="fixture {}".format(func.__name__), where=baseid ) self.params = params self.argnames = getfuncargnames(func, is_method=unittest) @@ -791,8 +837,10 @@ class FixtureDef: return hook.pytest_fixture_setup(fixturedef=self, request=request) def __repr__(self): - return ("" % - (self.argname, self.scope, self.baseid)) + return ( + "" + % (self.argname, self.scope, self.baseid) + ) def pytest_fixture_setup(fixturedef, request): @@ -838,21 +886,26 @@ def _ensure_immutable_ids(ids): @attr.s(frozen=True) class FixtureFunctionMarker(object): scope = attr.ib() - params = attr.ib(convert=attr.converters.optional(tuple)) + params = attr.ib(converter=attr.converters.optional(tuple)) autouse = attr.ib(default=False) - ids = attr.ib(default=None, convert=_ensure_immutable_ids) + ids = attr.ib(default=None, converter=_ensure_immutable_ids) name = attr.ib(default=None) def __call__(self, function): if isclass(function): + raise ValueError("class fixtures not supported (may be in the future)") + + if getattr(function, "_pytestfixturefunction", False): raise ValueError( - "class fixtures not supported (may be in the future)") + "fixture is being applied more than once to the same function" + ) + function._pytestfixturefunction = self return function def fixture(scope="function", params=None, autouse=False, ids=None, name=None): - """ (return a) decorator to mark a fixture factory function. + """Decorator to mark a fixture factory function. This decorator can be used (with or without parameters) to define a fixture function. The name of the fixture function can later be @@ -891,8 +944,7 @@ def fixture(scope="function", params=None, autouse=False, ids=None, name=None): """ if callable(scope) and params is None and autouse is False: # direct decoration - return FixtureFunctionMarker( - "function", params, autouse, name=name)(scope) + return FixtureFunctionMarker("function", params, autouse, name=name)(scope) if params is not None and not isinstance(params, (list, tuple)): params = list(params) return FixtureFunctionMarker(scope, params, autouse, ids=ids, name=name) @@ -906,8 +958,9 @@ def yield_fixture(scope="function", params=None, autouse=False, ids=None, name=N """ if callable(scope) and params is None and not autouse: # direct decoration - return FixtureFunctionMarker( - "function", params, autouse, ids=ids, name=name)(scope) + return FixtureFunctionMarker("function", params, autouse, ids=ids, name=name)( + scope + ) else: return FixtureFunctionMarker(scope, params, autouse, ids=ids, name=name) @@ -917,11 +970,19 @@ defaultfuncargprefixmarker = fixture() @fixture(scope="session") def pytestconfig(request): - """ the pytest config object with access to command line opts.""" + """Session-scoped fixture that returns the :class:`_pytest.config.Config` object. + + Example:: + + def test_foo(pytestconfig): + if pytestconfig.getoption("verbose"): + ... + + """ return request.config -class FixtureManager: +class FixtureManager(object): """ pytest fixtures definitions and information is stored and managed from this class. @@ -967,17 +1028,17 @@ class FixtureManager: session.config.pluginmanager.register(self, "funcmanage") def getfixtureinfo(self, node, func, cls, funcargs=True): - if funcargs and not hasattr(node, "nofuncargs"): + if funcargs and not getattr(node, "nofuncargs", False): argnames = getfuncargnames(func, cls=cls) else: argnames = () - usefixtures = getattr(func, "usefixtures", None) + usefixtures = flatten( + mark.args for mark in node.iter_markers(name="usefixtures") + ) initialnames = argnames - if usefixtures is not None: - initialnames = usefixtures.args + initialnames + initialnames = tuple(usefixtures) + initialnames fm = node.session._fixturemanager - names_closure, arg2fixturedefs = fm.getfixtureclosure(initialnames, - node) + names_closure, arg2fixturedefs = fm.getfixtureclosure(initialnames, node) return FuncFixtureInfo(argnames, names_closure, arg2fixturedefs) def pytest_plugin_registered(self, plugin): @@ -1007,15 +1068,12 @@ class FixtureManager: if nextchar and nextchar not in ":/": continue autousenames.extend(basenames) - # make sure autousenames are sorted by scope, scopenum 0 is session - autousenames.sort( - key=lambda x: self._arg2fixturedefs[x][-1].scopenum) return autousenames def getfixtureclosure(self, fixturenames, parentnode): # collect the closure of all fixtures , starting with the given # fixturenames as the initial set. As we have to visit all - # factory definitions anyway, we also return a arg2fixturedefs + # factory definitions anyway, we also return an arg2fixturedefs # mapping so that the caller can reuse it and does not have # to re-discover fixturedefs again for each fixturename # (discovering matching fixtures for a given name/node is expensive) @@ -1040,6 +1098,16 @@ class FixtureManager: if fixturedefs: arg2fixturedefs[argname] = fixturedefs merge(fixturedefs[-1].argnames) + + def sort_by_scope(arg_name): + try: + fixturedefs = arg2fixturedefs[arg_name] + except KeyError: + return scopes.index("function") + else: + return fixturedefs[-1].scopenum + + fixturenames_closure.sort(key=sort_by_scope) return fixturenames_closure, arg2fixturedefs def pytest_generate_tests(self, metafunc): @@ -1048,9 +1116,11 @@ class FixtureManager: if faclist: fixturedef = faclist[-1] if fixturedef.params is not None: - parametrize_func = getattr(metafunc.function, 'parametrize', None) - func_params = getattr(parametrize_func, 'args', [[None]]) - func_kwargs = getattr(parametrize_func, 'kwargs', {}) + parametrize_func = getattr(metafunc.function, "parametrize", None) + if parametrize_func is not None: + parametrize_func = parametrize_func.combined + func_params = getattr(parametrize_func, "args", [[None]]) + func_kwargs = getattr(parametrize_func, "kwargs", {}) # skip directly parametrized arguments if "argnames" in func_kwargs: argnames = parametrize_func.kwargs["argnames"] @@ -1059,9 +1129,13 @@ class FixtureManager: if not isinstance(argnames, (tuple, list)): argnames = [x.strip() for x in argnames.split(",") if x.strip()] if argname not in func_params and argname not in argnames: - metafunc.parametrize(argname, fixturedef.params, - indirect=True, scope=fixturedef.scope, - ids=fixturedef.ids) + metafunc.parametrize( + argname, + fixturedef.params, + indirect=True, + scope=fixturedef.scope, + ids=fixturedef.ids, + ) else: continue # will raise FixtureLookupError at setup time @@ -1093,7 +1167,10 @@ class FixtureManager: continue marker = defaultfuncargprefixmarker from _pytest import deprecated - self.config.warn('C1', deprecated.FUNCARG_PREFIX.format(name=name), nodeid=nodeid) + + self.config.warn( + "C1", deprecated.FUNCARG_PREFIX.format(name=name), nodeid=nodeid + ) name = name[len(self._argprefix):] elif not isinstance(marker, FixtureFunctionMarker): # magic globals with __getattr__ might have got us a wrong @@ -1102,13 +1179,18 @@ class FixtureManager: else: if marker.name: name = marker.name - msg = 'fixtures cannot have "pytest_funcarg__" prefix ' \ - 'and be decorated with @pytest.fixture:\n%s' % name - assert not name.startswith(self._argprefix), msg + assert not name.startswith(self._argprefix), FIXTURE_MSG.format(name) - fixture_def = FixtureDef(self, nodeid, name, obj, - marker.scope, marker.params, - unittest=unittest, ids=marker.ids) + fixture_def = FixtureDef( + self, + nodeid, + name, + obj, + marker.scope, + marker.params, + unittest=unittest, + ids=marker.ids, + ) faclist = self._arg2fixturedefs.setdefault(name, []) if fixture_def.has_location: @@ -1124,7 +1206,7 @@ class FixtureManager: autousenames.append(name) if autousenames: - self._nodeid_and_autousenames.append((nodeid or '', autousenames)) + self._nodeid_and_autousenames.append((nodeid or "", autousenames)) def getfixturedefs(self, argname, nodeid): """ diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/freeze_support.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/freeze_support.py similarity index 83% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/freeze_support.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/freeze_support.py index 97147a88250..002e077301f 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/freeze_support.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/freeze_support.py @@ -7,17 +7,18 @@ from __future__ import absolute_import, division, print_function def freeze_includes(): """ - Returns a list of module names used by py.test that should be + Returns a list of module names used by pytest that should be included by cx_freeze. """ import py import _pytest + result = list(_iter_all_modules(py)) result += list(_iter_all_modules(_pytest)) return result -def _iter_all_modules(package, prefix=''): +def _iter_all_modules(package, prefix=""): """ Iterates over the names of all modules that can be found in the given package, recursively. @@ -31,13 +32,14 @@ def _iter_all_modules(package, prefix=''): """ import os import pkgutil + if type(package) is not str: - path, prefix = package.__path__[0], package.__name__ + '.' + path, prefix = package.__path__[0], package.__name__ + "." else: path = package for _, name, is_package in pkgutil.iter_modules([path]): if is_package: - for m in _iter_all_modules(os.path.join(path, name), prefix=name + '.'): + for m in _iter_all_modules(os.path.join(path, name), prefix=name + "."): yield prefix + m else: yield prefix + name diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/helpconfig.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/helpconfig.py similarity index 61% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/helpconfig.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/helpconfig.py index e744637f866..5514fec404d 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/helpconfig.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/helpconfig.py @@ -18,48 +18,69 @@ class HelpAction(Action): implemented by raising SystemExit. """ - def __init__(self, - option_strings, - dest=None, - default=False, - help=None): + def __init__(self, option_strings, dest=None, default=False, help=None): super(HelpAction, self).__init__( option_strings=option_strings, dest=dest, const=True, default=default, nargs=0, - help=help) + help=help, + ) def __call__(self, parser, namespace, values, option_string=None): setattr(namespace, self.dest, self.const) # We should only skip the rest of the parsing after preparse is done - if getattr(parser._parser, 'after_preparse', False): + if getattr(parser._parser, "after_preparse", False): raise PrintHelp def pytest_addoption(parser): - group = parser.getgroup('debugconfig') - group.addoption('--version', action="store_true", - help="display pytest lib version and import information.") - group._addoption("-h", "--help", action=HelpAction, dest="help", - help="show help message and configuration info") - group._addoption('-p', action="append", dest="plugins", default=[], - metavar="name", - help="early-load given plugin (multi-allowed). " - "To avoid loading of plugins, use the `no:` prefix, e.g. " - "`no:doctest`.") - group.addoption('--traceconfig', '--trace-config', - action="store_true", default=False, - help="trace considerations of conftest.py files."), - group.addoption('--debug', - action="store_true", dest="debug", default=False, - help="store internal tracing debug information in 'pytestdebug.log'.") + group = parser.getgroup("debugconfig") + group.addoption( + "--version", + action="store_true", + help="display pytest lib version and import information.", + ) group._addoption( - '-o', '--override-ini', nargs='*', dest="override_ini", + "-h", + "--help", + action=HelpAction, + dest="help", + help="show help message and configuration info", + ) + group._addoption( + "-p", action="append", - help="override config option with option=value style, e.g. `-o xfail_strict=True`.") + dest="plugins", + default=[], + metavar="name", + help="early-load given plugin (multi-allowed). " + "To avoid loading of plugins, use the `no:` prefix, e.g. " + "`no:doctest`.", + ) + group.addoption( + "--traceconfig", + "--trace-config", + action="store_true", + default=False, + help="trace considerations of conftest.py files.", + ), + group.addoption( + "--debug", + action="store_true", + dest="debug", + default=False, + help="store internal tracing debug information in 'pytestdebug.log'.", + ) + group._addoption( + "-o", + "--override-ini", + dest="override_ini", + action="append", + help='override ini option with "option=value" style, e.g. `-o xfail_strict=True -o cache_dir=cache`.', + ) @pytest.hookimpl(hookwrapper=True) @@ -68,20 +89,25 @@ def pytest_cmdline_parse(): config = outcome.get_result() if config.option.debug: path = os.path.abspath("pytestdebug.log") - debugfile = open(path, 'w') - debugfile.write("versions pytest-%s, py-%s, " - "python-%s\ncwd=%s\nargs=%s\n\n" % ( - pytest.__version__, py.__version__, - ".".join(map(str, sys.version_info)), - os.getcwd(), config._origargs)) + debugfile = open(path, "w") + debugfile.write( + "versions pytest-%s, py-%s, " + "python-%s\ncwd=%s\nargs=%s\n\n" + % ( + pytest.__version__, + py.__version__, + ".".join(map(str, sys.version_info)), + os.getcwd(), + config._origargs, + ) + ) config.trace.root.setwriter(debugfile.write) undo_tracing = config.pluginmanager.enable_tracing() sys.stderr.write("writing pytestdebug information to %s\n" % path) def unset_tracing(): debugfile.close() - sys.stderr.write("wrote pytestdebug information to %s\n" % - debugfile.name) + sys.stderr.write("wrote pytestdebug information to %s\n" % debugfile.name) config.trace.root.setwriter(None) undo_tracing() @@ -91,8 +117,9 @@ def pytest_cmdline_parse(): def pytest_cmdline_main(config): if config.option.version: p = py.path.local(pytest.__file__) - sys.stderr.write("This is pytest version %s, imported from %s\n" % - (pytest.__version__, p)) + sys.stderr.write( + "This is pytest version %s, imported from %s\n" % (pytest.__version__, p) + ) plugininfo = getpluginversioninfo(config) if plugininfo: for line in plugininfo: @@ -106,13 +133,14 @@ def pytest_cmdline_main(config): def showhelp(config): - reporter = config.pluginmanager.get_plugin('terminalreporter') + reporter = config.pluginmanager.get_plugin("terminalreporter") tw = reporter._tw tw.write(config._parser.optparser.format_help()) tw.line() tw.line() - tw.line("[pytest] ini-options in the first " - "pytest.ini|tox.ini|setup.cfg file found:") + tw.line( + "[pytest] ini-options in the first " "pytest.ini|tox.ini|setup.cfg file found:" + ) tw.line() for name in config._parser._ininames: @@ -128,7 +156,7 @@ def showhelp(config): vars = [ ("PYTEST_ADDOPTS", "extra command line options"), ("PYTEST_PLUGINS", "comma-separated plugins to load during startup"), - ("PYTEST_DEBUG", "set to enable debug tracing of pytest's internals") + ("PYTEST_DEBUG", "set to enable debug tracing of pytest's internals"), ] for name, help in vars: tw.line(" %-24s %s" % (name, help)) @@ -137,17 +165,18 @@ def showhelp(config): tw.line("to see available markers type: pytest --markers") tw.line("to see available fixtures type: pytest --fixtures") - tw.line("(shown according to specified file_or_dir or current dir " - "if not specified)") + tw.line( + "(shown according to specified file_or_dir or current dir " + "if not specified; fixtures with leading '_' are only shown " + "with the '-v' option" + ) - for warningreport in reporter.stats.get('warnings', []): + for warningreport in reporter.stats.get("warnings", []): tw.line("warning : " + warningreport.message, red=True) return -conftest_options = [ - ('pytest_plugins', 'list of plugin names to load'), -] +conftest_options = [("pytest_plugins", "list of plugin names to load")] def getpluginversioninfo(config): @@ -156,7 +185,7 @@ def getpluginversioninfo(config): if plugininfo: lines.append("setuptools registered plugins:") for plugin, dist in plugininfo: - loc = getattr(plugin, '__file__', repr(plugin)) + loc = getattr(plugin, "__file__", repr(plugin)) content = "%s-%s at %s" % (dist.project_name, dist.version, loc) lines.append(" " + content) return lines @@ -165,8 +194,7 @@ def getpluginversioninfo(config): def pytest_report_header(config): lines = [] if config.option.debug or config.option.traceconfig: - lines.append("using: pytest-%s pylib-%s" % - (pytest.__version__, py.__version__)) + lines.append("using: pytest-%s pylib-%s" % (pytest.__version__, py.__version__)) verinfo = getpluginversioninfo(config) if verinfo: @@ -176,7 +204,7 @@ def pytest_report_header(config): lines.append("active plugins:") items = config.pluginmanager.list_name_plugin() for name, plugin in items: - if hasattr(plugin, '__file__'): + if hasattr(plugin, "__file__"): r = plugin.__file__ else: r = repr(plugin) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/hookspec.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/hookspec.py similarity index 66% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/hookspec.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/hookspec.py index 440bf99d375..fec43a40099 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/hookspec.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/hookspec.py @@ -12,22 +12,40 @@ hookspec = HookspecMarker("pytest") @hookspec(historic=True) def pytest_addhooks(pluginmanager): """called at plugin registration time to allow adding new hooks via a call to - pluginmanager.add_hookspecs(module_or_class, prefix).""" + ``pluginmanager.add_hookspecs(module_or_class, prefix)``. + + + :param _pytest.config.PytestPluginManager pluginmanager: pytest plugin manager + + .. note:: + This hook is incompatible with ``hookwrapper=True``. + """ @hookspec(historic=True) def pytest_namespace(): """ - DEPRECATED: this hook causes direct monkeypatching on pytest, its use is strongly discouraged + (**Deprecated**) this hook causes direct monkeypatching on pytest, its use is strongly discouraged return dict of name->object to be made globally available in - the pytest namespace. This hook is called at plugin registration - time. + the pytest namespace. + + This hook is called at plugin registration time. + + .. note:: + This hook is incompatible with ``hookwrapper=True``. """ @hookspec(historic=True) def pytest_plugin_registered(plugin, manager): - """ a new pytest plugin got registered. """ + """ a new pytest plugin got registered. + + :param plugin: the plugin module or instance + :param _pytest.config.PytestPluginManager manager: pytest plugin manager + + .. note:: + This hook is incompatible with ``hookwrapper=True``. + """ @hookspec(historic=True) @@ -41,7 +59,7 @@ def pytest_addoption(parser): files situated at the tests root directory due to how pytest :ref:`discovers plugins during startup `. - :arg parser: To add command line options, call + :arg _pytest.config.Parser parser: To add command line options, call :py:func:`parser.addoption(...) <_pytest.config.Parser.addoption>`. To add ini-file values call :py:func:`parser.addini(...) <_pytest.config.Parser.addini>`. @@ -56,8 +74,10 @@ def pytest_addoption(parser): a value read from an ini-style file. The config object is passed around on many internal objects via the ``.config`` - attribute or can be retrieved as the ``pytestconfig`` fixture or accessed - via (deprecated) ``pytest.config``. + attribute or can be retrieved as the ``pytestconfig`` fixture. + + .. note:: + This hook is incompatible with ``hookwrapper=True``. """ @@ -72,14 +92,16 @@ def pytest_configure(config): After that, the hook is called for other conftest files as they are imported. - :arg config: pytest config object - :type config: _pytest.config.Config + .. note:: + This hook is incompatible with ``hookwrapper=True``. + + :arg _pytest.config.Config config: pytest config object """ + # ------------------------------------------------------------------------- # Bootstrapping hooks called for plugins registered early enough: -# internal and 3rd party plugins as well as directly -# discoverable conftest.py local plugins. +# internal and 3rd party plugins. # ------------------------------------------------------------------------- @@ -87,11 +109,28 @@ def pytest_configure(config): def pytest_cmdline_parse(pluginmanager, args): """return initialized config object, parsing the specified args. - Stops at first non-None result, see :ref:`firstresult` """ + Stops at first non-None result, see :ref:`firstresult` + + .. note:: + This hook will not be called for ``conftest.py`` files, only for setuptools plugins. + + :param _pytest.config.PytestPluginManager pluginmanager: pytest plugin manager + :param list[str] args: list of arguments passed on the command line + """ def pytest_cmdline_preparse(config, args): - """(deprecated) modify command line arguments before option parsing. """ + """(**Deprecated**) modify command line arguments before option parsing. + + This hook is considered deprecated and will be removed in a future pytest version. Consider + using :func:`pytest_load_initial_conftests` instead. + + .. note:: + This hook will not be called for ``conftest.py`` files, only for setuptools plugins. + + :param _pytest.config.Config config: pytest config object + :param list[str] args: list of arguments passed on the command line + """ @hookspec(firstresult=True) @@ -99,32 +138,58 @@ def pytest_cmdline_main(config): """ called for performing the main command line action. The default implementation will invoke the configure hooks and runtest_mainloop. - Stops at first non-None result, see :ref:`firstresult` """ + .. note:: + This hook will not be called for ``conftest.py`` files, only for setuptools plugins. + + Stops at first non-None result, see :ref:`firstresult` + + :param _pytest.config.Config config: pytest config object + """ def pytest_load_initial_conftests(early_config, parser, args): """ implements the loading of initial conftest files ahead - of command line option parsing. """ + of command line option parsing. + + .. note:: + This hook will not be called for ``conftest.py`` files, only for setuptools plugins. + + :param _pytest.config.Config early_config: pytest config object + :param list[str] args: list of arguments passed on the command line + :param _pytest.config.Parser parser: to add command line options + """ # ------------------------------------------------------------------------- # collection hooks # ------------------------------------------------------------------------- + @hookspec(firstresult=True) def pytest_collection(session): - """ perform the collection protocol for the given session. + """Perform the collection protocol for the given session. - Stops at first non-None result, see :ref:`firstresult` """ + Stops at first non-None result, see :ref:`firstresult`. + + :param _pytest.main.Session session: the pytest session object + """ def pytest_collection_modifyitems(session, config, items): """ called after collection has been performed, may filter or re-order - the items in-place.""" + the items in-place. + + :param _pytest.main.Session session: the pytest session object + :param _pytest.config.Config config: pytest config object + :param List[_pytest.nodes.Item] items: list of item objects + """ def pytest_collection_finish(session): - """ called after collection has been performed and modified. """ + """ called after collection has been performed and modified. + + :param _pytest.main.Session session: the pytest session object + """ @hookspec(firstresult=True) @@ -134,6 +199,9 @@ def pytest_ignore_collect(path, config): more specific hooks. Stops at first non-None result, see :ref:`firstresult` + + :param str path: the path to analyze + :param _pytest.config.Config config: pytest config object """ @@ -141,12 +209,19 @@ def pytest_ignore_collect(path, config): def pytest_collect_directory(path, parent): """ called before traversing a directory for collection files. - Stops at first non-None result, see :ref:`firstresult` """ + Stops at first non-None result, see :ref:`firstresult` + + :param str path: the path to analyze + """ def pytest_collect_file(path, parent): """ return collection Node or None for the given path. Any new node - needs to have the specified ``parent`` as a parent.""" + needs to have the specified ``parent`` as a parent. + + :param str path: the path to collect + """ + # logging hooks for collection @@ -173,6 +248,7 @@ def pytest_make_collect_report(collector): Stops at first non-None result, see :ref:`firstresult` """ + # ------------------------------------------------------------------------- # Python test function related hooks # ------------------------------------------------------------------------- @@ -212,7 +288,13 @@ def pytest_make_parametrize_id(config, val, argname): by @pytest.mark.parametrize calls. Return None if the hook doesn't know about ``val``. The parameter name is available as ``argname``, if required. - Stops at first non-None result, see :ref:`firstresult` """ + Stops at first non-None result, see :ref:`firstresult` + + :param _pytest.config.Config config: pytest config object + :param val: the parametrized value + :param str argname: the automatic parameter name produced by pytest + """ + # ------------------------------------------------------------------------- # generic runtest related hooks @@ -224,11 +306,14 @@ def pytest_runtestloop(session): """ called for performing the main runtest loop (after collection finished). - Stops at first non-None result, see :ref:`firstresult` """ + Stops at first non-None result, see :ref:`firstresult` + + :param _pytest.main.Session session: the pytest session object + """ def pytest_itemstart(item, node): - """ (deprecated, use pytest_runtest_logstart). """ + """(**Deprecated**) use pytest_runtest_logstart. """ @hookspec(firstresult=True) @@ -250,7 +335,25 @@ def pytest_runtest_protocol(item, nextitem): def pytest_runtest_logstart(nodeid, location): - """ signal the start of running a single test item. """ + """ signal the start of running a single test item. + + This hook will be called **before** :func:`pytest_runtest_setup`, :func:`pytest_runtest_call` and + :func:`pytest_runtest_teardown` hooks. + + :param str nodeid: full id of the item + :param location: a triple of ``(filename, linenum, testname)`` + """ + + +def pytest_runtest_logfinish(nodeid, location): + """ signal the complete finish of running a single test item. + + This hook will be called **after** :func:`pytest_runtest_setup`, :func:`pytest_runtest_call` and + :func:`pytest_runtest_teardown` hooks. + + :param str nodeid: full id of the item + :param location: a triple of ``(filename, linenum, testname)`` + """ def pytest_runtest_setup(item): @@ -284,6 +387,7 @@ def pytest_runtest_logreport(report): """ process a test setup/call/teardown report relating to the respective phase of executing a test. """ + # ------------------------------------------------------------------------- # Fixture related hooks # ------------------------------------------------------------------------- @@ -293,7 +397,15 @@ def pytest_runtest_logreport(report): def pytest_fixture_setup(fixturedef, request): """ performs fixture setup execution. - Stops at first non-None result, see :ref:`firstresult` """ + :return: The return value of the call to the fixture function + + Stops at first non-None result, see :ref:`firstresult` + + .. note:: + If the fixture function returns None, other implementations of + this hook function will continue to be called, according to the + behavior of the :ref:`firstresult` option. + """ def pytest_fixture_post_finalizer(fixturedef, request): @@ -301,27 +413,40 @@ def pytest_fixture_post_finalizer(fixturedef, request): the fixture result cache ``fixturedef.cached_result`` can still be accessed.""" + # ------------------------------------------------------------------------- # test session related hooks # ------------------------------------------------------------------------- def pytest_sessionstart(session): - """ before session.main() is called. """ + """ called after the ``Session`` object has been created and before performing collection + and entering the run test loop. + + :param _pytest.main.Session session: the pytest session object + """ def pytest_sessionfinish(session, exitstatus): - """ whole test run finishes. """ + """ called after whole test run finished, right before returning the exit status to the system. + + :param _pytest.main.Session session: the pytest session object + :param int exitstatus: the status which pytest will return to the system + """ def pytest_unconfigure(config): - """ called before test process is exited. """ + """ called before test process is exited. + + :param _pytest.config.Config config: pytest config object + """ # ------------------------------------------------------------------------- # hooks for customizing the assert methods # ------------------------------------------------------------------------- + def pytest_assertrepr_compare(config, op, left, right): """return explanation for comparisons in failing assert expressions. @@ -329,8 +454,11 @@ def pytest_assertrepr_compare(config, op, left, right): of strings. The strings will be joined by newlines but any newlines *in* a string will be escaped. Note that all but the first line will be indented slightly, the intention is for the first line to be a summary. + + :param _pytest.config.Config config: pytest config object """ + # ------------------------------------------------------------------------- # hooks for influencing reporting (invoked from _pytest_terminal) # ------------------------------------------------------------------------- @@ -339,7 +467,7 @@ def pytest_assertrepr_compare(config, op, left, right): def pytest_report_header(config, startdir): """ return a string or list of strings to be displayed as header info for terminal reporting. - :param config: the pytest config object. + :param _pytest.config.Config config: pytest config object :param startdir: py.path object with the starting dir .. note:: @@ -358,7 +486,7 @@ def pytest_report_collectionfinish(config, startdir, items): This strings will be displayed after the standard "collected X items" message. - :param config: the pytest config object. + :param _pytest.config.Config config: pytest config object :param startdir: py.path object with the starting dir :param items: list of pytest items that are going to be executed; this list should not be modified. """ @@ -372,14 +500,26 @@ def pytest_report_teststatus(report): def pytest_terminal_summary(terminalreporter, exitstatus): - """ add additional section in terminal summary reporting. """ + """Add a section to terminal summary reporting. + + :param _pytest.terminal.TerminalReporter terminalreporter: the internal terminal reporter object + :param int exitstatus: the exit status that will be reported back to the OS + + .. versionadded:: 3.5 + The ``config`` parameter. + """ @hookspec(historic=True) def pytest_logwarning(message, code, nodeid, fslocation): """ process a warning specified by a message, a code string, a nodeid and fslocation (both of which may be None - if the warning is not tied to a partilar node/location).""" + if the warning is not tied to a particular node/location). + + .. note:: + This hook is incompatible with ``hookwrapper=True``. + """ + # ------------------------------------------------------------------------- # doctest hooks @@ -392,6 +532,7 @@ def pytest_doctest_prepare_content(content): Stops at first non-None result, see :ref:`firstresult` """ + # ------------------------------------------------------------------------- # error handling and internal debugging hooks # ------------------------------------------------------------------------- @@ -418,6 +559,5 @@ def pytest_enter_pdb(config): """ called upon pdb.set_trace(), can be used by plugins to take special action just before the python debugger enters in interactive mode. - :arg config: pytest config object - :type config: _pytest.config.Config + :param _pytest.config.Config config: pytest config object """ diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/junitxml.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/junitxml.py similarity index 59% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/junitxml.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/junitxml.py index 7fb40dc3548..29da27de7cc 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/junitxml.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/junitxml.py @@ -39,15 +39,14 @@ class Junit(py.xml.Namespace): # chars is: Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] # | [#x10000-#x10FFFF] _legal_chars = (0x09, 0x0A, 0x0d) -_legal_ranges = ( - (0x20, 0x7E), (0x80, 0xD7FF), (0xE000, 0xFFFD), (0x10000, 0x10FFFF), -) +_legal_ranges = ((0x20, 0x7E), (0x80, 0xD7FF), (0xE000, 0xFFFD), (0x10000, 0x10FFFF)) _legal_xml_re = [ unicode("%s-%s") % (unichr(low), unichr(high)) - for (low, high) in _legal_ranges if low < sys.maxunicode + for (low, high) in _legal_ranges + if low < sys.maxunicode ] _legal_xml_re = [unichr(x) for x in _legal_chars] + _legal_xml_re -illegal_xml_re = re.compile(unicode('[^%s]') % unicode('').join(_legal_xml_re)) +illegal_xml_re = re.compile(unicode("[^%s]") % unicode("").join(_legal_xml_re)) del _legal_chars del _legal_ranges del _legal_xml_re @@ -56,17 +55,19 @@ _py_ext_re = re.compile(r"\.py$") def bin_xml_escape(arg): + def repl(matchobj): i = ord(matchobj.group()) if i <= 0xFF: - return unicode('#x%02X') % i + return unicode("#x%02X") % i else: - return unicode('#x%04X') % i + return unicode("#x%04X") % i return py.xml.raw(illegal_xml_re.sub(repl, py.xml.escape(arg))) class _NodeReporter(object): + def __init__(self, nodeid, xml): self.id = nodeid @@ -85,19 +86,25 @@ class _NodeReporter(object): def add_property(self, name, value): self.properties.append((str(name), bin_xml_escape(value))) + def add_attribute(self, name, value): + self.attrs[str(name)] = bin_xml_escape(value) + def make_properties_node(self): """Return a Junit node containing custom properties, if any. """ if self.properties: - return Junit.properties([ - Junit.property(name=name, value=value) - for name, value in self.properties - ]) - return '' + return Junit.properties( + [ + Junit.property(name=name, value=value) + for name, value in self.properties + ] + ) + return "" def record_testreport(self, testreport): assert not self.testcase names = mangle_test_address(testreport.nodeid) + existing_attrs = self.attrs classnames = names[:-1] if self.xml.prefix: classnames.insert(0, self.xml.prefix) @@ -111,6 +118,7 @@ class _NodeReporter(object): if hasattr(testreport, "url"): attrs["url"] = testreport.url self.attrs = attrs + self.attrs.update(existing_attrs) # restore any user-defined attributes def to_xml(self): testcase = Junit.testcase(time=self.duration, **self.attrs) @@ -125,21 +133,62 @@ class _NodeReporter(object): self.append(node) def write_captured_output(self, report): - for capname in ('out', 'err'): - content = getattr(report, 'capstd' + capname) + content_out = report.capstdout + content_log = report.caplog + content_err = report.capstderr + + if content_log or content_out: + if content_log and self.xml.logging == "system-out": + if content_out: + # syncing stdout and the log-output is not done yet. It's + # probably not worth the effort. Therefore, first the captured + # stdout is shown and then the captured logs. + content = "\n".join( + [ + " Captured Stdout ".center(80, "-"), + content_out, + "", + " Captured Log ".center(80, "-"), + content_log, + ] + ) + else: + content = content_log + else: + content = content_out + if content: - tag = getattr(Junit, 'system-' + capname) + tag = getattr(Junit, "system-out") + self.append(tag(bin_xml_escape(content))) + + if content_log or content_err: + if content_log and self.xml.logging == "system-err": + if content_err: + content = "\n".join( + [ + " Captured Stderr ".center(80, "-"), + content_err, + "", + " Captured Log ".center(80, "-"), + content_log, + ] + ) + else: + content = content_log + else: + content = content_err + + if content: + tag = getattr(Junit, "system-err") self.append(tag(bin_xml_escape(content))) def append_pass(self, report): - self.add_stats('passed') + self.add_stats("passed") def append_failure(self, report): # msg = str(report.longrepr.reprtraceback.extraline) if hasattr(report, "wasxfail"): - self._add_simple( - Junit.skipped, - "xfail-marked test passes unexpectedly") + self._add_simple(Junit.skipped, "xfail-marked test passes unexpectedly") else: if hasattr(report.longrepr, "reprcrash"): message = report.longrepr.reprcrash.message @@ -154,35 +203,35 @@ class _NodeReporter(object): def append_collect_error(self, report): # msg = str(report.longrepr.reprtraceback.extraline) - self.append(Junit.error(bin_xml_escape(report.longrepr), - message="collection failure")) + self.append( + Junit.error(bin_xml_escape(report.longrepr), message="collection failure") + ) def append_collect_skipped(self, report): - self._add_simple( - Junit.skipped, "collection skipped", report.longrepr) + self._add_simple(Junit.skipped, "collection skipped", report.longrepr) def append_error(self, report): - if getattr(report, 'when', None) == 'teardown': + if getattr(report, "when", None) == "teardown": msg = "test teardown failure" else: msg = "test setup failure" - self._add_simple( - Junit.error, msg, report.longrepr) + self._add_simple(Junit.error, msg, report.longrepr) def append_skipped(self, report): if hasattr(report, "wasxfail"): - self._add_simple( - Junit.skipped, "expected test failure", report.wasxfail - ) + self._add_simple(Junit.skipped, "expected test failure", report.wasxfail) else: filename, lineno, skipreason = report.longrepr if skipreason.startswith("Skipped: "): skipreason = bin_xml_escape(skipreason[9:]) self.append( - Junit.skipped("%s:%s: %s" % (filename, lineno, skipreason), - type="pytest.skip", - message=skipreason)) - self.write_captured_output(report) + Junit.skipped( + "%s:%s: %s" % (filename, lineno, skipreason), + type="pytest.skip", + message=skipreason, + ) + ) + self.write_captured_output(report) def finalize(self): data = self.to_xml().unicode(indent=0) @@ -191,69 +240,117 @@ class _NodeReporter(object): @pytest.fixture -def record_xml_property(request): - """Add extra xml properties to the tag for the calling test. +def record_property(request): + """Add an extra properties the calling test. + User properties become part of the test report and are available to the + configured reporters, like JUnit XML. The fixture is callable with ``(name, value)``, with value being automatically xml-encoded. + + Example:: + + def test_function(record_property): + record_property("example_key", 1) + """ + + def append_property(name, value): + request.node.user_properties.append((name, value)) + + return append_property + + +@pytest.fixture +def record_xml_property(record_property): + """(Deprecated) use record_property.""" + import warnings + from _pytest import deprecated + + warnings.warn(deprecated.RECORD_XML_PROPERTY, DeprecationWarning, stacklevel=2) + + return record_property + + +@pytest.fixture +def record_xml_attribute(request): + """Add extra xml attributes to the tag for the calling test. + The fixture is callable with ``(name, value)``, with value being + automatically xml-encoded """ request.node.warn( - code='C3', - message='record_xml_property is an experimental feature', + code="C3", message="record_xml_attribute is an experimental feature" ) xml = getattr(request.config, "_xml", None) if xml is not None: node_reporter = xml.node_reporter(request.node.nodeid) - return node_reporter.add_property + return node_reporter.add_attribute else: - def add_property_noop(name, value): + + def add_attr_noop(name, value): pass - return add_property_noop + return add_attr_noop def pytest_addoption(parser): group = parser.getgroup("terminal reporting") group.addoption( - '--junitxml', '--junit-xml', + "--junitxml", + "--junit-xml", action="store", dest="xmlpath", metavar="path", type=functools.partial(filename_arg, optname="--junitxml"), default=None, - help="create junit-xml style report file at given path.") + help="create junit-xml style report file at given path.", + ) group.addoption( - '--junitprefix', '--junit-prefix', + "--junitprefix", + "--junit-prefix", action="store", metavar="str", default=None, - help="prepend prefix to classnames in junit-xml output") - parser.addini("junit_suite_name", "Test suite name for JUnit report", default="pytest") + help="prepend prefix to classnames in junit-xml output", + ) + parser.addini( + "junit_suite_name", "Test suite name for JUnit report", default="pytest" + ) + parser.addini( + "junit_logging", + "Write captured log messages to JUnit report: " + "one of no|system-out|system-err", + default="no", + ) # choices=['no', 'stdout', 'stderr']) def pytest_configure(config): xmlpath = config.option.xmlpath # prevent opening xmllog on slave nodes (xdist) - if xmlpath and not hasattr(config, 'slaveinput'): - config._xml = LogXML(xmlpath, config.option.junitprefix, config.getini("junit_suite_name")) + if xmlpath and not hasattr(config, "slaveinput"): + config._xml = LogXML( + xmlpath, + config.option.junitprefix, + config.getini("junit_suite_name"), + config.getini("junit_logging"), + ) config.pluginmanager.register(config._xml) def pytest_unconfigure(config): - xml = getattr(config, '_xml', None) + xml = getattr(config, "_xml", None) if xml: del config._xml config.pluginmanager.unregister(xml) def mangle_test_address(address): - path, possible_open_bracket, params = address.partition('[') + path, possible_open_bracket, params = address.partition("[") names = path.split("::") try: - names.remove('()') + names.remove("()") except ValueError: pass # convert file path to dotted path - names[0] = names[0].replace(nodes.SEP, '.') + names[0] = names[0].replace(nodes.SEP, ".") names[0] = _py_ext_re.sub("", names[0]) # put any params back names[-1] += possible_open_bracket + params @@ -261,17 +358,14 @@ def mangle_test_address(address): class LogXML(object): - def __init__(self, logfile, prefix, suite_name="pytest"): + + def __init__(self, logfile, prefix, suite_name="pytest", logging="no"): logfile = os.path.expanduser(os.path.expandvars(logfile)) self.logfile = os.path.normpath(os.path.abspath(logfile)) self.prefix = prefix self.suite_name = suite_name - self.stats = dict.fromkeys([ - 'error', - 'passed', - 'failure', - 'skipped', - ], 0) + self.logging = logging + self.stats = dict.fromkeys(["error", "passed", "failure", "skipped"], 0) self.node_reporters = {} # nodeid -> _NodeReporter self.node_reporters_ordered = [] self.global_properties = [] @@ -280,17 +374,17 @@ class LogXML(object): self.cnt_double_fail_tests = 0 def finalize(self, report): - nodeid = getattr(report, 'nodeid', report) + nodeid = getattr(report, "nodeid", report) # local hack to handle xdist report order - slavenode = getattr(report, 'node', None) + slavenode = getattr(report, "node", None) reporter = self.node_reporters.pop((nodeid, slavenode)) if reporter is not None: reporter.finalize() def node_reporter(self, report): - nodeid = getattr(report, 'nodeid', report) + nodeid = getattr(report, "nodeid", report) # local hack to handle xdist report order - slavenode = getattr(report, 'node', None) + slavenode = getattr(report, "node", None) key = nodeid, slavenode @@ -348,12 +442,17 @@ class LogXML(object): report_wid = getattr(report, "worker_id", None) report_ii = getattr(report, "item_index", None) close_report = next( - (rep for rep in self.open_reports - if (rep.nodeid == report.nodeid and - getattr(rep, "item_index", None) == report_ii and - getattr(rep, "worker_id", None) == report_wid - ) - ), None) + ( + rep + for rep in self.open_reports + if ( + rep.nodeid == report.nodeid + and getattr(rep, "item_index", None) == report_ii + and getattr(rep, "worker_id", None) == report_wid + ) + ), + None, + ) if close_report: # We need to open new testcase in case we have failure in # call and error in teardown in order to follow junit @@ -373,16 +472,25 @@ class LogXML(object): if report.when == "teardown": reporter = self._opentestcase(report) reporter.write_captured_output(report) + + for propname, propvalue in report.user_properties: + reporter.add_property(propname, propvalue) + self.finalize(report) report_wid = getattr(report, "worker_id", None) report_ii = getattr(report, "item_index", None) close_report = next( - (rep for rep in self.open_reports - if (rep.nodeid == report.nodeid and - getattr(rep, "item_index", None) == report_ii and - getattr(rep, "worker_id", None) == report_wid - ) - ), None) + ( + rep + for rep in self.open_reports + if ( + rep.nodeid == report.nodeid + and getattr(rep, "item_index", None) == report_ii + and getattr(rep, "worker_id", None) == report_wid + ) + ), + None, + ) if close_report: self.open_reports.remove(close_report) @@ -391,7 +499,7 @@ class LogXML(object): the Junit.testcase with the new total if already created. """ reporter = self.node_reporter(report) - reporter.duration += getattr(report, 'duration', 0.0) + reporter.duration += getattr(report, "duration", 0.0) def pytest_collectreport(self, report): if not report.passed: @@ -402,9 +510,9 @@ class LogXML(object): reporter.append_collect_skipped(report) def pytest_internalerror(self, excrepr): - reporter = self.node_reporter('internal') - reporter.attrs.update(classname="pytest", name='internal') - reporter._add_simple(Junit.error, 'internal error', excrepr) + reporter = self.node_reporter("internal") + reporter.attrs.update(classname="pytest", name="internal") + reporter._add_simple(Junit.error, "internal error", excrepr) def pytest_sessionstart(self): self.suite_start_time = time.time() @@ -413,29 +521,37 @@ class LogXML(object): dirname = os.path.dirname(os.path.abspath(self.logfile)) if not os.path.isdir(dirname): os.makedirs(dirname) - logfile = open(self.logfile, 'w', encoding='utf-8') + logfile = open(self.logfile, "w", encoding="utf-8") suite_stop_time = time.time() suite_time_delta = suite_stop_time - self.suite_start_time - numtests = (self.stats['passed'] + self.stats['failure'] + - self.stats['skipped'] + self.stats['error'] - - self.cnt_double_fail_tests) + numtests = ( + self.stats["passed"] + + self.stats["failure"] + + self.stats["skipped"] + + self.stats["error"] + - self.cnt_double_fail_tests + ) logfile.write('') - logfile.write(Junit.testsuite( - self._get_global_properties_node(), - [x.to_xml() for x in self.node_reporters_ordered], - name=self.suite_name, - errors=self.stats['error'], - failures=self.stats['failure'], - skips=self.stats['skipped'], - tests=numtests, - time="%.3f" % suite_time_delta, ).unicode(indent=0)) + logfile.write( + Junit.testsuite( + self._get_global_properties_node(), + [x.to_xml() for x in self.node_reporters_ordered], + name=self.suite_name, + errors=self.stats["error"], + failures=self.stats["failure"], + skips=self.stats["skipped"], + tests=numtests, + time="%.3f" % suite_time_delta, + ).unicode( + indent=0 + ) + ) logfile.close() def pytest_terminal_summary(self, terminalreporter): - terminalreporter.write_sep("-", - "generated xml file: %s" % (self.logfile)) + terminalreporter.write_sep("-", "generated xml file: %s" % (self.logfile)) def add_global_property(self, name, value): self.global_properties.append((str(name), bin_xml_escape(value))) @@ -450,4 +566,4 @@ class LogXML(object): for name, value in self.global_properties ] ) - return '' + return "" diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/logging.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/logging.py new file mode 100644 index 00000000000..00bb9aeb54a --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/logging.py @@ -0,0 +1,575 @@ +""" Access and control log capturing. """ +from __future__ import absolute_import, division, print_function + +import logging +from contextlib import closing, contextmanager +import re +import six + +from _pytest.config import create_terminal_writer +import pytest +import py + + +DEFAULT_LOG_FORMAT = "%(filename)-25s %(lineno)4d %(levelname)-8s %(message)s" +DEFAULT_LOG_DATE_FORMAT = "%H:%M:%S" + + +class ColoredLevelFormatter(logging.Formatter): + """ + Colorize the %(levelname)..s part of the log format passed to __init__. + """ + + LOGLEVEL_COLOROPTS = { + logging.CRITICAL: {"red"}, + logging.ERROR: {"red", "bold"}, + logging.WARNING: {"yellow"}, + logging.WARN: {"yellow"}, + logging.INFO: {"green"}, + logging.DEBUG: {"purple"}, + logging.NOTSET: set(), + } + LEVELNAME_FMT_REGEX = re.compile(r"%\(levelname\)([+-]?\d*s)") + + def __init__(self, terminalwriter, *args, **kwargs): + super(ColoredLevelFormatter, self).__init__(*args, **kwargs) + if six.PY2: + self._original_fmt = self._fmt + else: + self._original_fmt = self._style._fmt + self._level_to_fmt_mapping = {} + + levelname_fmt_match = self.LEVELNAME_FMT_REGEX.search(self._fmt) + if not levelname_fmt_match: + return + levelname_fmt = levelname_fmt_match.group() + + for level, color_opts in self.LOGLEVEL_COLOROPTS.items(): + formatted_levelname = levelname_fmt % { + "levelname": logging.getLevelName(level) + } + + # add ANSI escape sequences around the formatted levelname + color_kwargs = {name: True for name in color_opts} + colorized_formatted_levelname = terminalwriter.markup( + formatted_levelname, **color_kwargs + ) + self._level_to_fmt_mapping[level] = self.LEVELNAME_FMT_REGEX.sub( + colorized_formatted_levelname, self._fmt + ) + + def format(self, record): + fmt = self._level_to_fmt_mapping.get(record.levelno, self._original_fmt) + if six.PY2: + self._fmt = fmt + else: + self._style._fmt = fmt + return super(ColoredLevelFormatter, self).format(record) + + +def get_option_ini(config, *names): + for name in names: + ret = config.getoption(name) # 'default' arg won't work as expected + if ret is None: + ret = config.getini(name) + if ret: + return ret + + +def pytest_addoption(parser): + """Add options to control log capturing.""" + group = parser.getgroup("logging") + + def add_option_ini(option, dest, default=None, type=None, **kwargs): + parser.addini( + dest, default=default, type=type, help="default value for " + option + ) + group.addoption(option, dest=dest, **kwargs) + + add_option_ini( + "--no-print-logs", + dest="log_print", + action="store_const", + const=False, + default=True, + type="bool", + help="disable printing caught logs on failed tests.", + ) + add_option_ini( + "--log-level", + dest="log_level", + default=None, + help="logging level used by the logging module", + ) + add_option_ini( + "--log-format", + dest="log_format", + default=DEFAULT_LOG_FORMAT, + help="log format as used by the logging module.", + ) + add_option_ini( + "--log-date-format", + dest="log_date_format", + default=DEFAULT_LOG_DATE_FORMAT, + help="log date format as used by the logging module.", + ) + parser.addini( + "log_cli", + default=False, + type="bool", + help='enable log display during test run (also known as "live logging").', + ) + add_option_ini( + "--log-cli-level", dest="log_cli_level", default=None, help="cli logging level." + ) + add_option_ini( + "--log-cli-format", + dest="log_cli_format", + default=None, + help="log format as used by the logging module.", + ) + add_option_ini( + "--log-cli-date-format", + dest="log_cli_date_format", + default=None, + help="log date format as used by the logging module.", + ) + add_option_ini( + "--log-file", + dest="log_file", + default=None, + help="path to a file when logging will be written to.", + ) + add_option_ini( + "--log-file-level", + dest="log_file_level", + default=None, + help="log file logging level.", + ) + add_option_ini( + "--log-file-format", + dest="log_file_format", + default=DEFAULT_LOG_FORMAT, + help="log format as used by the logging module.", + ) + add_option_ini( + "--log-file-date-format", + dest="log_file_date_format", + default=DEFAULT_LOG_DATE_FORMAT, + help="log date format as used by the logging module.", + ) + + +@contextmanager +def catching_logs(handler, formatter=None, level=None): + """Context manager that prepares the whole logging machinery properly.""" + root_logger = logging.getLogger() + + if formatter is not None: + handler.setFormatter(formatter) + if level is not None: + handler.setLevel(level) + + # Adding the same handler twice would confuse logging system. + # Just don't do that. + add_new_handler = handler not in root_logger.handlers + + if add_new_handler: + root_logger.addHandler(handler) + if level is not None: + orig_level = root_logger.level + root_logger.setLevel(min(orig_level, level)) + try: + yield handler + finally: + if level is not None: + root_logger.setLevel(orig_level) + if add_new_handler: + root_logger.removeHandler(handler) + + +class LogCaptureHandler(logging.StreamHandler): + """A logging handler that stores log records and the log text.""" + + def __init__(self): + """Creates a new log handler.""" + logging.StreamHandler.__init__(self, py.io.TextIO()) + self.records = [] + + def emit(self, record): + """Keep the log records in a list in addition to the log text.""" + self.records.append(record) + logging.StreamHandler.emit(self, record) + + def reset(self): + self.records = [] + self.stream = py.io.TextIO() + + +class LogCaptureFixture(object): + """Provides access and control of log capturing.""" + + def __init__(self, item): + """Creates a new funcarg.""" + self._item = item + self._initial_log_levels = {} # type: Dict[str, int] # dict of log name -> log level + + def _finalize(self): + """Finalizes the fixture. + + This restores the log levels changed by :meth:`set_level`. + """ + # restore log levels + for logger_name, level in self._initial_log_levels.items(): + logger = logging.getLogger(logger_name) + logger.setLevel(level) + + @property + def handler(self): + """ + :rtype: LogCaptureHandler + """ + return self._item.catch_log_handler + + def get_records(self, when): + """ + Get the logging records for one of the possible test phases. + + :param str when: + Which test phase to obtain the records from. Valid values are: "setup", "call" and "teardown". + + :rtype: List[logging.LogRecord] + :return: the list of captured records at the given stage + + .. versionadded:: 3.4 + """ + handler = self._item.catch_log_handlers.get(when) + if handler: + return handler.records + else: + return [] + + @property + def text(self): + """Returns the log text.""" + return self.handler.stream.getvalue() + + @property + def records(self): + """Returns the list of log records.""" + return self.handler.records + + @property + def record_tuples(self): + """Returns a list of a striped down version of log records intended + for use in assertion comparison. + + The format of the tuple is: + + (logger_name, log_level, message) + """ + return [(r.name, r.levelno, r.getMessage()) for r in self.records] + + def clear(self): + """Reset the list of log records and the captured log text.""" + self.handler.reset() + + def set_level(self, level, logger=None): + """Sets the level for capturing of logs. The level will be restored to its previous value at the end of + the test. + + :param int level: the logger to level. + :param str logger: the logger to update the level. If not given, the root logger level is updated. + + .. versionchanged:: 3.4 + The levels of the loggers changed by this function will be restored to their initial values at the + end of the test. + """ + logger_name = logger + logger = logging.getLogger(logger_name) + # save the original log-level to restore it during teardown + self._initial_log_levels.setdefault(logger_name, logger.level) + logger.setLevel(level) + + @contextmanager + def at_level(self, level, logger=None): + """Context manager that sets the level for capturing of logs. After the end of the 'with' statement the + level is restored to its original value. + + :param int level: the logger to level. + :param str logger: the logger to update the level. If not given, the root logger level is updated. + """ + logger = logging.getLogger(logger) + orig_level = logger.level + logger.setLevel(level) + try: + yield + finally: + logger.setLevel(orig_level) + + +@pytest.fixture +def caplog(request): + """Access and control log capturing. + + Captured logs are available through the following methods:: + + * caplog.text -> string containing formatted log output + * caplog.records -> list of logging.LogRecord instances + * caplog.record_tuples -> list of (logger_name, level, message) tuples + * caplog.clear() -> clear captured records and formatted log output string + """ + result = LogCaptureFixture(request.node) + yield result + result._finalize() + + +def get_actual_log_level(config, *setting_names): + """Return the actual logging level.""" + + for setting_name in setting_names: + log_level = config.getoption(setting_name) + if log_level is None: + log_level = config.getini(setting_name) + if log_level: + break + else: + return + + if isinstance(log_level, six.string_types): + log_level = log_level.upper() + try: + return int(getattr(logging, log_level, log_level)) + except ValueError: + # Python logging does not recognise this as a logging level + raise pytest.UsageError( + "'{}' is not recognized as a logging level name for " + "'{}'. Please consider passing the " + "logging level num instead.".format(log_level, setting_name) + ) + + +def pytest_configure(config): + config.pluginmanager.register(LoggingPlugin(config), "logging-plugin") + + +@contextmanager +def _dummy_context_manager(): + yield + + +class LoggingPlugin(object): + """Attaches to the logging module and captures log messages for each test. + """ + + def __init__(self, config): + """Creates a new plugin to capture log messages. + + The formatter can be safely shared across all handlers so + create a single one for the entire test session here. + """ + self._config = config + + # enable verbose output automatically if live logging is enabled + if self._log_cli_enabled() and not config.getoption("verbose"): + # sanity check: terminal reporter should not have been loaded at this point + assert self._config.pluginmanager.get_plugin("terminalreporter") is None + config.option.verbose = 1 + + self.print_logs = get_option_ini(config, "log_print") + self.formatter = logging.Formatter( + get_option_ini(config, "log_format"), + get_option_ini(config, "log_date_format"), + ) + self.log_level = get_actual_log_level(config, "log_level") + + log_file = get_option_ini(config, "log_file") + if log_file: + self.log_file_level = get_actual_log_level(config, "log_file_level") + + log_file_format = get_option_ini(config, "log_file_format", "log_format") + log_file_date_format = get_option_ini( + config, "log_file_date_format", "log_date_format" + ) + # Each pytest runtests session will write to a clean logfile + self.log_file_handler = logging.FileHandler(log_file, mode="w") + log_file_formatter = logging.Formatter( + log_file_format, datefmt=log_file_date_format + ) + self.log_file_handler.setFormatter(log_file_formatter) + else: + self.log_file_handler = None + + # initialized during pytest_runtestloop + self.log_cli_handler = None + + def _log_cli_enabled(self): + """Return True if log_cli should be considered enabled, either explicitly + or because --log-cli-level was given in the command-line. + """ + return self._config.getoption( + "--log-cli-level" + ) is not None or self._config.getini( + "log_cli" + ) + + @contextmanager + def _runtest_for(self, item, when): + """Implements the internals of pytest_runtest_xxx() hook.""" + with catching_logs( + LogCaptureHandler(), formatter=self.formatter, level=self.log_level + ) as log_handler: + if self.log_cli_handler: + self.log_cli_handler.set_when(when) + + if item is None: + yield # run the test + return + + if not hasattr(item, "catch_log_handlers"): + item.catch_log_handlers = {} + item.catch_log_handlers[when] = log_handler + item.catch_log_handler = log_handler + try: + yield # run test + finally: + del item.catch_log_handler + if when == "teardown": + del item.catch_log_handlers + + if self.print_logs: + # Add a captured log section to the report. + log = log_handler.stream.getvalue().strip() + item.add_report_section(when, "log", log) + + @pytest.hookimpl(hookwrapper=True) + def pytest_runtest_setup(self, item): + with self._runtest_for(item, "setup"): + yield + + @pytest.hookimpl(hookwrapper=True) + def pytest_runtest_call(self, item): + with self._runtest_for(item, "call"): + yield + + @pytest.hookimpl(hookwrapper=True) + def pytest_runtest_teardown(self, item): + with self._runtest_for(item, "teardown"): + yield + + @pytest.hookimpl(hookwrapper=True) + def pytest_runtest_logstart(self): + if self.log_cli_handler: + self.log_cli_handler.reset() + with self._runtest_for(None, "start"): + yield + + @pytest.hookimpl(hookwrapper=True) + def pytest_runtest_logfinish(self): + with self._runtest_for(None, "finish"): + yield + + @pytest.hookimpl(hookwrapper=True) + def pytest_runtestloop(self, session): + """Runs all collected test items.""" + self._setup_cli_logging() + with self.live_logs_context: + if self.log_file_handler is not None: + with closing(self.log_file_handler): + with catching_logs( + self.log_file_handler, level=self.log_file_level + ): + yield # run all the tests + else: + yield # run all the tests + + def _setup_cli_logging(self): + """Sets up the handler and logger for the Live Logs feature, if enabled. + + This must be done right before starting the loop so we can access the terminal reporter plugin. + """ + terminal_reporter = self._config.pluginmanager.get_plugin("terminalreporter") + if self._log_cli_enabled() and terminal_reporter is not None: + capture_manager = self._config.pluginmanager.get_plugin("capturemanager") + log_cli_handler = _LiveLoggingStreamHandler( + terminal_reporter, capture_manager + ) + log_cli_format = get_option_ini( + self._config, "log_cli_format", "log_format" + ) + log_cli_date_format = get_option_ini( + self._config, "log_cli_date_format", "log_date_format" + ) + if ( + self._config.option.color != "no" + and ColoredLevelFormatter.LEVELNAME_FMT_REGEX.search(log_cli_format) + ): + log_cli_formatter = ColoredLevelFormatter( + create_terminal_writer(self._config), + log_cli_format, + datefmt=log_cli_date_format, + ) + else: + log_cli_formatter = logging.Formatter( + log_cli_format, datefmt=log_cli_date_format + ) + log_cli_level = get_actual_log_level( + self._config, "log_cli_level", "log_level" + ) + self.log_cli_handler = log_cli_handler + self.live_logs_context = catching_logs( + log_cli_handler, formatter=log_cli_formatter, level=log_cli_level + ) + else: + self.live_logs_context = _dummy_context_manager() + + +class _LiveLoggingStreamHandler(logging.StreamHandler): + """ + Custom StreamHandler used by the live logging feature: it will write a newline before the first log message + in each test. + + During live logging we must also explicitly disable stdout/stderr capturing otherwise it will get captured + and won't appear in the terminal. + """ + + def __init__(self, terminal_reporter, capture_manager): + """ + :param _pytest.terminal.TerminalReporter terminal_reporter: + :param _pytest.capture.CaptureManager capture_manager: + """ + logging.StreamHandler.__init__(self, stream=terminal_reporter) + self.capture_manager = capture_manager + self.reset() + self.set_when(None) + self._test_outcome_written = False + + def reset(self): + """Reset the handler; should be called before the start of each test""" + self._first_record_emitted = False + + def set_when(self, when): + """Prepares for the given test phase (setup/call/teardown)""" + self._when = when + self._section_name_shown = False + if when == "start": + self._test_outcome_written = False + + def emit(self, record): + if self.capture_manager is not None: + self.capture_manager.suspend_global_capture() + try: + if not self._first_record_emitted: + self.stream.write("\n") + self._first_record_emitted = True + elif self._when in ("teardown", "finish"): + if not self._test_outcome_written: + self._test_outcome_written = True + self.stream.write("\n") + if not self._section_name_shown and self._when: + self.stream.section("live log " + self._when, sep="-", bold=True) + self._section_name_shown = True + logging.StreamHandler.emit(self, record) + finally: + if self.capture_manager is not None: + self.capture_manager.resume_global_capture() diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/main.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/main.py new file mode 100644 index 00000000000..23562358d7c --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/main.py @@ -0,0 +1,611 @@ +""" core implementation of testing process: init, session, runtest loop. """ +from __future__ import absolute_import, division, print_function + +import contextlib +import functools +import os +import pkgutil +import six +import sys + +import _pytest +from _pytest import nodes +import _pytest._code +import py + +from _pytest.config import directory_arg, UsageError, hookimpl +from _pytest.outcomes import exit +from _pytest.runner import collect_one_node + + +# exitcodes for the command line +EXIT_OK = 0 +EXIT_TESTSFAILED = 1 +EXIT_INTERRUPTED = 2 +EXIT_INTERNALERROR = 3 +EXIT_USAGEERROR = 4 +EXIT_NOTESTSCOLLECTED = 5 + + +def pytest_addoption(parser): + parser.addini( + "norecursedirs", + "directory patterns to avoid for recursion", + type="args", + default=[".*", "build", "dist", "CVS", "_darcs", "{arch}", "*.egg", "venv"], + ) + parser.addini( + "testpaths", + "directories to search for tests when no files or directories are given in the " + "command line.", + type="args", + default=[], + ) + # parser.addini("dirpatterns", + # "patterns specifying possible locations of test files", + # type="linelist", default=["**/test_*.txt", + # "**/test_*.py", "**/*_test.py"] + # ) + group = parser.getgroup("general", "running and selection options") + group._addoption( + "-x", + "--exitfirst", + action="store_const", + dest="maxfail", + const=1, + help="exit instantly on first error or failed test.", + ), + group._addoption( + "--maxfail", + metavar="num", + action="store", + type=int, + dest="maxfail", + default=0, + help="exit after first num failures or errors.", + ) + group._addoption( + "--strict", + action="store_true", + help="marks not registered in configuration file raise errors.", + ) + group._addoption( + "-c", + metavar="file", + type=str, + dest="inifilename", + help="load configuration from `file` instead of trying to locate one of the implicit " + "configuration files.", + ) + group._addoption( + "--continue-on-collection-errors", + action="store_true", + default=False, + dest="continue_on_collection_errors", + help="Force test execution even if collection errors occur.", + ) + group._addoption( + "--rootdir", + action="store", + dest="rootdir", + help="Define root directory for tests. Can be relative path: 'root_dir', './root_dir', " + "'root_dir/another_dir/'; absolute path: '/home/user/root_dir'; path with variables: " + "'$HOME/root_dir'.", + ) + + group = parser.getgroup("collect", "collection") + group.addoption( + "--collectonly", + "--collect-only", + action="store_true", + help="only collect tests, don't execute them.", + ), + group.addoption( + "--pyargs", + action="store_true", + help="try to interpret all arguments as python packages.", + ) + group.addoption( + "--ignore", + action="append", + metavar="path", + help="ignore path during collection (multi-allowed).", + ) + group.addoption( + "--deselect", + action="append", + metavar="nodeid_prefix", + help="deselect item during collection (multi-allowed).", + ) + # when changing this to --conf-cut-dir, config.py Conftest.setinitial + # needs upgrading as well + group.addoption( + "--confcutdir", + dest="confcutdir", + default=None, + metavar="dir", + type=functools.partial(directory_arg, optname="--confcutdir"), + help="only load conftest.py's relative to specified dir.", + ) + group.addoption( + "--noconftest", + action="store_true", + dest="noconftest", + default=False, + help="Don't load any conftest.py files.", + ) + group.addoption( + "--keepduplicates", + "--keep-duplicates", + action="store_true", + dest="keepduplicates", + default=False, + help="Keep duplicate tests.", + ) + group.addoption( + "--collect-in-virtualenv", + action="store_true", + dest="collect_in_virtualenv", + default=False, + help="Don't ignore tests in a local virtualenv directory", + ) + + group = parser.getgroup("debugconfig", "test session debugging and configuration") + group.addoption( + "--basetemp", + dest="basetemp", + default=None, + metavar="dir", + help="base temporary directory for this test run.", + ) + + +def pytest_configure(config): + __import__("pytest").config = config # compatibility + + +def wrap_session(config, doit): + """Skeleton command line program""" + session = Session(config) + session.exitstatus = EXIT_OK + initstate = 0 + try: + try: + config._do_configure() + initstate = 1 + config.hook.pytest_sessionstart(session=session) + initstate = 2 + session.exitstatus = doit(config, session) or 0 + except UsageError: + raise + except Failed: + session.exitstatus = EXIT_TESTSFAILED + except KeyboardInterrupt: + excinfo = _pytest._code.ExceptionInfo() + if initstate < 2 and isinstance(excinfo.value, exit.Exception): + sys.stderr.write("{}: {}\n".format(excinfo.typename, excinfo.value.msg)) + config.hook.pytest_keyboard_interrupt(excinfo=excinfo) + session.exitstatus = EXIT_INTERRUPTED + except: # noqa + excinfo = _pytest._code.ExceptionInfo() + config.notify_exception(excinfo, config.option) + session.exitstatus = EXIT_INTERNALERROR + if excinfo.errisinstance(SystemExit): + sys.stderr.write("mainloop: caught Spurious SystemExit!\n") + + finally: + excinfo = None # Explicitly break reference cycle. + session.startdir.chdir() + if initstate >= 2: + config.hook.pytest_sessionfinish( + session=session, exitstatus=session.exitstatus + ) + config._ensure_unconfigure() + return session.exitstatus + + +def pytest_cmdline_main(config): + return wrap_session(config, _main) + + +def _main(config, session): + """ default command line protocol for initialization, session, + running tests and reporting. """ + config.hook.pytest_collection(session=session) + config.hook.pytest_runtestloop(session=session) + + if session.testsfailed: + return EXIT_TESTSFAILED + elif session.testscollected == 0: + return EXIT_NOTESTSCOLLECTED + + +def pytest_collection(session): + return session.perform_collect() + + +def pytest_runtestloop(session): + if session.testsfailed and not session.config.option.continue_on_collection_errors: + raise session.Interrupted("%d errors during collection" % session.testsfailed) + + if session.config.option.collectonly: + return True + + for i, item in enumerate(session.items): + nextitem = session.items[i + 1] if i + 1 < len(session.items) else None + item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem) + if session.shouldfail: + raise session.Failed(session.shouldfail) + if session.shouldstop: + raise session.Interrupted(session.shouldstop) + return True + + +def _in_venv(path): + """Attempts to detect if ``path`` is the root of a Virtual Environment by + checking for the existence of the appropriate activate script""" + bindir = path.join("Scripts" if sys.platform.startswith("win") else "bin") + if not bindir.isdir(): + return False + activates = ( + "activate", + "activate.csh", + "activate.fish", + "Activate", + "Activate.bat", + "Activate.ps1", + ) + return any([fname.basename in activates for fname in bindir.listdir()]) + + +def pytest_ignore_collect(path, config): + ignore_paths = config._getconftest_pathlist("collect_ignore", path=path.dirpath()) + ignore_paths = ignore_paths or [] + excludeopt = config.getoption("ignore") + if excludeopt: + ignore_paths.extend([py.path.local(x) for x in excludeopt]) + + if py.path.local(path) in ignore_paths: + return True + + allow_in_venv = config.getoption("collect_in_virtualenv") + if _in_venv(path) and not allow_in_venv: + return True + + # Skip duplicate paths. + keepduplicates = config.getoption("keepduplicates") + duplicate_paths = config.pluginmanager._duplicatepaths + if not keepduplicates: + if path in duplicate_paths: + return True + else: + duplicate_paths.add(path) + + return False + + +def pytest_collection_modifyitems(items, config): + deselect_prefixes = tuple(config.getoption("deselect") or []) + if not deselect_prefixes: + return + + remaining = [] + deselected = [] + for colitem in items: + if colitem.nodeid.startswith(deselect_prefixes): + deselected.append(colitem) + else: + remaining.append(colitem) + + if deselected: + config.hook.pytest_deselected(items=deselected) + items[:] = remaining + + +@contextlib.contextmanager +def _patched_find_module(): + """Patch bug in pkgutil.ImpImporter.find_module + + When using pkgutil.find_loader on python<3.4 it removes symlinks + from the path due to a call to os.path.realpath. This is not consistent + with actually doing the import (in these versions, pkgutil and __import__ + did not share the same underlying code). This can break conftest + discovery for pytest where symlinks are involved. + + The only supported python<3.4 by pytest is python 2.7. + """ + if six.PY2: # python 3.4+ uses importlib instead + + def find_module_patched(self, fullname, path=None): + # Note: we ignore 'path' argument since it is only used via meta_path + subname = fullname.split(".")[-1] + if subname != fullname and self.path is None: + return None + if self.path is None: + path = None + else: + # original: path = [os.path.realpath(self.path)] + path = [self.path] + try: + file, filename, etc = pkgutil.imp.find_module(subname, path) + except ImportError: + return None + return pkgutil.ImpLoader(fullname, file, filename, etc) + + old_find_module = pkgutil.ImpImporter.find_module + pkgutil.ImpImporter.find_module = find_module_patched + try: + yield + finally: + pkgutil.ImpImporter.find_module = old_find_module + else: + yield + + +class FSHookProxy(object): + + def __init__(self, fspath, pm, remove_mods): + self.fspath = fspath + self.pm = pm + self.remove_mods = remove_mods + + def __getattr__(self, name): + x = self.pm.subset_hook_caller(name, remove_plugins=self.remove_mods) + self.__dict__[name] = x + return x + + +class NoMatch(Exception): + """ raised if matching cannot locate a matching names. """ + + +class Interrupted(KeyboardInterrupt): + """ signals an interrupted test run. """ + __module__ = "builtins" # for py3 + + +class Failed(Exception): + """ signals a stop as failed test run. """ + + +class Session(nodes.FSCollector): + Interrupted = Interrupted + Failed = Failed + + def __init__(self, config): + nodes.FSCollector.__init__( + self, config.rootdir, parent=None, config=config, session=self, nodeid="" + ) + self.testsfailed = 0 + self.testscollected = 0 + self.shouldstop = False + self.shouldfail = False + self.trace = config.trace.root.get("collection") + self._norecursepatterns = config.getini("norecursedirs") + self.startdir = py.path.local() + + self.config.pluginmanager.register(self, name="session") + + @hookimpl(tryfirst=True) + def pytest_collectstart(self): + if self.shouldfail: + raise self.Failed(self.shouldfail) + if self.shouldstop: + raise self.Interrupted(self.shouldstop) + + @hookimpl(tryfirst=True) + def pytest_runtest_logreport(self, report): + if report.failed and not hasattr(report, "wasxfail"): + self.testsfailed += 1 + maxfail = self.config.getvalue("maxfail") + if maxfail and self.testsfailed >= maxfail: + self.shouldfail = "stopping after %d failures" % (self.testsfailed) + + pytest_collectreport = pytest_runtest_logreport + + def isinitpath(self, path): + return path in self._initialpaths + + def gethookproxy(self, fspath): + # check if we have the common case of running + # hooks with all conftest.py files + pm = self.config.pluginmanager + my_conftestmodules = pm._getconftestmodules(fspath) + remove_mods = pm._conftest_plugins.difference(my_conftestmodules) + if remove_mods: + # one or more conftests are not in use at this fspath + proxy = FSHookProxy(fspath, pm, remove_mods) + else: + # all plugis are active for this fspath + proxy = self.config.hook + return proxy + + def perform_collect(self, args=None, genitems=True): + hook = self.config.hook + try: + items = self._perform_collect(args, genitems) + self.config.pluginmanager.check_pending() + hook.pytest_collection_modifyitems( + session=self, config=self.config, items=items + ) + finally: + hook.pytest_collection_finish(session=self) + self.testscollected = len(items) + return items + + def _perform_collect(self, args, genitems): + if args is None: + args = self.config.args + self.trace("perform_collect", self, args) + self.trace.root.indent += 1 + self._notfound = [] + self._initialpaths = set() + self._initialparts = [] + self.items = items = [] + for arg in args: + parts = self._parsearg(arg) + self._initialparts.append(parts) + self._initialpaths.add(parts[0]) + rep = collect_one_node(self) + self.ihook.pytest_collectreport(report=rep) + self.trace.root.indent -= 1 + if self._notfound: + errors = [] + for arg, exc in self._notfound: + line = "(no name %r in any of %r)" % (arg, exc.args[0]) + errors.append("not found: %s\n%s" % (arg, line)) + # XXX: test this + raise UsageError(*errors) + if not genitems: + return rep.result + else: + if rep.passed: + for node in rep.result: + self.items.extend(self.genitems(node)) + return items + + def collect(self): + for parts in self._initialparts: + arg = "::".join(map(str, parts)) + self.trace("processing argument", arg) + self.trace.root.indent += 1 + try: + for x in self._collect(arg): + yield x + except NoMatch: + # we are inside a make_report hook so + # we cannot directly pass through the exception + self._notfound.append((arg, sys.exc_info()[1])) + + self.trace.root.indent -= 1 + + def _collect(self, arg): + names = self._parsearg(arg) + path = names.pop(0) + if path.check(dir=1): + assert not names, "invalid arg %r" % (arg,) + for path in path.visit( + fil=lambda x: x.check(file=1), rec=self._recurse, bf=True, sort=True + ): + for x in self._collectfile(path): + yield x + else: + assert path.check(file=1) + for x in self.matchnodes(self._collectfile(path), names): + yield x + + def _collectfile(self, path): + ihook = self.gethookproxy(path) + if not self.isinitpath(path): + if ihook.pytest_ignore_collect(path=path, config=self.config): + return () + return ihook.pytest_collect_file(path=path, parent=self) + + def _recurse(self, path): + ihook = self.gethookproxy(path.dirpath()) + if ihook.pytest_ignore_collect(path=path, config=self.config): + return + for pat in self._norecursepatterns: + if path.check(fnmatch=pat): + return False + ihook = self.gethookproxy(path) + ihook.pytest_collect_directory(path=path, parent=self) + return True + + def _tryconvertpyarg(self, x): + """Convert a dotted module name to path. + + """ + + try: + with _patched_find_module(): + loader = pkgutil.find_loader(x) + except ImportError: + return x + if loader is None: + return x + # This method is sometimes invoked when AssertionRewritingHook, which + # does not define a get_filename method, is already in place: + try: + with _patched_find_module(): + path = loader.get_filename(x) + except AttributeError: + # Retrieve path from AssertionRewritingHook: + path = loader.modules[x][0].co_filename + if loader.is_package(x): + path = os.path.dirname(path) + return path + + def _parsearg(self, arg): + """ return (fspath, names) tuple after checking the file exists. """ + parts = str(arg).split("::") + if self.config.option.pyargs: + parts[0] = self._tryconvertpyarg(parts[0]) + relpath = parts[0].replace("/", os.sep) + path = self.config.invocation_dir.join(relpath, abs=True) + if not path.check(): + if self.config.option.pyargs: + raise UsageError( + "file or package not found: " + arg + " (missing __init__.py?)" + ) + else: + raise UsageError("file not found: " + arg) + parts[0] = path + return parts + + def matchnodes(self, matching, names): + self.trace("matchnodes", matching, names) + self.trace.root.indent += 1 + nodes = self._matchnodes(matching, names) + num = len(nodes) + self.trace("matchnodes finished -> ", num, "nodes") + self.trace.root.indent -= 1 + if num == 0: + raise NoMatch(matching, names[:1]) + return nodes + + def _matchnodes(self, matching, names): + if not matching or not names: + return matching + name = names[0] + assert name + nextnames = names[1:] + resultnodes = [] + for node in matching: + if isinstance(node, nodes.Item): + if not names: + resultnodes.append(node) + continue + assert isinstance(node, nodes.Collector) + rep = collect_one_node(node) + if rep.passed: + has_matched = False + for x in rep.result: + # TODO: remove parametrized workaround once collection structure contains parametrization + if x.name == name or x.name.split("[")[0] == name: + resultnodes.extend(self.matchnodes([x], nextnames)) + has_matched = True + # XXX accept IDs that don't have "()" for class instances + if not has_matched and len(rep.result) == 1 and x.name == "()": + nextnames.insert(0, name) + resultnodes.extend(self.matchnodes([x], nextnames)) + else: + # report collection failures here to avoid failing to run some test + # specified in the command line because the module could not be + # imported (#134) + node.ihook.pytest_collectreport(report=rep) + return resultnodes + + def genitems(self, node): + self.trace("genitems", node) + if isinstance(node, nodes.Item): + node.ihook.pytest_itemcollected(item=node) + yield node + else: + assert isinstance(node, nodes.Collector) + rep = collect_one_node(node) + if rep.passed: + for subnode in rep.result: + for x in self.genitems(subnode): + yield x + node.ihook.pytest_collectreport(report=rep) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/mark/__init__.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/mark/__init__.py new file mode 100644 index 00000000000..e3918ca6a4f --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/mark/__init__.py @@ -0,0 +1,174 @@ +""" generic mechanism for marking and selecting python functions. """ +from __future__ import absolute_import, division, print_function +from _pytest.config import UsageError +from .structures import ( + ParameterSet, + EMPTY_PARAMETERSET_OPTION, + MARK_GEN, + Mark, + MarkInfo, + MarkDecorator, + MarkGenerator, + transfer_markers, + get_empty_parameterset_mark, +) +from .legacy import matchkeyword, matchmark + +__all__ = [ + "Mark", + "MarkInfo", + "MarkDecorator", + "MarkGenerator", + "transfer_markers", + "get_empty_parameterset_mark", +] + + +class MarkerError(Exception): + + """Error in use of a pytest marker/attribute.""" + + +def param(*values, **kw): + """Specify a parameter in `pytest.mark.parametrize`_ calls or + :ref:`parametrized fixtures `. + + .. code-block:: python + + @pytest.mark.parametrize("test_input,expected", [ + ("3+5", 8), + pytest.param("6*9", 42, marks=pytest.mark.xfail), + ]) + def test_eval(test_input, expected): + assert eval(test_input) == expected + + :param values: variable args of the values of the parameter set, in order. + :keyword marks: a single mark or a list of marks to be applied to this parameter set. + :keyword str id: the id to attribute to this parameter set. + """ + return ParameterSet.param(*values, **kw) + + +def pytest_addoption(parser): + group = parser.getgroup("general") + group._addoption( + "-k", + action="store", + dest="keyword", + default="", + metavar="EXPRESSION", + help="only run tests which match the given substring expression. " + "An expression is a python evaluatable expression " + "where all names are substring-matched against test names " + "and their parent classes. Example: -k 'test_method or test_" + "other' matches all test functions and classes whose name " + "contains 'test_method' or 'test_other', while -k 'not test_method' " + "matches those that don't contain 'test_method' in their names. " + "Additionally keywords are matched to classes and functions " + "containing extra names in their 'extra_keyword_matches' set, " + "as well as functions which have names assigned directly to them.", + ) + + group._addoption( + "-m", + action="store", + dest="markexpr", + default="", + metavar="MARKEXPR", + help="only run tests matching given mark expression. " + "example: -m 'mark1 and not mark2'.", + ) + + group.addoption( + "--markers", + action="store_true", + help="show markers (builtin, plugin and per-project ones).", + ) + + parser.addini("markers", "markers for test functions", "linelist") + parser.addini(EMPTY_PARAMETERSET_OPTION, "default marker for empty parametersets") + + +def pytest_cmdline_main(config): + import _pytest.config + + if config.option.markers: + config._do_configure() + tw = _pytest.config.create_terminal_writer(config) + for line in config.getini("markers"): + parts = line.split(":", 1) + name = parts[0] + rest = parts[1] if len(parts) == 2 else "" + tw.write("@pytest.mark.%s:" % name, bold=True) + tw.line(rest) + tw.line() + config._ensure_unconfigure() + return 0 + + +pytest_cmdline_main.tryfirst = True + + +def deselect_by_keyword(items, config): + keywordexpr = config.option.keyword.lstrip() + if keywordexpr.startswith("-"): + keywordexpr = "not " + keywordexpr[1:] + selectuntil = False + if keywordexpr[-1:] == ":": + selectuntil = True + keywordexpr = keywordexpr[:-1] + + remaining = [] + deselected = [] + for colitem in items: + if keywordexpr and not matchkeyword(colitem, keywordexpr): + deselected.append(colitem) + else: + if selectuntil: + keywordexpr = None + remaining.append(colitem) + + if deselected: + config.hook.pytest_deselected(items=deselected) + items[:] = remaining + + +def deselect_by_mark(items, config): + matchexpr = config.option.markexpr + if not matchexpr: + return + + remaining = [] + deselected = [] + for item in items: + if matchmark(item, matchexpr): + remaining.append(item) + else: + deselected.append(item) + + if deselected: + config.hook.pytest_deselected(items=deselected) + items[:] = remaining + + +def pytest_collection_modifyitems(items, config): + deselect_by_keyword(items, config) + deselect_by_mark(items, config) + + +def pytest_configure(config): + config._old_mark_config = MARK_GEN._config + if config.option.strict: + MARK_GEN._config = config + + empty_parameterset = config.getini(EMPTY_PARAMETERSET_OPTION) + + if empty_parameterset not in ("skip", "xfail", None, ""): + raise UsageError( + "{!s} must be one of skip and xfail," + " but it is {!r}".format(EMPTY_PARAMETERSET_OPTION, empty_parameterset) + ) + + +def pytest_unconfigure(config): + MARK_GEN._config = getattr(config, "_old_mark_config", None) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/mark/evaluate.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/mark/evaluate.py new file mode 100644 index 00000000000..a3d11ee0f81 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/mark/evaluate.py @@ -0,0 +1,121 @@ +import os +import six +import sys +import platform +import traceback + +from ..outcomes import fail, TEST_OUTCOME + + +def cached_eval(config, expr, d): + if not hasattr(config, "_evalcache"): + config._evalcache = {} + try: + return config._evalcache[expr] + except KeyError: + import _pytest._code + + exprcode = _pytest._code.compile(expr, mode="eval") + config._evalcache[expr] = x = eval(exprcode, d) + return x + + +class MarkEvaluator(object): + + def __init__(self, item, name): + self.item = item + self._marks = None + self._mark = None + self._mark_name = name + + def __bool__(self): + # dont cache here to prevent staleness + return bool(self._get_marks()) + + __nonzero__ = __bool__ + + def wasvalid(self): + return not hasattr(self, "exc") + + def _get_marks(self): + return list(self.item.iter_markers(name=self._mark_name)) + + def invalidraise(self, exc): + raises = self.get("raises") + if not raises: + return + return not isinstance(exc, raises) + + def istrue(self): + try: + return self._istrue() + except TEST_OUTCOME: + self.exc = sys.exc_info() + if isinstance(self.exc[1], SyntaxError): + msg = [" " * (self.exc[1].offset + 4) + "^"] + msg.append("SyntaxError: invalid syntax") + else: + msg = traceback.format_exception_only(*self.exc[:2]) + fail( + "Error evaluating %r expression\n" + " %s\n" + "%s" % (self._mark_name, self.expr, "\n".join(msg)), + pytrace=False, + ) + + def _getglobals(self): + d = {"os": os, "sys": sys, "platform": platform, "config": self.item.config} + if hasattr(self.item, "obj"): + d.update(self.item.obj.__globals__) + return d + + def _istrue(self): + if hasattr(self, "result"): + return self.result + self._marks = self._get_marks() + + if self._marks: + self.result = False + for mark in self._marks: + self._mark = mark + if "condition" in mark.kwargs: + args = (mark.kwargs["condition"],) + else: + args = mark.args + + for expr in args: + self.expr = expr + if isinstance(expr, six.string_types): + d = self._getglobals() + result = cached_eval(self.item.config, expr, d) + else: + if "reason" not in mark.kwargs: + # XXX better be checked at collection time + msg = "you need to specify reason=STRING " "when using booleans as conditions." + fail(msg) + result = bool(expr) + if result: + self.result = True + self.reason = mark.kwargs.get("reason", None) + self.expr = expr + return self.result + + if not args: + self.result = True + self.reason = mark.kwargs.get("reason", None) + return self.result + return False + + def get(self, attr, default=None): + if self._mark is None: + return default + return self._mark.kwargs.get(attr, default) + + def getexplanation(self): + expl = getattr(self, "reason", None) or self.get("reason", None) + if not expl: + if not hasattr(self, "expr"): + return "" + else: + return "condition: " + str(self.expr) + return expl diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/mark/legacy.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/mark/legacy.py new file mode 100644 index 00000000000..ab016a0355b --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/mark/legacy.py @@ -0,0 +1,97 @@ +""" +this is a place where we put datastructures used by legacy apis +we hope ot remove +""" +import attr +import keyword + +from _pytest.config import UsageError + + +@attr.s +class MarkMapping(object): + """Provides a local mapping for markers where item access + resolves to True if the marker is present. """ + + own_mark_names = attr.ib() + + @classmethod + def from_item(cls, item): + mark_names = {mark.name for mark in item.iter_markers()} + return cls(mark_names) + + def __getitem__(self, name): + return name in self.own_mark_names + + +class KeywordMapping(object): + """Provides a local mapping for keywords. + Given a list of names, map any substring of one of these names to True. + """ + + def __init__(self, names): + self._names = names + + @classmethod + def from_item(cls, item): + mapped_names = set() + + # Add the names of the current item and any parent items + import pytest + + for item in item.listchain(): + if not isinstance(item, pytest.Instance): + mapped_names.add(item.name) + + # Add the names added as extra keywords to current or parent items + for name in item.listextrakeywords(): + mapped_names.add(name) + + # Add the names attached to the current function through direct assignment + if hasattr(item, "function"): + for name in item.function.__dict__: + mapped_names.add(name) + + return cls(mapped_names) + + def __getitem__(self, subname): + for name in self._names: + if subname in name: + return True + return False + + +python_keywords_allowed_list = ["or", "and", "not"] + + +def matchmark(colitem, markexpr): + """Tries to match on any marker names, attached to the given colitem.""" + return eval(markexpr, {}, MarkMapping.from_item(colitem)) + + +def matchkeyword(colitem, keywordexpr): + """Tries to match given keyword expression to given collector item. + + Will match on the name of colitem, including the names of its parents. + Only matches names of items which are either a :class:`Class` or a + :class:`Function`. + Additionally, matches on names in the 'extra_keyword_matches' set of + any item, as well as names directly assigned to test functions. + """ + mapping = KeywordMapping.from_item(colitem) + if " " not in keywordexpr: + # special case to allow for simple "-k pass" and "-k 1.3" + return mapping[keywordexpr] + elif keywordexpr.startswith("not ") and " " not in keywordexpr[4:]: + return not mapping[keywordexpr[4:]] + for kwd in keywordexpr.split(): + if keyword.iskeyword(kwd) and kwd not in python_keywords_allowed_list: + raise UsageError( + "Python keyword '{}' not accepted in expressions passed to '-k'".format( + kwd + ) + ) + try: + return eval(keywordexpr, {}, mapping) + except SyntaxError: + raise UsageError("Wrong expression passed to '-k': {}".format(keywordexpr)) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/mark.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/mark/structures.py similarity index 50% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/mark.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/mark/structures.py index 3f1f01b1a2e..1a2bd73de56 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/mark.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/mark/structures.py @@ -1,14 +1,16 @@ -""" generic mechanism for marking and selecting python functions. """ -from __future__ import absolute_import, division, print_function - import inspect import warnings -import attr from collections import namedtuple from operator import attrgetter -from six.moves import map -from .deprecated import MARK_PARAMETERSET_UNPACKING -from .compat import NOTSET, getfslineno + +import attr + +from ..deprecated import MARK_PARAMETERSET_UNPACKING, MARK_INFO_ATTRIBUTE +from ..compat import NOTSET, getfslineno, MappingMixin +from six.moves import map, reduce + + +EMPTY_PARAMETERSET_OPTION = "empty_parameter_set_mark" def alias(name, warning=None): @@ -18,13 +20,35 @@ def alias(name, warning=None): warnings.warn(warning, stacklevel=2) return getter(self) - return property(getter if warning is None else warned, doc='alias for ' + name) + return property(getter if warning is None else warned, doc="alias for " + name) -class ParameterSet(namedtuple('ParameterSet', 'values, marks, id')): +def istestfunc(func): + return hasattr(func, "__call__") and getattr( + func, "__name__", "" + ) != "" + + +def get_empty_parameterset_mark(config, argnames, func): + requested_mark = config.getini(EMPTY_PARAMETERSET_OPTION) + if requested_mark in ("", None, "skip"): + mark = MARK_GEN.skip + elif requested_mark == "xfail": + mark = MARK_GEN.xfail(run=False) + else: + raise LookupError(requested_mark) + fs, lineno = getfslineno(func) + reason = "got empty parameter set %r, function %s at %s:%d" % ( + argnames, func.__name__, fs, lineno + ) + return mark(reason=reason) + + +class ParameterSet(namedtuple("ParameterSet", "values, marks, id")): + @classmethod def param(cls, *values, **kw): - marks = kw.pop('marks', ()) + marks = kw.pop("marks", ()) if isinstance(marks, MarkDecorator): marks = marks, else: @@ -33,8 +57,8 @@ class ParameterSet(namedtuple('ParameterSet', 'values, marks, id')): def param_extract_id(id=None): return id - id = param_extract_id(**kw) - return cls(values, marks, id) + id_ = param_extract_id(**kw) + return cls(values, marks, id_) @classmethod def extract_from(cls, parameterset, legacy_force_tuple=False): @@ -57,8 +81,9 @@ class ParameterSet(namedtuple('ParameterSet', 'values, marks, id')): newmarks = [] argval = parameterset while isinstance(argval, MarkDecorator): - newmarks.append(MarkDecorator(Mark( - argval.markname, argval.args[:-1], argval.kwargs))) + newmarks.append( + MarkDecorator(Mark(argval.markname, argval.args[:-1], argval.kwargs)) + ) argval = argval.args[-1] assert not isinstance(argval, ParameterSet) if legacy_force_tuple: @@ -70,7 +95,7 @@ class ParameterSet(namedtuple('ParameterSet', 'values, marks, id')): return cls(argval, marks=newmarks, id=None) @classmethod - def _for_parameterize(cls, argnames, argvalues, function): + def _for_parametrize(cls, argnames, argvalues, func, config): if not isinstance(argnames, (tuple, list)): argnames = [x.strip() for x in argnames.split(",") if x.strip()] force_tuple = len(argnames) == 1 @@ -78,252 +103,39 @@ class ParameterSet(namedtuple('ParameterSet', 'values, marks, id')): force_tuple = False parameters = [ ParameterSet.extract_from(x, legacy_force_tuple=force_tuple) - for x in argvalues] + for x in argvalues + ] del argvalues if not parameters: - fs, lineno = getfslineno(function) - reason = "got empty parameter set %r, function %s at %s:%d" % ( - argnames, function.__name__, fs, lineno) - mark = MARK_GEN.skip(reason=reason) - parameters.append(ParameterSet( - values=(NOTSET,) * len(argnames), - marks=[mark], - id=None, - )) + mark = get_empty_parameterset_mark(config, argnames, func) + parameters.append( + ParameterSet(values=(NOTSET,) * len(argnames), marks=[mark], id=None) + ) return argnames, parameters -class MarkerError(Exception): - - """Error in use of a pytest marker/attribute.""" - - -def param(*values, **kw): - return ParameterSet.param(*values, **kw) - - -def pytest_addoption(parser): - group = parser.getgroup("general") - group._addoption( - '-k', - action="store", dest="keyword", default='', metavar="EXPRESSION", - help="only run tests which match the given substring expression. " - "An expression is a python evaluatable expression " - "where all names are substring-matched against test names " - "and their parent classes. Example: -k 'test_method or test_" - "other' matches all test functions and classes whose name " - "contains 'test_method' or 'test_other', while -k 'not test_method' " - "matches those that don't contain 'test_method' in their names. " - "Additionally keywords are matched to classes and functions " - "containing extra names in their 'extra_keyword_matches' set, " - "as well as functions which have names assigned directly to them." - ) - - group._addoption( - "-m", - action="store", dest="markexpr", default="", metavar="MARKEXPR", - help="only run tests matching given mark expression. " - "example: -m 'mark1 and not mark2'." - ) - - group.addoption( - "--markers", action="store_true", - help="show markers (builtin, plugin and per-project ones)." - ) - - parser.addini("markers", "markers for test functions", 'linelist') - - -def pytest_cmdline_main(config): - import _pytest.config - if config.option.markers: - config._do_configure() - tw = _pytest.config.create_terminal_writer(config) - for line in config.getini("markers"): - parts = line.split(":", 1) - name = parts[0] - rest = parts[1] if len(parts) == 2 else '' - tw.write("@pytest.mark.%s:" % name, bold=True) - tw.line(rest) - tw.line() - config._ensure_unconfigure() - return 0 - - -pytest_cmdline_main.tryfirst = True - - -def pytest_collection_modifyitems(items, config): - keywordexpr = config.option.keyword.lstrip() - matchexpr = config.option.markexpr - if not keywordexpr and not matchexpr: - return - # pytest used to allow "-" for negating - # but today we just allow "-" at the beginning, use "not" instead - # we probably remove "-" altogether soon - if keywordexpr.startswith("-"): - keywordexpr = "not " + keywordexpr[1:] - selectuntil = False - if keywordexpr[-1:] == ":": - selectuntil = True - keywordexpr = keywordexpr[:-1] - - remaining = [] - deselected = [] - for colitem in items: - if keywordexpr and not matchkeyword(colitem, keywordexpr): - deselected.append(colitem) - else: - if selectuntil: - keywordexpr = None - if matchexpr: - if not matchmark(colitem, matchexpr): - deselected.append(colitem) - continue - remaining.append(colitem) - - if deselected: - config.hook.pytest_deselected(items=deselected) - items[:] = remaining - - -@attr.s -class MarkMapping(object): - """Provides a local mapping for markers where item access - resolves to True if the marker is present. """ - - own_mark_names = attr.ib() - - @classmethod - def from_keywords(cls, keywords): - mark_names = set() - for key, value in keywords.items(): - if isinstance(value, MarkInfo) or isinstance(value, MarkDecorator): - mark_names.add(key) - return cls(mark_names) - - def __getitem__(self, name): - return name in self.own_mark_names - - -class KeywordMapping(object): - """Provides a local mapping for keywords. - Given a list of names, map any substring of one of these names to True. - """ - - def __init__(self, names): - self._names = names - - def __getitem__(self, subname): - for name in self._names: - if subname in name: - return True - return False - - -def matchmark(colitem, markexpr): - """Tries to match on any marker names, attached to the given colitem.""" - return eval(markexpr, {}, MarkMapping.from_keywords(colitem.keywords)) - - -def matchkeyword(colitem, keywordexpr): - """Tries to match given keyword expression to given collector item. - - Will match on the name of colitem, including the names of its parents. - Only matches names of items which are either a :class:`Class` or a - :class:`Function`. - Additionally, matches on names in the 'extra_keyword_matches' set of - any item, as well as names directly assigned to test functions. - """ - mapped_names = set() - - # Add the names of the current item and any parent items - import pytest - for item in colitem.listchain(): - if not isinstance(item, pytest.Instance): - mapped_names.add(item.name) - - # Add the names added as extra keywords to current or parent items - for name in colitem.listextrakeywords(): - mapped_names.add(name) - - # Add the names attached to the current function through direct assignment - if hasattr(colitem, 'function'): - for name in colitem.function.__dict__: - mapped_names.add(name) - - mapping = KeywordMapping(mapped_names) - if " " not in keywordexpr: - # special case to allow for simple "-k pass" and "-k 1.3" - return mapping[keywordexpr] - elif keywordexpr.startswith("not ") and " " not in keywordexpr[4:]: - return not mapping[keywordexpr[4:]] - return eval(keywordexpr, {}, mapping) - - -def pytest_configure(config): - config._old_mark_config = MARK_GEN._config - if config.option.strict: - MARK_GEN._config = config - - -def pytest_unconfigure(config): - MARK_GEN._config = getattr(config, '_old_mark_config', None) - - -class MarkGenerator: - """ Factory for :class:`MarkDecorator` objects - exposed as - a ``pytest.mark`` singleton instance. Example:: - - import pytest - @pytest.mark.slowtest - def test_function(): - pass - - will set a 'slowtest' :class:`MarkInfo` object - on the ``test_function`` object. """ - _config = None - - def __getattr__(self, name): - if name[0] == "_": - raise AttributeError("Marker name must NOT start with underscore") - if self._config is not None: - self._check(name) - return MarkDecorator(Mark(name, (), {})) - - def _check(self, name): - try: - if name in self._markers: - return - except AttributeError: - pass - self._markers = values = set() - for line in self._config.getini("markers"): - marker = line.split(":", 1)[0] - marker = marker.rstrip() - x = marker.split("(", 1)[0] - values.add(x) - if name not in self._markers: - raise AttributeError("%r not a registered marker" % (name,)) - - -def istestfunc(func): - return hasattr(func, "__call__") and \ - getattr(func, "__name__", "") != "" - - @attr.s(frozen=True) class Mark(object): - name = attr.ib() - args = attr.ib() - kwargs = attr.ib() + #: name of the mark + name = attr.ib(type=str) + #: positional arguments of the mark decorator + args = attr.ib(type="List[object]") + #: keyword arguments of the mark decorator + kwargs = attr.ib(type="Dict[str, object]") def combined_with(self, other): + """ + :param other: the mark to combine with + :type other: Mark + :rtype: Mark + + combines by appending aargs and merging the mappings + """ assert self.name == other.name return Mark( - self.name, self.args + other.args, - dict(self.kwargs, **other.kwargs)) + self.name, self.args + other.args, dict(self.kwargs, **other.kwargs) + ) @attr.s @@ -363,9 +175,9 @@ class MarkDecorator(object): mark = attr.ib(validator=attr.validators.instance_of(Mark)) - name = alias('mark.name') - args = alias('mark.args') - kwargs = alias('mark.kwargs') + name = alias("mark.name") + args = alias("mark.args") + kwargs = alias("mark.kwargs") @property def markname(self): @@ -406,20 +218,17 @@ class MarkDecorator(object): def get_unpacked_marks(obj): """ - obtain the unpacked marks that are stored on a object + obtain the unpacked marks that are stored on an object """ - mark_list = getattr(obj, 'pytestmark', []) + mark_list = getattr(obj, "pytestmark", []) if not isinstance(mark_list, list): mark_list = [mark_list] - return [ - getattr(mark, 'mark', mark) # unpack MarkDecorator - for mark in mark_list - ] + return [getattr(mark, "mark", mark) for mark in mark_list] # unpack MarkDecorator def store_mark(obj, mark): - """store a Mark on a object + """store a Mark on an object this is used to implement the Mark declarations/decorators correctly """ assert isinstance(mark, Mark), mark @@ -435,52 +244,12 @@ def store_legacy_markinfo(func, mark): raise TypeError("got {mark!r} instead of a Mark".format(mark=mark)) holder = getattr(func, mark.name, None) if holder is None: - holder = MarkInfo(mark) + holder = MarkInfo.for_mark(mark) setattr(func, mark.name, holder) else: holder.add_mark(mark) -class MarkInfo(object): - """ Marking object created by :class:`MarkDecorator` instances. """ - - def __init__(self, mark): - assert isinstance(mark, Mark), repr(mark) - self.combined = mark - self._marks = [mark] - - name = alias('combined.name') - args = alias('combined.args') - kwargs = alias('combined.kwargs') - - def __repr__(self): - return "".format(self.combined) - - def add_mark(self, mark): - """ add a MarkInfo with the given args and kwargs. """ - self._marks.append(mark) - self.combined = self.combined.combined_with(mark) - - def __iter__(self): - """ yield MarkInfo objects each relating to a marking-call. """ - return map(MarkInfo, self._marks) - - -MARK_GEN = MarkGenerator() - - -def _marked(func, mark): - """ Returns True if :func: is already marked with :mark:, False otherwise. - This can happen if marker is applied to class and the test file is - invoked more than once. - """ - try: - func_mark = getattr(func, mark.name) - except AttributeError: - return False - return mark.args == func_mark.args and mark.kwargs == func_mark.kwargs - - def transfer_markers(funcobj, cls, mod): """ this function transfers class level markers and module level markers @@ -494,3 +263,166 @@ def transfer_markers(funcobj, cls, mod): for mark in get_unpacked_marks(obj): if not _marked(funcobj, mark): store_legacy_markinfo(funcobj, mark) + + +def _marked(func, mark): + """ Returns True if :func: is already marked with :mark:, False otherwise. + This can happen if marker is applied to class and the test file is + invoked more than once. + """ + try: + func_mark = getattr(func, getattr(mark, "combined", mark).name) + except AttributeError: + return False + return any(mark == info.combined for info in func_mark) + + +@attr.s +class MarkInfo(object): + """ Marking object created by :class:`MarkDecorator` instances. """ + + _marks = attr.ib(convert=list) + + @_marks.validator + def validate_marks(self, attribute, value): + for item in value: + if not isinstance(item, Mark): + raise ValueError( + "MarkInfo expects Mark instances, got {!r} ({!r})".format( + item, type(item) + ) + ) + + combined = attr.ib( + repr=False, + default=attr.Factory( + lambda self: reduce(Mark.combined_with, self._marks), takes_self=True + ), + ) + + name = alias("combined.name", warning=MARK_INFO_ATTRIBUTE) + args = alias("combined.args", warning=MARK_INFO_ATTRIBUTE) + kwargs = alias("combined.kwargs", warning=MARK_INFO_ATTRIBUTE) + + @classmethod + def for_mark(cls, mark): + return cls([mark]) + + def __repr__(self): + return "".format(self.combined) + + def add_mark(self, mark): + """ add a MarkInfo with the given args and kwargs. """ + self._marks.append(mark) + self.combined = self.combined.combined_with(mark) + + def __iter__(self): + """ yield MarkInfo objects each relating to a marking-call. """ + return map(MarkInfo.for_mark, self._marks) + + +class MarkGenerator(object): + """ Factory for :class:`MarkDecorator` objects - exposed as + a ``pytest.mark`` singleton instance. Example:: + + import pytest + @pytest.mark.slowtest + def test_function(): + pass + + will set a 'slowtest' :class:`MarkInfo` object + on the ``test_function`` object. """ + _config = None + + def __getattr__(self, name): + if name[0] == "_": + raise AttributeError("Marker name must NOT start with underscore") + if self._config is not None: + self._check(name) + return MarkDecorator(Mark(name, (), {})) + + def _check(self, name): + try: + if name in self._markers: + return + except AttributeError: + pass + self._markers = values = set() + for line in self._config.getini("markers"): + marker = line.split(":", 1)[0] + marker = marker.rstrip() + x = marker.split("(", 1)[0] + values.add(x) + if name not in self._markers: + raise AttributeError("%r not a registered marker" % (name,)) + + +MARK_GEN = MarkGenerator() + + +class NodeKeywords(MappingMixin): + + def __init__(self, node): + self.node = node + self.parent = node.parent + self._markers = {node.name: True} + + def __getitem__(self, key): + try: + return self._markers[key] + except KeyError: + if self.parent is None: + raise + return self.parent.keywords[key] + + def __setitem__(self, key, value): + self._markers[key] = value + + def __delitem__(self, key): + raise ValueError("cannot delete key in keywords dict") + + def __iter__(self): + seen = self._seen() + return iter(seen) + + def _seen(self): + seen = set(self._markers) + if self.parent is not None: + seen.update(self.parent.keywords) + return seen + + def __len__(self): + return len(self._seen()) + + def __repr__(self): + return "" % (self.node,) + + +@attr.s(cmp=False, hash=False) +class NodeMarkers(object): + """ + internal strucutre for storing marks belongong to a node + + ..warning:: + + unstable api + + """ + own_markers = attr.ib(default=attr.Factory(list)) + + def update(self, add_markers): + """update the own markers + """ + self.own_markers.extend(add_markers) + + def find(self, name): + """ + find markers in own nodes or parent nodes + needs a better place + """ + for mark in self.own_markers: + if mark.name == name: + yield mark + + def __iter__(self): + return iter(self.own_markers) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/monkeypatch.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/monkeypatch.py similarity index 83% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/monkeypatch.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/monkeypatch.py index 40ae560f070..16080b5d5cb 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/monkeypatch.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/monkeypatch.py @@ -4,6 +4,8 @@ from __future__ import absolute_import, division, print_function import os import sys import re +from contextlib import contextmanager + import six from _pytest.fixtures import fixture @@ -36,12 +38,12 @@ def monkeypatch(): def resolve(name): # simplified from zope.dottedname - parts = name.split('.') + parts = name.split(".") used = parts.pop(0) found = __import__(used) for part in parts: - used += '.' + part + used += "." + part try: found = getattr(found, part) except AttributeError: @@ -58,9 +60,7 @@ def resolve(name): if expected == used: raise else: - raise ImportError( - 'import error in %s: %s' % (used, ex) - ) + raise ImportError("import error in %s: %s" % (used, ex)) found = annotated_getattr(found, part, used) return found @@ -70,25 +70,23 @@ def annotated_getattr(obj, name, ann): obj = getattr(obj, name) except AttributeError: raise AttributeError( - '%r object at %s has no attribute %r' % ( - type(obj).__name__, ann, name - ) + "%r object at %s has no attribute %r" % (type(obj).__name__, ann, name) ) return obj def derive_importpath(import_path, raising): if not isinstance(import_path, six.string_types) or "." not in import_path: - raise TypeError("must be absolute import path string, not %r" % - (import_path,)) - module, attr = import_path.rsplit('.', 1) + raise TypeError("must be absolute import path string, not %r" % (import_path,)) + module, attr = import_path.rsplit(".", 1) target = resolve(module) if raising: annotated_getattr(target, attr, ann=module) return attr, target -class Notset: +class Notset(object): + def __repr__(self): return "" @@ -96,7 +94,7 @@ class Notset: notset = Notset() -class MonkeyPatch: +class MonkeyPatch(object): """ Object returned by the ``monkeypatch`` fixture keeping a record of setattr/item/env/syspath changes. """ @@ -106,6 +104,29 @@ class MonkeyPatch: self._cwd = None self._savesyspath = None + @contextmanager + def context(self): + """ + Context manager that returns a new :class:`MonkeyPatch` object which + undoes any patching done inside the ``with`` block upon exit: + + .. code-block:: python + + import functools + def test_partial(monkeypatch): + with monkeypatch.context() as m: + m.setattr(functools, "partial", 3) + + Useful in situations where it is desired to undo some patches before the test ends, + such as mocking ``stdlib`` functions that might break pytest itself if mocked (for examples + of this see `#3290 `_. + """ + m = MonkeyPatch() + try: + yield m + finally: + m.undo() + def setattr(self, target, name, value=notset, raising=True): """ Set attribute value on target, memorizing the old value. By default raise AttributeError if the attribute did not exist. @@ -113,7 +134,7 @@ class MonkeyPatch: For convenience you can specify a string as ``target`` which will be interpreted as a dotted import path, with the last part being the attribute name. Example: - ``monkeypatch.setattr("os.getcwd", lambda x: "/")`` + ``monkeypatch.setattr("os.getcwd", lambda: "/")`` would set the ``getcwd`` function of the ``os`` module. The ``raising`` value determines if the setattr should fail @@ -125,9 +146,11 @@ class MonkeyPatch: if value is notset: if not isinstance(target, six.string_types): - raise TypeError("use setattr(target, name, value) or " - "setattr(target, value) with target being a dotted " - "import string") + raise TypeError( + "use setattr(target, name, value) or " + "setattr(target, value) with target being a dotted " + "import string" + ) value = name name, target = derive_importpath(target, raising) @@ -155,9 +178,11 @@ class MonkeyPatch: __tracebackhide__ = True if name is notset: if not isinstance(target, six.string_types): - raise TypeError("use delattr(target, name) or " - "delattr(target) with target being a dotted " - "import string") + raise TypeError( + "use delattr(target, name) or " + "delattr(target) with target being a dotted " + "import string" + ) name, target = derive_importpath(target, raising) if not hasattr(target, name): diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/nodes.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/nodes.py new file mode 100644 index 00000000000..ef74c53eba4 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/nodes.py @@ -0,0 +1,419 @@ +from __future__ import absolute_import, division, print_function +import os + +import six +import py +import attr + +import _pytest +import _pytest._code + +from _pytest.mark.structures import NodeKeywords, MarkInfo + +SEP = "/" + +tracebackcutdir = py.path.local(_pytest.__file__).dirpath() + + +def _splitnode(nodeid): + """Split a nodeid into constituent 'parts'. + + Node IDs are strings, and can be things like: + '' + 'testing/code' + 'testing/code/test_excinfo.py' + 'testing/code/test_excinfo.py::TestFormattedExcinfo::()' + + Return values are lists e.g. + [] + ['testing', 'code'] + ['testing', 'code', 'test_excinfo.py'] + ['testing', 'code', 'test_excinfo.py', 'TestFormattedExcinfo', '()'] + """ + if nodeid == "": + # If there is no root node at all, return an empty list so the caller's logic can remain sane + return [] + parts = nodeid.split(SEP) + # Replace single last element 'test_foo.py::Bar::()' with multiple elements 'test_foo.py', 'Bar', '()' + parts[-1:] = parts[-1].split("::") + return parts + + +def ischildnode(baseid, nodeid): + """Return True if the nodeid is a child node of the baseid. + + E.g. 'foo/bar::Baz::()' is a child of 'foo', 'foo/bar' and 'foo/bar::Baz', but not of 'foo/blorp' + """ + base_parts = _splitnode(baseid) + node_parts = _splitnode(nodeid) + if len(node_parts) < len(base_parts): + return False + return node_parts[:len(base_parts)] == base_parts + + +@attr.s +class _CompatProperty(object): + name = attr.ib() + + def __get__(self, obj, owner): + if obj is None: + return self + + # TODO: reenable in the features branch + # warnings.warn( + # "usage of {owner!r}.{name} is deprecated, please use pytest.{name} instead".format( + # name=self.name, owner=type(owner).__name__), + # PendingDeprecationWarning, stacklevel=2) + return getattr(__import__("pytest"), self.name) + + +class Node(object): + """ base class for Collector and Item the test collection tree. + Collector subclasses have children, Items are terminal nodes.""" + + def __init__( + self, name, parent=None, config=None, session=None, fspath=None, nodeid=None + ): + #: a unique name within the scope of the parent node + self.name = name + + #: the parent collector node. + self.parent = parent + + #: the pytest config object + self.config = config or parent.config + + #: the session this node is part of + self.session = session or parent.session + + #: filesystem path where this node was collected from (can be None) + self.fspath = fspath or getattr(parent, "fspath", None) + + #: keywords/markers collected from all scopes + self.keywords = NodeKeywords(self) + + #: the marker objects belonging to this node + self.own_markers = [] + + #: allow adding of extra keywords to use for matching + self.extra_keyword_matches = set() + + # used for storing artificial fixturedefs for direct parametrization + self._name2pseudofixturedef = {} + + if nodeid is not None: + self._nodeid = nodeid + else: + assert parent is not None + self._nodeid = self.parent.nodeid + "::" + self.name + + @property + def ihook(self): + """ fspath sensitive hook proxy used to call pytest hooks""" + return self.session.gethookproxy(self.fspath) + + Module = _CompatProperty("Module") + Class = _CompatProperty("Class") + Instance = _CompatProperty("Instance") + Function = _CompatProperty("Function") + File = _CompatProperty("File") + Item = _CompatProperty("Item") + + def _getcustomclass(self, name): + maybe_compatprop = getattr(type(self), name) + if isinstance(maybe_compatprop, _CompatProperty): + return getattr(__import__("pytest"), name) + else: + cls = getattr(self, name) + # TODO: reenable in the features branch + # warnings.warn("use of node.%s is deprecated, " + # "use pytest_pycollect_makeitem(...) to create custom " + # "collection nodes" % name, category=DeprecationWarning) + return cls + + def __repr__(self): + return "<%s %r>" % (self.__class__.__name__, getattr(self, "name", None)) + + def warn(self, code, message): + """ generate a warning with the given code and message for this + item. """ + assert isinstance(code, str) + fslocation = getattr(self, "location", None) + if fslocation is None: + fslocation = getattr(self, "fspath", None) + self.ihook.pytest_logwarning.call_historic( + kwargs=dict( + code=code, message=message, nodeid=self.nodeid, fslocation=fslocation + ) + ) + + # methods for ordering nodes + @property + def nodeid(self): + """ a ::-separated string denoting its collection tree address. """ + return self._nodeid + + def __hash__(self): + return hash(self.nodeid) + + def setup(self): + pass + + def teardown(self): + pass + + def listchain(self): + """ return list of all parent collectors up to self, + starting from root of collection tree. """ + chain = [] + item = self + while item is not None: + chain.append(item) + item = item.parent + chain.reverse() + return chain + + def add_marker(self, marker): + """dynamically add a marker object to the node. + + :type marker: str or pytest.mark.* + """ + from _pytest.mark import MarkDecorator, MARK_GEN + + if isinstance(marker, six.string_types): + marker = getattr(MARK_GEN, marker) + elif not isinstance(marker, MarkDecorator): + raise ValueError("is not a string or pytest.mark.* Marker") + self.keywords[marker.name] = marker + self.own_markers.append(marker.mark) + + def iter_markers(self, name=None): + """ + :param name: if given, filter the results by the name attribute + + iterate over all markers of the node + """ + return (x[1] for x in self.iter_markers_with_node(name=name)) + + def iter_markers_with_node(self, name=None): + """ + :param name: if given, filter the results by the name attribute + + iterate over all markers of the node + returns sequence of tuples (node, mark) + """ + for node in reversed(self.listchain()): + for mark in node.own_markers: + if name is None or getattr(mark, "name", None) == name: + yield node, mark + + def get_closest_marker(self, name, default=None): + """return the first marker matching the name, from closest (for example function) to farther level (for example + module level). + + :param default: fallback return value of no marker was found + :param name: name to filter by + """ + return next(self.iter_markers(name=name), default) + + def get_marker(self, name): + """ get a marker object from this node or None if + the node doesn't have a marker with that name. + + .. deprecated:: 3.6 + This function has been deprecated in favor of + :meth:`Node.get_closest_marker <_pytest.nodes.Node.get_closest_marker>` and + :meth:`Node.iter_markers <_pytest.nodes.Node.iter_markers>`, see :ref:`update marker code` + for more details. + """ + markers = list(self.iter_markers(name=name)) + if markers: + return MarkInfo(markers) + + def listextrakeywords(self): + """ Return a set of all extra keywords in self and any parents.""" + extra_keywords = set() + for item in self.listchain(): + extra_keywords.update(item.extra_keyword_matches) + return extra_keywords + + def listnames(self): + return [x.name for x in self.listchain()] + + def addfinalizer(self, fin): + """ register a function to be called when this node is finalized. + + This method can only be called when this node is active + in a setup chain, for example during self.setup(). + """ + self.session._setupstate.addfinalizer(fin, self) + + def getparent(self, cls): + """ get the next parent node (including ourself) + which is an instance of the given class""" + current = self + while current and not isinstance(current, cls): + current = current.parent + return current + + def _prunetraceback(self, excinfo): + pass + + def _repr_failure_py(self, excinfo, style=None): + fm = self.session._fixturemanager + if excinfo.errisinstance(fm.FixtureLookupError): + return excinfo.value.formatrepr() + tbfilter = True + if self.config.option.fulltrace: + style = "long" + else: + tb = _pytest._code.Traceback([excinfo.traceback[-1]]) + self._prunetraceback(excinfo) + if len(excinfo.traceback) == 0: + excinfo.traceback = tb + tbfilter = False # prunetraceback already does it + if style == "auto": + style = "long" + # XXX should excinfo.getrepr record all data and toterminal() process it? + if style is None: + if self.config.option.tbstyle == "short": + style = "short" + else: + style = "long" + + try: + os.getcwd() + abspath = False + except OSError: + abspath = True + + return excinfo.getrepr( + funcargs=True, + abspath=abspath, + showlocals=self.config.option.showlocals, + style=style, + tbfilter=tbfilter, + ) + + repr_failure = _repr_failure_py + + +class Collector(Node): + """ Collector instances create children through collect() + and thus iteratively build a tree. + """ + + class CollectError(Exception): + """ an error during collection, contains a custom message. """ + + def collect(self): + """ returns a list of children (items and collectors) + for this collection node. + """ + raise NotImplementedError("abstract") + + def repr_failure(self, excinfo): + """ represent a collection failure. """ + if excinfo.errisinstance(self.CollectError): + exc = excinfo.value + return str(exc.args[0]) + return self._repr_failure_py(excinfo, style="short") + + def _prunetraceback(self, excinfo): + if hasattr(self, "fspath"): + traceback = excinfo.traceback + ntraceback = traceback.cut(path=self.fspath) + if ntraceback == traceback: + ntraceback = ntraceback.cut(excludepath=tracebackcutdir) + excinfo.traceback = ntraceback.filter() + + +def _check_initialpaths_for_relpath(session, fspath): + for initial_path in session._initialpaths: + if fspath.common(initial_path) == initial_path: + return fspath.relto(initial_path.dirname) + + +class FSCollector(Collector): + + def __init__(self, fspath, parent=None, config=None, session=None, nodeid=None): + fspath = py.path.local(fspath) # xxx only for test_resultlog.py? + name = fspath.basename + if parent is not None: + rel = fspath.relto(parent.fspath) + if rel: + name = rel + name = name.replace(os.sep, SEP) + self.fspath = fspath + + session = session or parent.session + + if nodeid is None: + nodeid = self.fspath.relto(session.config.rootdir) + + if not nodeid: + nodeid = _check_initialpaths_for_relpath(session, fspath) + if os.sep != SEP: + nodeid = nodeid.replace(os.sep, SEP) + + super(FSCollector, self).__init__( + name, parent, config, session, nodeid=nodeid, fspath=fspath + ) + + +class File(FSCollector): + """ base class for collecting tests from a file. """ + + +class Item(Node): + """ a basic test invocation item. Note that for a single function + there might be multiple test invocation items. + """ + nextitem = None + + def __init__(self, name, parent=None, config=None, session=None, nodeid=None): + super(Item, self).__init__(name, parent, config, session, nodeid=nodeid) + self._report_sections = [] + + #: user properties is a list of tuples (name, value) that holds user + #: defined properties for this test. + self.user_properties = [] + + def add_report_section(self, when, key, content): + """ + Adds a new report section, similar to what's done internally to add stdout and + stderr captured output:: + + item.add_report_section("call", "stdout", "report section contents") + + :param str when: + One of the possible capture states, ``"setup"``, ``"call"``, ``"teardown"``. + :param str key: + Name of the section, can be customized at will. Pytest uses ``"stdout"`` and + ``"stderr"`` internally. + + :param str content: + The full contents as a string. + """ + if content: + self._report_sections.append((when, key, content)) + + def reportinfo(self): + return self.fspath, None, "" + + @property + def location(self): + try: + return self._location + except AttributeError: + location = self.reportinfo() + # bestrelpath is a quite slow function + cache = self.config.__dict__.setdefault("_bestrelpathcache", {}) + try: + fspath = cache[location[0]] + except KeyError: + fspath = self.session.fspath.bestrelpath(location[0]) + cache[location[0]] = fspath + location = (fspath, location[1], str(location[2])) + self._location = location + return location diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/nose.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/nose.py similarity index 72% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/nose.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/nose.py index c81542eadf3..bb2e4277d1c 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/nose.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/nose.py @@ -9,9 +9,9 @@ from _pytest.config import hookimpl def get_skip_exceptions(): skip_classes = set() - for module_name in ('unittest', 'unittest2', 'nose'): + for module_name in ("unittest", "unittest2", "nose"): mod = sys.modules.get(module_name) - if hasattr(mod, 'SkipTest'): + if hasattr(mod, "SkipTest"): skip_classes.add(mod.SkipTest) return tuple(skip_classes) @@ -19,8 +19,7 @@ def get_skip_exceptions(): def pytest_runtest_makereport(item, call): if call.excinfo and call.excinfo.errisinstance(get_skip_exceptions()): # let's substitute the excinfo with a pytest.skip one - call2 = call.__class__( - lambda: runner.skip(str(call.excinfo.value)), call.when) + call2 = call.__class__(lambda: runner.skip(str(call.excinfo.value)), call.when) call.excinfo = call2.excinfo @@ -29,22 +28,22 @@ def pytest_runtest_setup(item): if is_potential_nosetest(item): if isinstance(item.parent, python.Generator): gen = item.parent - if not hasattr(gen, '_nosegensetup'): - call_optional(gen.obj, 'setup') + if not hasattr(gen, "_nosegensetup"): + call_optional(gen.obj, "setup") if isinstance(gen.parent, python.Instance): - call_optional(gen.parent.obj, 'setup') + call_optional(gen.parent.obj, "setup") gen._nosegensetup = True - if not call_optional(item.obj, 'setup'): + if not call_optional(item.obj, "setup"): # call module level setup if there is no object level one - call_optional(item.parent.obj, 'setup') + call_optional(item.parent.obj, "setup") # XXX this implies we only call teardown when setup worked item.session._setupstate.addfinalizer((lambda: teardown_nose(item)), item) def teardown_nose(item): if is_potential_nosetest(item): - if not call_optional(item.obj, 'teardown'): - call_optional(item.parent.obj, 'teardown') + if not call_optional(item.obj, "teardown"): + call_optional(item.parent.obj, "teardown") # if hasattr(item.parent, '_nosegensetup'): # #call_optional(item._nosegensetup, 'teardown') # del item.parent._nosegensetup @@ -52,14 +51,15 @@ def teardown_nose(item): def pytest_make_collect_report(collector): if isinstance(collector, python.Generator): - call_optional(collector.obj, 'setup') + call_optional(collector.obj, "setup") def is_potential_nosetest(item): # extra check needed since we do not do nose style setup/teardown # on direct unittest style classes - return isinstance(item, python.Function) and \ - not isinstance(item, unittest.TestCaseFunction) + return isinstance(item, python.Function) and not isinstance( + item, unittest.TestCaseFunction + ) def call_optional(obj, name): diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/outcomes.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/outcomes.py similarity index 81% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/outcomes.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/outcomes.py index 7f0c18fa6c1..8a3662e1b3e 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/outcomes.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/outcomes.py @@ -11,6 +11,7 @@ class OutcomeException(BaseException): """ OutcomeException and its subclass instances indicate and contain info about test and collection outcomes. """ + def __init__(self, msg=None, pytrace=True): BaseException.__init__(self, msg) self.msg = msg @@ -20,9 +21,10 @@ class OutcomeException(BaseException): if self.msg: val = self.msg if isinstance(val, bytes): - val = py._builtin._totext(val, errors='replace') + val = py._builtin._totext(val, errors="replace") return val return "<%s instance>" % (self.__class__.__name__,) + __str__ = __repr__ @@ -32,7 +34,7 @@ TEST_OUTCOME = (OutcomeException, Exception) class Skipped(OutcomeException): # XXX hackish: on 3k we fake to live in the builtins # in order to have Skipped exception printing shorter/nicer - __module__ = 'builtins' + __module__ = "builtins" def __init__(self, msg=None, pytrace=True, allow_module_level=False): OutcomeException.__init__(self, msg=msg, pytrace=pytrace) @@ -41,15 +43,17 @@ class Skipped(OutcomeException): class Failed(OutcomeException): """ raised from an explicit call to pytest.fail() """ - __module__ = 'builtins' + __module__ = "builtins" class Exit(KeyboardInterrupt): """ raised for immediate program exits (no tracebacks/summaries)""" + def __init__(self, msg="unknown reason"): self.msg = msg KeyboardInterrupt.__init__(self, msg) + # exposed helper methods @@ -72,10 +76,10 @@ def skip(msg="", **kwargs): module level, skipping the rest of the module. Default to False. """ __tracebackhide__ = True - allow_module_level = kwargs.pop('allow_module_level', False) + allow_module_level = kwargs.pop("allow_module_level", False) if kwargs: keys = [k for k in kwargs.keys()] - raise TypeError('unexpected keyword arguments: {0}'.format(keys)) + raise TypeError("unexpected keyword arguments: {}".format(keys)) raise Skipped(msg=msg, allow_module_level=allow_module_level) @@ -83,7 +87,7 @@ skip.Exception = Skipped def fail(msg="", pytrace=True): - """ explicitly fail an currently-executing test with the given Message. + """ explicitly fail a currently-executing test with the given Message. :arg pytrace: if false the msg represents the full failure information and no python traceback will be reported. @@ -114,15 +118,16 @@ def importorskip(modname, minversion=None): is only triggered if the module can not be imported. """ import warnings + __tracebackhide__ = True - compile(modname, '', 'eval') # to catch syntaxerrors + compile(modname, "", "eval") # to catch syntaxerrors should_skip = False with warnings.catch_warnings(): # make sure to ignore ImportWarnings that might happen because # of existing directories with the same name we're trying to # import but without a __init__.py file - warnings.simplefilter('ignore') + warnings.simplefilter("ignore") try: __import__(modname) except ImportError: @@ -133,15 +138,20 @@ def importorskip(modname, minversion=None): mod = sys.modules[modname] if minversion is None: return mod - verattr = getattr(mod, '__version__', None) + verattr = getattr(mod, "__version__", None) if minversion is not None: try: from pkg_resources import parse_version as pv except ImportError: - raise Skipped("we have a required version for %r but can not import " - "pkg_resources to parse version strings." % (modname,), - allow_module_level=True) + raise Skipped( + "we have a required version for %r but can not import " + "pkg_resources to parse version strings." % (modname,), + allow_module_level=True, + ) if verattr is None or pv(verattr) < pv(minversion): - raise Skipped("module %r has __version__ %r, required is: %r" % ( - modname, verattr, minversion), allow_module_level=True) + raise Skipped( + "module %r has __version__ %r, required is: %r" + % (modname, verattr, minversion), + allow_module_level=True, + ) return mod diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/pastebin.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/pastebin.py similarity index 68% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/pastebin.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/pastebin.py index b588b021b12..6af202d1f0a 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/pastebin.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/pastebin.py @@ -9,43 +9,48 @@ import tempfile def pytest_addoption(parser): group = parser.getgroup("terminal reporting") - group._addoption('--pastebin', metavar="mode", - action='store', dest="pastebin", default=None, - choices=['failed', 'all'], - help="send failed|all info to bpaste.net pastebin service.") + group._addoption( + "--pastebin", + metavar="mode", + action="store", + dest="pastebin", + default=None, + choices=["failed", "all"], + help="send failed|all info to bpaste.net pastebin service.", + ) @pytest.hookimpl(trylast=True) def pytest_configure(config): if config.option.pastebin == "all": - tr = config.pluginmanager.getplugin('terminalreporter') + tr = config.pluginmanager.getplugin("terminalreporter") # if no terminal reporter plugin is present, nothing we can do here; # this can happen when this function executes in a slave node # when using pytest-xdist, for example if tr is not None: # pastebin file will be utf-8 encoded binary file - config._pastebinfile = tempfile.TemporaryFile('w+b') + config._pastebinfile = tempfile.TemporaryFile("w+b") oldwrite = tr._tw.write def tee_write(s, **kwargs): oldwrite(s, **kwargs) if isinstance(s, six.text_type): - s = s.encode('utf-8') + s = s.encode("utf-8") config._pastebinfile.write(s) tr._tw.write = tee_write def pytest_unconfigure(config): - if hasattr(config, '_pastebinfile'): + if hasattr(config, "_pastebinfile"): # get terminal contents and delete file config._pastebinfile.seek(0) sessionlog = config._pastebinfile.read() config._pastebinfile.close() del config._pastebinfile # undo our patching in the terminal reporter - tr = config.pluginmanager.getplugin('terminalreporter') - del tr._tw.__dict__['write'] + tr = config.pluginmanager.getplugin("terminalreporter") + del tr._tw.__dict__["write"] # write summary tr.write_sep("=", "Sending information to Paste Service") pastebinurl = create_new_paste(sessionlog) @@ -60,6 +65,7 @@ def create_new_paste(contents): :returns: url to the pasted contents """ import re + if sys.version_info < (3, 0): from urllib import urlopen, urlencode else: @@ -67,32 +73,35 @@ def create_new_paste(contents): from urllib.parse import urlencode params = { - 'code': contents, - 'lexer': 'python3' if sys.version_info[0] == 3 else 'python', - 'expiry': '1week', + "code": contents, + "lexer": "python3" if sys.version_info[0] == 3 else "python", + "expiry": "1week", } - url = 'https://bpaste.net' - response = urlopen(url, data=urlencode(params).encode('ascii')).read() - m = re.search(r'href="/raw/(\w+)"', response.decode('utf-8')) + url = "https://bpaste.net" + response = urlopen(url, data=urlencode(params).encode("ascii")).read() + m = re.search(r'href="/raw/(\w+)"', response.decode("utf-8")) if m: - return '%s/show/%s' % (url, m.group(1)) + return "%s/show/%s" % (url, m.group(1)) else: - return 'bad response: ' + response + return "bad response: " + response def pytest_terminal_summary(terminalreporter): import _pytest.config + if terminalreporter.config.option.pastebin != "failed": return tr = terminalreporter - if 'failed' in tr.stats: + if "failed" in tr.stats: terminalreporter.write_sep("=", "Sending information to Paste Service") - for rep in terminalreporter.stats.get('failed'): + for rep in terminalreporter.stats.get("failed"): try: msg = rep.longrepr.reprtraceback.reprentries[-1].reprfileloc except AttributeError: msg = tr._getfailureheadline(rep) - tw = _pytest.config.create_terminal_writer(terminalreporter.config, stringio=True) + tw = _pytest.config.create_terminal_writer( + terminalreporter.config, stringio=True + ) rep.toterminal(tw) s = tw.stringio.getvalue() assert len(s) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/pytester.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/pytester.py similarity index 65% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/pytester.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/pytester.py index f2dd5994f1b..c9defe03a66 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/pytester.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/pytester.py @@ -1,4 +1,4 @@ -""" (disabled by default) support for testing pytest and pytest plugins. """ +"""(disabled by default) support for testing pytest and pytest plugins.""" from __future__ import absolute_import, division, print_function import codecs @@ -23,19 +23,35 @@ from _pytest.main import Session, EXIT_OK from _pytest.assertion.rewrite import AssertionRewritingHook -PYTEST_FULLPATH = os.path.abspath(pytest.__file__.rstrip("oc")).replace("$py.class", ".py") +PYTEST_FULLPATH = os.path.abspath(pytest.__file__.rstrip("oc")).replace( + "$py.class", ".py" +) + + +IGNORE_PAM = [ # filenames added when obtaining details about the current user + u"/var/lib/sss/mc/passwd" +] def pytest_addoption(parser): - # group = parser.getgroup("pytester", "pytester (self-tests) options") - parser.addoption('--lsof', - action="store_true", dest="lsof", default=False, - help=("run FD checks if lsof is available")) + parser.addoption( + "--lsof", + action="store_true", + dest="lsof", + default=False, + help=("run FD checks if lsof is available"), + ) - parser.addoption('--runpytest', default="inprocess", dest="runpytest", - choices=("inprocess", "subprocess", ), - help=("run pytest sub runs in tests using an 'inprocess' " - "or 'subprocess' (python -m main) method")) + parser.addoption( + "--runpytest", + default="inprocess", + dest="runpytest", + choices=("inprocess", "subprocess"), + help=( + "run pytest sub runs in tests using an 'inprocess' " + "or 'subprocess' (python -m main) method" + ), + ) def pytest_configure(config): @@ -46,6 +62,7 @@ def pytest_configure(config): class LsofFdLeakChecker(object): + def get_open_files(self): out = self._exec_lsof() open_files = self._parse_lsof_output(out) @@ -56,18 +73,25 @@ class LsofFdLeakChecker(object): return py.process.cmdexec("lsof -Ffn0 -p %d" % pid) def _parse_lsof_output(self, out): + def isopen(line): - return line.startswith('f') and ("deleted" not in line and - 'mem' not in line and "txt" not in line and 'cwd' not in line) + return line.startswith("f") and ( + "deleted" not in line + and "mem" not in line + and "txt" not in line + and "cwd" not in line + ) open_files = [] for line in out.split("\n"): if isopen(line): - fields = line.split('\0') + fields = line.split("\0") fd = fields[0][1:] filename = fields[1][1:] - if filename.startswith('/'): + if filename in IGNORE_PAM: + continue + if filename.startswith("/"): open_files.append((fd, filename)) return open_files @@ -76,8 +100,8 @@ class LsofFdLeakChecker(object): try: py.process.cmdexec("lsof -v") except (py.process.cmdexec.Error, UnicodeDecodeError): - # cmdexec may raise UnicodeDecodeError on Windows systems - # with locale other than english: + # cmdexec may raise UnicodeDecodeError on Windows systems with + # locale other than English: # https://bitbucket.org/pytest-dev/py/issues/66 return False else: @@ -91,7 +115,7 @@ class LsofFdLeakChecker(object): gc.collect() lines2 = self.get_open_files() - new_fds = set([t[0] for t in lines2]) - set([t[0] for t in lines1]) + new_fds = {t[0] for t in lines2} - {t[0] for t in lines1} leaked_files = [t for t in lines2 if t[0] in new_fds] if leaked_files: error = [] @@ -104,15 +128,15 @@ class LsofFdLeakChecker(object): error.append(error[0]) error.append("*** function %s:%s: %s " % item.location) error.append("See issue #2366") - item.warn('', "\n".join(error)) + item.warn("", "\n".join(error)) # XXX copied from execnet's conftest.py - needs to be merged winpymap = { - 'python2.7': r'C:\Python27\python.exe', - 'python3.4': r'C:\Python34\python.exe', - 'python3.5': r'C:\Python35\python.exe', - 'python3.6': r'C:\Python36\python.exe', + "python2.7": r"C:\Python27\python.exe", + "python3.4": r"C:\Python34\python.exe", + "python3.5": r"C:\Python35\python.exe", + "python3.6": r"C:\Python36\python.exe", } @@ -123,8 +147,12 @@ def getexecutable(name, cache={}): executable = py.path.local.sysfind(name) if executable: import subprocess - popen = subprocess.Popen([str(executable), "--version"], - universal_newlines=True, stderr=subprocess.PIPE) + + popen = subprocess.Popen( + [str(executable), "--version"], + universal_newlines=True, + stderr=subprocess.PIPE, + ) out, err = popen.communicate() if name == "jython": if not err or "2.5" not in err: @@ -132,13 +160,13 @@ def getexecutable(name, cache={}): if "2.5.2" in err: executable = None # http://bugs.jython.org/issue1790 elif popen.returncode != 0: - # Handle pyenv's 127. + # handle pyenv's 127 executable = None cache[name] = executable return executable -@pytest.fixture(params=['python2.7', 'python3.4', 'pypy', 'pypy3']) +@pytest.fixture(params=["python2.7", "python3.4", "pypy", "pypy3"]) def anypython(request): name = request.param executable = getexecutable(name) @@ -152,19 +180,22 @@ def anypython(request): pytest.skip("no suitable %s found" % (name,)) return executable + # used at least by pytest-xdist plugin @pytest.fixture def _pytest(request): - """ Return a helper which offers a gethookrecorder(hook) - method which returns a HookRecorder instance which helps - to make assertions about called hooks. + """Return a helper which offers a gethookrecorder(hook) method which + returns a HookRecorder instance which helps to make assertions about called + hooks. + """ return PytestArg(request) -class PytestArg: +class PytestArg(object): + def __init__(self, request): self.request = request @@ -179,22 +210,23 @@ def get_public_names(values): return [x for x in values if x[0] != "_"] -class ParsedCall: +class ParsedCall(object): + def __init__(self, name, kwargs): self.__dict__.update(kwargs) self._name = name def __repr__(self): d = self.__dict__.copy() - del d['_name'] + del d["_name"] return "" % (self._name, d) -class HookRecorder: +class HookRecorder(object): """Record all hooks called in a plugin manager. - This wraps all the hook calls in the plugin manager, recording - each call before propagating the normal calls. + This wraps all the hook calls in the plugin manager, recording each call + before propagating the normal calls. """ @@ -256,13 +288,16 @@ class HookRecorder: # functionality for test reports - def getreports(self, - names="pytest_runtest_logreport pytest_collectreport"): + def getreports(self, names="pytest_runtest_logreport pytest_collectreport"): return [x.report for x in self.getcalls(names)] - def matchreport(self, inamepart="", - names="pytest_runtest_logreport pytest_collectreport", when=None): - """ return a testreport whose dotted import path matches """ + def matchreport( + self, + inamepart="", + names="pytest_runtest_logreport pytest_collectreport", + when=None, + ): + """return a testreport whose dotted import path matches""" values = [] for rep in self.getreports(names=names): try: @@ -271,31 +306,32 @@ class HookRecorder: continue except AttributeError: pass - if when and getattr(rep, 'when', None) != when: + if when and getattr(rep, "when", None) != when: continue if not inamepart or inamepart in rep.nodeid.split("::"): values.append(rep) if not values: - raise ValueError("could not find test report matching %r: " - "no test reports at all!" % (inamepart,)) + raise ValueError( + "could not find test report matching %r: " + "no test reports at all!" % (inamepart,) + ) if len(values) > 1: raise ValueError( - "found 2 or more testreports matching %r: %s" % (inamepart, values)) + "found 2 or more testreports matching %r: %s" % (inamepart, values) + ) return values[0] - def getfailures(self, - names='pytest_runtest_logreport pytest_collectreport'): + def getfailures(self, names="pytest_runtest_logreport pytest_collectreport"): return [rep for rep in self.getreports(names) if rep.failed] def getfailedcollections(self): - return self.getfailures('pytest_collectreport') + return self.getfailures("pytest_collectreport") def listoutcomes(self): passed = [] skipped = [] failed = [] - for rep in self.getreports( - "pytest_collectreport pytest_runtest_logreport"): + for rep in self.getreports("pytest_collectreport pytest_runtest_logreport"): if rep.passed: if getattr(rep, "when", None) == "call": passed.append(rep) @@ -323,7 +359,7 @@ def linecomp(request): return LineComp() -@pytest.fixture(name='LineMatcher') +@pytest.fixture(name="LineMatcher") def LineMatcher_fixture(request): return LineMatcher @@ -336,19 +372,19 @@ def testdir(request, tmpdir_factory): rex_outcome = re.compile(r"(\d+) ([\w-]+)") -class RunResult: +class RunResult(object): """The result of running a command. Attributes: - :ret: The return value. - :outlines: List of lines captured from stdout. - :errlines: List of lines captures from stderr. + :ret: the return value + :outlines: list of lines captured from stdout + :errlines: list of lines captures from stderr :stdout: :py:class:`LineMatcher` of stdout, use ``stdout.str()`` to - reconstruct stdout or the commonly used - ``stdout.fnmatch_lines()`` method. - :stderrr: :py:class:`LineMatcher` of stderr. - :duration: Duration in seconds. + reconstruct stdout or the commonly used ``stdout.fnmatch_lines()`` + method + :stderr: :py:class:`LineMatcher` of stderr + :duration: duration in seconds """ @@ -361,10 +397,12 @@ class RunResult: self.duration = duration def parseoutcomes(self): - """ Return a dictionary of outcomestring->num from parsing - the terminal output that the test process produced.""" + """Return a dictionary of outcomestring->num from parsing the terminal + output that the test process produced. + + """ for line in reversed(self.outlines): - if 'seconds' in line: + if "seconds" in line: outcomes = rex_outcome.findall(line) if outcomes: d = {} @@ -374,36 +412,70 @@ class RunResult: raise ValueError("Pytest terminal report not found") def assert_outcomes(self, passed=0, skipped=0, failed=0, error=0): - """ assert that the specified outcomes appear with the respective - numbers (0 means it didn't occur) in the text output from a test run.""" + """Assert that the specified outcomes appear with the respective + numbers (0 means it didn't occur) in the text output from a test run. + + """ d = self.parseoutcomes() obtained = { - 'passed': d.get('passed', 0), - 'skipped': d.get('skipped', 0), - 'failed': d.get('failed', 0), - 'error': d.get('error', 0), + "passed": d.get("passed", 0), + "skipped": d.get("skipped", 0), + "failed": d.get("failed", 0), + "error": d.get("error", 0), } - assert obtained == dict(passed=passed, skipped=skipped, failed=failed, error=error) + assert ( + obtained == dict(passed=passed, skipped=skipped, failed=failed, error=error) + ) -class Testdir: +class CwdSnapshot(object): + + def __init__(self): + self.__saved = os.getcwd() + + def restore(self): + os.chdir(self.__saved) + + +class SysModulesSnapshot(object): + + def __init__(self, preserve=None): + self.__preserve = preserve + self.__saved = dict(sys.modules) + + def restore(self): + if self.__preserve: + self.__saved.update( + (k, m) for k, m in sys.modules.items() if self.__preserve(k) + ) + sys.modules.clear() + sys.modules.update(self.__saved) + + +class SysPathsSnapshot(object): + + def __init__(self): + self.__saved = list(sys.path), list(sys.meta_path) + + def restore(self): + sys.path[:], sys.meta_path[:] = self.__saved + + +class Testdir(object): """Temporary test directory with tools to test/run pytest itself. - This is based on the ``tmpdir`` fixture but provides a number of - methods which aid with testing pytest itself. Unless - :py:meth:`chdir` is used all methods will use :py:attr:`tmpdir` as - current working directory. + This is based on the ``tmpdir`` fixture but provides a number of methods + which aid with testing pytest itself. Unless :py:meth:`chdir` is used all + methods will use :py:attr:`tmpdir` as their current working directory. Attributes: - :tmpdir: The :py:class:`py.path.local` instance of the temporary - directory. + :tmpdir: The :py:class:`py.path.local` instance of the temporary directory. :plugins: A list of plugins to use with :py:meth:`parseconfig` and - :py:meth:`runpytest`. Initially this is an empty list but - plugins can be added to the list. The type of items to add to - the list depend on the method which uses them so refer to them - for details. + :py:meth:`runpytest`. Initially this is an empty list but plugins can + be added to the list. The type of items to add to the list depends on + the method using them so refer to them for details. """ @@ -413,9 +485,10 @@ class Testdir: name = request.function.__name__ self.tmpdir = tmpdir_factory.mktemp(name, numbered=True) self.plugins = [] - self._savesyspath = (list(sys.path), list(sys.meta_path)) - self._savemodulekeys = set(sys.modules) - self.chdir() # always chdir + self._cwd_snapshot = CwdSnapshot() + self._sys_path_snapshot = SysPathsSnapshot() + self._sys_modules_snapshot = self.__take_sys_modules_snapshot() + self.chdir() self.request.addfinalizer(self.finalize) method = self.request.config.getoption("--runpytest") if method == "inprocess": @@ -429,29 +502,23 @@ class Testdir: def finalize(self): """Clean up global state artifacts. - Some methods modify the global interpreter state and this - tries to clean this up. It does not remove the temporary - directory however so it can be looked at after the test run - has finished. + Some methods modify the global interpreter state and this tries to + clean this up. It does not remove the temporary directory however so + it can be looked at after the test run has finished. """ - sys.path[:], sys.meta_path[:] = self._savesyspath - if hasattr(self, '_olddir'): - self._olddir.chdir() - self.delete_loaded_modules() + self._sys_modules_snapshot.restore() + self._sys_path_snapshot.restore() + self._cwd_snapshot.restore() - def delete_loaded_modules(self): - """Delete modules that have been loaded during a test. + def __take_sys_modules_snapshot(self): + # some zope modules used by twisted-related tests keep internal state + # and can't be deleted; we had some trouble in the past with + # `zope.interface` for example + def preserve_module(name): + return name.startswith("zope") - This allows the interpreter to catch module changes in case - the module is re-imported. - """ - for name in set(sys.modules).difference(self._savemodulekeys): - # some zope modules used by twisted-related tests keeps internal - # state and can't be deleted; we had some trouble in the past - # with zope.interface for example - if not name.startswith("zope"): - del sys.modules[name] + return SysModulesSnapshot(preserve=preserve_module) def make_hook_recorder(self, pluginmanager): """Create a new :py:class:`HookRecorder` for a PluginManager.""" @@ -466,11 +533,9 @@ class Testdir: This is done automatically upon instantiation. """ - old = self.tmpdir.chdir() - if not hasattr(self, '_olddir'): - self._olddir = old + self.tmpdir.chdir() - def _makefile(self, ext, args, kwargs, encoding='utf-8'): + def _makefile(self, ext, args, kwargs, encoding="utf-8"): items = list(kwargs.items()) def to_text(s): @@ -495,17 +560,15 @@ class Testdir: def makefile(self, ext, *args, **kwargs): """Create a new file in the testdir. - ext: The extension the file should use, including the dot. - E.g. ".py". + ext: The extension the file should use, including the dot, e.g. `.py`. - args: All args will be treated as strings and joined using - newlines. The result will be written as contents to the - file. The name of the file will be based on the test - function requesting this fixture. + args: All args will be treated as strings and joined using newlines. + The result will be written as contents to the file. The name of the + file will be based on the test function requesting this fixture. E.g. "testdir.makefile('.txt', 'line1', 'line2')" - kwargs: Each keyword is the name of a file, while the value of - it will be written as contents of the file. + kwargs: Each keyword is the name of a file, while the value of it will + be written as contents of the file. E.g. "testdir.makefile('.ini', pytest='[pytest]\naddopts=-rs\n')" """ @@ -517,32 +580,34 @@ class Testdir: def makeini(self, source): """Write a tox.ini file with 'source' as contents.""" - return self.makefile('.ini', tox=source) + return self.makefile(".ini", tox=source) def getinicfg(self, source): """Return the pytest section from the tox.ini config file.""" p = self.makeini(source) - return py.iniconfig.IniConfig(p)['pytest'] + return py.iniconfig.IniConfig(p)["pytest"] def makepyfile(self, *args, **kwargs): """Shortcut for .makefile() with a .py extension.""" - return self._makefile('.py', args, kwargs) + return self._makefile(".py", args, kwargs) def maketxtfile(self, *args, **kwargs): """Shortcut for .makefile() with a .txt extension.""" - return self._makefile('.txt', args, kwargs) + return self._makefile(".txt", args, kwargs) def syspathinsert(self, path=None): """Prepend a directory to sys.path, defaults to :py:attr:`tmpdir`. - This is undone automatically after the test. + This is undone automatically when this object dies at the end of each + test. + """ if path is None: path = self.tmpdir sys.path.insert(0, str(path)) - # a call to syspathinsert() usually means that the caller - # wants to import some dynamically created files. - # with python3 we thus invalidate import caches. + # a call to syspathinsert() usually means that the caller wants to + # import some dynamically created files, thus with python3 we + # invalidate its import caches self._possibly_invalidate_import_caches() def _possibly_invalidate_import_caches(self): @@ -562,8 +627,8 @@ class Testdir: def mkpydir(self, name): """Create a new python package. - This creates a (sub)directory with an empty ``__init__.py`` - file so that is recognised as a python package. + This creates a (sub)directory with an empty ``__init__.py`` file so it + gets recognised as a python package. """ p = self.mkdir(name) @@ -576,14 +641,14 @@ class Testdir: """Return the collection node of a file. :param config: :py:class:`_pytest.config.Config` instance, see - :py:meth:`parseconfig` and :py:meth:`parseconfigure` to - create the configuration. + :py:meth:`parseconfig` and :py:meth:`parseconfigure` to create the + configuration - :param arg: A :py:class:`py.path.local` instance of the file. + :param arg: a :py:class:`py.path.local` instance of the file """ session = Session(config) - assert '::' not in str(arg) + assert "::" not in str(arg) p = py.path.local(arg) config.hook.pytest_sessionstart(session=session) res = session.perform_collect([str(p)], genitems=False)[0] @@ -593,11 +658,10 @@ class Testdir: def getpathnode(self, path): """Return the collection node of a file. - This is like :py:meth:`getnode` but uses - :py:meth:`parseconfigure` to create the (configured) pytest - Config instance. + This is like :py:meth:`getnode` but uses :py:meth:`parseconfigure` to + create the (configured) pytest Config instance. - :param path: A :py:class:`py.path.local` instance of the file. + :param path: a :py:class:`py.path.local` instance of the file """ config = self.parseconfigure(path) @@ -611,8 +675,8 @@ class Testdir: def genitems(self, colitems): """Generate all test items from a collection node. - This recurses into the collection node and returns a list of - all the test items contained within. + This recurses into the collection node and returns a list of all the + test items contained within. """ session = colitems[0].session @@ -624,10 +688,10 @@ class Testdir: def runitem(self, source): """Run the "test_func" Item. - The calling test instance (the class which contains the test - method) must provide a ``.getrunner()`` method which should - return a runner which can run the test protocol for a single - item, like e.g. :py:func:`_pytest.runner.runtestprotocol`. + The calling test instance (class containing the test method) must + provide a ``.getrunner()`` method which should return a runner which + can run the test protocol for a single item, e.g. + :py:func:`_pytest.runner.runtestprotocol`. """ # used from runner functional tests @@ -641,14 +705,14 @@ class Testdir: """Run a test module in process using ``pytest.main()``. This run writes "source" into a temporary file and runs - ``pytest.main()`` on it, returning a :py:class:`HookRecorder` - instance for the result. + ``pytest.main()`` on it, returning a :py:class:`HookRecorder` instance + for the result. - :param source: The source code of the test module. + :param source: the source code of the test module - :param cmdlineargs: Any extra command line arguments to use. + :param cmdlineargs: any extra command line arguments to use - :return: :py:class:`HookRecorder` instance of the result. + :return: :py:class:`HookRecorder` instance of the result """ p = self.makepyfile(source) @@ -658,13 +722,9 @@ class Testdir: def inline_genitems(self, *args): """Run ``pytest.main(['--collectonly'])`` in-process. - Returns a tuple of the collected items and a - :py:class:`HookRecorder` instance. - - This runs the :py:func:`pytest.main` function to run all of - pytest inside the test process itself like - :py:meth:`inline_run`. However the return value is a tuple of - the collection items and a :py:class:`HookRecorder` instance. + Runs the :py:func:`pytest.main` function to run all of pytest inside + the test process itself like :py:meth:`inline_run`, but returns a + tuple of the collected items and a :py:class:`HookRecorder` instance. """ rec = self.inline_run("--collect-only", *args) @@ -674,60 +734,82 @@ class Testdir: def inline_run(self, *args, **kwargs): """Run ``pytest.main()`` in-process, returning a HookRecorder. - This runs the :py:func:`pytest.main` function to run all of - pytest inside the test process itself. This means it can - return a :py:class:`HookRecorder` instance which gives more - detailed results from then run then can be done by matching - stdout/stderr from :py:meth:`runpytest`. + Runs the :py:func:`pytest.main` function to run all of pytest inside + the test process itself. This means it can return a + :py:class:`HookRecorder` instance which gives more detailed results + from that run than can be done by matching stdout/stderr from + :py:meth:`runpytest`. - :param args: Any command line arguments to pass to - :py:func:`pytest.main`. + :param args: command line arguments to pass to :py:func:`pytest.main` - :param plugin: (keyword-only) Extra plugin instances the - ``pytest.main()`` instance should use. + :param plugin: (keyword-only) extra plugin instances the + ``pytest.main()`` instance should use + + :return: a :py:class:`HookRecorder` instance - :return: A :py:class:`HookRecorder` instance. """ - # When running py.test inline any plugins active in the main - # test process are already imported. So this disables the - # warning which will trigger to say they can no longer be - # rewritten, which is fine as they are already rewritten. - orig_warn = AssertionRewritingHook._warn_already_imported + finalizers = [] + try: + # When running pytest inline any plugins active in the main test + # process are already imported. So this disables the warning which + # will trigger to say they can no longer be rewritten, which is + # fine as they have already been rewritten. + orig_warn = AssertionRewritingHook._warn_already_imported - def revert(): - AssertionRewritingHook._warn_already_imported = orig_warn + def revert_warn_already_imported(): + AssertionRewritingHook._warn_already_imported = orig_warn - self.request.addfinalizer(revert) - AssertionRewritingHook._warn_already_imported = lambda *a: None + finalizers.append(revert_warn_already_imported) + AssertionRewritingHook._warn_already_imported = lambda *a: None - rec = [] + # Any sys.module or sys.path changes done while running pytest + # inline should be reverted after the test run completes to avoid + # clashing with later inline tests run within the same pytest test, + # e.g. just because they use matching test module names. + finalizers.append(self.__take_sys_modules_snapshot().restore) + finalizers.append(SysPathsSnapshot().restore) - class Collect: - def pytest_configure(x, config): - rec.append(self.make_hook_recorder(config.pluginmanager)) + # Important note: + # - our tests should not leave any other references/registrations + # laying around other than possibly loaded test modules + # referenced from sys.modules, as nothing will clean those up + # automatically - plugins = kwargs.get("plugins") or [] - plugins.append(Collect()) - ret = pytest.main(list(args), plugins=plugins) - self.delete_loaded_modules() - if len(rec) == 1: - reprec = rec.pop() - else: - class reprec: - pass - reprec.ret = ret + rec = [] - # typically we reraise keyboard interrupts from the child run - # because it's our user requesting interruption of the testing - if ret == 2 and not kwargs.get("no_reraise_ctrlc"): - calls = reprec.getcalls("pytest_keyboard_interrupt") - if calls and calls[-1].excinfo.type == KeyboardInterrupt: - raise KeyboardInterrupt() - return reprec + class Collect(object): + + def pytest_configure(x, config): + rec.append(self.make_hook_recorder(config.pluginmanager)) + + plugins = kwargs.get("plugins") or [] + plugins.append(Collect()) + ret = pytest.main(list(args), plugins=plugins) + if len(rec) == 1: + reprec = rec.pop() + else: + + class reprec(object): + pass + + reprec.ret = ret + + # typically we reraise keyboard interrupts from the child run + # because it's our user requesting interruption of the testing + if ret == 2 and not kwargs.get("no_reraise_ctrlc"): + calls = reprec.getcalls("pytest_keyboard_interrupt") + if calls and calls[-1].excinfo.type == KeyboardInterrupt: + raise KeyboardInterrupt() + return reprec + finally: + for finalizer in finalizers: + finalizer() def runpytest_inprocess(self, *args, **kwargs): - """ Return result of running pytest in-process, providing a similar - interface to what self.runpytest() provides. """ + """Return result of running pytest in-process, providing a similar + interface to what self.runpytest() provides. + + """ if kwargs.get("syspathinsert"): self.syspathinsert() now = time.time() @@ -738,28 +820,27 @@ class Testdir: reprec = self.inline_run(*args, **kwargs) except SystemExit as e: - class reprec: + class reprec(object): ret = e.args[0] except Exception: traceback.print_exc() - class reprec: + class reprec(object): ret = 3 + finally: out, err = capture.readouterr() capture.stop_capturing() sys.stdout.write(out) sys.stderr.write(err) - res = RunResult(reprec.ret, - out.split("\n"), err.split("\n"), - time.time() - now) + res = RunResult(reprec.ret, out.split("\n"), err.split("\n"), time.time() - now) res.reprec = reprec return res def runpytest(self, *args, **kwargs): - """ Run pytest inline or in a subprocess, depending on the command line + """Run pytest inline or in a subprocess, depending on the command line option "--runpytest" and return a :py:class:`RunResult`. """ @@ -769,29 +850,30 @@ class Testdir: def _ensure_basetemp(self, args): args = [str(x) for x in args] for x in args: - if str(x).startswith('--basetemp'): + if str(x).startswith("--basetemp"): # print("basedtemp exists: %s" %(args,)) break else: - args.append("--basetemp=%s" % self.tmpdir.dirpath('basetemp')) + args.append("--basetemp=%s" % self.tmpdir.dirpath("basetemp")) # print("added basetemp: %s" %(args,)) return args def parseconfig(self, *args): """Return a new pytest Config instance from given commandline args. - This invokes the pytest bootstrapping code in _pytest.config - to create a new :py:class:`_pytest.core.PluginManager` and - call the pytest_cmdline_parse hook to create new + This invokes the pytest bootstrapping code in _pytest.config to create + a new :py:class:`_pytest.core.PluginManager` and call the + pytest_cmdline_parse hook to create a new :py:class:`_pytest.config.Config` instance. - If :py:attr:`plugins` has been populated they should be plugin - modules which will be registered with the PluginManager. + If :py:attr:`plugins` has been populated they should be plugin modules + to be registered with the PluginManager. """ args = self._ensure_basetemp(args) import _pytest.config + config = _pytest.config._prepareconfig(args, self.plugins) # we don't know what the test will do with this half-setup config # object and thus we make sure it gets unconfigured properly in any @@ -802,9 +884,8 @@ class Testdir: def parseconfigure(self, *args): """Return a new pytest configured Config instance. - This returns a new :py:class:`_pytest.config.Config` instance - like :py:meth:`parseconfig`, but also calls the - pytest_configure hook. + This returns a new :py:class:`_pytest.config.Config` instance like + :py:meth:`parseconfig`, but also calls the pytest_configure hook. """ config = self.parseconfig(*args) @@ -815,29 +896,29 @@ class Testdir: def getitem(self, source, funcname="test_func"): """Return the test item for a test function. - This writes the source to a python file and runs pytest's - collection on the resulting module, returning the test item - for the requested function name. + This writes the source to a python file and runs pytest's collection on + the resulting module, returning the test item for the requested + function name. - :param source: The module source. + :param source: the module source - :param funcname: The name of the test function for which the - Item must be returned. + :param funcname: the name of the test function for which to return a + test item """ items = self.getitems(source) for item in items: if item.name == funcname: return item - assert 0, "%r item not found in module:\n%s\nitems: %s" % ( - funcname, source, items) + assert 0, ( + "%r item not found in module:\n%s\nitems: %s" % (funcname, source, items) + ) def getitems(self, source): """Return all test items collected from the module. - This writes the source to a python file and runs pytest's - collection on the resulting module, returning all test items - contained within. + This writes the source to a python file and runs pytest's collection on + the resulting module, returning all test items contained within. """ modcol = self.getmodulecol(source) @@ -846,17 +927,17 @@ class Testdir: def getmodulecol(self, source, configargs=(), withinit=False): """Return the module collection node for ``source``. - This writes ``source`` to a file using :py:meth:`makepyfile` - and then runs the pytest collection on it, returning the - collection node for the test module. + This writes ``source`` to a file using :py:meth:`makepyfile` and then + runs the pytest collection on it, returning the collection node for the + test module. - :param source: The source code of the module to collect. + :param source: the source code of the module to collect - :param configargs: Any extra arguments to pass to - :py:meth:`parseconfigure`. + :param configargs: any extra arguments to pass to + :py:meth:`parseconfigure` - :param withinit: Whether to also write a ``__init__.py`` file - to the temporary directory to ensure it is a package. + :param withinit: whether to also write an ``__init__.py`` file to the + same directory to ensure it is a package """ kw = {self.request.function.__name__: Source(source).strip()} @@ -871,13 +952,12 @@ class Testdir: def collect_by_name(self, modcol, name): """Return the collection node for name from the module collection. - This will search a module collection node for a collection - node matching the given name. + This will search a module collection node for a collection node + matching the given name. - :param modcol: A module collection node, see - :py:meth:`getmodulecol`. + :param modcol: a module collection node; see :py:meth:`getmodulecol` - :param name: The name of the node to return. + :param name: the name of the node to return """ if modcol not in self._mod_collections: @@ -889,18 +969,21 @@ class Testdir: def popen(self, cmdargs, stdout, stderr, **kw): """Invoke subprocess.Popen. - This calls subprocess.Popen making sure the current working - directory is the PYTHONPATH. + This calls subprocess.Popen making sure the current working directory + is in the PYTHONPATH. You probably want to use :py:meth:`run` instead. """ env = os.environ.copy() - env['PYTHONPATH'] = os.pathsep.join(filter(None, [ - str(os.getcwd()), env.get('PYTHONPATH', '')])) - kw['env'] = env + env["PYTHONPATH"] = os.pathsep.join( + filter(None, [str(os.getcwd()), env.get("PYTHONPATH", "")]) + ) + kw["env"] = env - popen = subprocess.Popen(cmdargs, stdin=subprocess.PIPE, stdout=stdout, stderr=stderr, **kw) + popen = subprocess.Popen( + cmdargs, stdin=subprocess.PIPE, stdout=stdout, stderr=stderr, **kw + ) popen.stdin.close() return popen @@ -908,8 +991,7 @@ class Testdir: def run(self, *cmdargs): """Run a command with arguments. - Run a process using subprocess.Popen saving the stdout and - stderr. + Run a process using subprocess.Popen saving the stdout and stderr. Returns a :py:class:`RunResult`. @@ -920,14 +1002,15 @@ class Testdir: cmdargs = [str(x) for x in cmdargs] p1 = self.tmpdir.join("stdout") p2 = self.tmpdir.join("stderr") - print("running:", ' '.join(cmdargs)) + print("running:", " ".join(cmdargs)) print(" in:", str(py.path.local())) f1 = codecs.open(str(p1), "w", encoding="utf8") f2 = codecs.open(str(p2), "w", encoding="utf8") try: now = time.time() - popen = self.popen(cmdargs, stdout=f1, stderr=f2, - close_fds=(sys.platform != "win32")) + popen = self.popen( + cmdargs, stdout=f1, stderr=f2, close_fds=(sys.platform != "win32") + ) ret = popen.wait() finally: f1.close() @@ -952,14 +1035,15 @@ class Testdir: print("couldn't print to %s because of encoding" % (fp,)) def _getpytestargs(self): - # we cannot use "(sys.executable,script)" - # because on windows the script is e.g. a pytest.exe - return (sys.executable, PYTEST_FULLPATH) # noqa + # we cannot use `(sys.executable, script)` because on Windows the + # script is e.g. `pytest.exe` + return (sys.executable, PYTEST_FULLPATH) # noqa def runpython(self, script): """Run a python script using sys.executable as interpreter. Returns a :py:class:`RunResult`. + """ return self.run(sys.executable, script) @@ -970,36 +1054,30 @@ class Testdir: def runpytest_subprocess(self, *args, **kwargs): """Run pytest as a subprocess with given arguments. - Any plugins added to the :py:attr:`plugins` list will added - using the ``-p`` command line option. Addtionally - ``--basetemp`` is used put any temporary files and directories - in a numbered directory prefixed with "runpytest-" so they do - not conflict with the normal numberd pytest location for - temporary files and directories. + Any plugins added to the :py:attr:`plugins` list will added using the + ``-p`` command line option. Additionally ``--basetemp`` is used put + any temporary files and directories in a numbered directory prefixed + with "runpytest-" so they do not conflict with the normal numbered + pytest location for temporary files and directories. Returns a :py:class:`RunResult`. """ - p = py.path.local.make_numbered_dir(prefix="runpytest-", - keep=None, rootdir=self.tmpdir) - args = ('--basetemp=%s' % p, ) + args - # for x in args: - # if '--confcutdir' in str(x): - # break - # else: - # pass - # args = ('--confcutdir=.',) + args + p = py.path.local.make_numbered_dir( + prefix="runpytest-", keep=None, rootdir=self.tmpdir + ) + args = ("--basetemp=%s" % p,) + args plugins = [x for x in self.plugins if isinstance(x, str)] if plugins: - args = ('-p', plugins[0]) + args + args = ("-p", plugins[0]) + args args = self._getpytestargs() + args return self.run(*args) def spawn_pytest(self, string, expect_timeout=10.0): """Run pytest using pexpect. - This makes sure to use the right pytest and sets up the - temporary directory locations. + This makes sure to use the right pytest and sets up the temporary + directory locations. The pexpect child is returned. @@ -1013,9 +1091,10 @@ class Testdir: """Run a command using pexpect. The pexpect child is returned. + """ pexpect = pytest.importorskip("pexpect", "3.0") - if hasattr(sys, 'pypy_version_info') and '64' in platform.machine(): + if hasattr(sys, "pypy_version_info") and "64" in platform.machine(): pytest.skip("pypy-64 bit not supported") if sys.platform.startswith("freebsd"): pytest.xfail("pexpect does not work reliably on freebsd") @@ -1031,16 +1110,20 @@ def getdecoded(out): return out.decode("utf-8") except UnicodeDecodeError: return "INTERNAL not-utf8-decodeable, truncated string:\n%s" % ( - py.io.saferepr(out),) + py.io.saferepr(out), + ) -class LineComp: +class LineComp(object): + def __init__(self): self.stringio = py.io.TextIO() def assert_contains_lines(self, lines2): - """ assert that lines2 are contained (linearly) in lines1. - return a list of extralines found. + """Assert that lines2 are contained (linearly) in lines1. + + Return a list of extralines found. + """ __tracebackhide__ = True val = self.stringio.getvalue() @@ -1050,14 +1133,14 @@ class LineComp: return LineMatcher(lines1).fnmatch_lines(lines2) -class LineMatcher: +class LineMatcher(object): """Flexible matching of text. This is a convenience class to test large texts like the output of commands. - The constructor takes a list of lines without their trailing - newlines, i.e. ``text.splitlines()``. + The constructor takes a list of lines without their trailing newlines, i.e. + ``text.splitlines()``. """ @@ -1077,18 +1160,19 @@ class LineMatcher: return lines2 def fnmatch_lines_random(self, lines2): - """Check lines exist in the output using ``fnmatch.fnmatch``, in any order. + """Check lines exist in the output using in any order. + + Lines are checked using ``fnmatch.fnmatch``. The argument is a list of + lines which have to occur in the output, in any order. - The argument is a list of lines which have to occur in the - output, in any order. """ self._match_lines_random(lines2, fnmatch) def re_match_lines_random(self, lines2): """Check lines exist in the output using ``re.match``, in any order. - The argument is a list of lines which have to occur in the - output, in any order. + The argument is a list of lines which have to occur in the output, in + any order. """ self._match_lines_random(lines2, lambda name, pat: re.match(pat, name)) @@ -1096,8 +1180,8 @@ class LineMatcher: def _match_lines_random(self, lines2, match_func): """Check lines exist in the output. - The argument is a list of lines which have to occur in the - output, in any order. Each line can contain glob whildcards. + The argument is a list of lines which have to occur in the output, in + any order. Each line can contain glob whildcards. """ lines2 = self._getlines(lines2) @@ -1114,6 +1198,7 @@ class LineMatcher: """Return all lines following the given line in the text. The given line can contain glob wildcards. + """ for i, line in enumerate(self.lines): if fnline == line or fnmatch(line, fnline): @@ -1121,22 +1206,21 @@ class LineMatcher: raise ValueError("line %r not found in output" % fnline) def _log(self, *args): - self._log_output.append(' '.join((str(x) for x in args))) + self._log_output.append(" ".join((str(x) for x in args))) @property def _log_text(self): - return '\n'.join(self._log_output) + return "\n".join(self._log_output) def fnmatch_lines(self, lines2): """Search captured text for matching lines using ``fnmatch.fnmatch``. - The argument is a list of lines which have to match and can - use glob wildcards. If they do not match a pytest.fail() is - called. The matches and non-matches are also printed on - stdout. + The argument is a list of lines which have to match and can use glob + wildcards. If they do not match a pytest.fail() is called. The + matches and non-matches are also printed on stdout. """ - self._match_lines(lines2, fnmatch, 'fnmatch') + self._match_lines(lines2, fnmatch, "fnmatch") def re_match_lines(self, lines2): """Search captured text for matching lines using ``re.match``. @@ -1144,21 +1228,22 @@ class LineMatcher: The argument is a list of lines which have to match using ``re.match``. If they do not match a pytest.fail() is called. - The matches and non-matches are also printed on - stdout. + The matches and non-matches are also printed on stdout. + """ - self._match_lines(lines2, lambda name, pat: re.match(pat, name), 're.match') + self._match_lines(lines2, lambda name, pat: re.match(pat, name), "re.match") def _match_lines(self, lines2, match_func, match_nickname): """Underlying implementation of ``fnmatch_lines`` and ``re_match_lines``. - :param list[str] lines2: list of string patterns to match. The actual format depends on - ``match_func``. - :param match_func: a callable ``match_func(line, pattern)`` where line is the captured - line from stdout/stderr and pattern is the matching pattern. + :param list[str] lines2: list of string patterns to match. The actual + format depends on ``match_func`` + :param match_func: a callable ``match_func(line, pattern)`` where line + is the captured line from stdout/stderr and pattern is the matching + pattern + :param str match_nickname: the nickname for the match function that + will be logged to stdout when a match occurs - :param str match_nickname: the nickname for the match function that will be logged - to stdout when a match occurs. """ lines2 = self._getlines(lines2) lines1 = self.lines[:] diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/python.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/python.py similarity index 73% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/python.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/python.py index 650171a9e9c..48516199fff 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/python.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/python.py @@ -19,20 +19,39 @@ from _pytest.config import hookimpl import _pytest import pluggy from _pytest import fixtures -from _pytest import main +from _pytest import nodes from _pytest import deprecated from _pytest.compat import ( - isclass, isfunction, is_generator, ascii_escaped, - REGEX_TYPE, STRING_TYPES, NoneType, NOTSET, - get_real_func, getfslineno, safe_getattr, - safe_str, getlocation, enum, + isclass, + isfunction, + is_generator, + ascii_escaped, + REGEX_TYPE, + STRING_TYPES, + NoneType, + NOTSET, + get_real_func, + getfslineno, + safe_getattr, + safe_str, + getlocation, + enum, + get_default_arg_names, ) from _pytest.outcomes import fail -from _pytest.mark import transfer_markers +from _pytest.mark.structures import transfer_markers, get_unpacked_marks -cutdir1 = py.path.local(pluggy.__file__.rstrip("oc")) -cutdir2 = py.path.local(_pytest.__file__).dirpath() -cutdir3 = py.path.local(py.__file__).dirpath() + +# relative paths that we use to filter traceback entries from appearing to the user; +# see filter_traceback +# note: if we need to add more paths than what we have now we should probably use a list +# for better maintenance +_pluggy_dir = py.path.local(pluggy.__file__.rstrip("oc")) +# pluggy is either a package or a single module depending on the version +if _pluggy_dir.basename == "__init__.py": + _pluggy_dir = _pluggy_dir.dirpath() +_pytest_dir = py.path.local(_pytest.__file__).dirpath() +_py_dir = py.path.local(py.__file__).dirpath() def filter_traceback(entry): @@ -44,52 +63,81 @@ def filter_traceback(entry): # points to dynamically generated code # see https://bitbucket.org/pytest-dev/py/issues/71 raw_filename = entry.frame.code.raw.co_filename - is_generated = '<' in raw_filename and '>' in raw_filename + is_generated = "<" in raw_filename and ">" in raw_filename if is_generated: return False - # entry.path might point to an inexisting file, in which case it will - # alsso return a str object. see #1133 + # entry.path might point to a non-existing file, in which case it will + # also return a str object. see #1133 p = py.path.local(entry.path) - return p != cutdir1 and not p.relto(cutdir2) and not p.relto(cutdir3) + return not p.relto(_pluggy_dir) and not p.relto(_pytest_dir) and not p.relto( + _py_dir + ) def pyobj_property(name): + def get(self): - node = self.getparent(getattr(__import__('pytest'), name)) + node = self.getparent(getattr(__import__("pytest"), name)) if node is not None: return node.obj + doc = "python %s object this node was collected from (can be None)." % ( - name.lower(),) + name.lower(), + ) return property(get, None, None, doc) def pytest_addoption(parser): group = parser.getgroup("general") - group.addoption('--fixtures', '--funcargs', - action="store_true", dest="showfixtures", default=False, - help="show available fixtures, sorted by plugin appearance") group.addoption( - '--fixtures-per-test', + "--fixtures", + "--funcargs", + action="store_true", + dest="showfixtures", + default=False, + help="show available fixtures, sorted by plugin appearance " + "(fixtures with leading '_' are only shown with '-v')", + ) + group.addoption( + "--fixtures-per-test", action="store_true", dest="show_fixtures_per_test", default=False, help="show fixtures per test", ) - parser.addini("usefixtures", type="args", default=[], - help="list of default fixtures to be used with this project") - parser.addini("python_files", type="args", - default=['test_*.py', '*_test.py'], - help="glob-style file patterns for Python test module discovery") - parser.addini("python_classes", type="args", default=["Test", ], - help="prefixes or glob names for Python test class discovery") - parser.addini("python_functions", type="args", default=["test", ], - help="prefixes or glob names for Python test function and " - "method discovery") + parser.addini( + "usefixtures", + type="args", + default=[], + help="list of default fixtures to be used with this project", + ) + parser.addini( + "python_files", + type="args", + default=["test_*.py", "*_test.py"], + help="glob-style file patterns for Python test module discovery", + ) + parser.addini( + "python_classes", + type="args", + default=["Test"], + help="prefixes or glob names for Python test class discovery", + ) + parser.addini( + "python_functions", + type="args", + default=["test"], + help="prefixes or glob names for Python test function and " "method discovery", + ) - group.addoption("--import-mode", default="prepend", - choices=["prepend", "append"], dest="importmode", - help="prepend/append to sys.path when importing test modules, " - "default is to prepend.") + group.addoption( + "--import-mode", + default="prepend", + choices=["prepend", "append"], + dest="importmode", + help="prepend/append to sys.path when importing test modules, " + "default is to prepend.", + ) def pytest_cmdline_main(config): @@ -104,34 +152,32 @@ def pytest_cmdline_main(config): def pytest_generate_tests(metafunc): # those alternative spellings are common - raise a specific error to alert # the user - alt_spellings = ['parameterize', 'parametrise', 'parameterise'] + alt_spellings = ["parameterize", "parametrise", "parameterise"] for attr in alt_spellings: if hasattr(metafunc.function, attr): msg = "{0} has '{1}', spelling should be 'parametrize'" raise MarkerError(msg.format(metafunc.function.__name__, attr)) - try: - markers = metafunc.function.parametrize - except AttributeError: - return - for marker in markers: + for marker in metafunc.definition.iter_markers(name="parametrize"): metafunc.parametrize(*marker.args, **marker.kwargs) def pytest_configure(config): - config.addinivalue_line("markers", - "parametrize(argnames, argvalues): call a test function multiple " - "times passing in different arguments in turn. argvalues generally " - "needs to be a list of values if argnames specifies only one name " - "or a list of tuples of values if argnames specifies multiple names. " - "Example: @parametrize('arg1', [1,2]) would lead to two calls of the " - "decorated test function, one with arg1=1 and another with arg1=2." - "see http://pytest.org/latest/parametrize.html for more info and " - "examples." - ) - config.addinivalue_line("markers", - "usefixtures(fixturename1, fixturename2, ...): mark tests as needing " - "all of the specified fixtures. see http://pytest.org/latest/fixture.html#usefixtures " - ) + config.addinivalue_line( + "markers", + "parametrize(argnames, argvalues): call a test function multiple " + "times passing in different arguments in turn. argvalues generally " + "needs to be a list of values if argnames specifies only one name " + "or a list of tuples of values if argnames specifies multiple names. " + "Example: @parametrize('arg1', [1,2]) would lead to two calls of the " + "decorated test function, one with arg1=1 and another with arg1=2." + "see http://pytest.org/latest/parametrize.html for more info and " + "examples.", + ) + config.addinivalue_line( + "markers", + "usefixtures(fixturename1, fixturename2, ...): mark tests as needing " + "all of the specified fixtures. see http://pytest.org/latest/fixture.html#usefixtures ", + ) @hookimpl(trylast=True) @@ -152,7 +198,7 @@ def pytest_collect_file(path, parent): ext = path.ext if ext == ".py": if not parent.session.isinitpath(path): - for pat in parent.config.getini('python_files'): + for pat in parent.config.getini("python_files"): if path.fnmatch(pat): break else: @@ -183,8 +229,10 @@ def pytest_pycollect_makeitem(collector, name, obj): # or a funtools.wrapped. # We musn't if it's been wrapped with mock.patch (python 2 only) if not (isfunction(obj) or isfunction(get_real_func(obj))): - collector.warn(code="C2", message="cannot collect %r because it is not a function." - % name, ) + collector.warn( + code="C2", + message="cannot collect %r because it is not a function." % name, + ) elif getattr(obj, "__test__", True): if is_generator(obj): res = Generator(name, parent=collector) @@ -204,11 +252,21 @@ class PyobjContext(object): class PyobjMixin(PyobjContext): + _ALLOW_MARKERS = True + + def __init__(self, *k, **kw): + super(PyobjMixin, self).__init__(*k, **kw) + def obj(): + def fget(self): - obj = getattr(self, '_obj', None) + obj = getattr(self, "_obj", None) if obj is None: self._obj = obj = self._getobj() + # XXX evil hack + # used to avoid Instance collector marker duplication + if self._ALLOW_MARKERS: + self.own_markers.extend(get_unpacked_marks(self.obj)) return obj def fset(self, value): @@ -247,7 +305,7 @@ class PyobjMixin(PyobjContext): def reportinfo(self): # XXX caching? obj = self.obj - compat_co_firstlineno = getattr(obj, 'compat_co_firstlineno', None) + compat_co_firstlineno = getattr(obj, "compat_co_firstlineno", None) if isinstance(compat_co_firstlineno, int): # nose compatibility fspath = sys.modules[obj.__module__].__file__ @@ -261,10 +319,10 @@ class PyobjMixin(PyobjContext): return fspath, lineno, modpath -class PyCollector(PyobjMixin, main.Collector): +class PyCollector(PyobjMixin, nodes.Collector): def funcnamefilter(self, name): - return self._matches_prefix_or_glob_option('python_functions', name) + return self._matches_prefix_or_glob_option("python_functions", name) def isnosetest(self, obj): """ Look for the __test__ attribute, which is applied by the @@ -273,25 +331,24 @@ class PyCollector(PyobjMixin, main.Collector): # We explicitly check for "is True" here to not mistakenly treat # classes with a custom __getattr__ returning something truthy (like a # function) as test classes. - return safe_getattr(obj, '__test__', False) is True + return safe_getattr(obj, "__test__", False) is True def classnamefilter(self, name): - return self._matches_prefix_or_glob_option('python_classes', name) + return self._matches_prefix_or_glob_option("python_classes", name) def istestfunction(self, obj, name): if self.funcnamefilter(name) or self.isnosetest(obj): if isinstance(obj, staticmethod): # static methods need to be unwrapped - obj = safe_getattr(obj, '__func__', False) + obj = safe_getattr(obj, "__func__", False) if obj is False: # Python 2.6 wraps in a different way that we won't try to handle - msg = "cannot collect static method %r because " \ - "it is not a function (always the case in Python 2.6)" - self.warn( - code="C2", message=msg % name) + msg = "cannot collect static method %r because it is not a function" + self.warn(code="C2", message=msg % name) return False return ( - safe_getattr(obj, "__call__", False) and fixtures.getfixturemarker(obj) is None + safe_getattr(obj, "__call__", False) + and fixtures.getfixturemarker(obj) is None ) else: return False @@ -310,8 +367,9 @@ class PyCollector(PyobjMixin, main.Collector): # check that name looks like a glob-string before calling fnmatch # because this is called for every name in each collected module, # and fnmatch is somewhat expensive to call - elif ('*' in option or '?' in option or '[' in option) and \ - fnmatch.fnmatch(name, option): + elif ("*" in option or "?" in option or "[" in option) and fnmatch.fnmatch( + name, option + ): return True return False @@ -321,7 +379,7 @@ class PyCollector(PyobjMixin, main.Collector): # NB. we avoid random getattrs and peek in the __dict__ instead # (XXX originally introduced from a PyPy need, still true?) - dicts = [getattr(self.obj, '__dict__', {})] + dicts = [getattr(self.obj, "__dict__", {})] for basecls in inspect.getmro(self.obj.__class__): dicts.append(basecls.__dict__) seen = {} @@ -346,8 +404,7 @@ class PyCollector(PyobjMixin, main.Collector): def _makeitem(self, name, obj): # assert self.ihook.fspath == self.fspath, self - return self.ihook.pytest_pycollect_makeitem( - collector=self, name=name, obj=obj) + return self.ihook.pytest_pycollect_makeitem(collector=self, name=name, obj=obj) def _genfunctions(self, name, funcobj): module = self.getparent(Module).obj @@ -355,17 +412,22 @@ class PyCollector(PyobjMixin, main.Collector): cls = clscol and clscol.obj or None transfer_markers(funcobj, cls, module) fm = self.session._fixturemanager - fixtureinfo = fm.getfixtureinfo(self, funcobj, cls) - metafunc = Metafunc(funcobj, fixtureinfo, self.config, - cls=cls, module=module) + + definition = FunctionDefinition(name=name, parent=self, callobj=funcobj) + fixtureinfo = fm.getfixtureinfo(definition, funcobj, cls) + + metafunc = Metafunc( + definition, fixtureinfo, self.config, cls=cls, module=module + ) methods = [] if hasattr(module, "pytest_generate_tests"): methods.append(module.pytest_generate_tests) if hasattr(cls, "pytest_generate_tests"): methods.append(cls().pytest_generate_tests) if methods: - self.ihook.pytest_generate_tests.call_extra(methods, - dict(metafunc=metafunc)) + self.ihook.pytest_generate_tests.call_extra( + methods, dict(metafunc=metafunc) + ) else: self.ihook.pytest_generate_tests(metafunc=metafunc) @@ -378,15 +440,18 @@ class PyCollector(PyobjMixin, main.Collector): for callspec in metafunc._calls: subname = "%s[%s]" % (name, callspec.id) - yield Function(name=subname, parent=self, - callspec=callspec, callobj=funcobj, - fixtureinfo=fixtureinfo, - keywords={callspec.id: True}, - originalname=name, - ) + yield Function( + name=subname, + parent=self, + callspec=callspec, + callobj=funcobj, + fixtureinfo=fixtureinfo, + keywords={callspec.id: True}, + originalname=name, + ) -class Module(main.File, PyCollector): +class Module(nodes.File, PyCollector): """ Collector for test classes and functions. """ def _getobj(self): @@ -403,7 +468,8 @@ class Module(main.File, PyCollector): mod = self.fspath.pyimport(ensuresyspath=importmode) except SyntaxError: raise self.CollectError( - _pytest._code.ExceptionInfo().getrepr(style="short")) + _pytest._code.ExceptionInfo().getrepr(style="short") + ) except self.fspath.ImportMismatchError: e = sys.exc_info()[1] raise self.CollectError( @@ -413,15 +479,17 @@ class Module(main.File, PyCollector): "which is not the same as the test file we want to collect:\n" " %s\n" "HINT: remove __pycache__ / .pyc files and/or use a " - "unique basename for your test file modules" - % e.args + "unique basename for your test file modules" % e.args ) except ImportError: from _pytest._code.code import ExceptionInfo + exc_info = ExceptionInfo() - if self.config.getoption('verbose') < 2: + if self.config.getoption("verbose") < 2: exc_info.traceback = exc_info.traceback.filter(filter_traceback) - exc_repr = exc_info.getrepr(style='short') if exc_info.traceback else exc_info.exconly() + exc_repr = exc_info.getrepr( + style="short" + ) if exc_info.traceback else exc_info.exconly() formatted_tb = safe_str(exc_repr) raise self.CollectError( "ImportError while importing test module '{fspath}'.\n" @@ -448,9 +516,9 @@ class Module(main.File, PyCollector): if setup_module is not None: setup_module() - teardown_module = _get_xunit_setup_teardown(self.obj, 'tearDownModule') + teardown_module = _get_xunit_setup_teardown(self.obj, "tearDownModule") if teardown_module is None: - teardown_module = _get_xunit_setup_teardown(self.obj, 'teardown_module') + teardown_module = _get_xunit_setup_teardown(self.obj, "teardown_module") if teardown_module is not None: self.addfinalizer(teardown_module) @@ -492,30 +560,41 @@ class Class(PyCollector): if not safe_getattr(self.obj, "__test__", True): return [] if hasinit(self.obj): - self.warn("C1", "cannot collect test class %r because it has a " - "__init__ constructor" % self.obj.__name__) + self.warn( + "C1", + "cannot collect test class %r because it has a " + "__init__ constructor" % self.obj.__name__, + ) return [] elif hasnew(self.obj): - self.warn("C1", "cannot collect test class %r because it has a " - "__new__ constructor" % self.obj.__name__) + self.warn( + "C1", + "cannot collect test class %r because it has a " + "__new__ constructor" % self.obj.__name__, + ) return [] return [self._getcustomclass("Instance")(name="()", parent=self)] def setup(self): - setup_class = _get_xunit_func(self.obj, 'setup_class') + setup_class = _get_xunit_func(self.obj, "setup_class") if setup_class is not None: - setup_class = getattr(setup_class, 'im_func', setup_class) - setup_class = getattr(setup_class, '__func__', setup_class) + setup_class = getattr(setup_class, "im_func", setup_class) + setup_class = getattr(setup_class, "__func__", setup_class) setup_class(self.obj) - fin_class = getattr(self.obj, 'teardown_class', None) + fin_class = getattr(self.obj, "teardown_class", None) if fin_class is not None: - fin_class = getattr(fin_class, 'im_func', fin_class) - fin_class = getattr(fin_class, '__func__', fin_class) + fin_class = getattr(fin_class, "im_func", fin_class) + fin_class = getattr(fin_class, "__func__", fin_class) self.addfinalizer(lambda: fin_class(self.obj)) class Instance(PyCollector): + _ALLOW_MARKERS = False # hack, destroy later + # instances share the object with their parents in a way + # that duplicates markers instances if not taken out + # can be removed at node strucutre reorganization time + def _getobj(self): return self.parent.obj() @@ -534,7 +613,7 @@ class FunctionMixin(PyobjMixin): def setup(self): """ perform setup for this test function. """ - if hasattr(self, '_preservedparent'): + if hasattr(self, "_preservedparent"): obj = self._preservedparent elif isinstance(self.parent, Instance): obj = self.parent.newinstance() @@ -542,20 +621,24 @@ class FunctionMixin(PyobjMixin): else: obj = self.parent.obj if inspect.ismethod(self.obj): - setup_name = 'setup_method' - teardown_name = 'teardown_method' + setup_name = "setup_method" + teardown_name = "teardown_method" else: - setup_name = 'setup_function' - teardown_name = 'teardown_function' - setup_func_or_method = _get_xunit_setup_teardown(obj, setup_name, param_obj=self.obj) + setup_name = "setup_function" + teardown_name = "teardown_function" + setup_func_or_method = _get_xunit_setup_teardown( + obj, setup_name, param_obj=self.obj + ) if setup_func_or_method is not None: setup_func_or_method() - teardown_func_or_method = _get_xunit_setup_teardown(obj, teardown_name, param_obj=self.obj) + teardown_func_or_method = _get_xunit_setup_teardown( + obj, teardown_name, param_obj=self.obj + ) if teardown_func_or_method is not None: self.addfinalizer(teardown_func_or_method) def _prunetraceback(self, excinfo): - if hasattr(self, '_obj') and not self.config.option.fulltrace: + if hasattr(self, "_obj") and not self.config.option.fulltrace: code = _pytest._code.Code(get_real_func(self.obj)) path, firstlineno = code.path, code.firstlineno traceback = excinfo.traceback @@ -563,7 +646,6 @@ class FunctionMixin(PyobjMixin): if ntraceback == traceback: ntraceback = ntraceback.cut(path=path) if ntraceback == traceback: - # ntraceback = ntraceback.cut(excludepath=cutdir2) ntraceback = ntraceback.filter(filter_traceback) if not ntraceback: ntraceback = traceback @@ -574,14 +656,13 @@ class FunctionMixin(PyobjMixin): if self.config.option.tbstyle == "auto": if len(excinfo.traceback) > 2: for entry in excinfo.traceback[1:-1]: - entry.set_repr_style('short') + entry.set_repr_style("short") def _repr_failure_py(self, excinfo, style="long"): if excinfo.errisinstance(fail.Exception): if not excinfo.value.pytrace: return py._builtin._totext(excinfo.value) - return super(FunctionMixin, self)._repr_failure_py(excinfo, - style=style) + return super(FunctionMixin, self)._repr_failure_py(excinfo, style=style) def repr_failure(self, excinfo, outerr=None): assert outerr is None, "XXX outerr usage is deprecated" @@ -592,11 +673,13 @@ class FunctionMixin(PyobjMixin): class Generator(FunctionMixin, PyCollector): + def collect(self): # test generators are seen as collectors but they also # invoke setup/teardown on popular request # (induced by the common "test_*" naming shared with normal tests) from _pytest import deprecated + self.session._setupstate.prepare(self) # see FunctionMixin.setup and test_setupstate_is_preserved_134 self._preservedparent = self.parent.obj @@ -605,16 +688,18 @@ class Generator(FunctionMixin, PyCollector): for i, x in enumerate(self.obj()): name, call, args = self.getcallargs(x) if not callable(call): - raise TypeError("%r yielded non callable test %r" % (self.obj, call,)) + raise TypeError("%r yielded non callable test %r" % (self.obj, call)) if name is None: name = "[%d]" % i else: name = "['%s']" % name if name in seen: - raise ValueError("%r generated tests with non-unique name %r" % (self, name)) + raise ValueError( + "%r generated tests with non-unique name %r" % (self, name) + ) seen[name] = True values.append(self.Function(name, self, args=args, callobj=call)) - self.warn('C1', deprecated.YIELD_TESTS) + self.warn("C1", deprecated.YIELD_TESTS) return values def getcallargs(self, obj): @@ -631,18 +716,19 @@ class Generator(FunctionMixin, PyCollector): def hasinit(obj): - init = getattr(obj, '__init__', None) + init = getattr(obj, "__init__", None) if init: return init != object.__init__ def hasnew(obj): - new = getattr(obj, '__new__', None) + new = getattr(obj, "__new__", None) if new: return new != object.__new__ class CallSpec2(object): + def __init__(self, metafunc): self.metafunc = metafunc self.funcargs = {} @@ -684,8 +770,7 @@ class CallSpec2(object): def id(self): return "-".join(map(str, filter(None, self._idlist))) - def setmulti2(self, valtypes, argnames, valset, id, marks, scopenum, - param_index): + def setmulti2(self, valtypes, argnames, valset, id, marks, scopenum, param_index): for arg, val in zip(argnames, valset): self._checkargnotcontained(arg) valtype_for_arg = valtypes[arg] @@ -710,21 +795,26 @@ class CallSpec2(object): class Metafunc(fixtures.FuncargnamesCompatAttr): """ - Metafunc objects are passed to the ``pytest_generate_tests`` hook. + Metafunc objects are passed to the :func:`pytest_generate_tests <_pytest.hookspec.pytest_generate_tests>` hook. They help to inspect a test function and to generate tests according to test configuration or values specified in the class or module where a test function is defined. """ - def __init__(self, function, fixtureinfo, config, cls=None, module=None): + def __init__(self, definition, fixtureinfo, config, cls=None, module=None): #: access to the :class:`_pytest.config.Config` object for the test session + assert ( + isinstance(definition, FunctionDefinition) + or type(definition).__name__ == "DefinitionMock" + ) + self.definition = definition self.config = config #: the module object where the test function is defined in. self.module = module #: underlying python test function - self.function = function + self.function = definition.obj #: set of fixture names required by the test function self.fixturenames = fixtureinfo.names_closure @@ -736,8 +826,7 @@ class Metafunc(fixtures.FuncargnamesCompatAttr): self._ids = set() self._arg2fixturedefs = fixtureinfo.name2fixturedefs - def parametrize(self, argnames, argvalues, indirect=False, ids=None, - scope=None): + def parametrize(self, argnames, argvalues, indirect=False, ids=None, scope=None): """ Add new invocations to the underlying test function using the list of argvalues for the given argnames. Parametrization is performed during the collection phase. If you need to setup expensive resources @@ -778,24 +867,31 @@ class Metafunc(fixtures.FuncargnamesCompatAttr): from _pytest.fixtures import scope2index from _pytest.mark import ParameterSet from py.io import saferepr - argnames, parameters = ParameterSet._for_parameterize( - argnames, argvalues, self.function) + + argnames, parameters = ParameterSet._for_parametrize( + argnames, argvalues, self.function, self.config + ) del argvalues + default_arg_names = set(get_default_arg_names(self.function)) if scope is None: scope = _find_parametrized_scope(argnames, self._arg2fixturedefs, indirect) - scopenum = scope2index(scope, descr='call to {0}'.format(self.parametrize)) + scopenum = scope2index(scope, descr="call to {}".format(self.parametrize)) valtypes = {} for arg in argnames: if arg not in self.fixturenames: - if isinstance(indirect, (tuple, list)): - name = 'fixture' if arg in indirect else 'argument' + if arg in default_arg_names: + raise ValueError( + "%r already takes an argument %r with a default value" + % (self.function, arg) + ) else: - name = 'fixture' if indirect else 'argument' - raise ValueError( - "%r uses no %s %r" % ( - self.function, name, arg)) + if isinstance(indirect, (tuple, list)): + name = "fixture" if arg in indirect else "argument" + else: + name = "fixture" if indirect else "argument" + raise ValueError("%r uses no %s %r" % (self.function, name, arg)) if indirect is True: valtypes = dict.fromkeys(argnames, "params") @@ -805,8 +901,10 @@ class Metafunc(fixtures.FuncargnamesCompatAttr): valtypes = dict.fromkeys(argnames, "funcargs") for arg in indirect: if arg not in argnames: - raise ValueError("indirect given to %r: fixture %r doesn't exist" % ( - self.function, arg)) + raise ValueError( + "indirect given to %r: fixture %r doesn't exist" + % (self.function, arg) + ) valtypes[arg] = "params" idfn = None if callable(ids): @@ -814,12 +912,15 @@ class Metafunc(fixtures.FuncargnamesCompatAttr): ids = None if ids: if len(ids) != len(parameters): - raise ValueError('%d tests specified with %d ids' % ( - len(parameters), len(ids))) + raise ValueError( + "%d tests specified with %d ids" % (len(parameters), len(ids)) + ) for id_value in ids: if id_value is not None and not isinstance(id_value, six.string_types): - msg = 'ids must be list of strings, found: %s (type: %s)' - raise ValueError(msg % (saferepr(id_value), type(id_value).__name__)) + msg = "ids must be list of strings, found: %s (type: %s)" + raise ValueError( + msg % (saferepr(id_value), type(id_value).__name__) + ) ids = idmaker(argnames, parameters, idfn, ids, self.config) newcalls = [] for callspec in self._calls or [CallSpec2(self)]: @@ -827,12 +928,21 @@ class Metafunc(fixtures.FuncargnamesCompatAttr): for a_id, param, param_index in elements: if len(param.values) != len(argnames): raise ValueError( - 'In "parametrize" the number of values ({0}) must be ' - 'equal to the number of names ({1})'.format( - param.values, argnames)) + 'In "parametrize" the number of values ({}) must be ' + "equal to the number of names ({})".format( + param.values, argnames + ) + ) newcallspec = callspec.copy(self) - newcallspec.setmulti2(valtypes, argnames, param.values, a_id, - param.marks, scopenum, param_index) + newcallspec.setmulti2( + valtypes, + argnames, + param.values, + a_id, + param.marks, + scopenum, + param_index, + ) newcalls.append(newcallspec) self._calls = newcalls @@ -857,7 +967,9 @@ class Metafunc(fixtures.FuncargnamesCompatAttr): invocation through the ``request.param`` attribute. """ if self.config: - self.config.warn('C1', message=deprecated.METAFUNC_ADD_CALL, fslocation=None) + self.config.warn( + "C1", message=deprecated.METAFUNC_ADD_CALL, fslocation=None + ) assert funcargs is None or isinstance(funcargs, dict) if funcargs is not None: for name in funcargs: @@ -890,9 +1002,11 @@ def _find_parametrized_scope(argnames, arg2fixturedefs, indirect): Related to issue #1832, based on code posted by @Kingdread. """ from _pytest.fixtures import scopes + indirect_as_list = isinstance(indirect, (list, tuple)) - all_arguments_are_fixtures = indirect is True or \ - indirect_as_list and len(indirect) == argnames + all_arguments_are_fixtures = indirect is True or indirect_as_list and len( + indirect + ) == argnames if all_arguments_are_fixtures: fixturedefs = arg2fixturedefs or {} used_scopes = [fixturedef[0].scope for name, fixturedef in fixturedefs.items()] @@ -902,7 +1016,7 @@ def _find_parametrized_scope(argnames, arg2fixturedefs, indirect): if scope in used_scopes: return scope - return 'function' + return "function" def _idval(val, argname, idx, idfn, config=None): @@ -913,15 +1027,19 @@ def _idval(val, argname, idx, idfn, config=None): except Exception: # See issue https://github.com/pytest-dev/pytest/issues/2169 import warnings - msg = "Raised while trying to determine id of parameter %s at position %d." % (argname, idx) - msg += '\nUpdate your code as this will raise an error in pytest-4.0.' + + msg = "Raised while trying to determine id of parameter %s at position %d." % ( + argname, idx + ) + msg += "\nUpdate your code as this will raise an error in pytest-4.0." warnings.warn(msg, DeprecationWarning) if s: return ascii_escaped(s) if config: hook_id = config.hook.pytest_make_parametrize_id( - config=config, val=val, argname=argname) + config=config, val=val, argname=argname + ) if hook_id: return hook_id @@ -933,7 +1051,7 @@ def _idval(val, argname, idx, idfn, config=None): return ascii_escaped(val.pattern) elif enum is not None and isinstance(val, enum.Enum): return str(val) - elif isclass(val) and hasattr(val, '__name__'): + elif (isclass(val) or isfunction(val)) and hasattr(val, "__name__"): return val.__name__ return str(argname) + str(idx) @@ -942,16 +1060,20 @@ def _idvalset(idx, parameterset, argnames, idfn, ids, config=None): if parameterset.id is not None: return parameterset.id if ids is None or (idx >= len(ids) or ids[idx] is None): - this_id = [_idval(val, argname, idx, idfn, config) - for val, argname in zip(parameterset.values, argnames)] + this_id = [ + _idval(val, argname, idx, idfn, config) + for val, argname in zip(parameterset.values, argnames) + ] return "-".join(this_id) else: return ascii_escaped(ids[idx]) def idmaker(argnames, parametersets, idfn=None, ids=None, config=None): - ids = [_idvalset(valindex, parameterset, argnames, idfn, ids, config) - for valindex, parameterset in enumerate(parametersets)] + ids = [ + _idvalset(valindex, parameterset, argnames, idfn, ids, config) + for valindex, parameterset in enumerate(parametersets) + ] if len(set(ids)) != len(ids): # The ids are not unique duplicates = [testid for testid in ids if ids.count(testid) > 1] @@ -965,11 +1087,13 @@ def idmaker(argnames, parametersets, idfn=None, ids=None, config=None): def show_fixtures_per_test(config): from _pytest.main import wrap_session + return wrap_session(config, _show_fixtures_per_test) def _show_fixtures_per_test(config, session): import _pytest.config + session.perform_collect() curdir = py.path.local() tw = _pytest.config.create_terminal_writer(config) @@ -985,7 +1109,7 @@ def _show_fixtures_per_test(config, session): return if verbose > 0: bestrel = get_best_relpath(fixture_def.func) - funcargspec = "{0} -- {1}".format(argname, bestrel) + funcargspec = "{} -- {}".format(argname, bestrel) else: funcargspec = argname tw.line(funcargspec, green=True) @@ -993,7 +1117,7 @@ def _show_fixtures_per_test(config, session): if fixture_doc: write_docstring(tw, fixture_doc) else: - tw.line(' no docstring available', red=True) + tw.line(" no docstring available", red=True) def write_item(item): try: @@ -1005,8 +1129,8 @@ def _show_fixtures_per_test(config, session): # this test item does not use any fixtures return tw.line() - tw.sep('-', 'fixtures used by {0}'.format(item.name)) - tw.sep('-', '({0})'.format(get_best_relpath(item.function))) + tw.sep("-", "fixtures used by {}".format(item.name)) + tw.sep("-", "({})".format(get_best_relpath(item.function))) # dict key not used in loop but needed for sorting for _, fixturedefs in sorted(info.name2fixturedefs.items()): assert fixturedefs is not None @@ -1021,11 +1145,13 @@ def _show_fixtures_per_test(config, session): def showfixtures(config): from _pytest.main import wrap_session + return wrap_session(config, _showfixtures_main) def _showfixtures_main(config, session): import _pytest.config + session.perform_collect() curdir = py.path.local() tw = _pytest.config.create_terminal_writer(config) @@ -1045,10 +1171,15 @@ def _showfixtures_main(config, session): if (fixturedef.argname, loc) in seen: continue seen.add((fixturedef.argname, loc)) - available.append((len(fixturedef.baseid), - fixturedef.func.__module__, - curdir.bestrelpath(loc), - fixturedef.argname, fixturedef)) + available.append( + ( + len(fixturedef.baseid), + fixturedef.func.__module__, + curdir.bestrelpath(loc), + fixturedef.argname, + fixturedef, + ) + ) available.sort() currentmodule = None @@ -1061,7 +1192,7 @@ def _showfixtures_main(config, session): if verbose <= 0 and argname[0] == "_": continue if verbose > 0: - funcargspec = "%s -- %s" % (argname, bestrel,) + funcargspec = "%s -- %s" % (argname, bestrel) else: funcargspec = argname tw.line(funcargspec, green=True) @@ -1070,8 +1201,7 @@ def _showfixtures_main(config, session): if doc: write_docstring(tw, doc) else: - tw.line(" %s: no docstring available" % (loc,), - red=True) + tw.line(" %s: no docstring available" % (loc,), red=True) def write_docstring(tw, doc): @@ -1090,22 +1220,34 @@ def write_docstring(tw, doc): tw.write(INDENT + line + "\n") -class Function(FunctionMixin, main.Item, fixtures.FuncargnamesCompatAttr): +class Function(FunctionMixin, nodes.Item, fixtures.FuncargnamesCompatAttr): """ a Function Item is responsible for setting up and executing a Python test function. """ _genid = None + # disable since functions handle it themselfes + _ALLOW_MARKERS = False - def __init__(self, name, parent, args=None, config=None, - callspec=None, callobj=NOTSET, keywords=None, session=None, - fixtureinfo=None, originalname=None): - super(Function, self).__init__(name, parent, config=config, - session=session) + def __init__( + self, + name, + parent, + args=None, + config=None, + callspec=None, + callobj=NOTSET, + keywords=None, + session=None, + fixtureinfo=None, + originalname=None, + ): + super(Function, self).__init__(name, parent, config=config, session=session) self._args = args if callobj is not NOTSET: self.obj = callobj self.keywords.update(self.obj.__dict__) + self.own_markers.extend(get_unpacked_marks(self.obj)) if callspec: self.callspec = callspec # this is total hostile and a mess @@ -1115,13 +1257,14 @@ class Function(FunctionMixin, main.Item, fixtures.FuncargnamesCompatAttr): # feel free to cry, this was broken for years before # and keywords cant fix it per design self.keywords[mark.name] = mark + self.own_markers.extend(callspec.marks) if keywords: self.keywords.update(keywords) if fixtureinfo is None: fixtureinfo = self.session._fixturemanager.getfixtureinfo( - self.parent, self.obj, self.cls, - funcargs=not self._isyieldedfunction()) + self, self.obj, self.cls, funcargs=not self._isyieldedfunction() + ) self._fixtureinfo = fixtureinfo self.fixturenames = fixtureinfo.names_closure self._initrequest() @@ -1135,8 +1278,9 @@ class Function(FunctionMixin, main.Item, fixtures.FuncargnamesCompatAttr): def _initrequest(self): self.funcargs = {} if self._isyieldedfunction(): - assert not hasattr(self, "callspec"), ( - "yielded functions (deprecated) cannot have funcargs") + assert not hasattr( + self, "callspec" + ), "yielded functions (deprecated) cannot have funcargs" else: if hasattr(self, "callspec"): callspec = self.callspec @@ -1149,7 +1293,7 @@ class Function(FunctionMixin, main.Item, fixtures.FuncargnamesCompatAttr): @property def function(self): "underlying python 'function' object" - return getattr(self.obj, 'im_func', self.obj) + return getattr(self.obj, "im_func", self.obj) def _getobj(self): name = self.name @@ -1173,3 +1317,15 @@ class Function(FunctionMixin, main.Item, fixtures.FuncargnamesCompatAttr): def setup(self): super(Function, self).setup() fixtures.fillfixtures(self) + + +class FunctionDefinition(Function): + """ + internal hack until we get actual definition nodes instead of the + crappy metafunc hack + """ + + def runtest(self): + raise RuntimeError("function definitions are not supposed to be used") + + setup = runtest diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/python_api.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/python_api.py similarity index 83% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/python_api.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/python_api.py index 81960295b38..9257d210c27 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/python_api.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/python_api.py @@ -2,12 +2,19 @@ import math import sys import py -from six.moves import zip +from six.moves import zip, filterfalse +from more_itertools.more import always_iterable from _pytest.compat import isclass + +from _pytest.compat import Mapping, Sequence +from _pytest.compat import STRING_TYPES + from _pytest.outcomes import fail import _pytest._code +BASE_TYPE = (type, STRING_TYPES) + def _cmp_raises_type_error(self, other): """__cmp__ implementation which raises TypeError. Used @@ -18,7 +25,9 @@ def _cmp_raises_type_error(self, other): other operators at all. """ __tracebackhide__ = True - raise TypeError('Comparison operators other than == and != not supported by approx objects') + raise TypeError( + "Comparison operators other than == and != not supported by approx objects" + ) # builtin pytest.approx helper @@ -30,6 +39,10 @@ class ApproxBase(object): or sequences of numbers. """ + # Tell numpy to use our `__eq__` operator instead of its + __array_ufunc__ = None + __array_priority__ = 100 + def __init__(self, expected, rel=None, abs=None, nan_ok=False): self.expected = expected self.abs = abs @@ -41,8 +54,8 @@ class ApproxBase(object): def __eq__(self, actual): return all( - a == self._approx_scalar(x) - for a, x in self._yield_comparisons(actual)) + a == self._approx_scalar(x) for a, x in self._yield_comparisons(actual) + ) __hash__ = None @@ -68,14 +81,14 @@ class ApproxNumpy(ApproxBase): Perform approximate comparisons for numpy arrays. """ - # Tell numpy to use our `__eq__` operator instead of its. - __array_priority__ = 100 - def __repr__(self): # It might be nice to rewrite this function to account for the # shape of the array... - return "approx({0!r})".format(list( - self._approx_scalar(x) for x in self.expected)) + import numpy as np + + return "approx({!r})".format( + list(self._approx_scalar(x) for x in np.asarray(self.expected)) + ) if sys.version_info[0] == 2: __cmp__ = _cmp_raises_type_error @@ -83,12 +96,15 @@ class ApproxNumpy(ApproxBase): def __eq__(self, actual): import numpy as np - try: - actual = np.asarray(actual) - except: # noqa - raise TypeError("cannot compare '{0}' to numpy.ndarray".format(actual)) + # self.expected is supposed to always be an array here - if actual.shape != self.expected.shape: + if not np.isscalar(actual): + try: + actual = np.asarray(actual) + except: # noqa + raise TypeError("cannot compare '{}' to numpy.ndarray".format(actual)) + + if not np.isscalar(actual) and actual.shape != self.expected.shape: return False return ApproxBase.__eq__(self, actual) @@ -96,11 +112,16 @@ class ApproxNumpy(ApproxBase): def _yield_comparisons(self, actual): import numpy as np - # We can be sure that `actual` is a numpy array, because it's - # casted in `__eq__` before being passed to `ApproxBase.__eq__`, - # which is the only method that calls this one. - for i in np.ndindex(self.expected.shape): - yield actual[i], self.expected[i] + # `actual` can either be a numpy array or a scalar, it is treated in + # `__eq__` before being passed to `ApproxBase.__eq__`, which is the + # only method that calls this one. + + if np.isscalar(actual): + for i in np.ndindex(self.expected.shape): + yield actual, np.asscalar(self.expected[i]) + else: + for i in np.ndindex(self.expected.shape): + yield np.asscalar(actual[i]), np.asscalar(self.expected[i]) class ApproxMapping(ApproxBase): @@ -110,9 +131,9 @@ class ApproxMapping(ApproxBase): """ def __repr__(self): - return "approx({0!r})".format(dict( - (k, self._approx_scalar(v)) - for k, v in self.expected.items())) + return "approx({!r})".format( + {k: self._approx_scalar(v) for k, v in self.expected.items()} + ) def __eq__(self, actual): if set(actual.keys()) != set(self.expected.keys()): @@ -130,15 +151,13 @@ class ApproxSequence(ApproxBase): Perform approximate comparisons for sequences of numbers. """ - # Tell numpy to use our `__eq__` operator instead of its. - __array_priority__ = 100 - def __repr__(self): seq_type = type(self.expected) if seq_type not in (tuple, list, set): seq_type = list - return "approx({0!r})".format(seq_type( - self._approx_scalar(x) for x in self.expected)) + return "approx({!r})".format( + seq_type(self._approx_scalar(x) for x in self.expected) + ) def __eq__(self, actual): if len(actual) != len(self.expected): @@ -153,6 +172,8 @@ class ApproxScalar(ApproxBase): """ Perform approximate comparisons for single numbers only. """ + DEFAULT_ABSOLUTE_TOLERANCE = 1e-12 + DEFAULT_RELATIVE_TOLERANCE = 1e-6 def __repr__(self): """ @@ -172,20 +193,22 @@ class ApproxScalar(ApproxBase): # If a sensible tolerance can't be calculated, self.tolerance will # raise a ValueError. In this case, display '???'. try: - vetted_tolerance = '{:.1e}'.format(self.tolerance) + vetted_tolerance = "{:.1e}".format(self.tolerance) except ValueError: - vetted_tolerance = '???' + vetted_tolerance = "???" if sys.version_info[0] == 2: - return '{0} +- {1}'.format(self.expected, vetted_tolerance) + return "{} +- {}".format(self.expected, vetted_tolerance) else: - return u'{0} \u00b1 {1}'.format(self.expected, vetted_tolerance) + return u"{} \u00b1 {}".format(self.expected, vetted_tolerance) def __eq__(self, actual): """ Return true if the given value is equal to the expected value within the pre-specified tolerance. """ + if _is_numpy_array(actual): + return ApproxNumpy(actual, self.abs, self.rel, self.nan_ok) == self.expected # Short-circuit exact equality. if actual == self.expected: @@ -218,15 +241,18 @@ class ApproxScalar(ApproxBase): absolute tolerance or a relative tolerance, depending on what the user specified or which would be larger. """ + def set_default(x, default): return x if x is not None else default # Figure out what the absolute tolerance should be. ``self.abs`` is # either None or a value specified by the user. - absolute_tolerance = set_default(self.abs, 1e-12) + absolute_tolerance = set_default(self.abs, self.DEFAULT_ABSOLUTE_TOLERANCE) if absolute_tolerance < 0: - raise ValueError("absolute tolerance can't be negative: {}".format(absolute_tolerance)) + raise ValueError( + "absolute tolerance can't be negative: {}".format(absolute_tolerance) + ) if math.isnan(absolute_tolerance): raise ValueError("absolute tolerance can't be NaN.") @@ -241,10 +267,16 @@ class ApproxScalar(ApproxBase): # we've made sure the user didn't ask for an absolute tolerance only, # because we don't want to raise errors about the relative tolerance if # we aren't even going to use it. - relative_tolerance = set_default(self.rel, 1e-6) * abs(self.expected) + relative_tolerance = set_default( + self.rel, self.DEFAULT_RELATIVE_TOLERANCE + ) * abs( + self.expected + ) if relative_tolerance < 0: - raise ValueError("relative tolerance can't be negative: {}".format(absolute_tolerance)) + raise ValueError( + "relative tolerance can't be negative: {}".format(absolute_tolerance) + ) if math.isnan(relative_tolerance): raise ValueError("relative tolerance can't be NaN.") @@ -252,6 +284,13 @@ class ApproxScalar(ApproxBase): return max(relative_tolerance, absolute_tolerance) +class ApproxDecimal(ApproxScalar): + from decimal import Decimal + + DEFAULT_ABSOLUTE_TOLERANCE = Decimal("1e-12") + DEFAULT_RELATIVE_TOLERANCE = Decimal("1e-6") + + def approx(expected, rel=None, abs=None, nan_ok=False): """ Assert that two numbers (or two sets of numbers) are equal to each other @@ -298,12 +337,18 @@ def approx(expected, rel=None, abs=None, nan_ok=False): >>> {'a': 0.1 + 0.2, 'b': 0.2 + 0.4} == approx({'a': 0.3, 'b': 0.6}) True - And ``numpy`` arrays:: + ``numpy`` arrays:: >>> import numpy as np # doctest: +SKIP >>> np.array([0.1, 0.2]) + np.array([0.2, 0.4]) == approx(np.array([0.3, 0.6])) # doctest: +SKIP True + And for a ``numpy`` array against a scalar:: + + >>> import numpy as np # doctest: +SKIP + >>> np.array([0.1, 0.2]) + np.array([0.2, 0.1]) == approx(0.3) # doctest: +SKIP + True + By default, ``approx`` considers numbers within a relative tolerance of ``1e-6`` (i.e. one part in a million) of its expected value to be equal. This treatment would lead to surprising results if the expected value was @@ -399,8 +444,7 @@ def approx(expected, rel=None, abs=None, nan_ok=False): __ https://docs.python.org/3/reference/datamodel.html#object.__ge__ """ - from collections import Mapping, Sequence - from _pytest.compat import STRING_TYPES as String + from decimal import Decimal # Delegate the comparison to a class that knows how to deal with the type # of the expected value (e.g. int, float, list, dict, numpy.array, etc). @@ -420,8 +464,10 @@ def approx(expected, rel=None, abs=None, nan_ok=False): cls = ApproxNumpy elif isinstance(expected, Mapping): cls = ApproxMapping - elif isinstance(expected, Sequence) and not isinstance(expected, String): + elif isinstance(expected, Sequence) and not isinstance(expected, STRING_TYPES): cls = ApproxSequence + elif isinstance(expected, Decimal): + cls = ApproxDecimal else: cls = ApproxScalar @@ -436,9 +482,10 @@ def _is_numpy_array(obj): import inspect for cls in inspect.getmro(type(obj)): - if cls.__module__ == 'numpy': + if cls.__module__ == "numpy": try: import numpy as np + return isinstance(obj, np.ndarray) except ImportError: pass @@ -448,11 +495,16 @@ def _is_numpy_array(obj): # builtin pytest.raises helper + def raises(expected_exception, *args, **kwargs): - """ + r""" Assert that a code block/function call raises ``expected_exception`` and raise a failure exception otherwise. + :arg message: if specified, provides a custom failure message if the + exception is not raised + :arg match: if specified, asserts that the exception matches a text or regex + This helper produces a ``ExceptionInfo()`` object (see below). You may use this function as a context manager:: @@ -531,8 +583,9 @@ def raises(expected_exception, *args, **kwargs): The string will be evaluated using the same ``locals()`` and ``globals()`` at the moment of the ``raises`` call. - .. autoclass:: _pytest._code.ExceptionInfo - :members: + .. currentmodule:: _pytest._code + + Consult the API of ``excinfo`` objects: :class:`ExceptionInfo`. .. note:: Similar to caught exception objects in Python, explicitly clearing @@ -550,16 +603,14 @@ def raises(expected_exception, *args, **kwargs): """ __tracebackhide__ = True - msg = ("exceptions must be old-style classes or" - " derived from BaseException, not %s") - if isinstance(expected_exception, tuple): - for exc in expected_exception: - if not isclass(exc): - raise TypeError(msg % type(exc)) - elif not isclass(expected_exception): - raise TypeError(msg % type(expected_exception)) + for exc in filterfalse(isclass, always_iterable(expected_exception, BASE_TYPE)): + msg = ( + "exceptions must be old-style classes or" + " derived from BaseException, not %s" + ) + raise TypeError(msg % type(exc)) - message = "DID NOT RAISE {0}".format(expected_exception) + message = "DID NOT RAISE {}".format(expected_exception) match_expr = None if not args: @@ -567,7 +618,10 @@ def raises(expected_exception, *args, **kwargs): message = kwargs.pop("message") if "match" in kwargs: match_expr = kwargs.pop("match") - message += " matching '{0}'".format(match_expr) + if kwargs: + msg = "Unexpected keyword arguments passed to pytest.raises: " + msg += ", ".join(kwargs.keys()) + raise TypeError(msg) return RaisesContext(expected_exception, message, match_expr) elif isinstance(args[0], str): code, = args @@ -596,6 +650,7 @@ raises.Exception = fail.Exception class RaisesContext(object): + def __init__(self, expected_exception, message, match_expr): self.expected_exception = expected_exception self.message = message @@ -614,6 +669,6 @@ class RaisesContext(object): suppress_exception = issubclass(self.excinfo.type, self.expected_exception) if sys.version_info[0] == 2 and suppress_exception: sys.exc_clear() - if self.match_expr: + if self.match_expr and suppress_exception: self.excinfo.match(self.match_expr) return suppress_exception diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/recwarn.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/recwarn.py similarity index 82% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/recwarn.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/recwarn.py index 4fceb10a7f3..7839f5700c8 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/recwarn.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/recwarn.py @@ -16,17 +16,14 @@ from _pytest.outcomes import fail @yield_fixture def recwarn(): - """Return a WarningsRecorder instance that provides these methods: - - * ``pop(category=None)``: return last warning matching the category. - * ``clear()``: clear list of warnings + """Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions. See http://docs.python.org/library/warnings.html for information on warning categories. """ wrec = WarningsRecorder() with wrec: - warnings.simplefilter('default') + warnings.simplefilter("default") yield wrec @@ -79,20 +76,22 @@ class _DeprecatedCallContext(object): if exc_type is None: deprecation_categories = (DeprecationWarning, PendingDeprecationWarning) - if not any(issubclass(c, deprecation_categories) for c in self._captured_categories): + if not any( + issubclass(c, deprecation_categories) for c in self._captured_categories + ): __tracebackhide__ = True msg = "Did not produce DeprecationWarning or PendingDeprecationWarning" raise AssertionError(msg) def warns(expected_warning, *args, **kwargs): - """Assert that code raises a particular class of warning. + r"""Assert that code raises a particular class of warning. - Specifically, the input @expected_warning can be a warning class or - tuple of warning classes, and the code must return that warning - (if a single class) or one of those warnings (if a tuple). + Specifically, the parameter ``expected_warning`` can be a warning class or + sequence of warning classes, and the inside the ``with`` block must issue a warning of that class or + classes. - This helper produces a list of ``warnings.WarningMessage`` objects, + This helper produces a list of :class:`warnings.WarningMessage` objects, one for each warning raised. This function can be used as a context manager, or any of the other ways @@ -183,7 +182,7 @@ class WarningsRecorder(warnings.catch_warnings): __tracebackhide__ = True raise RuntimeError("Cannot enter %r twice" % self) self._list = super(WarningsRecorder, self).__enter__() - warnings.simplefilter('always') + warnings.simplefilter("always") return self def __exit__(self, *exc_info): @@ -194,11 +193,13 @@ class WarningsRecorder(warnings.catch_warnings): class WarningsChecker(WarningsRecorder): + def __init__(self, expected_warning=None, match_expr=None): super(WarningsChecker, self).__init__() - msg = ("exceptions must be old-style classes or " - "derived from Warning, not %s") + msg = ( + "exceptions must be old-style classes or " "derived from Warning, not %s" + ) if isinstance(expected_warning, tuple): for exc in expected_warning: if not inspect.isclass(exc): @@ -217,20 +218,26 @@ class WarningsChecker(WarningsRecorder): # only check if we're not currently handling an exception if all(a is None for a in exc_info): if self.expected_warning is not None: - if not any(issubclass(r.category, self.expected_warning) - for r in self): + if not any(issubclass(r.category, self.expected_warning) for r in self): __tracebackhide__ = True - fail("DID NOT WARN. No warnings of type {0} was emitted. " - "The list of emitted warnings is: {1}.".format( - self.expected_warning, - [each.message for each in self])) + fail( + "DID NOT WARN. No warnings of type {} was emitted. " + "The list of emitted warnings is: {}.".format( + self.expected_warning, [each.message for each in self] + ) + ) elif self.match_expr is not None: for r in self: if issubclass(r.category, self.expected_warning): if re.compile(self.match_expr).search(str(r.message)): break else: - fail("DID NOT WARN. No warnings of type {0} matching" - " ('{1}') was emitted. The list of emitted warnings" - " is: {2}.".format(self.expected_warning, self.match_expr, - [each.message for each in self])) + fail( + "DID NOT WARN. No warnings of type {} matching" + " ('{}') was emitted. The list of emitted warnings" + " is: {}.".format( + self.expected_warning, + self.match_expr, + [each.message for each in self], + ) + ) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/resultlog.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/resultlog.py similarity index 78% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/resultlog.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/resultlog.py index 9f9c2d1f653..8f300c98300 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/resultlog.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/resultlog.py @@ -9,28 +9,34 @@ import os def pytest_addoption(parser): group = parser.getgroup("terminal reporting", "resultlog plugin options") - group.addoption('--resultlog', '--result-log', action="store", - metavar="path", default=None, - help="DEPRECATED path for machine-readable result log.") + group.addoption( + "--resultlog", + "--result-log", + action="store", + metavar="path", + default=None, + help="DEPRECATED path for machine-readable result log.", + ) def pytest_configure(config): resultlog = config.option.resultlog # prevent opening resultlog on slave nodes (xdist) - if resultlog and not hasattr(config, 'slaveinput'): + if resultlog and not hasattr(config, "slaveinput"): dirname = os.path.dirname(os.path.abspath(resultlog)) if not os.path.isdir(dirname): os.makedirs(dirname) - logfile = open(resultlog, 'w', 1) # line buffered + logfile = open(resultlog, "w", 1) # line buffered config._resultlog = ResultLog(config, logfile) config.pluginmanager.register(config._resultlog) from _pytest.deprecated import RESULT_LOG - config.warn('C1', RESULT_LOG) + + config.warn("C1", RESULT_LOG) def pytest_unconfigure(config): - resultlog = getattr(config, '_resultlog', None) + resultlog = getattr(config, "_resultlog", None) if resultlog: resultlog.logfile.close() del config._resultlog @@ -46,22 +52,23 @@ def generic_path(item): newfspath = node.fspath if newfspath == fspath: if fspart: - gpath.append(':') + gpath.append(":") fspart = False else: - gpath.append('.') + gpath.append(".") else: - gpath.append('/') + gpath.append("/") fspart = True name = node.name - if name[0] in '([': + if name[0] in "([": gpath.pop() gpath.append(name) fspath = newfspath - return ''.join(gpath) + return "".join(gpath) class ResultLog(object): + def __init__(self, config, logfile): self.config = config self.logfile = logfile # preferably line buffered @@ -72,7 +79,7 @@ class ResultLog(object): print(" %s" % line, file=self.logfile) def log_outcome(self, report, lettercode, longrepr): - testpath = getattr(report, 'nodeid', None) + testpath = getattr(report, "nodeid", None) if testpath is None: testpath = report.fspath self.write_log_entry(testpath, lettercode, longrepr) @@ -82,10 +89,10 @@ class ResultLog(object): return res = self.config.hook.pytest_report_teststatus(report=report) code = res[1] - if code == 'x': + if code == "x": longrepr = str(report.longrepr) - elif code == 'X': - longrepr = '' + elif code == "X": + longrepr = "" elif report.passed: longrepr = "" elif report.failed: @@ -106,8 +113,8 @@ class ResultLog(object): self.log_outcome(report, code, longrepr) def pytest_internalerror(self, excrepr): - reprcrash = getattr(excrepr, 'reprcrash', None) + reprcrash = getattr(excrepr, "reprcrash", None) path = getattr(reprcrash, "path", None) if path is None: path = "cwd:%s" % py.path.local() - self.write_log_entry(path, '!', str(excrepr)) + self.write_log_entry(path, "!", str(excrepr)) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/runner.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/runner.py similarity index 76% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/runner.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/runner.py index e07ed2a248b..18e925509ec 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/runner.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/runner.py @@ -16,9 +16,14 @@ from _pytest.outcomes import skip, Skipped, TEST_OUTCOME def pytest_addoption(parser): group = parser.getgroup("terminal reporting", "reporting", after="general") - group.addoption('--durations', - action="store", type=int, default=None, metavar="N", - help="show N slowest setup/test durations (N=0 for all)."), + group.addoption( + "--durations", + action="store", + type=int, + default=None, + metavar="N", + help="show N slowest setup/test durations (N=0 for all).", + ), def pytest_terminal_summary(terminalreporter): @@ -29,7 +34,7 @@ def pytest_terminal_summary(terminalreporter): dlist = [] for replist in tr.stats.values(): for rep in replist: - if hasattr(rep, 'duration'): + if hasattr(rep, "duration"): dlist.append(rep) if not dlist: return @@ -43,8 +48,7 @@ def pytest_terminal_summary(terminalreporter): for rep in dlist: nodeid = rep.nodeid.replace("::()::", "::") - tr.write_line("%02.2fs %-8s %s" % - (rep.duration, rep.when, nodeid)) + tr.write_line("%02.2fs %-8s %s" % (rep.duration, rep.when, nodeid)) def pytest_sessionstart(session): @@ -56,10 +60,9 @@ def pytest_sessionfinish(session): def pytest_runtest_protocol(item, nextitem): - item.ihook.pytest_runtest_logstart( - nodeid=item.nodeid, location=item.location, - ) + item.ihook.pytest_runtest_logstart(nodeid=item.nodeid, location=item.location) runtestprotocol(item, nextitem=nextitem) + item.ihook.pytest_runtest_logfinish(nodeid=item.nodeid, location=item.location) return True @@ -74,8 +77,7 @@ def runtestprotocol(item, log=True, nextitem=None): show_test_item(item) if not item.config.option.setuponly: reports.append(call_and_report(item, "call", log)) - reports.append(call_and_report(item, "teardown", log, - nextitem=nextitem)) + reports.append(call_and_report(item, "teardown", log, nextitem=nextitem)) # after all teardown hooks have been called # want funcargs and request info to go away if hasrequest: @@ -88,20 +90,21 @@ def show_test_item(item): """Show test function, parameters and the fixtures of the test item.""" tw = item.config.get_terminal_writer() tw.line() - tw.write(' ' * 8) + tw.write(" " * 8) tw.write(item._nodeid) used_fixtures = sorted(item._fixtureinfo.name2fixturedefs.keys()) if used_fixtures: - tw.write(' (fixtures used: {0})'.format(', '.join(used_fixtures))) + tw.write(" (fixtures used: {})".format(", ".join(used_fixtures))) def pytest_runtest_setup(item): - _update_current_test_var(item, 'setup') + _update_current_test_var(item, "setup") item.session._setupstate.prepare(item) def pytest_runtest_call(item): - _update_current_test_var(item, 'call') + _update_current_test_var(item, "call") + sys.last_type, sys.last_value, sys.last_traceback = (None, None, None) try: item.runtest() except Exception: @@ -111,12 +114,12 @@ def pytest_runtest_call(item): sys.last_type = type sys.last_value = value sys.last_traceback = tb - del tb # Get rid of it in this namespace + del type, value, tb # Get rid of these in this frame raise def pytest_runtest_teardown(item, nextitem): - _update_current_test_var(item, 'teardown') + _update_current_test_var(item, "teardown") item.session._setupstate.teardown_exact(item, nextitem) _update_current_test_var(item, None) @@ -127,11 +130,11 @@ def _update_current_test_var(item, when): If ``when`` is None, delete PYTEST_CURRENT_TEST from the environment. """ - var_name = 'PYTEST_CURRENT_TEST' + var_name = "PYTEST_CURRENT_TEST" if when: - value = '{0} ({1})'.format(item.nodeid, when) + value = "{} ({})".format(item.nodeid, when) # don't allow null bytes on environment variables (see #2644, #2957) - value = value.replace('\x00', '(null)') + value = value.replace("\x00", "(null)") os.environ[var_name] = value else: os.environ.pop(var_name) @@ -151,6 +154,7 @@ def pytest_report_teststatus(report): # # Implementation + def call_and_report(item, when, log=True, **kwds): call = call_runtest_hook(item, when, **kwds) hook = item.ihook @@ -164,23 +168,28 @@ def call_and_report(item, when, log=True, **kwds): def check_interactive_exception(call, report): return call.excinfo and not ( - hasattr(report, "wasxfail") or - call.excinfo.errisinstance(skip.Exception) or - call.excinfo.errisinstance(bdb.BdbQuit)) + hasattr(report, "wasxfail") + or call.excinfo.errisinstance(skip.Exception) + or call.excinfo.errisinstance(bdb.BdbQuit) + ) def call_runtest_hook(item, when, **kwds): hookname = "pytest_runtest_" + when ihook = getattr(item.ihook, hookname) - return CallInfo(lambda: ihook(item=item, **kwds), when=when) + return CallInfo( + lambda: ihook(item=item, **kwds), + when=when, + treat_keyboard_interrupt_as_exception=item.config.getvalue("usepdb"), + ) -class CallInfo: +class CallInfo(object): """ Result/Exception info a function invocation. """ #: None or ExceptionInfo object. excinfo = None - def __init__(self, func, when): + def __init__(self, func, when, treat_keyboard_interrupt_as_exception=False): #: context of invocation: one of "setup", "call", #: "teardown", "memocollect" self.when = when @@ -188,8 +197,11 @@ class CallInfo: try: self.result = func() except KeyboardInterrupt: - self.stop = time() - raise + if treat_keyboard_interrupt_as_exception: + self.excinfo = ExceptionInfo() + else: + self.stop = time() + raise except: # noqa self.excinfo = ExceptionInfo() self.stop = time() @@ -207,9 +219,10 @@ def getslaveinfoline(node): return node._slaveinfocache except AttributeError: d = node.slaveinfo - ver = "%s.%s.%s" % d['version_info'][:3] + ver = "%s.%s.%s" % d["version_info"][:3] node._slaveinfocache = s = "[%s] %s -- Python %s %s" % ( - d['id'], d['sysplatform'], ver, d['executable']) + d["id"], d["sysplatform"], ver, d["executable"] + ) return s @@ -219,14 +232,14 @@ class BaseReport(object): self.__dict__.update(kw) def toterminal(self, out): - if hasattr(self, 'node'): + if hasattr(self, "node"): out.line(getslaveinfoline(self.node)) longrepr = self.longrepr if longrepr is None: return - if hasattr(longrepr, 'toterminal'): + if hasattr(longrepr, "toterminal"): longrepr.toterminal(out) else: try: @@ -253,13 +266,25 @@ class BaseReport(object): exc = tw.stringio.getvalue() return exc.strip() + @property + def caplog(self): + """Return captured log lines, if log capturing is enabled + + .. versionadded:: 3.5 + """ + return "\n".join( + content for (prefix, content) in self.get_sections("Captured log") + ) + @property def capstdout(self): """Return captured text from stdout, if capturing is enabled .. versionadded:: 3.0 """ - return ''.join(content for (prefix, content) in self.get_sections('Captured stdout')) + return "".join( + content for (prefix, content) in self.get_sections("Captured stdout") + ) @property def capstderr(self): @@ -267,7 +292,9 @@ class BaseReport(object): .. versionadded:: 3.0 """ - return ''.join(content for (prefix, content) in self.get_sections('Captured stderr')) + return "".join( + content for (prefix, content) in self.get_sections("Captured stderr") + ) passed = property(lambda x: x.outcome == "passed") failed = property(lambda x: x.outcome == "failed") @@ -281,7 +308,7 @@ class BaseReport(object): def pytest_runtest_makereport(item, call): when = call.when duration = call.stop - call.start - keywords = dict([(x, 1) for x in item.keywords]) + keywords = {x: 1 for x in item.keywords} excinfo = call.excinfo sections = [] if not call.excinfo: @@ -300,13 +327,22 @@ def pytest_runtest_makereport(item, call): if call.when == "call": longrepr = item.repr_failure(excinfo) else: # exception in setup or teardown - longrepr = item._repr_failure_py(excinfo, - style=item.config.option.tbstyle) + longrepr = item._repr_failure_py( + excinfo, style=item.config.option.tbstyle + ) for rwhen, key, content in item._report_sections: sections.append(("Captured %s %s" % (key, rwhen), content)) - return TestReport(item.nodeid, item.location, - keywords, outcome, longrepr, when, - sections, duration) + return TestReport( + item.nodeid, + item.location, + keywords, + outcome, + longrepr, + when, + sections, + duration, + user_properties=item.user_properties, + ) class TestReport(BaseReport): @@ -314,8 +350,19 @@ class TestReport(BaseReport): they fail). """ - def __init__(self, nodeid, location, keywords, outcome, - longrepr, when, sections=(), duration=0, **extra): + def __init__( + self, + nodeid, + location, + keywords, + outcome, + longrepr, + when, + sections=(), + duration=0, + user_properties=(), + **extra + ): #: normalized collection node id self.nodeid = nodeid @@ -337,6 +384,10 @@ class TestReport(BaseReport): #: one of 'setup', 'call', 'teardown' to indicate runtest phase. self.when = when + #: user properties is a list of tuples (name, value) that holds user + #: defined properties of the test + self.user_properties = user_properties + #: list of pairs ``(str, str)`` of extra information which needs to #: marshallable. Used by pytest to add captured text #: from ``stdout`` and ``stderr``, but may be used by other plugins @@ -350,7 +401,8 @@ class TestReport(BaseReport): def __repr__(self): return "" % ( - self.nodeid, self.when, self.outcome) + self.nodeid, self.when, self.outcome + ) class TeardownErrorReport(BaseReport): @@ -364,14 +416,13 @@ class TeardownErrorReport(BaseReport): def pytest_make_collect_report(collector): - call = CallInfo( - lambda: list(collector.collect()), - 'collect') + call = CallInfo(lambda: list(collector.collect()), "collect") longrepr = None if not call.excinfo: outcome = "passed" else: from _pytest import nose + skip_exceptions = (Skipped,) + nose.get_skip_exceptions() if call.excinfo.errisinstance(skip_exceptions): outcome = "skipped" @@ -383,15 +434,16 @@ def pytest_make_collect_report(collector): if not hasattr(errorinfo, "toterminal"): errorinfo = CollectErrorRepr(errorinfo) longrepr = errorinfo - rep = CollectReport(collector.nodeid, outcome, longrepr, - getattr(call, 'result', None)) + rep = CollectReport( + collector.nodeid, outcome, longrepr, getattr(call, "result", None) + ) rep.call = call # see collect_one_node return rep class CollectReport(BaseReport): - def __init__(self, nodeid, outcome, longrepr, result, - sections=(), **extra): + + def __init__(self, nodeid, outcome, longrepr, result, sections=(), **extra): self.nodeid = nodeid self.outcome = outcome self.longrepr = longrepr @@ -405,10 +457,12 @@ class CollectReport(BaseReport): def __repr__(self): return "" % ( - self.nodeid, len(self.result), self.outcome) + self.nodeid, len(self.result), self.outcome + ) class CollectErrorRepr(TerminalRepr): + def __init__(self, msg): self.longrepr = msg @@ -457,8 +511,9 @@ class SetupState(object): if hasattr(colitem, "teardown"): colitem.teardown() for colitem in self._finalizers: - assert colitem is None or colitem in self.stack \ - or isinstance(colitem, tuple) + assert ( + colitem is None or colitem in self.stack or isinstance(colitem, tuple) + ) def teardown_all(self): while self.stack: @@ -472,10 +527,19 @@ class SetupState(object): self._teardown_towards(needed_collectors) def _teardown_towards(self, needed_collectors): + exc = None while self.stack: if self.stack == needed_collectors[:len(self.stack)]: break - self._pop_and_teardown() + try: + self._pop_and_teardown() + except TEST_OUTCOME: + # XXX Only first exception will be seen by user, + # ideally all should be reported. + if exc is None: + exc = sys.exc_info() + if exc: + py.builtin._reraise(*exc) def prepare(self, colitem): """ setup objects along the collector chain to the test-method @@ -485,7 +549,7 @@ class SetupState(object): # check if the last collection node has raised an error for col in self.stack: - if hasattr(col, '_prepare_exc'): + if hasattr(col, "_prepare_exc"): py.builtin._reraise(*col._prepare_exc) for col in needed_collectors[len(self.stack):]: self.stack.append(col) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/setuponly.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/setuponly.py similarity index 58% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/setuponly.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/setuponly.py index a1c7457d7e5..81240d9d055 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/setuponly.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/setuponly.py @@ -6,10 +6,18 @@ import sys def pytest_addoption(parser): group = parser.getgroup("debugconfig") - group.addoption('--setuponly', '--setup-only', action="store_true", - help="only setup fixtures, do not execute tests.") - group.addoption('--setupshow', '--setup-show', action="store_true", - help="show setup of fixtures while executing tests.") + group.addoption( + "--setuponly", + "--setup-only", + action="store_true", + help="only setup fixtures, do not execute tests.", + ) + group.addoption( + "--setupshow", + "--setup-show", + action="store_true", + help="show setup of fixtures while executing tests.", + ) @pytest.hookimpl(hookwrapper=True) @@ -17,50 +25,52 @@ def pytest_fixture_setup(fixturedef, request): yield config = request.config if config.option.setupshow: - if hasattr(request, 'param'): + if hasattr(request, "param"): # Save the fixture parameter so ._show_fixture_action() can # display it now and during the teardown (in .finish()). if fixturedef.ids: if callable(fixturedef.ids): fixturedef.cached_param = fixturedef.ids(request.param) else: - fixturedef.cached_param = fixturedef.ids[ - request.param_index] + fixturedef.cached_param = fixturedef.ids[request.param_index] else: fixturedef.cached_param = request.param - _show_fixture_action(fixturedef, 'SETUP') + _show_fixture_action(fixturedef, "SETUP") def pytest_fixture_post_finalizer(fixturedef): if hasattr(fixturedef, "cached_result"): config = fixturedef._fixturemanager.config if config.option.setupshow: - _show_fixture_action(fixturedef, 'TEARDOWN') + _show_fixture_action(fixturedef, "TEARDOWN") if hasattr(fixturedef, "cached_param"): del fixturedef.cached_param def _show_fixture_action(fixturedef, msg): config = fixturedef._fixturemanager.config - capman = config.pluginmanager.getplugin('capturemanager') + capman = config.pluginmanager.getplugin("capturemanager") if capman: out, err = capman.suspend_global_capture() tw = config.get_terminal_writer() tw.line() - tw.write(' ' * 2 * fixturedef.scopenum) - tw.write('{step} {scope} {fixture}'.format( - step=msg.ljust(8), # align the output to TEARDOWN - scope=fixturedef.scope[0].upper(), - fixture=fixturedef.argname)) + tw.write(" " * 2 * fixturedef.scopenum) + tw.write( + "{step} {scope} {fixture}".format( + step=msg.ljust(8), # align the output to TEARDOWN + scope=fixturedef.scope[0].upper(), + fixture=fixturedef.argname, + ) + ) - if msg == 'SETUP': - deps = sorted(arg for arg in fixturedef.argnames if arg != 'request') + if msg == "SETUP": + deps = sorted(arg for arg in fixturedef.argnames if arg != "request") if deps: - tw.write(' (fixtures used: {0})'.format(', '.join(deps))) + tw.write(" (fixtures used: {})".format(", ".join(deps))) - if hasattr(fixturedef, 'cached_param'): - tw.write('[{0}]'.format(fixturedef.cached_param)) + if hasattr(fixturedef, "cached_param"): + tw.write("[{}]".format(fixturedef.cached_param)) if capman: capman.resume_global_capture() diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/setupplan.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/setupplan.py similarity index 75% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/setupplan.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/setupplan.py index e11bd40698b..23f4f97e6d9 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/setupplan.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/setupplan.py @@ -5,9 +5,13 @@ import pytest def pytest_addoption(parser): group = parser.getgroup("debugconfig") - group.addoption('--setupplan', '--setup-plan', action="store_true", - help="show what fixtures and tests would be executed but " - "don't execute anything.") + group.addoption( + "--setupplan", + "--setup-plan", + action="store_true", + help="show what fixtures and tests would be executed but " + "don't execute anything.", + ) @pytest.hookimpl(tryfirst=True) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/skipping.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/skipping.py new file mode 100644 index 00000000000..a348d5484cd --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/skipping.py @@ -0,0 +1,293 @@ +""" support for skip/xfail functions and markers. """ +from __future__ import absolute_import, division, print_function + +from _pytest.config import hookimpl +from _pytest.mark.evaluate import MarkEvaluator +from _pytest.outcomes import fail, skip, xfail + + +def pytest_addoption(parser): + group = parser.getgroup("general") + group.addoption( + "--runxfail", + action="store_true", + dest="runxfail", + default=False, + help="run tests even if they are marked xfail", + ) + + parser.addini( + "xfail_strict", + "default for the strict parameter of xfail " + "markers when not given explicitly (default: False)", + default=False, + type="bool", + ) + + +def pytest_configure(config): + if config.option.runxfail: + # yay a hack + import pytest + + old = pytest.xfail + config._cleanup.append(lambda: setattr(pytest, "xfail", old)) + + def nop(*args, **kwargs): + pass + + nop.Exception = xfail.Exception + setattr(pytest, "xfail", nop) + + config.addinivalue_line( + "markers", + "skip(reason=None): skip the given test function with an optional reason. " + 'Example: skip(reason="no way of currently testing this") skips the ' + "test.", + ) + config.addinivalue_line( + "markers", + "skipif(condition): skip the given test function if eval(condition) " + "results in a True value. Evaluation happens within the " + "module global context. Example: skipif('sys.platform == \"win32\"') " + "skips the test if we are on the win32 platform. see " + "http://pytest.org/latest/skipping.html", + ) + config.addinivalue_line( + "markers", + "xfail(condition, reason=None, run=True, raises=None, strict=False): " + "mark the test function as an expected failure if eval(condition) " + "has a True value. Optionally specify a reason for better reporting " + "and run=False if you don't even want to execute the test function. " + "If only specific exception(s) are expected, you can list them in " + "raises, and if the test fails in other ways, it will be reported as " + "a true failure. See http://pytest.org/latest/skipping.html", + ) + + +@hookimpl(tryfirst=True) +def pytest_runtest_setup(item): + # Check if skip or skipif are specified as pytest marks + item._skipped_by_mark = False + eval_skipif = MarkEvaluator(item, "skipif") + if eval_skipif.istrue(): + item._skipped_by_mark = True + skip(eval_skipif.getexplanation()) + + for skip_info in item.iter_markers(name="skip"): + item._skipped_by_mark = True + if "reason" in skip_info.kwargs: + skip(skip_info.kwargs["reason"]) + elif skip_info.args: + skip(skip_info.args[0]) + else: + skip("unconditional skip") + + item._evalxfail = MarkEvaluator(item, "xfail") + check_xfail_no_run(item) + + +@hookimpl(hookwrapper=True) +def pytest_pyfunc_call(pyfuncitem): + check_xfail_no_run(pyfuncitem) + outcome = yield + passed = outcome.excinfo is None + if passed: + check_strict_xfail(pyfuncitem) + + +def check_xfail_no_run(item): + """check xfail(run=False)""" + if not item.config.option.runxfail: + evalxfail = item._evalxfail + if evalxfail.istrue(): + if not evalxfail.get("run", True): + xfail("[NOTRUN] " + evalxfail.getexplanation()) + + +def check_strict_xfail(pyfuncitem): + """check xfail(strict=True) for the given PASSING test""" + evalxfail = pyfuncitem._evalxfail + if evalxfail.istrue(): + strict_default = pyfuncitem.config.getini("xfail_strict") + is_strict_xfail = evalxfail.get("strict", strict_default) + if is_strict_xfail: + del pyfuncitem._evalxfail + explanation = evalxfail.getexplanation() + fail("[XPASS(strict)] " + explanation, pytrace=False) + + +@hookimpl(hookwrapper=True) +def pytest_runtest_makereport(item, call): + outcome = yield + rep = outcome.get_result() + evalxfail = getattr(item, "_evalxfail", None) + # unitttest special case, see setting of _unexpectedsuccess + if hasattr(item, "_unexpectedsuccess") and rep.when == "call": + from _pytest.compat import _is_unittest_unexpected_success_a_failure + + if item._unexpectedsuccess: + rep.longrepr = "Unexpected success: {}".format(item._unexpectedsuccess) + else: + rep.longrepr = "Unexpected success" + if _is_unittest_unexpected_success_a_failure(): + rep.outcome = "failed" + else: + rep.outcome = "passed" + rep.wasxfail = rep.longrepr + elif item.config.option.runxfail: + pass # don't interefere + elif call.excinfo and call.excinfo.errisinstance(xfail.Exception): + rep.wasxfail = "reason: " + call.excinfo.value.msg + rep.outcome = "skipped" + elif evalxfail and not rep.skipped and evalxfail.wasvalid() and evalxfail.istrue(): + if call.excinfo: + if evalxfail.invalidraise(call.excinfo.value): + rep.outcome = "failed" + else: + rep.outcome = "skipped" + rep.wasxfail = evalxfail.getexplanation() + elif call.when == "call": + strict_default = item.config.getini("xfail_strict") + is_strict_xfail = evalxfail.get("strict", strict_default) + explanation = evalxfail.getexplanation() + if is_strict_xfail: + rep.outcome = "failed" + rep.longrepr = "[XPASS(strict)] {}".format(explanation) + else: + rep.outcome = "passed" + rep.wasxfail = explanation + elif getattr(item, "_skipped_by_mark", False) and rep.skipped and type( + rep.longrepr + ) is tuple: + # skipped by mark.skipif; change the location of the failure + # to point to the item definition, otherwise it will display + # the location of where the skip exception was raised within pytest + filename, line, reason = rep.longrepr + filename, line = item.location[:2] + rep.longrepr = filename, line, reason + + +# called by terminalreporter progress reporting + + +def pytest_report_teststatus(report): + if hasattr(report, "wasxfail"): + if report.skipped: + return "xfailed", "x", "xfail" + elif report.passed: + return "xpassed", "X", ("XPASS", {"yellow": True}) + + +# called by the terminalreporter instance/plugin + + +def pytest_terminal_summary(terminalreporter): + tr = terminalreporter + if not tr.reportchars: + # for name in "xfailed skipped failed xpassed": + # if not tr.stats.get(name, 0): + # tr.write_line("HINT: use '-r' option to see extra " + # "summary info about tests") + # break + return + + lines = [] + for char in tr.reportchars: + action = REPORTCHAR_ACTIONS.get(char, lambda tr, lines: None) + action(terminalreporter, lines) + + if lines: + tr._tw.sep("=", "short test summary info") + for line in lines: + tr._tw.line(line) + + +def show_simple(terminalreporter, lines, stat, format): + failed = terminalreporter.stats.get(stat) + if failed: + for rep in failed: + pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid) + lines.append(format % (pos,)) + + +def show_xfailed(terminalreporter, lines): + xfailed = terminalreporter.stats.get("xfailed") + if xfailed: + for rep in xfailed: + pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid) + reason = rep.wasxfail + lines.append("XFAIL %s" % (pos,)) + if reason: + lines.append(" " + str(reason)) + + +def show_xpassed(terminalreporter, lines): + xpassed = terminalreporter.stats.get("xpassed") + if xpassed: + for rep in xpassed: + pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid) + reason = rep.wasxfail + lines.append("XPASS %s %s" % (pos, reason)) + + +def folded_skips(skipped): + d = {} + for event in skipped: + key = event.longrepr + assert len(key) == 3, (event, key) + keywords = getattr(event, "keywords", {}) + # folding reports with global pytestmark variable + # this is workaround, because for now we cannot identify the scope of a skip marker + # TODO: revisit after marks scope would be fixed + when = getattr(event, "when", None) + if when == "setup" and "skip" in keywords and "pytestmark" not in keywords: + key = (key[0], None, key[2]) + d.setdefault(key, []).append(event) + values = [] + for key, events in d.items(): + values.append((len(events),) + key) + return values + + +def show_skipped(terminalreporter, lines): + tr = terminalreporter + skipped = tr.stats.get("skipped", []) + if skipped: + # if not tr.hasopt('skipped'): + # tr.write_line( + # "%d skipped tests, specify -rs for more info" % + # len(skipped)) + # return + fskips = folded_skips(skipped) + if fskips: + # tr.write_sep("_", "skipped test summary") + for num, fspath, lineno, reason in fskips: + if reason.startswith("Skipped: "): + reason = reason[9:] + if lineno is not None: + lines.append( + "SKIP [%d] %s:%d: %s" % (num, fspath, lineno + 1, reason) + ) + else: + lines.append("SKIP [%d] %s: %s" % (num, fspath, reason)) + + +def shower(stat, format): + + def show_(terminalreporter, lines): + return show_simple(terminalreporter, lines, stat, format) + + return show_ + + +REPORTCHAR_ACTIONS = { + "x": show_xfailed, + "X": show_xpassed, + "f": shower("failed", "FAIL %s"), + "F": shower("failed", "FAIL %s"), + "s": show_skipped, + "S": show_skipped, + "p": shower("passed", "PASSED %s"), + "E": shower("error", "ERROR %s"), +} diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/terminal.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/terminal.py similarity index 65% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/terminal.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/terminal.py index 1aba5e845e5..9c4eec7531a 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/terminal.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/terminal.py @@ -12,73 +12,163 @@ import time import pluggy import py import six +from more_itertools import collapse import pytest from _pytest import nodes -from _pytest.main import EXIT_OK, EXIT_TESTSFAILED, EXIT_INTERRUPTED, \ - EXIT_USAGEERROR, EXIT_NOTESTSCOLLECTED +from _pytest.main import ( + EXIT_OK, + EXIT_TESTSFAILED, + EXIT_INTERRUPTED, + EXIT_USAGEERROR, + EXIT_NOTESTSCOLLECTED, +) + + +import argparse + + +class MoreQuietAction(argparse.Action): + """ + a modified copy of the argparse count action which counts down and updates + the legacy quiet attribute at the same time + + used to unify verbosity handling + """ + + def __init__(self, option_strings, dest, default=None, required=False, help=None): + super(MoreQuietAction, self).__init__( + option_strings=option_strings, + dest=dest, + nargs=0, + default=default, + required=required, + help=help, + ) + + def __call__(self, parser, namespace, values, option_string=None): + new_count = getattr(namespace, self.dest, 0) - 1 + setattr(namespace, self.dest, new_count) + # todo Deprecate config.quiet + namespace.quiet = getattr(namespace, "quiet", 0) + 1 def pytest_addoption(parser): group = parser.getgroup("terminal reporting", "reporting", after="general") - group._addoption('-v', '--verbose', action="count", - dest="verbose", default=0, help="increase verbosity."), - group._addoption('-q', '--quiet', action="count", - dest="quiet", default=0, help="decrease verbosity."), - group._addoption('-r', - action="store", dest="reportchars", default='', metavar="chars", - help="show extra test summary info as specified by chars (f)ailed, " - "(E)error, (s)skipped, (x)failed, (X)passed, " - "(p)passed, (P)passed with output, (a)all except pP. " - "Warnings are displayed at all times except when " - "--disable-warnings is set") - group._addoption('--disable-warnings', '--disable-pytest-warnings', default=False, - dest='disable_warnings', action='store_true', - help='disable warnings summary') - group._addoption('-l', '--showlocals', - action="store_true", dest="showlocals", default=False, - help="show locals in tracebacks (disabled by default).") - group._addoption('--tb', metavar="style", - action="store", dest="tbstyle", default='auto', - choices=['auto', 'long', 'short', 'no', 'line', 'native'], - help="traceback print mode (auto/long/short/line/native/no).") - group._addoption('--fulltrace', '--full-trace', - action="store_true", default=False, - help="don't cut any tracebacks (default is to cut).") - group._addoption('--color', metavar="color", - action="store", dest="color", default='auto', - choices=['yes', 'no', 'auto'], - help="color terminal output (yes/no/auto).") + group._addoption( + "-v", + "--verbose", + action="count", + default=0, + dest="verbose", + help="increase verbosity.", + ), + group._addoption( + "-q", + "--quiet", + action=MoreQuietAction, + default=0, + dest="verbose", + help="decrease verbosity.", + ), + group._addoption( + "--verbosity", dest="verbose", type=int, default=0, help="set verbosity" + ) + group._addoption( + "-r", + action="store", + dest="reportchars", + default="", + metavar="chars", + help="show extra test summary info as specified by chars (f)ailed, " + "(E)error, (s)skipped, (x)failed, (X)passed, " + "(p)passed, (P)passed with output, (a)all except pP. " + "Warnings are displayed at all times except when " + "--disable-warnings is set", + ) + group._addoption( + "--disable-warnings", + "--disable-pytest-warnings", + default=False, + dest="disable_warnings", + action="store_true", + help="disable warnings summary", + ) + group._addoption( + "-l", + "--showlocals", + action="store_true", + dest="showlocals", + default=False, + help="show locals in tracebacks (disabled by default).", + ) + group._addoption( + "--tb", + metavar="style", + action="store", + dest="tbstyle", + default="auto", + choices=["auto", "long", "short", "no", "line", "native"], + help="traceback print mode (auto/long/short/line/native/no).", + ) + group._addoption( + "--show-capture", + action="store", + dest="showcapture", + choices=["no", "stdout", "stderr", "log", "all"], + default="all", + help="Controls how captured stdout/stderr/log is shown on failed tests. " + "Default is 'all'.", + ) + group._addoption( + "--fulltrace", + "--full-trace", + action="store_true", + default=False, + help="don't cut any tracebacks (default is to cut).", + ) + group._addoption( + "--color", + metavar="color", + action="store", + dest="color", + default="auto", + choices=["yes", "no", "auto"], + help="color terminal output (yes/no/auto).", + ) - parser.addini("console_output_style", - help="console output: classic or with additional progress information (classic|progress).", - default='progress') + parser.addini( + "console_output_style", + help="console output: classic or with additional progress information (classic|progress).", + default="progress", + ) def pytest_configure(config): - config.option.verbose -= config.option.quiet reporter = TerminalReporter(config, sys.stdout) - config.pluginmanager.register(reporter, 'terminalreporter') + config.pluginmanager.register(reporter, "terminalreporter") if config.option.debug or config.option.traceconfig: + def mywriter(tags, args): msg = " ".join(map(str, args)) reporter.write_line("[traceconfig] " + msg) + config.trace.root.setprocessor("pytest:config", mywriter) def getreportopt(config): reportopts = "" reportchars = config.option.reportchars - if not config.option.disable_warnings and 'w' not in reportchars: - reportchars += 'w' - elif config.option.disable_warnings and 'w' in reportchars: - reportchars = reportchars.replace('w', '') + if not config.option.disable_warnings and "w" not in reportchars: + reportchars += "w" + elif config.option.disable_warnings and "w" in reportchars: + reportchars = reportchars.replace("w", "") if reportchars: for char in reportchars: - if char not in reportopts and char != 'a': + if char not in reportopts and char != "a": reportopts += char - elif char == 'a': - reportopts = 'fEsxXw' + elif char == "a": + reportopts = "fEsxXw" return reportopts @@ -94,7 +184,7 @@ def pytest_report_teststatus(report): return report.outcome, letter, report.outcome.upper() -class WarningReport: +class WarningReport(object): """ Simple structure to hold warnings information captured by ``pytest_logwarning``. """ @@ -123,15 +213,17 @@ class WarningReport: if isinstance(self.fslocation, tuple) and len(self.fslocation) >= 2: filename, linenum = self.fslocation[:2] relpath = py.path.local(filename).relto(config.invocation_dir) - return '%s:%s' % (relpath, linenum) + return "%s:%s" % (relpath, linenum) else: return str(self.fslocation) return None -class TerminalReporter: +class TerminalReporter(object): + def __init__(self, config, file=None): import _pytest.config + self.config = config self.verbosity = self.config.option.verbose self.showheader = self.verbosity >= 0 @@ -152,11 +244,21 @@ class TerminalReporter: self.reportchars = getreportopt(config) self.hasmarkup = self._tw.hasmarkup self.isatty = file.isatty() - self._progress_items_reported = 0 - self._show_progress_info = self.config.getini('console_output_style') == 'progress' + self._progress_nodeids_reported = set() + self._show_progress_info = self._determine_show_progress_info() + + def _determine_show_progress_info(self): + """Return True if we should display progress information based on the current config""" + # do not show progress if we are not capturing output (#3038) + if self.config.getoption("capture") == "no": + return False + # do not show progress if we are showing fixture setup/teardown + if self.config.getoption("setupshow"): + return False + return self.config.getini("console_output_style") == "progress" def hasopt(self, char): - char = {'xfailed': 'x', 'skipped': 's'}.get(char, char) + char = {"xfailed": "x", "skipped": "s"}.get(char, char) return char in self.reportchars def write_fspath_result(self, nodeid, res): @@ -178,7 +280,6 @@ class TerminalReporter: if extra: self._tw.write(extra, **kwargs) self.currentfspath = -2 - self._write_progress_information_filling_space() def ensure_newline(self): if self.currentfspath: @@ -203,12 +304,12 @@ class TerminalReporter: The rest of the keyword arguments are markup instructions. """ - erase = markup.pop('erase', False) + erase = markup.pop("erase", False) if erase: fill_count = self._tw.fullwidth - len(line) - 1 - fill = ' ' * fill_count + fill = " " * fill_count else: - fill = '' + fill = "" line = str(line) self._tw.write("\r" + line + fill, **markup) @@ -229,8 +330,9 @@ class TerminalReporter: def pytest_logwarning(self, code, fslocation, message, nodeid): warnings = self.stats.setdefault("warnings", []) - warning = WarningReport(code=code, fslocation=fslocation, - message=message, nodeid=nodeid) + warning = WarningReport( + code=code, fslocation=fslocation, message=message, nodeid=nodeid + ) warnings.append(warning) def pytest_plugin_registered(self, plugin): @@ -242,7 +344,7 @@ class TerminalReporter: self.write_line(msg) def pytest_deselected(self, items): - self.stats.setdefault('deselected', []).extend(items) + self.stats.setdefault("deselected", []).extend(items) def pytest_runtest_logstart(self, nodeid, location): # ensure that the path is printed before the @@ -267,65 +369,71 @@ class TerminalReporter: if not letter and not word: # probably passed setup/teardown return - running_xdist = hasattr(rep, 'node') - self._progress_items_reported += 1 + running_xdist = hasattr(rep, "node") if self.verbosity <= 0: if not running_xdist and self.showfspath: self.write_fspath_result(rep.nodeid, letter) else: self._tw.write(letter) - self._write_progress_if_past_edge() else: + self._progress_nodeids_reported.add(rep.nodeid) if markup is None: if rep.passed: - markup = {'green': True} + markup = {"green": True} elif rep.failed: - markup = {'red': True} + markup = {"red": True} elif rep.skipped: - markup = {'yellow': True} + markup = {"yellow": True} else: markup = {} line = self._locationline(rep.nodeid, *rep.location) if not running_xdist: self.write_ensure_prefix(line, word, **markup) + if self._show_progress_info: + self._write_progress_information_filling_space() else: self.ensure_newline() self._tw.write("[%s]" % rep.node.gateway.id) if self._show_progress_info: - self._tw.write(self._get_progress_information_message() + " ", cyan=True) + self._tw.write( + self._get_progress_information_message() + " ", cyan=True + ) else: - self._tw.write(' ') + self._tw.write(" ") self._tw.write(word, **markup) self._tw.write(" " + line) self.currentfspath = -2 - def _write_progress_if_past_edge(self): - if not self._show_progress_info: - return - last_item = self._progress_items_reported == self._session.testscollected - if last_item: - self._write_progress_information_filling_space() - return + def pytest_runtest_logfinish(self, nodeid): + if self.verbosity <= 0 and self._show_progress_info: + self._progress_nodeids_reported.add(nodeid) + last_item = len( + self._progress_nodeids_reported + ) == self._session.testscollected + if last_item: + self._write_progress_information_filling_space() + else: + past_edge = self._tw.chars_on_current_line + self._PROGRESS_LENGTH + 1 >= self._screen_width + if past_edge: + msg = self._get_progress_information_message() + self._tw.write(msg + "\n", cyan=True) - past_edge = self._tw.chars_on_current_line + self._PROGRESS_LENGTH + 1 >= self._screen_width - if past_edge: - msg = self._get_progress_information_message() - self._tw.write(msg + '\n', cyan=True) - - _PROGRESS_LENGTH = len(' [100%]') + _PROGRESS_LENGTH = len(" [100%]") def _get_progress_information_message(self): + if self.config.getoption("capture") == "no": + return "" collected = self._session.testscollected if collected: - progress = self._progress_items_reported * 100 // collected - return ' [{:3d}%]'.format(progress) - return ' [100%]' + progress = len(self._progress_nodeids_reported) * 100 // collected + return " [{:3d}%]".format(progress) + return " [100%]" def _write_progress_information_filling_space(self): - if not self._show_progress_info: - return msg = self._get_progress_information_message() - fill = ' ' * (self._tw.fullwidth - self._tw.chars_on_current_line - len(msg) - 1) + fill = " " * ( + self._tw.fullwidth - self._tw.chars_on_current_line - len(msg) - 1 + ) self.write(fill + msg, cyan=True) def pytest_collection(self): @@ -347,24 +455,30 @@ class TerminalReporter: if self.config.option.verbose < 0: return - errors = len(self.stats.get('error', [])) - skipped = len(self.stats.get('skipped', [])) + errors = len(self.stats.get("error", [])) + skipped = len(self.stats.get("skipped", [])) + deselected = len(self.stats.get("deselected", [])) if final: line = "collected " else: line = "collecting " - line += str(self._numcollected) + " item" + ('' if self._numcollected == 1 else 's') + line += str(self._numcollected) + " item" + ( + "" if self._numcollected == 1 else "s" + ) if errors: line += " / %d errors" % errors + if deselected: + line += " / %d deselected" % deselected if skipped: line += " / %d skipped" % skipped if self.isatty: self.rewrite(line, bold=True, erase=True) if final: - self.write('\n') + self.write("\n") else: self.write_line(line) + @pytest.hookimpl(trylast=True) def pytest_collection_modifyitems(self): self.report_collect(True) @@ -377,22 +491,27 @@ class TerminalReporter: self.write_sep("=", "test session starts", bold=True) verinfo = platform.python_version() msg = "platform %s -- Python %s" % (sys.platform, verinfo) - if hasattr(sys, 'pypy_version_info'): + if hasattr(sys, "pypy_version_info"): verinfo = ".".join(map(str, sys.pypy_version_info[:3])) msg += "[pypy-%s-%s]" % (verinfo, sys.pypy_version_info[3]) msg += ", pytest-%s, py-%s, pluggy-%s" % ( - pytest.__version__, py.__version__, pluggy.__version__) - if self.verbosity > 0 or self.config.option.debug or \ - getattr(self.config.option, 'pastebin', None): + pytest.__version__, py.__version__, pluggy.__version__ + ) + if ( + self.verbosity > 0 + or self.config.option.debug + or getattr(self.config.option, "pastebin", None) + ): msg += " -- " + str(sys.executable) self.write_line(msg) lines = self.config.hook.pytest_report_header( - config=self.config, startdir=self.startdir) + config=self.config, startdir=self.startdir + ) self._write_report_lines_from_hooks(lines) def _write_report_lines_from_hooks(self, lines): lines.reverse() - for line in flatten(lines): + for line in collapse(lines): self.write_line(line) def pytest_report_header(self, config): @@ -404,21 +523,21 @@ class TerminalReporter: plugininfo = config.pluginmanager.list_plugin_distinfo() if plugininfo: - lines.append( - "plugins: %s" % ", ".join(_plugin_nameversions(plugininfo))) + lines.append("plugins: %s" % ", ".join(_plugin_nameversions(plugininfo))) return lines def pytest_collection_finish(self, session): if self.config.option.collectonly: self._printcollecteditems(session.items) - if self.stats.get('failed'): + if self.stats.get("failed"): self._tw.sep("!", "collection failures") - for rep in self.stats.get('failed'): + for rep in self.stats.get("failed"): rep.toterminal(self._tw) return 1 return 0 lines = self.config.hook.pytest_report_collectionfinish( - config=self.config, startdir=self.startdir, items=session.items) + config=self.config, startdir=self.startdir, items=session.items + ) self._write_report_lines_from_hooks(lines) def _printcollecteditems(self, items): @@ -429,7 +548,7 @@ class TerminalReporter: if self.config.option.verbose < -1: counts = {} for item in items: - name = item.nodeid.split('::', 1)[0] + name = item.nodeid.split("::", 1)[0] counts[name] = counts.get(name, 0) + 1 for name, count in sorted(counts.items()): self._tw.line("%s: %d" % (name, count)) @@ -460,26 +579,34 @@ class TerminalReporter: outcome.get_result() self._tw.line("") summary_exit_codes = ( - EXIT_OK, EXIT_TESTSFAILED, EXIT_INTERRUPTED, EXIT_USAGEERROR, - EXIT_NOTESTSCOLLECTED) + EXIT_OK, + EXIT_TESTSFAILED, + EXIT_INTERRUPTED, + EXIT_USAGEERROR, + EXIT_NOTESTSCOLLECTED, + ) if exitstatus in summary_exit_codes: - self.config.hook.pytest_terminal_summary(terminalreporter=self, - exitstatus=exitstatus) - self.summary_errors() - self.summary_failures() - self.summary_warnings() - self.summary_passes() + self.config.hook.pytest_terminal_summary( + terminalreporter=self, exitstatus=exitstatus + ) if exitstatus == EXIT_INTERRUPTED: self._report_keyboardinterrupt() del self._keyboardinterrupt_memo - self.summary_deselected() self.summary_stats() + @pytest.hookimpl(hookwrapper=True) + def pytest_terminal_summary(self): + self.summary_errors() + self.summary_failures() + yield + self.summary_warnings() + self.summary_passes() + def pytest_keyboard_interrupt(self, excinfo): self._keyboardinterrupt_memo = excinfo.getrepr(funcargs=True) def pytest_unconfigure(self): - if hasattr(self, '_keyboardinterrupt_memo'): + if hasattr(self, "_keyboardinterrupt_memo"): self._report_keyboardinterrupt() def _report_keyboardinterrupt(self): @@ -490,18 +617,23 @@ class TerminalReporter: if self.config.option.fulltrace: excrepr.toterminal(self._tw) else: - self._tw.line("to show a full traceback on KeyboardInterrupt use --fulltrace", yellow=True) excrepr.reprcrash.toterminal(self._tw) + self._tw.line( + "(to show a full traceback on KeyboardInterrupt use --fulltrace)", + yellow=True, + ) def _locationline(self, nodeid, fspath, lineno, domain): + def mkrel(nodeid): line = self.config.cwd_relative_nodeid(nodeid) if domain and line.endswith(domain): line = line[:-len(domain)] values = domain.split("[") - values[0] = values[0].replace('.', '::') # don't replace '.' in params + values[0] = values[0].replace(".", "::") # don't replace '.' in params line += "[".join(values) return line + # collect_fspath comes from testid which has a "/"-normalized path if fspath: @@ -513,7 +645,7 @@ class TerminalReporter: return res + " " def _getfailureheadline(self, rep): - if hasattr(rep, 'location'): + if hasattr(rep, "location"): fspath, lineno, domain = rep.location return domain else: @@ -534,7 +666,7 @@ class TerminalReporter: def getreports(self, name): values = [] for x in self.stats.get(name, []): - if not hasattr(x, '_pdbshown'): + if not hasattr(x, "_pdbshown"): values.append(x) return values @@ -544,22 +676,24 @@ class TerminalReporter: if not all_warnings: return - grouped = itertools.groupby(all_warnings, key=lambda wr: wr.get_location(self.config)) + grouped = itertools.groupby( + all_warnings, key=lambda wr: wr.get_location(self.config) + ) self.write_sep("=", "warnings summary", yellow=True, bold=False) for location, warning_records in grouped: - self._tw.line(str(location) or '') + self._tw.line(str(location) if location else "") for w in warning_records: lines = w.message.splitlines() - indented = '\n'.join(' ' + x for x in lines) + indented = "\n".join(" " + x for x in lines) self._tw.line(indented) self._tw.line() - self._tw.line('-- Docs: http://doc.pytest.org/en/latest/warnings.html') + self._tw.line("-- Docs: http://doc.pytest.org/en/latest/warnings.html") def summary_passes(self): if self.config.option.tbstyle != "no": if self.hasopt("P"): - reports = self.getreports('passed') + reports = self.getreports("passed") if not reports: return self.write_sep("=", "PASSES") @@ -570,15 +704,15 @@ class TerminalReporter: def print_teardown_sections(self, rep): for secname, content in rep.sections: - if 'teardown' in secname: - self._tw.sep('-', secname) + if "teardown" in secname: + self._tw.sep("-", secname) if content[-1:] == "\n": content = content[:-1] self._tw.line(content) def summary_failures(self): if self.config.option.tbstyle != "no": - reports = self.getreports('failed') + reports = self.getreports("failed") if not reports: return self.write_sep("=", "FAILURES") @@ -588,22 +722,22 @@ class TerminalReporter: self.write_line(line) else: msg = self._getfailureheadline(rep) - markup = {'red': True, 'bold': True} + markup = {"red": True, "bold": True} self.write_sep("_", msg, **markup) self._outrep_summary(rep) - for report in self.getreports(''): - if report.nodeid == rep.nodeid and report.when == 'teardown': + for report in self.getreports(""): + if report.nodeid == rep.nodeid and report.when == "teardown": self.print_teardown_sections(report) def summary_errors(self): if self.config.option.tbstyle != "no": - reports = self.getreports('error') + reports = self.getreports("error") if not reports: return self.write_sep("=", "ERRORS") - for rep in self.stats['error']: + for rep in self.stats["error"]: msg = self._getfailureheadline(rep) - if not hasattr(rep, 'when'): + if not hasattr(rep, "when"): # collect msg = "ERROR collecting " + msg elif rep.when == "setup": @@ -615,7 +749,12 @@ class TerminalReporter: def _outrep_summary(self, rep): rep.toterminal(self._tw) + showcapture = self.config.option.showcapture + if showcapture == "no": + return for secname, content in rep.sections: + if showcapture != "all" and showcapture not in secname: + continue self._tw.sep("-", secname) if content[-1:] == "\n": content = content[:-1] @@ -625,18 +764,13 @@ class TerminalReporter: session_duration = time.time() - self._sessionstarttime (line, color) = build_summary_stats_line(self.stats) msg = "%s in %.2f seconds" % (line, session_duration) - markup = {color: True, 'bold': True} + markup = {color: True, "bold": True} if self.verbosity >= 0: self.write_sep("=", msg, **markup) if self.verbosity == -1: self.write_line(msg, **markup) - def summary_deselected(self): - if 'deselected' in self.stats: - self.write_sep("=", "%d tests deselected" % ( - len(self.stats['deselected'])), bold=True) - def repr_pythonversion(v=None): if v is None: @@ -647,18 +781,10 @@ def repr_pythonversion(v=None): return str(v) -def flatten(values): - for x in values: - if isinstance(x, (list, tuple)): - for y in flatten(x): - yield y - else: - yield x - - def build_summary_stats_line(stats): - keys = ("failed passed skipped deselected " - "xfailed xpassed warnings error").split() + keys = ( + "failed passed skipped deselected " "xfailed xpassed warnings error" + ).split() unknown_key_seen = False for key in stats.keys(): if key not in keys: @@ -676,14 +802,14 @@ def build_summary_stats_line(stats): else: line = "no tests ran" - if 'failed' in stats or 'error' in stats: - color = 'red' - elif 'warnings' in stats or unknown_key_seen: - color = 'yellow' - elif 'passed' in stats: - color = 'green' + if "failed" in stats or "error" in stats: + color = "red" + elif "warnings" in stats or unknown_key_seen: + color = "yellow" + elif "passed" in stats: + color = "green" else: - color = 'yellow' + color = "yellow" return (line, color) @@ -692,7 +818,7 @@ def _plugin_nameversions(plugininfo): values = [] for plugin, dist in plugininfo: # gets us name and version! - name = '{dist.project_name}-{dist.version}'.format(dist=dist) + name = "{dist.project_name}-{dist.version}".format(dist=dist) # questionable convenience, but it keeps things short if name.startswith("pytest-"): name = name[7:] diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/tmpdir.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/tmpdir.py similarity index 86% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/tmpdir.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/tmpdir.py index da1b032237a..260d2842234 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/tmpdir.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/tmpdir.py @@ -8,7 +8,7 @@ import py from _pytest.monkeypatch import MonkeyPatch -class TempdirFactory: +class TempdirFactory(object): """Factory for temporary directories under the common base temp directory. The base directory can be configured using the ``--basetemp`` option. @@ -37,8 +37,9 @@ class TempdirFactory: if not numbered: p = basetemp.mkdir(basename) else: - p = py.path.local.make_numbered_dir(prefix=basename, - keep=0, rootdir=basetemp, lock_timeout=None) + p = py.path.local.make_numbered_dir( + prefix=basename, keep=0, rootdir=basetemp, lock_timeout=None + ) self.trace("mktemp", p) return p @@ -59,12 +60,13 @@ class TempdirFactory: if user: # use a sub-directory in the temproot to speed-up # make_numbered_dir() call - rootdir = temproot.join('pytest-of-%s' % user) + rootdir = temproot.join("pytest-of-%s" % user) else: rootdir = temproot rootdir.ensure(dir=1) - basetemp = py.path.local.make_numbered_dir(prefix='pytest-', - rootdir=rootdir) + basetemp = py.path.local.make_numbered_dir( + prefix="pytest-", rootdir=rootdir + ) self._basetemp = t = basetemp.realpath() self.trace("new basetemp", t) return t @@ -78,6 +80,7 @@ def get_user(): in the current environment (see #1010). """ import getpass + try: return getpass.getuser() except (ImportError, KeyError): @@ -98,11 +101,11 @@ def pytest_configure(config): mp = MonkeyPatch() t = TempdirFactory(config) config._cleanup.extend([mp.undo, t.finish]) - mp.setattr(config, '_tmpdirhandler', t, raising=False) - mp.setattr(pytest, 'ensuretemp', t.ensuretemp, raising=False) + mp.setattr(config, "_tmpdirhandler", t, raising=False) + mp.setattr(pytest, "ensuretemp", t.ensuretemp, raising=False) -@pytest.fixture(scope='session') +@pytest.fixture(scope="session") def tmpdir_factory(request): """Return a TempdirFactory instance for the test session. """ @@ -116,6 +119,8 @@ def tmpdir(request, tmpdir_factory): created as a sub directory of the base temporary directory. The returned object is a `py.path.local`_ path object. + + .. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html """ name = request.node.name name = re.sub(r"[\W]", "_", name) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/unittest.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/unittest.py similarity index 77% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/unittest.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/unittest.py index 3ddb39495e3..6ad9fda8870 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/unittest.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/unittest.py @@ -29,18 +29,19 @@ class UnitTestCase(Class): def setup(self): cls = self.obj - if getattr(cls, '__unittest_skip__', False): + if getattr(cls, "__unittest_skip__", False): return # skipped - setup = getattr(cls, 'setUpClass', None) + setup = getattr(cls, "setUpClass", None) if setup is not None: setup() - teardown = getattr(cls, 'tearDownClass', None) + teardown = getattr(cls, "tearDownClass", None) if teardown is not None: self.addfinalizer(teardown) super(UnitTestCase, self).setup() def collect(self): from unittest import TestLoader + cls = self.obj if not getattr(cls, "__test__", True): return @@ -50,29 +51,30 @@ class UnitTestCase(Class): foundsomething = False for name in loader.getTestCaseNames(self.obj): x = getattr(self.obj, name) - if not getattr(x, '__test__', True): + if not getattr(x, "__test__", True): continue - funcobj = getattr(x, 'im_func', x) + funcobj = getattr(x, "im_func", x) transfer_markers(funcobj, cls, module) - yield TestCaseFunction(name, parent=self) + yield TestCaseFunction(name, parent=self, callobj=funcobj) foundsomething = True if not foundsomething: - runtest = getattr(self.obj, 'runTest', None) + runtest = getattr(self.obj, "runTest", None) if runtest is not None: ut = sys.modules.get("twisted.trial.unittest", None) if ut is None or runtest != ut.TestCase.runTest: - yield TestCaseFunction('runTest', parent=self) + yield TestCaseFunction("runTest", parent=self) class TestCaseFunction(Function): + nofuncargs = True _excinfo = None def setup(self): self._testcase = self.parent.obj(self.name) self._fix_unittest_skip_decorator() self._obj = getattr(self._testcase, self.name) - if hasattr(self._testcase, 'setup_method'): + if hasattr(self._testcase, "setup_method"): self._testcase.setup_method(self._obj) if hasattr(self, "_request"): self._request._fillfixtures() @@ -91,7 +93,7 @@ class TestCaseFunction(Function): setattr(self._testcase, "__name__", self.name) def teardown(self): - if hasattr(self._testcase, 'teardown_method'): + if hasattr(self._testcase, "teardown_method"): self._testcase.teardown_method(self._obj) # Allow garbage collection on TestCase instance attributes. self._testcase = None @@ -102,26 +104,32 @@ class TestCaseFunction(Function): def _addexcinfo(self, rawexcinfo): # unwrap potential exception info (see twisted trial support below) - rawexcinfo = getattr(rawexcinfo, '_rawexcinfo', rawexcinfo) + rawexcinfo = getattr(rawexcinfo, "_rawexcinfo", rawexcinfo) try: excinfo = _pytest._code.ExceptionInfo(rawexcinfo) except TypeError: try: try: values = traceback.format_exception(*rawexcinfo) - values.insert(0, "NOTE: Incompatible Exception Representation, " - "displaying natively:\n\n") + values.insert( + 0, + "NOTE: Incompatible Exception Representation, " + "displaying natively:\n\n", + ) fail("".join(values), pytrace=False) except (fail.Exception, KeyboardInterrupt): raise except: # noqa - fail("ERROR: Unknown Incompatible Exception " - "representation:\n%r" % (rawexcinfo,), pytrace=False) + fail( + "ERROR: Unknown Incompatible Exception " + "representation:\n%r" % (rawexcinfo,), + pytrace=False, + ) except KeyboardInterrupt: raise except fail.Exception: excinfo = _pytest._code.ExceptionInfo() - self.__dict__.setdefault('_excinfo', []).append(excinfo) + self.__dict__.setdefault("_excinfo", []).append(excinfo) def addError(self, testcase, rawexcinfo): self._addexcinfo(rawexcinfo) @@ -155,11 +163,15 @@ class TestCaseFunction(Function): # implements the skipping machinery (see #2137) # analog to pythons Lib/unittest/case.py:run testMethod = getattr(self._testcase, self._testcase._testMethodName) - if (getattr(self._testcase.__class__, "__unittest_skip__", False) or - getattr(testMethod, "__unittest_skip__", False)): + if ( + getattr(self._testcase.__class__, "__unittest_skip__", False) + or getattr(testMethod, "__unittest_skip__", False) + ): # If the class or method was skipped. - skip_why = (getattr(self._testcase.__class__, '__unittest_skip_why__', '') or - getattr(testMethod, '__unittest_skip_why__', '')) + skip_why = ( + getattr(self._testcase.__class__, "__unittest_skip_why__", "") + or getattr(testMethod, "__unittest_skip_why__", "") + ) try: # PY3, unittest2 on PY2 self._testcase._addSkip(self, self._testcase, skip_why) except TypeError: # PY2 @@ -181,7 +193,8 @@ class TestCaseFunction(Function): def _prunetraceback(self, excinfo): Function._prunetraceback(self, excinfo) traceback = excinfo.traceback.filter( - lambda x: not x.frame.f_globals.get('__unittest')) + lambda x: not x.frame.f_globals.get("__unittest") + ) if traceback: excinfo.traceback = traceback @@ -196,19 +209,20 @@ def pytest_runtest_makereport(item, call): except AttributeError: pass + # twisted trial support @hookimpl(hookwrapper=True) def pytest_runtest_protocol(item): - if isinstance(item, TestCaseFunction) and \ - 'twisted.trial.unittest' in sys.modules: - ut = sys.modules['twisted.python.failure'] + if isinstance(item, TestCaseFunction) and "twisted.trial.unittest" in sys.modules: + ut = sys.modules["twisted.python.failure"] Failure__init__ = ut.Failure.__init__ check_testcase_implements_trial_reporter() - def excstore(self, exc_value=None, exc_type=None, exc_tb=None, - captureVars=None): + def excstore( + self, exc_value=None, exc_type=None, exc_tb=None, captureVars=None + ): if exc_value is None: self._rawexcinfo = sys.exc_info() else: @@ -216,8 +230,9 @@ def pytest_runtest_protocol(item): exc_type = type(exc_value) self._rawexcinfo = (exc_type, exc_value, exc_tb) try: - Failure__init__(self, exc_value, exc_type, exc_tb, - captureVars=captureVars) + Failure__init__( + self, exc_value, exc_type, exc_tb, captureVars=captureVars + ) except TypeError: Failure__init__(self, exc_value, exc_type, exc_tb) @@ -233,5 +248,6 @@ def check_testcase_implements_trial_reporter(done=[]): return from zope.interface import classImplements from twisted.trial.itrial import IReporter + classImplements(TestCaseFunction, IReporter) done.append(1) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/warnings.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/warnings.py similarity index 66% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/warnings.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/warnings.py index 3c2b1914fb6..e023d0ab491 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/warnings.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/warnings.py @@ -12,13 +12,12 @@ def _setoption(wmod, arg): """ Copy of the warning._setoption function but does not escape arguments. """ - parts = arg.split(':') + parts = arg.split(":") if len(parts) > 5: raise wmod._OptionError("too many fields (max 5): %r" % (arg,)) while len(parts) < 5: - parts.append('') - action, message, category, module, lineno = [s.strip() - for s in parts] + parts.append("") + action, message, category, module, lineno = [s.strip() for s in parts] action = wmod._getaction(action) category = wmod._getcategory(category) if lineno: @@ -36,12 +35,18 @@ def _setoption(wmod, arg): def pytest_addoption(parser): group = parser.getgroup("pytest-warnings") group.addoption( - '-W', '--pythonwarnings', action='append', - help="set which warnings to report, see -W option of python itself.") - parser.addini("filterwarnings", type="linelist", - help="Each line specifies a pattern for " - "warnings.filterwarnings. " - "Processed after -W and --pythonwarnings.") + "-W", + "--pythonwarnings", + action="append", + help="set which warnings to report, see -W option of python itself.", + ) + parser.addini( + "filterwarnings", + type="linelist", + help="Each line specifies a pattern for " + "warnings.filterwarnings. " + "Processed after -W and --pythonwarnings.", + ) @contextmanager @@ -51,7 +56,7 @@ def catch_warnings_for_item(item): of the given item and after it is done posts them as warnings to this item. """ - args = item.config.getoption('pythonwarnings') or [] + args = item.config.getoption("pythonwarnings") or [] inifilters = item.config.getini("filterwarnings") with warnings.catch_warnings(record=True) as log: for arg in args: @@ -60,8 +65,7 @@ def catch_warnings_for_item(item): for arg in inifilters: _setoption(warnings, arg) - mark = item.get_marker('filterwarnings') - if mark: + for mark in item.iter_markers(name="filterwarnings"): for arg in mark.args: warnings._setoption(arg) @@ -71,23 +75,35 @@ def catch_warnings_for_item(item): warn_msg = warning.message unicode_warning = False - if compat._PY2 and any(isinstance(m, compat.UNICODE_TYPES) for m in warn_msg.args): + if ( + compat._PY2 + and any(isinstance(m, compat.UNICODE_TYPES) for m in warn_msg.args) + ): new_args = [] for m in warn_msg.args: - new_args.append(compat.ascii_escaped(m) if isinstance(m, compat.UNICODE_TYPES) else m) + new_args.append( + compat.ascii_escaped(m) + if isinstance(m, compat.UNICODE_TYPES) + else m + ) unicode_warning = list(warn_msg.args) != new_args warn_msg.args = new_args msg = warnings.formatwarning( - warn_msg, warning.category, - warning.filename, warning.lineno, warning.line) + warn_msg, + warning.category, + warning.filename, + warning.lineno, + warning.line, + ) item.warn("unused", msg) if unicode_warning: warnings.warn( "Warning is using unicode non convertible to ascii, " "converting to a safe representation:\n %s" % msg, - UnicodeWarning) + UnicodeWarning, + ) @pytest.hookimpl(hookwrapper=True) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/pytest.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/pytest.py similarity index 55% rename from tests/wpt/web-platform-tests/tools/third_party/pytest/pytest.py rename to tests/wpt/web-platform-tests/tools/third_party/pytest/src/pytest.py index 2b681b64b4c..f27f5a1955b 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/pytest.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/src/pytest.py @@ -6,10 +6,7 @@ pytest: unit and functional testing with Python. # else we are imported -from _pytest.config import ( - main, UsageError, cmdline, - hookspec, hookimpl -) +from _pytest.config import main, UsageError, cmdline, hookspec, hookimpl from _pytest.fixtures import fixture, yield_fixture from _pytest.assertion import register_assert_rewrite from _pytest.freeze_support import freeze_includes @@ -18,60 +15,58 @@ from _pytest.debugging import pytestPDB as __pytestPDB from _pytest.recwarn import warns, deprecated_call from _pytest.outcomes import fail, skip, importorskip, exit, xfail from _pytest.mark import MARK_GEN as mark, param -from _pytest.main import Item, Collector, File, Session +from _pytest.main import Session +from _pytest.nodes import Item, Collector, File from _pytest.fixtures import fillfixtures as _fillfuncargs -from _pytest.python import ( - Module, Class, Instance, Function, Generator, -) +from _pytest.python import Module, Class, Instance, Function, Generator from _pytest.python_api import approx, raises set_trace = __pytestPDB.set_trace __all__ = [ - 'main', - 'UsageError', - 'cmdline', - 'hookspec', - 'hookimpl', - '__version__', - 'register_assert_rewrite', - 'freeze_includes', - 'set_trace', - 'warns', - 'deprecated_call', - 'fixture', - 'yield_fixture', - 'fail', - 'skip', - 'xfail', - 'importorskip', - 'exit', - 'mark', - 'param', - 'approx', - '_fillfuncargs', - - 'Item', - 'File', - 'Collector', - 'Session', - 'Module', - 'Class', - 'Instance', - 'Function', - 'Generator', - 'raises', - - + "main", + "UsageError", + "cmdline", + "hookspec", + "hookimpl", + "__version__", + "register_assert_rewrite", + "freeze_includes", + "set_trace", + "warns", + "deprecated_call", + "fixture", + "yield_fixture", + "fail", + "skip", + "xfail", + "importorskip", + "exit", + "mark", + "param", + "approx", + "_fillfuncargs", + "Item", + "File", + "Collector", + "Session", + "Module", + "Class", + "Instance", + "Function", + "Generator", + "raises", ] -if __name__ == '__main__': +if __name__ == "__main__": # if run as a script or by 'python -m pytest' # we trigger the below "else" condition by the following import import pytest + raise SystemExit(pytest.main()) else: from _pytest.compat import _setup_collect_fakemodule + _setup_collect_fakemodule() diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/__init__.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/__init__.py index 8ea038f0af0..ea5b1293e33 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/__init__.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/__init__.py @@ -7,6 +7,4 @@ import invoke from . import generate -ns = invoke.Collection( - generate, -) +ns = invoke.Collection(generate) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/generate.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/generate.py index fa8ee6557df..398af70c942 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/generate.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/generate.py @@ -1,68 +1,82 @@ -import os +""" +Invoke development tasks. +""" from pathlib import Path from subprocess import check_output, check_call import invoke -@invoke.task(help={ - 'version': 'version being released', -}) +@invoke.task(help={"version": "version being released"}) def announce(ctx, version): """Generates a new release announcement entry in the docs.""" # Get our list of authors - stdout = check_output(["git", "describe", "--abbrev=0", '--tags']) - stdout = stdout.decode('utf-8') + stdout = check_output(["git", "describe", "--abbrev=0", "--tags"]) + stdout = stdout.decode("utf-8") last_version = stdout.strip() - stdout = check_output(["git", "log", "{}..HEAD".format(last_version), "--format=%aN"]) - stdout = stdout.decode('utf-8') + stdout = check_output( + ["git", "log", "{}..HEAD".format(last_version), "--format=%aN"] + ) + stdout = stdout.decode("utf-8") contributors = set(stdout.splitlines()) - template_name = 'release.minor.rst' if version.endswith('.0') else 'release.patch.rst' - template_text = Path(__file__).parent.joinpath(template_name).read_text(encoding='UTF-8') + template_name = "release.minor.rst" if version.endswith( + ".0" + ) else "release.patch.rst" + template_text = Path(__file__).parent.joinpath(template_name).read_text( + encoding="UTF-8" + ) - contributors_text = '\n'.join('* {}'.format(name) for name in sorted(contributors)) + '\n' + contributors_text = "\n".join( + "* {}".format(name) for name in sorted(contributors) + ) + "\n" text = template_text.format(version=version, contributors=contributors_text) - target = Path(__file__).parent.joinpath('../doc/en/announce/release-{}.rst'.format(version)) - target.write_text(text, encoding='UTF-8') + target = Path(__file__).parent.joinpath( + "../doc/en/announce/release-{}.rst".format(version) + ) + target.write_text(text, encoding="UTF-8") print("[generate.announce] Generated {}".format(target.name)) # Update index with the new release entry - index_path = Path(__file__).parent.joinpath('../doc/en/announce/index.rst') - lines = index_path.read_text(encoding='UTF-8').splitlines() - indent = ' ' + index_path = Path(__file__).parent.joinpath("../doc/en/announce/index.rst") + lines = index_path.read_text(encoding="UTF-8").splitlines() + indent = " " for index, line in enumerate(lines): - if line.startswith('{}release-'.format(indent)): + if line.startswith("{}release-".format(indent)): new_line = indent + target.stem if line != new_line: lines.insert(index, new_line) - index_path.write_text('\n'.join(lines) + '\n', encoding='UTF-8') + index_path.write_text("\n".join(lines) + "\n", encoding="UTF-8") print("[generate.announce] Updated {}".format(index_path.name)) else: - print("[generate.announce] Skip {} (already contains release)".format(index_path.name)) + print( + "[generate.announce] Skip {} (already contains release)".format( + index_path.name + ) + ) break - check_call(['git', 'add', str(target)]) + check_call(["git", "add", str(target)]) @invoke.task() def regen(ctx): """Call regendoc tool to update examples and pytest output in the docs.""" print("[generate.regen] Updating docs") - check_call(['tox', '-e', 'regen']) + check_call(["tox", "-e", "regen"]) @invoke.task() def make_tag(ctx, version): - """Create a new (local) tag for the release, only if the repository is clean.""" + """Create a new, local tag for the release, only if the repository is clean.""" from git import Repo - repo = Repo('.') + repo = Repo(".") if repo.is_dirty(): - print('Current repository is dirty. Please commit any changes and try again.') + print("Current repository is dirty. Please commit any changes and try again.") raise invoke.Exit(code=2) tag_names = [x.name for x in repo.tags] @@ -74,89 +88,31 @@ def make_tag(ctx, version): repo.create_tag(version) -@invoke.task() -def devpi_upload(ctx, version, user, password=None): - """Creates and uploads a package to devpi for testing.""" - if password: - print("[generate.devpi_upload] devpi login {}".format(user)) - check_call(['devpi', 'login', user, '--password', password]) - - check_call(['devpi', 'use', 'https://devpi.net/{}/dev'.format(user)]) - - env = os.environ.copy() - env['SETUPTOOLS_SCM_PRETEND_VERSION'] = version - check_call(['devpi', 'upload', '--formats', 'sdist,bdist_wheel'], env=env) - print("[generate.devpi_upload] package uploaded") - - -@invoke.task(help={ - 'version': 'version being released', - 'user': 'name of the user on devpi to stage the generated package', - 'password': 'user password on devpi to stage the generated package ' - '(if not given assumed logged in)', -}) -def pre_release(ctx, version, user, password=None): - """Generates new docs, release announcements and uploads a new release to devpi for testing.""" +@invoke.task(help={"version": "version being released"}) +def pre_release(ctx, version): + """Generates new docs, release announcements and creates a local tag.""" announce(ctx, version) regen(ctx) changelog(ctx, version, write_out=True) - msg = 'Preparing release version {}'.format(version) - check_call(['git', 'commit', '-a', '-m', msg]) - + msg = "Preparing release version {}".format(version) + check_call(["git", "commit", "-a", "-m", msg]) + make_tag(ctx, version) - devpi_upload(ctx, version=version, user=user, password=password) - print() - print('[generate.pre_release] Please push your branch and open a PR.') + print("[generate.pre_release] Please push your branch and open a PR.") -@invoke.task(help={ - 'version': 'version being released', - 'user': 'name of the user on devpi to stage the generated package', - 'pypi_name': 'name of the pypi configuration section in your ~/.pypirc', -}) -def publish_release(ctx, version, user, pypi_name): - """Publishes a package previously created by the 'pre_release' command.""" - from git import Repo - repo = Repo('.') - tag_names = [x.name for x in repo.tags] - if version not in tag_names: - print('Could not find tag for version {}, exiting...'.format(version)) - raise invoke.Exit(code=2) - - check_call(['devpi', 'use', 'https://devpi.net/{}/dev'.format(user)]) - check_call(['devpi', 'push', 'pytest=={}'.format(version), 'pypi:{}'.format(pypi_name)]) - check_call(['git', 'push', 'git@github.com:pytest-dev/pytest.git', version]) - - emails = [ - 'pytest-dev@python.org', - 'python-announce-list@python.org' - ] - if version.endswith('.0'): - emails.append('testing-in-python@lists.idyll.org') - print('Version {} has been published to PyPI!'.format(version)) - print() - print('Please send an email announcement with the contents from:') - print() - print(' doc/en/announce/release-{}.rst'.format(version)) - print() - print('To the following mail lists:') - print() - print(' ', ','.join(emails)) - print() - print('And announce it on twitter adding the #pytest hash tag.') - - -@invoke.task(help={ - 'version': 'version being released', - 'write_out': 'write changes to the actial changelog' -}) +@invoke.task( + help={ + "version": "version being released", + "write_out": "write changes to the actual changelog", + } +) def changelog(ctx, version, write_out=False): if write_out: addopts = [] else: - addopts = ['--draft'] - check_call(['towncrier', '--version', version] + addopts) - + addopts = ["--draft"] + check_call(["towncrier", "--yes", "--version", version] + addopts) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/release.minor.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/release.minor.rst index 3c0b7d718a1..bdd8282cfad 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/release.minor.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/release.minor.rst @@ -3,7 +3,7 @@ pytest-{version} The pytest team is proud to announce the {version} release! -pytest is a mature Python testing tool with more than a 1600 tests +pytest is a mature Python testing tool with more than a 2000 tests against itself, passing on many different interpreters and platforms. This release contains a number of bugs fixes and improvements, so users are encouraged diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/release.patch.rst b/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/release.patch.rst index 56764b91307..1982dc353c4 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/release.patch.rst +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/release.patch.rst @@ -6,7 +6,7 @@ pytest {version} has just been released to PyPI. This is a bug-fix release, being a drop-in replacement. To upgrade:: pip install --upgrade pytest - + The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/requirements.txt b/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/requirements.txt index 6392de0cc0a..db54e76e85c 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/requirements.txt +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/tasks/requirements.txt @@ -1,5 +1,6 @@ -invoke -tox +-e . gitpython +invoke towncrier +tox wheel diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/acceptance_test.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/acceptance_test.py index a7838545b07..c2eed419c9c 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/acceptance_test.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/acceptance_test.py @@ -2,6 +2,9 @@ from __future__ import absolute_import, division, print_function import os import sys +import types + +import six import _pytest._code import py @@ -10,17 +13,18 @@ from _pytest.main import EXIT_NOTESTSCOLLECTED, EXIT_USAGEERROR class TestGeneralUsage(object): + def test_config_error(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_configure(config): import pytest raise pytest.UsageError("hello") - """) + """ + ) result = testdir.runpytest(testdir.tmpdir) assert result.ret != 0 - result.stderr.fnmatch_lines([ - '*ERROR: hello' - ]) + result.stderr.fnmatch_lines(["*ERROR: hello"]) def test_root_conftest_syntax_error(self, testdir): testdir.makepyfile(conftest="raise SyntaxError\n") @@ -29,37 +33,38 @@ class TestGeneralUsage(object): assert result.ret != 0 def test_early_hook_error_issue38_1(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_sessionstart(): 0 / 0 - """) + """ + ) result = testdir.runpytest(testdir.tmpdir) assert result.ret != 0 # tracestyle is native by default for hook failures - result.stdout.fnmatch_lines([ - '*INTERNALERROR*File*conftest.py*line 2*', - '*0 / 0*', - ]) + result.stdout.fnmatch_lines( + ["*INTERNALERROR*File*conftest.py*line 2*", "*0 / 0*"] + ) result = testdir.runpytest(testdir.tmpdir, "--fulltrace") assert result.ret != 0 # tracestyle is native by default for hook failures - result.stdout.fnmatch_lines([ - '*INTERNALERROR*def pytest_sessionstart():*', - '*INTERNALERROR*0 / 0*', - ]) + result.stdout.fnmatch_lines( + ["*INTERNALERROR*def pytest_sessionstart():*", "*INTERNALERROR*0 / 0*"] + ) def test_early_hook_configure_error_issue38(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_configure(): 0 / 0 - """) + """ + ) result = testdir.runpytest(testdir.tmpdir) assert result.ret != 0 # here we get it on stderr - result.stderr.fnmatch_lines([ - '*INTERNALERROR*File*conftest.py*line 2*', - '*0 / 0*', - ]) + result.stderr.fnmatch_lines( + ["*INTERNALERROR*File*conftest.py*line 2*", "*0 / 0*"] + ) def test_file_not_found(self, testdir): result = testdir.runpytest("asd") @@ -67,61 +72,65 @@ class TestGeneralUsage(object): result.stderr.fnmatch_lines(["ERROR: file not found*asd"]) def test_file_not_found_unconfigure_issue143(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_configure(): print("---configure") def pytest_unconfigure(): print("---unconfigure") - """) + """ + ) result = testdir.runpytest("-s", "asd") assert result.ret == 4 # EXIT_USAGEERROR result.stderr.fnmatch_lines(["ERROR: file not found*asd"]) - result.stdout.fnmatch_lines([ - "*---configure", - "*---unconfigure", - ]) + result.stdout.fnmatch_lines(["*---configure", "*---unconfigure"]) def test_config_preparse_plugin_option(self, testdir): - testdir.makepyfile(pytest_xyz=""" + testdir.makepyfile( + pytest_xyz=""" def pytest_addoption(parser): parser.addoption("--xyz", dest="xyz", action="store") - """) - testdir.makepyfile(test_one=""" + """ + ) + testdir.makepyfile( + test_one=""" def test_option(pytestconfig): assert pytestconfig.option.xyz == "123" - """) + """ + ) result = testdir.runpytest("-p", "pytest_xyz", "--xyz=123", syspathinsert=True) assert result.ret == 0 - result.stdout.fnmatch_lines([ - '*1 passed*', - ]) + result.stdout.fnmatch_lines(["*1 passed*"]) def test_assertion_magic(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_this(): x = 0 assert x - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "> assert x", - "E assert 0", - ]) + result.stdout.fnmatch_lines(["> assert x", "E assert 0"]) assert result.ret == 1 def test_nested_import_error(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import import_fails def test_this(): assert import_fails.a == 1 - """) + """ + ) testdir.makepyfile(import_fails="import does_not_work") result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - # XXX on jython this fails: "> import import_fails", - "ImportError while importing test module*", - "*No module named *does_not_work*", - ]) + result.stdout.fnmatch_lines( + [ + # XXX on jython this fails: "> import import_fails", + "ImportError while importing test module*", + "*No module named *does_not_work*", + ] + ) assert result.ret == 2 def test_not_collectable_arguments(self, testdir): @@ -129,38 +138,41 @@ class TestGeneralUsage(object): p2 = testdir.makefile(".pyc", "123") result = testdir.runpytest(p1, p2) assert result.ret - result.stderr.fnmatch_lines([ - "*ERROR: not found:*%s" % (p2.basename,) - ]) + result.stderr.fnmatch_lines(["*ERROR: not found:*%s" % (p2.basename,)]) def test_issue486_better_reporting_on_conftest_load_failure(self, testdir): testdir.makepyfile("") testdir.makeconftest("import qwerty") result = testdir.runpytest("--help") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *--version* *warning*conftest.py* - """) + """ + ) result = testdir.runpytest() - result.stderr.fnmatch_lines(""" + result.stderr.fnmatch_lines( + """ *ERROR*could not load*conftest.py* - """) + """ + ) def test_early_skip(self, testdir): testdir.mkdir("xyz") - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest def pytest_collect_directory(): pytest.skip("early") - """) + """ + ) result = testdir.runpytest() assert result.ret == EXIT_NOTESTSCOLLECTED - result.stdout.fnmatch_lines([ - "*1 skip*" - ]) + result.stdout.fnmatch_lines(["*1 skip*"]) def test_issue88_initial_file_multinodes(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest class MyFile(pytest.File): def collect(self): @@ -169,40 +181,46 @@ class TestGeneralUsage(object): return MyFile(path, parent) class MyItem(pytest.Item): pass - """) + """ + ) p = testdir.makepyfile("def test_hello(): pass") result = testdir.runpytest(p, "--collect-only") - result.stdout.fnmatch_lines([ - "*MyFile*test_issue88*", - "*Module*test_issue88*", - ]) + result.stdout.fnmatch_lines(["*MyFile*test_issue88*", "*Module*test_issue88*"]) def test_issue93_initialnode_importing_capturing(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import sys print ("should not be seen") sys.stderr.write("stder42\\n") - """) + """ + ) result = testdir.runpytest() assert result.ret == EXIT_NOTESTSCOLLECTED assert "should not be seen" not in result.stdout.str() assert "stderr42" not in result.stderr.str() def test_conftest_printing_shows_if_error(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ print ("should be seen") assert 0 - """) + """ + ) result = testdir.runpytest() assert result.ret != 0 assert "should be seen" in result.stdout.str() - @pytest.mark.skipif(not hasattr(py.path.local, 'mksymlinkto'), - reason="symlink not available on this platform") + @pytest.mark.skipif( + not hasattr(py.path.local, "mksymlinkto"), + reason="symlink not available on this platform", + ) def test_chdir(self, testdir): testdir.tmpdir.join("py").mksymlinkto(py._pydir) p = testdir.tmpdir.join("main.py") - p.write(_pytest._code.Source(""" + p.write( + _pytest._code.Source( + """ import sys, os sys.path.insert(0, '') import py @@ -210,13 +228,15 @@ class TestGeneralUsage(object): print (py.__path__) os.chdir(os.path.dirname(os.getcwd())) print (py.log) - """)) + """ + ) + ) result = testdir.runpython(p) assert not result.ret def test_issue109_sibling_conftests_not_loaded(self, testdir): - sub1 = testdir.tmpdir.mkdir("sub1") - sub2 = testdir.tmpdir.mkdir("sub2") + sub1 = testdir.mkdir("sub1") + sub2 = testdir.mkdir("sub2") sub1.join("conftest.py").write("assert 0") result = testdir.runpytest(sub2) assert result.ret == EXIT_NOTESTSCOLLECTED @@ -228,20 +248,21 @@ class TestGeneralUsage(object): assert result.ret == EXIT_USAGEERROR def test_directory_skipped(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest def pytest_ignore_collect(): pytest.skip("intentional") - """) + """ + ) testdir.makepyfile("def test_hello(): pass") result = testdir.runpytest() assert result.ret == EXIT_NOTESTSCOLLECTED - result.stdout.fnmatch_lines([ - "*1 skipped*" - ]) + result.stdout.fnmatch_lines(["*1 skipped*"]) def test_multiple_items_per_collector_byid(self, testdir): - c = testdir.makeconftest(""" + c = testdir.makeconftest( + """ import pytest class MyItem(pytest.Item): def runtest(self): @@ -252,15 +273,15 @@ class TestGeneralUsage(object): def pytest_collect_file(path, parent): if path.basename.startswith("conftest"): return MyCollector(path, parent) - """) + """ + ) result = testdir.runpytest(c.basename + "::" + "xyz") assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*1 pass*", - ]) + result.stdout.fnmatch_lines(["*1 pass*"]) def test_skip_on_generated_funcarg_id(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest def pytest_generate_tests(metafunc): metafunc.addcall({'x': 3}, id='hello-123') @@ -269,75 +290,77 @@ class TestGeneralUsage(object): if 'hello-123' in item.keywords: pytest.skip("hello") assert 0 - """) + """ + ) p = testdir.makepyfile("""def test_func(x): pass""") res = testdir.runpytest(p) assert res.ret == 0 res.stdout.fnmatch_lines(["*1 skipped*"]) def test_direct_addressing_selects(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def pytest_generate_tests(metafunc): metafunc.addcall({'i': 1}, id="1") metafunc.addcall({'i': 2}, id="2") def test_func(i): pass - """) + """ + ) res = testdir.runpytest(p.basename + "::" + "test_func[1]") assert res.ret == 0 res.stdout.fnmatch_lines(["*1 passed*"]) def test_direct_addressing_notfound(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_func(): pass - """) + """ + ) res = testdir.runpytest(p.basename + "::" + "test_notfound") assert res.ret res.stderr.fnmatch_lines(["*ERROR*not found*"]) def test_docstring_on_hookspec(self): from _pytest import hookspec + for name, value in vars(hookspec).items(): if name.startswith("pytest_"): assert value.__doc__, "no docstring for %s" % name def test_initialization_error_issue49(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_configure(): x - """) + """ + ) result = testdir.runpytest() assert result.ret == 3 # internal error - result.stderr.fnmatch_lines([ - "INTERNAL*pytest_configure*", - "INTERNAL*x*", - ]) - assert 'sessionstarttime' not in result.stderr.str() + result.stderr.fnmatch_lines(["INTERNAL*pytest_configure*", "INTERNAL*x*"]) + assert "sessionstarttime" not in result.stderr.str() - @pytest.mark.parametrize('lookfor', ['test_fun.py::test_a']) + @pytest.mark.parametrize("lookfor", ["test_fun.py::test_a"]) def test_issue134_report_error_when_collecting_member(self, testdir, lookfor): - testdir.makepyfile(test_fun=""" + testdir.makepyfile( + test_fun=""" def test_a(): pass - def""") + def""" + ) result = testdir.runpytest(lookfor) - result.stdout.fnmatch_lines(['*SyntaxError*']) - if '::' in lookfor: - result.stderr.fnmatch_lines([ - '*ERROR*', - ]) + result.stdout.fnmatch_lines(["*SyntaxError*"]) + if "::" in lookfor: + result.stderr.fnmatch_lines(["*ERROR*"]) assert result.ret == 4 # usage error only if item not found def test_report_all_failed_collections_initargs(self, testdir): testdir.makepyfile(test_a="def", test_b="def") result = testdir.runpytest("test_a.py::a", "test_b.py::b") - result.stderr.fnmatch_lines([ - "*ERROR*test_a.py::a*", - "*ERROR*test_b.py::b*", - ]) + result.stderr.fnmatch_lines(["*ERROR*test_a.py::a*", "*ERROR*test_b.py::b*"]) - @pytest.mark.usefixtures('recwarn') + @pytest.mark.usefixtures("recwarn") def test_namespace_import_doesnt_confuse_import_hook(self, testdir): """ Ref #383. Python 3.3's namespace package messed with our import hooks @@ -347,8 +370,9 @@ class TestGeneralUsage(object): Use recwarn here to silence this warning in Python 2.7: ImportWarning: Not importing directory '...\not_a_package': missing __init__.py """ - testdir.mkdir('not_a_package') - p = testdir.makepyfile(""" + testdir.mkdir("not_a_package") + p = testdir.makepyfile( + """ try: from not_a_package import doesnt_exist except ImportError: @@ -357,19 +381,23 @@ class TestGeneralUsage(object): def test_whatever(): pass - """) + """ + ) res = testdir.runpytest(p.basename) assert res.ret == 0 def test_unknown_option(self, testdir): result = testdir.runpytest("--qwlkej") - result.stderr.fnmatch_lines(""" + result.stderr.fnmatch_lines( + """ *unrecognized* - """) + """ + ) def test_getsourcelines_error_issue553(self, testdir, monkeypatch): monkeypatch.setattr("inspect.getsourcelines", None) - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def raise_error(obj): raise IOError('source code not available') @@ -378,12 +406,12 @@ class TestGeneralUsage(object): def test_foo(invalid_fixture): pass - """) + """ + ) res = testdir.runpytest(p) - res.stdout.fnmatch_lines([ - "*source code not available*", - "E*fixture 'invalid_fixture' not found", - ]) + res.stdout.fnmatch_lines( + ["*source code not available*", "E*fixture 'invalid_fixture' not found"] + ) def test_plugins_given_as_strings(self, tmpdir, monkeypatch): """test that str values passed to main() as `plugins` arg @@ -391,62 +419,67 @@ class TestGeneralUsage(object): #855. """ with pytest.raises(ImportError) as excinfo: - pytest.main([str(tmpdir)], plugins=['invalid.module']) - assert 'invalid' in str(excinfo.value) + pytest.main([str(tmpdir)], plugins=["invalid.module"]) + assert "invalid" in str(excinfo.value) - p = tmpdir.join('test_test_plugins_given_as_strings.py') - p.write('def test_foo(): pass') - mod = py.std.types.ModuleType("myplugin") - monkeypatch.setitem(sys.modules, 'myplugin', mod) - assert pytest.main(args=[str(tmpdir)], plugins=['myplugin']) == 0 + p = tmpdir.join("test_test_plugins_given_as_strings.py") + p.write("def test_foo(): pass") + mod = types.ModuleType("myplugin") + monkeypatch.setitem(sys.modules, "myplugin", mod) + assert pytest.main(args=[str(tmpdir)], plugins=["myplugin"]) == 0 def test_parametrized_with_bytes_regex(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import re import pytest @pytest.mark.parametrize('r', [re.compile(b'foo')]) def test_stuff(r): pass """ - ) + ) res = testdir.runpytest(p) - res.stdout.fnmatch_lines([ - '*1 passed*' - ]) + res.stdout.fnmatch_lines(["*1 passed*"]) def test_parametrized_with_null_bytes(self, testdir): """Test parametrization with values that contain null bytes and unicode characters (#2644, #2957)""" - p = testdir.makepyfile(u""" + p = testdir.makepyfile( + u""" # encoding: UTF-8 import pytest @pytest.mark.parametrize("data", [b"\\x00", "\\x00", u'ação']) def test_foo(data): assert data - """) + """ + ) res = testdir.runpytest(p) res.assert_outcomes(passed=3) class TestInvocationVariants(object): + def test_earlyinit(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest assert hasattr(pytest, 'mark') - """) + """ + ) result = testdir.runpython(p) assert result.ret == 0 @pytest.mark.xfail("sys.platform.startswith('java')") def test_pydoc(self, testdir): - for name in ('py.test', 'pytest'): + for name in ("py.test", "pytest"): result = testdir.runpython_c("import %s;help(%s)" % (name, name)) assert result.ret == 0 s = result.stdout.str() - assert 'MarkGenerator' in s + assert "MarkGenerator" in s def test_import_star_py_dot_test(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ from py.test import * #collect #cmdline @@ -456,51 +489,55 @@ class TestInvocationVariants(object): main skip xfail - """) + """ + ) result = testdir.runpython(p) assert result.ret == 0 def test_import_star_pytest(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ from pytest import * #Item #File main skip xfail - """) + """ + ) result = testdir.runpython(p) assert result.ret == 0 def test_double_pytestcmdline(self, testdir): - p = testdir.makepyfile(run=""" + p = testdir.makepyfile( + run=""" import pytest pytest.main() pytest.main() - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ def test_hello(): pass - """) + """ + ) result = testdir.runpython(p) - result.stdout.fnmatch_lines([ - "*1 passed*", - "*1 passed*", - ]) + result.stdout.fnmatch_lines(["*1 passed*", "*1 passed*"]) def test_python_minus_m_invocation_ok(self, testdir): p1 = testdir.makepyfile("def test_hello(): pass") - res = testdir.run(py.std.sys.executable, "-m", "pytest", str(p1)) + res = testdir.run(sys.executable, "-m", "pytest", str(p1)) assert res.ret == 0 def test_python_minus_m_invocation_fail(self, testdir): p1 = testdir.makepyfile("def test_fail(): 0/0") - res = testdir.run(py.std.sys.executable, "-m", "pytest", str(p1)) + res = testdir.run(sys.executable, "-m", "pytest", str(p1)) assert res.ret == 1 def test_python_pytest_package(self, testdir): p1 = testdir.makepyfile("def test_pass(): pass") - res = testdir.run(py.std.sys.executable, "-m", "pytest", str(p1)) + res = testdir.run(sys.executable, "-m", "pytest", str(p1)) assert res.ret == 0 res.stdout.fnmatch_lines(["*1 passed*"]) @@ -520,7 +557,9 @@ class TestInvocationVariants(object): out, err = capsys.readouterr() def test_invoke_plugin_api(self, testdir, capsys): + class MyPlugin(object): + def pytest_addoption(self, parser): parser.addoption("--myopt") @@ -529,63 +568,55 @@ class TestInvocationVariants(object): assert "--myopt" in out def test_pyargs_importerror(self, testdir, monkeypatch): - monkeypatch.delenv('PYTHONDONTWRITEBYTECODE', False) + monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", False) path = testdir.mkpydir("tpkg") - path.join("test_hello.py").write('raise ImportError') + path.join("test_hello.py").write("raise ImportError") - result = testdir.runpytest_subprocess("--pyargs", "tpkg.test_hello") + result = testdir.runpytest("--pyargs", "tpkg.test_hello", syspathinsert=True) assert result.ret != 0 - result.stdout.fnmatch_lines([ - "collected*0*items*/*1*errors" - ]) + result.stdout.fnmatch_lines(["collected*0*items*/*1*errors"]) def test_cmdline_python_package(self, testdir, monkeypatch): import warnings - monkeypatch.delenv('PYTHONDONTWRITEBYTECODE', False) + + monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", False) path = testdir.mkpydir("tpkg") path.join("test_hello.py").write("def test_hello(): pass") path.join("test_world.py").write("def test_world(): pass") result = testdir.runpytest("--pyargs", "tpkg") assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*2 passed*" - ]) - result = testdir.runpytest("--pyargs", "tpkg.test_hello") + result.stdout.fnmatch_lines(["*2 passed*"]) + result = testdir.runpytest("--pyargs", "tpkg.test_hello", syspathinsert=True) assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*1 passed*" - ]) + result.stdout.fnmatch_lines(["*1 passed*"]) def join_pythonpath(what): - cur = py.std.os.environ.get('PYTHONPATH') + cur = os.environ.get("PYTHONPATH") if cur: return str(what) + os.pathsep + cur return what + empty_package = testdir.mkpydir("empty_package") - monkeypatch.setenv('PYTHONPATH', join_pythonpath(empty_package)) + monkeypatch.setenv("PYTHONPATH", join_pythonpath(empty_package)) # the path which is not a package raises a warning on pypy; # no idea why only pypy and not normal python warn about it here with warnings.catch_warnings(): - warnings.simplefilter('ignore', ImportWarning) + warnings.simplefilter("ignore", ImportWarning) result = testdir.runpytest("--pyargs", ".") assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*2 passed*" - ]) + result.stdout.fnmatch_lines(["*2 passed*"]) - monkeypatch.setenv('PYTHONPATH', join_pythonpath(testdir)) - result = testdir.runpytest("--pyargs", "tpkg.test_missing") + monkeypatch.setenv("PYTHONPATH", join_pythonpath(testdir)) + result = testdir.runpytest("--pyargs", "tpkg.test_missing", syspathinsert=True) assert result.ret != 0 - result.stderr.fnmatch_lines([ - "*not*found*test_missing*", - ]) + result.stderr.fnmatch_lines(["*not*found*test_missing*"]) def test_cmdline_python_namespace_package(self, testdir, monkeypatch): """ test --pyargs option with namespace packages (#1567) """ - monkeypatch.delenv('PYTHONDONTWRITEBYTECODE', raising=False) + monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=False) search_path = [] for dirname in "hello", "world": @@ -593,21 +624,22 @@ class TestInvocationVariants(object): search_path.append(d) ns = d.mkdir("ns_pkg") ns.join("__init__.py").write( - "__import__('pkg_resources').declare_namespace(__name__)") + "__import__('pkg_resources').declare_namespace(__name__)" + ) lib = ns.mkdir(dirname) lib.ensure("__init__.py") - lib.join("test_{0}.py".format(dirname)). \ - write("def test_{0}(): pass\n" - "def test_other():pass".format(dirname)) + lib.join("test_{}.py".format(dirname)).write( + "def test_{}(): pass\n" "def test_other():pass".format(dirname) + ) # The structure of the test directory is now: # . # ├── hello - # │   └── ns_pkg - # │   ├── __init__.py - # │   └── hello - # │   ├── __init__.py - # │   └── test_hello.py + # │ └── ns_pkg + # │ ├── __init__.py + # │ └── hello + # │ ├── __init__.py + # │ └── test_hello.py # └── world # └── ns_pkg # ├── __init__.py @@ -616,45 +648,122 @@ class TestInvocationVariants(object): # └── test_world.py def join_pythonpath(*dirs): - cur = py.std.os.environ.get('PYTHONPATH') + cur = os.environ.get("PYTHONPATH") if cur: dirs += (cur,) return os.pathsep.join(str(p) for p in dirs) - monkeypatch.setenv('PYTHONPATH', join_pythonpath(*search_path)) + + monkeypatch.setenv("PYTHONPATH", join_pythonpath(*search_path)) for p in search_path: monkeypatch.syspath_prepend(p) - os.chdir('world') # mixed module and filenames: + os.chdir("world") result = testdir.runpytest("--pyargs", "-v", "ns_pkg.hello", "ns_pkg/world") - testdir.chdir() assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*test_hello.py::test_hello*PASSED*", - "*test_hello.py::test_other*PASSED*", - "*test_world.py::test_world*PASSED*", - "*test_world.py::test_other*PASSED*", - "*4 passed*" - ]) + result.stdout.fnmatch_lines( + [ + "*test_hello.py::test_hello*PASSED*", + "*test_hello.py::test_other*PASSED*", + "*test_world.py::test_world*PASSED*", + "*test_world.py::test_other*PASSED*", + "*4 passed*", + ] + ) # specify tests within a module - result = testdir.runpytest("--pyargs", "-v", "ns_pkg.world.test_world::test_other") + testdir.chdir() + result = testdir.runpytest( + "--pyargs", "-v", "ns_pkg.world.test_world::test_other" + ) assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*test_world.py::test_other*PASSED*", - "*1 passed*" - ]) + result.stdout.fnmatch_lines( + ["*test_world.py::test_other*PASSED*", "*1 passed*"] + ) + + @pytest.mark.skipif(not hasattr(os, "symlink"), reason="requires symlinks") + def test_cmdline_python_package_symlink(self, testdir, monkeypatch): + """ + test --pyargs option with packages with path containing symlink can + have conftest.py in their package (#2985) + """ + # dummy check that we can actually create symlinks: on Windows `os.symlink` is available, + # but normal users require special admin privileges to create symlinks. + if sys.platform == "win32": + try: + os.symlink( + str(testdir.tmpdir.ensure("tmpfile")), + str(testdir.tmpdir.join("tmpfile2")), + ) + except OSError as e: + pytest.skip(six.text_type(e.args[0])) + monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=False) + + search_path = ["lib", os.path.join("local", "lib")] + + dirname = "lib" + d = testdir.mkdir(dirname) + foo = d.mkdir("foo") + foo.ensure("__init__.py") + lib = foo.mkdir("bar") + lib.ensure("__init__.py") + lib.join("test_bar.py").write( + "def test_bar(): pass\n" "def test_other(a_fixture):pass" + ) + lib.join("conftest.py").write( + "import pytest\n" "@pytest.fixture\n" "def a_fixture():pass" + ) + + d_local = testdir.mkdir("local") + symlink_location = os.path.join(str(d_local), "lib") + if six.PY2: + os.symlink(str(d), symlink_location) + else: + os.symlink(str(d), symlink_location, target_is_directory=True) + + # The structure of the test directory is now: + # . + # ├── local + # │ └── lib -> ../lib + # └── lib + # └── foo + # ├── __init__.py + # └── bar + # ├── __init__.py + # ├── conftest.py + # └── test_bar.py + + def join_pythonpath(*dirs): + cur = os.getenv("PYTHONPATH") + if cur: + dirs += (cur,) + return os.pathsep.join(str(p) for p in dirs) + + monkeypatch.setenv("PYTHONPATH", join_pythonpath(*search_path)) + for p in search_path: + monkeypatch.syspath_prepend(p) + + # module picked up in symlink-ed directory: + result = testdir.runpytest("--pyargs", "-v", "foo.bar") + testdir.chdir() + assert result.ret == 0 + result.stdout.fnmatch_lines( + [ + "*lib/foo/bar/test_bar.py::test_bar*PASSED*", + "*lib/foo/bar/test_bar.py::test_other*PASSED*", + "*2 passed*", + ] + ) def test_cmdline_python_package_not_exists(self, testdir): result = testdir.runpytest("--pyargs", "tpkgwhatv") assert result.ret - result.stderr.fnmatch_lines([ - "ERROR*file*or*package*not*found*", - ]) + result.stderr.fnmatch_lines(["ERROR*file*or*package*not*found*"]) @pytest.mark.xfail(reason="decide: feature or bug") def test_noclass_discovery_if_not_testcase(self, testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ import unittest class TestHello(object): def test_hello(self): @@ -662,36 +771,40 @@ class TestInvocationVariants(object): class RealTest(unittest.TestCase, TestHello): attr = 42 - """) + """ + ) reprec = testdir.inline_run(testpath) reprec.assertoutcome(passed=1) def test_doctest_id(self, testdir): - testdir.makefile('.txt', """ + testdir.makefile( + ".txt", + """ >>> x=3 >>> x 4 - """) + """, + ) result = testdir.runpytest("-rf") lines = result.stdout.str().splitlines() for line in lines: if line.startswith("FAIL "): testid = line[5:].strip() break - result = testdir.runpytest(testid, '-rf') - result.stdout.fnmatch_lines([ - line, - "*1 failed*", - ]) + result = testdir.runpytest(testid, "-rf") + result.stdout.fnmatch_lines([line, "*1 failed*"]) def test_core_backward_compatibility(self): """Test backward compatibility for get_plugin_manager function. See #787.""" import _pytest.config - assert type(_pytest.config.get_plugin_manager()) is _pytest.config.PytestPluginManager + + assert type( + _pytest.config.get_plugin_manager() + ) is _pytest.config.PytestPluginManager def test_has_plugin(self, request): """Test hasplugin function of the plugin manager (#932).""" - assert request.config.pluginmanager.hasplugin('python') + assert request.config.pluginmanager.hasplugin("python") class TestDurations(object): @@ -712,12 +825,9 @@ class TestDurations(object): testdir.makepyfile(self.source) result = testdir.runpytest("--durations=10") assert result.ret == 0 - result.stdout.fnmatch_lines_random([ - "*durations*", - "*call*test_3*", - "*call*test_2*", - "*call*test_1*", - ]) + result.stdout.fnmatch_lines_random( + ["*durations*", "*call*test_3*", "*call*test_2*", "*call*test_1*"] + ) def test_calls_show_2(self, testdir): testdir.makepyfile(self.source) @@ -731,7 +841,7 @@ class TestDurations(object): result = testdir.runpytest("--durations=0") assert result.ret == 0 for x in "123": - for y in 'call', : # 'setup', 'call', 'teardown': + for y in ("call",): # 'setup', 'call', 'teardown': for line in result.stdout.lines: if ("test_%s" % x) in line and y in line: break @@ -742,19 +852,14 @@ class TestDurations(object): testdir.makepyfile(self.source) result = testdir.runpytest("--durations=2", "-k test_1") assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*durations*", - "*call*test_1*", - ]) + result.stdout.fnmatch_lines(["*durations*", "*call*test_1*"]) def test_with_failing_collection(self, testdir): testdir.makepyfile(self.source) testdir.makepyfile(test_collecterror="""xyz""") result = testdir.runpytest("--durations=2", "-k test_1") assert result.ret == 2 - result.stdout.fnmatch_lines([ - "*Interrupted: 1 errors during collection*", - ]) + result.stdout.fnmatch_lines(["*Interrupted: 1 errors during collection*"]) # Collection errors abort test execution, therefore no duration is # output assert "duration" not in result.stdout.str() @@ -782,42 +887,48 @@ class TestDurationWithFixture(object): result = testdir.runpytest("--durations=10") assert result.ret == 0 - result.stdout.fnmatch_lines_random(""" + result.stdout.fnmatch_lines_random( + """ *durations* * setup *test_1* * call *test_1* - """) + """ + ) def test_zipimport_hook(testdir, tmpdir): """Test package loader is being used correctly (see #1837).""" - zipapp = pytest.importorskip('zipapp') - testdir.tmpdir.join('app').ensure(dir=1) - testdir.makepyfile(**{ - 'app/foo.py': """ + zipapp = pytest.importorskip("zipapp") + testdir.tmpdir.join("app").ensure(dir=1) + testdir.makepyfile( + **{ + "app/foo.py": """ import pytest def main(): pytest.main(['--pyarg', 'foo']) - """, - }) - target = tmpdir.join('foo.zip') - zipapp.create_archive(str(testdir.tmpdir.join('app')), str(target), main='foo:main') + """ + } + ) + target = tmpdir.join("foo.zip") + zipapp.create_archive(str(testdir.tmpdir.join("app")), str(target), main="foo:main") result = testdir.runpython(target) assert result.ret == 0 - result.stderr.fnmatch_lines(['*not found*foo*']) - assert 'INTERNALERROR>' not in result.stdout.str() + result.stderr.fnmatch_lines(["*not found*foo*"]) + assert "INTERNALERROR>" not in result.stdout.str() def test_import_plugin_unicode_name(testdir): + testdir.makepyfile(myplugin="") testdir.makepyfile( - myplugin='', - ) - testdir.makepyfile(""" + """ def test(): pass - """) - testdir.makeconftest(""" + """ + ) + testdir.makeconftest( + """ pytest_plugins = [u'myplugin'] - """) + """ + ) r = testdir.runpytest() assert r.ret == 0 @@ -827,24 +938,129 @@ def test_deferred_hook_checking(testdir): Check hooks as late as possible (#1821). """ testdir.syspathinsert() - testdir.makepyfile(**{ - 'plugin.py': """ - class Hooks: + testdir.makepyfile( + **{ + "plugin.py": """ + class Hooks(object): def pytest_my_hook(self, config): pass def pytest_configure(config): config.pluginmanager.add_hookspecs(Hooks) """, - 'conftest.py': """ + "conftest.py": """ pytest_plugins = ['plugin'] def pytest_my_hook(config): return 40 """, - 'test_foo.py': """ + "test_foo.py": """ def test(request): assert request.config.hook.pytest_my_hook(config=request.config) == [40] - """ - }) + """, + } + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(['* 1 passed *']) + result.stdout.fnmatch_lines(["* 1 passed *"]) + + +def test_fixture_values_leak(testdir): + """Ensure that fixture objects are properly destroyed by the garbage collector at the end of their expected + life-times (#2981). + """ + testdir.makepyfile( + """ + import attr + import gc + import pytest + import weakref + + @attr.s + class SomeObj(object): + name = attr.ib() + + fix_of_test1_ref = None + session_ref = None + + @pytest.fixture(scope='session') + def session_fix(): + global session_ref + obj = SomeObj(name='session-fixture') + session_ref = weakref.ref(obj) + return obj + + @pytest.fixture + def fix(session_fix): + global fix_of_test1_ref + obj = SomeObj(name='local-fixture') + fix_of_test1_ref = weakref.ref(obj) + return obj + + def test1(fix): + assert fix_of_test1_ref() is fix + + def test2(): + gc.collect() + # fixture "fix" created during test1 must have been destroyed by now + assert fix_of_test1_ref() is None + """ + ) + result = testdir.runpytest() + result.stdout.fnmatch_lines(["* 2 passed *"]) + + +def test_fixture_order_respects_scope(testdir): + """Ensure that fixtures are created according to scope order, regression test for #2405 + """ + testdir.makepyfile( + """ + import pytest + + data = {} + + @pytest.fixture(scope='module') + def clean_data(): + data.clear() + + @pytest.fixture(autouse=True) + def add_data(): + data.update(value=True) + + @pytest.mark.usefixtures('clean_data') + def test_value(): + assert data.get('value') + """ + ) + result = testdir.runpytest() + assert result.ret == 0 + + +def test_frame_leak_on_failing_test(testdir): + """pytest would leak garbage referencing the frames of tests that failed that could never be reclaimed (#2798) + + Unfortunately it was not possible to remove the actual circles because most of them + are made of traceback objects which cannot be weakly referenced. Those objects at least + can be eventually claimed by the garbage collector. + """ + testdir.makepyfile( + """ + import gc + import weakref + + class Obj: + pass + + ref = None + + def test1(): + obj = Obj() + global ref + ref = weakref.ref(obj) + assert 0 + + def test2(): + gc.collect() + assert ref() is None + """ + ) + result = testdir.runpytest_subprocess() + result.stdout.fnmatch_lines(["*1 failed, 1 passed in*"]) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_code.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_code.py index 209a8ef19a0..bfae3691882 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_code.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_code.py @@ -6,18 +6,19 @@ import _pytest._code import py import pytest from test_excinfo import TWMock +from six import text_type def test_ne(): - code1 = _pytest._code.Code(compile('foo = "bar"', '', 'exec')) + code1 = _pytest._code.Code(compile('foo = "bar"', "", "exec")) assert code1 == code1 - code2 = _pytest._code.Code(compile('foo = "baz"', '', 'exec')) + code2 = _pytest._code.Code(compile('foo = "baz"', "", "exec")) assert code2 != code1 def test_code_gives_back_name_for_not_existing_file(): - name = 'abc-123' - co_code = compile("pass\n", name, 'exec') + name = "abc-123" + co_code = compile("pass\n", name, "exec") assert co_code.co_filename == name code = _pytest._code.Code(co_code) assert str(code.path) == name @@ -25,12 +26,15 @@ def test_code_gives_back_name_for_not_existing_file(): def test_code_with_class(): + class A(object): pass + pytest.raises(TypeError, "_pytest._code.Code(A)") if True: + def x(): pass @@ -38,7 +42,7 @@ if True: def test_code_fullsource(): code = _pytest._code.Code(x) full = code.fullsource - assert 'test_code_fullsource()' in str(full) + assert "test_code_fullsource()" in str(full) def test_code_source(): @@ -50,8 +54,10 @@ def test_code_source(): def test_frame_getsourcelineno_myself(): + def func(): return sys._getframe(0) + f = func() f = _pytest._code.Frame(f) source, lineno = f.code.fullsource, f.lineno @@ -59,8 +65,10 @@ def test_frame_getsourcelineno_myself(): def test_getstatement_empty_fullsource(): + def func(): return sys._getframe(0) + f = func() f = _pytest._code.Frame(f) prop = f.code.__class__.fullsource @@ -78,7 +86,7 @@ def test_code_from_func(): def test_unicode_handling(): - value = py.builtin._totext('\xc4\x85\xc4\x87\n', 'utf-8').encode('utf8') + value = py.builtin._totext("\xc4\x85\xc4\x87\n", "utf-8").encode("utf8") def f(): raise Exception(value) @@ -86,65 +94,74 @@ def test_unicode_handling(): excinfo = pytest.raises(Exception, f) str(excinfo) if sys.version_info[0] < 3: - unicode(excinfo) + text_type(excinfo) -@pytest.mark.skipif(sys.version_info[0] >= 3, reason='python 2 only issue') +@pytest.mark.skipif(sys.version_info[0] >= 3, reason="python 2 only issue") def test_unicode_handling_syntax_error(): - value = py.builtin._totext('\xc4\x85\xc4\x87\n', 'utf-8').encode('utf8') + value = py.builtin._totext("\xc4\x85\xc4\x87\n", "utf-8").encode("utf8") def f(): - raise SyntaxError('invalid syntax', (None, 1, 3, value)) + raise SyntaxError("invalid syntax", (None, 1, 3, value)) excinfo = pytest.raises(Exception, f) str(excinfo) if sys.version_info[0] < 3: - unicode(excinfo) + text_type(excinfo) def test_code_getargs(): + def f1(x): pass + c1 = _pytest._code.Code(f1) - assert c1.getargs(var=True) == ('x',) + assert c1.getargs(var=True) == ("x",) def f2(x, *y): pass + c2 = _pytest._code.Code(f2) - assert c2.getargs(var=True) == ('x', 'y') + assert c2.getargs(var=True) == ("x", "y") def f3(x, **z): pass + c3 = _pytest._code.Code(f3) - assert c3.getargs(var=True) == ('x', 'z') + assert c3.getargs(var=True) == ("x", "z") def f4(x, *y, **z): pass + c4 = _pytest._code.Code(f4) - assert c4.getargs(var=True) == ('x', 'y', 'z') + assert c4.getargs(var=True) == ("x", "y", "z") def test_frame_getargs(): + def f1(x): return sys._getframe(0) - fr1 = _pytest._code.Frame(f1('a')) - assert fr1.getargs(var=True) == [('x', 'a')] + + fr1 = _pytest._code.Frame(f1("a")) + assert fr1.getargs(var=True) == [("x", "a")] def f2(x, *y): return sys._getframe(0) - fr2 = _pytest._code.Frame(f2('a', 'b', 'c')) - assert fr2.getargs(var=True) == [('x', 'a'), ('y', ('b', 'c'))] + + fr2 = _pytest._code.Frame(f2("a", "b", "c")) + assert fr2.getargs(var=True) == [("x", "a"), ("y", ("b", "c"))] def f3(x, **z): return sys._getframe(0) - fr3 = _pytest._code.Frame(f3('a', b='c')) - assert fr3.getargs(var=True) == [('x', 'a'), ('z', {'b': 'c'})] + + fr3 = _pytest._code.Frame(f3("a", b="c")) + assert fr3.getargs(var=True) == [("x", "a"), ("z", {"b": "c"})] def f4(x, *y, **z): return sys._getframe(0) - fr4 = _pytest._code.Frame(f4('a', 'b', c='d')) - assert fr4.getargs(var=True) == [('x', 'a'), ('y', ('b',)), - ('z', {'c': 'd'})] + + fr4 = _pytest._code.Frame(f4("a", "b", c="d")) + assert fr4.getargs(var=True) == [("x", "a"), ("y", ("b",)), ("z", {"c": "d"})] class TestExceptionInfo(object): @@ -173,7 +190,7 @@ class TestTracebackEntry(object): entry = exci.traceback[0] source = entry.getsource() assert len(source) == 6 - assert 'assert False' in source[5] + assert "assert False" in source[5] class TestReprFuncArgs(object): @@ -183,14 +200,11 @@ class TestReprFuncArgs(object): tw = TWMock() - args = [ - ('unicode_string', u"São Paulo"), - ('utf8_string', 'S\xc3\xa3o Paulo'), - ] + args = [("unicode_string", u"São Paulo"), ("utf8_string", "S\xc3\xa3o Paulo")] r = ReprFuncArgs(args) r.toterminal(tw) if sys.version_info[0] >= 3: - assert tw.lines[0] == 'unicode_string = São Paulo, utf8_string = São Paulo' + assert tw.lines[0] == "unicode_string = São Paulo, utf8_string = São Paulo" else: - assert tw.lines[0] == 'unicode_string = São Paulo, utf8_string = São Paulo' + assert tw.lines[0] == "unicode_string = São Paulo, utf8_string = São Paulo" diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_excinfo.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_excinfo.py index 34db8ffa189..f4044b6ecc4 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_excinfo.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_excinfo.py @@ -2,6 +2,8 @@ from __future__ import absolute_import, division, print_function import operator +import os +import sys import _pytest import py import pytest @@ -9,7 +11,9 @@ from _pytest._code.code import ( ExceptionInfo, FormattedExcinfo, ReprExceptionInfo, - ExceptionChainRepr) + ExceptionChainRepr, +) +from six.moves import queue from test_source import astonly @@ -20,8 +24,6 @@ except ImportError: else: invalidate_import_caches = getattr(importlib, "invalidate_caches", None) -queue = py.builtin._tryimport('queue', 'Queue') - failsonjython = pytest.mark.xfail("sys.platform.startswith('java')") pytest_version_info = tuple(map(int, pytest.__version__.split(".")[:3])) @@ -63,6 +65,7 @@ def test_excinfo_simple(): def test_excinfo_getstatement(): + def g(): raise ValueError @@ -73,9 +76,11 @@ def test_excinfo_getstatement(): f() except ValueError: excinfo = _pytest._code.ExceptionInfo() - linenumbers = [_pytest._code.getrawcode(f).co_firstlineno - 1 + 4, - _pytest._code.getrawcode(f).co_firstlineno - 1 + 1, - _pytest._code.getrawcode(g).co_firstlineno - 1 + 1, ] + linenumbers = [ + _pytest._code.getrawcode(f).co_firstlineno - 1 + 4, + _pytest._code.getrawcode(f).co_firstlineno - 1 + 1, + _pytest._code.getrawcode(g).co_firstlineno - 1 + 1, + ] values = list(excinfo.traceback) foundlinenumbers = [x.lineno for x in values] assert foundlinenumbers == linenumbers @@ -83,6 +88,7 @@ def test_excinfo_getstatement(): # print "%s:%d %s" %(x.path.relto(root), x.lineno, x.statement) # xxx + # testchain for getentries test below @@ -106,6 +112,7 @@ def h(): class TestTraceback_f_g_h(object): + def setup_method(self, method): try: h() @@ -117,7 +124,7 @@ class TestTraceback_f_g_h(object): entries = list(tb) assert len(tb) == 4 # maybe fragile test assert len(entries) == 4 # maybe fragile test - names = ['f', 'g', 'h'] + names = ["f", "g", "h"] for entry in entries: try: names.remove(entry.frame.code.name) @@ -134,14 +141,16 @@ class TestTraceback_f_g_h(object): @astonly @failsonjython def test_traceback_entry_getsource_in_construct(self): - source = _pytest._code.Source("""\ + source = _pytest._code.Source( + """\ def xyz(): try: raise ValueError except somenoname: pass xyz() - """) + """ + ) try: exec(source.compile()) except NameError: @@ -166,7 +175,7 @@ class TestTraceback_f_g_h(object): basedir = py.path.local(pytest.__file__).dirpath() newtraceback = excinfo.traceback.cut(excludepath=basedir) for x in newtraceback: - if hasattr(x, 'path'): + if hasattr(x, "path"): assert not py.path.local(x.path).relto(basedir) assert newtraceback[-1].frame.code.path == p @@ -175,13 +184,17 @@ class TestTraceback_f_g_h(object): ntraceback = traceback.filter() assert len(ntraceback) == len(traceback) - 1 - @pytest.mark.parametrize('tracebackhide, matching', [ - (lambda info: True, True), - (lambda info: False, False), - (operator.methodcaller('errisinstance', ValueError), True), - (operator.methodcaller('errisinstance', IndexError), False), - ]) + @pytest.mark.parametrize( + "tracebackhide, matching", + [ + (lambda info: True, True), + (lambda info: False, False), + (operator.methodcaller("errisinstance", ValueError), True), + (operator.methodcaller("errisinstance", IndexError), False), + ], + ) def test_traceback_filter_selective(self, tracebackhide, matching): + def f(): # raise ValueError @@ -201,8 +214,8 @@ class TestTraceback_f_g_h(object): excinfo = pytest.raises(ValueError, h) traceback = excinfo.traceback ntraceback = traceback.filter() - print('old: {0!r}'.format(traceback)) - print('new: {0!r}'.format(ntraceback)) + print("old: {!r}".format(traceback)) + print("new: {!r}".format(ntraceback)) if matching: assert len(ntraceback) == len(traceback) - 2 @@ -211,16 +224,19 @@ class TestTraceback_f_g_h(object): assert len(ntraceback) == len(traceback) - 1 def test_traceback_recursion_index(self): + def f(n): if n < 10: n += 1 f(n) + excinfo = pytest.raises(RuntimeError, f, 8) traceback = excinfo.traceback recindex = traceback.recursionindex() assert recindex == 3 def test_traceback_only_specific_recursion_errors(self, monkeypatch): + def f(n): if n == 0: raise RuntimeError("hello") @@ -232,11 +248,13 @@ class TestTraceback_f_g_h(object): assert "RuntimeError: hello" in str(repr.reprcrash) def test_traceback_no_recursion_index(self): + def do_stuff(): raise RuntimeError def reraise_me(): import sys + exc, val, tb = sys.exc_info() py.builtin._reraise(exc, val, tb) @@ -253,15 +271,16 @@ class TestTraceback_f_g_h(object): def test_traceback_messy_recursion(self): # XXX: simplified locally testable version - decorator = pytest.importorskip('decorator').decorator + decorator = pytest.importorskip("decorator").decorator def log(f, *k, **kw): - print('%s %s' % (k, kw)) + print("%s %s" % (k, kw)) f(*k, **kw) + log = decorator(log) def fail(): - raise ValueError('') + raise ValueError("") fail = log(log(fail)) @@ -269,6 +288,7 @@ class TestTraceback_f_g_h(object): assert excinfo.traceback.recursionindex() is None def test_traceback_getcrashentry(self): + def i(): __tracebackhide__ = True raise ValueError @@ -289,9 +309,10 @@ class TestTraceback_f_g_h(object): co = _pytest._code.Code(h) assert entry.frame.code.path == co.path assert entry.lineno == co.firstlineno + 1 - assert entry.frame.code.name == 'h' + assert entry.frame.code.name == "h" def test_traceback_getcrashentry_empty(self): + def g(): __tracebackhide__ = True raise ValueError @@ -306,16 +327,15 @@ class TestTraceback_f_g_h(object): co = _pytest._code.Code(g) assert entry.frame.code.path == co.path assert entry.lineno == co.firstlineno + 2 - assert entry.frame.code.name == 'g' + assert entry.frame.code.name == "g" def test_excinfo_exconly(): excinfo = pytest.raises(ValueError, h) - assert excinfo.exconly().startswith('ValueError') - excinfo = pytest.raises(ValueError, - "raise ValueError('hello\\nworld')") + assert excinfo.exconly().startswith("ValueError") + excinfo = pytest.raises(ValueError, "raise ValueError('hello\\nworld')") msg = excinfo.exconly(tryshort=True) - assert msg.startswith('ValueError') + assert msg.startswith("ValueError") assert msg.endswith("world") @@ -349,19 +369,18 @@ def test_excinfo_no_sourcecode(): def test_excinfo_no_python_sourcecode(tmpdir): # XXX: simplified locally testable version - tmpdir.join('test.txt').write("{{ h()}}:") + tmpdir.join("test.txt").write("{{ h()}}:") - jinja2 = pytest.importorskip('jinja2') + jinja2 = pytest.importorskip("jinja2") loader = jinja2.FileSystemLoader(str(tmpdir)) env = jinja2.Environment(loader=loader) - template = env.get_template('test.txt') - excinfo = pytest.raises(ValueError, - template.render, h=h) + template = env.get_template("test.txt") + excinfo = pytest.raises(ValueError, template.render, h=h) for item in excinfo.traceback: print(item) # XXX: for some reason jinja.Template.render is printed in full item.source # shouldnt fail - if item.path.basename == 'test.txt': - assert str(item.source) == '{{ h()}}:' + if item.path.basename == "test.txt": + assert str(item.source) == "{{ h()}}:" def test_entrysource_Queue_example(): @@ -391,28 +410,29 @@ def test_codepath_Queue_example(): def test_match_succeeds(): with pytest.raises(ZeroDivisionError) as excinfo: 0 // 0 - excinfo.match(r'.*zero.*') + excinfo.match(r".*zero.*") def test_match_raises_error(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def test_division_zero(): with pytest.raises(ZeroDivisionError) as excinfo: 0 / 0 excinfo.match(r'[123]+') - """) + """ + ) result = testdir.runpytest() assert result.ret != 0 - result.stdout.fnmatch_lines([ - "*AssertionError*Pattern*[123]*not found*", - ]) + result.stdout.fnmatch_lines(["*AssertionError*Pattern*[123]*not found*"]) class TestFormattedExcinfo(object): @pytest.fixture def importasmod(self, request): + def importasmod(source): source = _pytest._code.Source(source) tmpdir = request.getfixturevalue("tmpdir") @@ -422,6 +442,7 @@ class TestFormattedExcinfo(object): if invalidate_import_caches is not None: invalidate_import_caches() return modpath.pyimport() + return importasmod def excinfo_from_exec(self, source): @@ -436,10 +457,12 @@ class TestFormattedExcinfo(object): def test_repr_source(self): pr = FormattedExcinfo() - source = _pytest._code.Source(""" + source = _pytest._code.Source( + """ def f(x): pass - """).strip() + """ + ).strip() pr.flow_marker = "|" lines = pr.get_source(source, 0) assert len(lines) == 2 @@ -449,19 +472,17 @@ class TestFormattedExcinfo(object): def test_repr_source_excinfo(self): """ check if indentation is right """ pr = FormattedExcinfo() - excinfo = self.excinfo_from_exec(""" + excinfo = self.excinfo_from_exec( + """ def f(): assert 0 f() - """) + """ + ) pr = FormattedExcinfo() source = pr._getentrysource(excinfo.traceback[-1]) lines = pr.get_source(source, 1, excinfo) - assert lines == [ - ' def f():', - '> assert 0', - 'E AssertionError' - ] + assert lines == [" def f():", "> assert 0", "E AssertionError"] def test_repr_source_not_existing(self): pr = FormattedExcinfo() @@ -472,32 +493,37 @@ class TestFormattedExcinfo(object): excinfo = _pytest._code.ExceptionInfo() repr = pr.repr_excinfo(excinfo) assert repr.reprtraceback.reprentries[1].lines[0] == "> ???" - if py.std.sys.version_info[0] >= 3: + if sys.version_info[0] >= 3: assert repr.chain[0][0].reprentries[1].lines[0] == "> ???" def test_repr_many_line_source_not_existing(self): pr = FormattedExcinfo() - co = compile(""" + co = compile( + """ a = 1 raise ValueError() -""", "", "exec") +""", + "", + "exec", + ) try: exec(co) except ValueError: excinfo = _pytest._code.ExceptionInfo() repr = pr.repr_excinfo(excinfo) assert repr.reprtraceback.reprentries[1].lines[0] == "> ???" - if py.std.sys.version_info[0] >= 3: + if sys.version_info[0] >= 3: assert repr.chain[0][0].reprentries[1].lines[0] == "> ???" def test_repr_source_failing_fullsource(self): pr = FormattedExcinfo() class FakeCode(object): - class raw(object): - co_filename = '?' - path = '?' + class raw(object): + co_filename = "?" + + path = "?" firstlineno = 5 def fullsource(self): @@ -511,6 +537,7 @@ raise ValueError() f_globals = {} class FakeTracebackEntry(_pytest._code.Traceback.Entry): + def __init__(self, tb, excinfo=None): self.lineno = 5 + 3 @@ -542,33 +569,35 @@ raise ValueError() tb = FakeRawTB() excinfo.traceback = Traceback(tb) - fail = IOError() # noqa + fail = IOError() repr = pr.repr_excinfo(excinfo) assert repr.reprtraceback.reprentries[0].lines[0] == "> ???" - if py.std.sys.version_info[0] >= 3: + if sys.version_info[0] >= 3: assert repr.chain[0][0].reprentries[0].lines[0] == "> ???" fail = py.error.ENOENT # noqa repr = pr.repr_excinfo(excinfo) assert repr.reprtraceback.reprentries[0].lines[0] == "> ???" - if py.std.sys.version_info[0] >= 3: + if sys.version_info[0] >= 3: assert repr.chain[0][0].reprentries[0].lines[0] == "> ???" def test_repr_local(self): p = FormattedExcinfo(showlocals=True) - loc = {'y': 5, 'z': 7, 'x': 3, '@x': 2, '__builtins__': {}} + loc = {"y": 5, "z": 7, "x": 3, "@x": 2, "__builtins__": {}} reprlocals = p.repr_locals(loc) assert reprlocals.lines - assert reprlocals.lines[0] == '__builtins__ = ' - assert reprlocals.lines[1] == 'x = 3' - assert reprlocals.lines[2] == 'y = 5' - assert reprlocals.lines[3] == 'z = 7' + assert reprlocals.lines[0] == "__builtins__ = " + assert reprlocals.lines[1] == "x = 3" + assert reprlocals.lines[2] == "y = 5" + assert reprlocals.lines[3] == "z = 7" def test_repr_tracebackentry_lines(self, importasmod): - mod = importasmod(""" + mod = importasmod( + """ def func1(): raise ValueError("hello\\nworld") - """) + """ + ) excinfo = pytest.raises(ValueError, mod.func1) excinfo.traceback = excinfo.traceback.filter() p = FormattedExcinfo() @@ -576,17 +605,17 @@ raise ValueError() # test as intermittent entry lines = reprtb.lines - assert lines[0] == ' def func1():' + assert lines[0] == " def func1():" assert lines[1] == '> raise ValueError("hello\\nworld")' # test as last entry p = FormattedExcinfo(showlocals=True) repr_entry = p.repr_traceback_entry(excinfo.traceback[-1], excinfo) lines = repr_entry.lines - assert lines[0] == ' def func1():' + assert lines[0] == " def func1():" assert lines[1] == '> raise ValueError("hello\\nworld")' - assert lines[2] == 'E ValueError: hello' - assert lines[3] == 'E world' + assert lines[2] == "E ValueError: hello" + assert lines[3] == "E world" assert not lines[4:] loc = repr_entry.reprlocals is not None @@ -596,42 +625,46 @@ raise ValueError() # assert loc.message == "ValueError: hello" def test_repr_tracebackentry_lines2(self, importasmod): - mod = importasmod(""" + mod = importasmod( + """ def func1(m, x, y, z): raise ValueError("hello\\nworld") - """) + """ + ) excinfo = pytest.raises(ValueError, mod.func1, "m" * 90, 5, 13, "z" * 120) excinfo.traceback = excinfo.traceback.filter() entry = excinfo.traceback[-1] p = FormattedExcinfo(funcargs=True) reprfuncargs = p.repr_args(entry) - assert reprfuncargs.args[0] == ('m', repr("m" * 90)) - assert reprfuncargs.args[1] == ('x', '5') - assert reprfuncargs.args[2] == ('y', '13') - assert reprfuncargs.args[3] == ('z', repr("z" * 120)) + assert reprfuncargs.args[0] == ("m", repr("m" * 90)) + assert reprfuncargs.args[1] == ("x", "5") + assert reprfuncargs.args[2] == ("y", "13") + assert reprfuncargs.args[3] == ("z", repr("z" * 120)) p = FormattedExcinfo(funcargs=True) repr_entry = p.repr_traceback_entry(entry) assert repr_entry.reprfuncargs.args == reprfuncargs.args tw = TWMock() repr_entry.toterminal(tw) - assert tw.lines[0] == "m = " + repr('m' * 90) + assert tw.lines[0] == "m = " + repr("m" * 90) assert tw.lines[1] == "x = 5, y = 13" - assert tw.lines[2] == "z = " + repr('z' * 120) + assert tw.lines[2] == "z = " + repr("z" * 120) def test_repr_tracebackentry_lines_var_kw_args(self, importasmod): - mod = importasmod(""" + mod = importasmod( + """ def func1(x, *y, **z): raise ValueError("hello\\nworld") - """) - excinfo = pytest.raises(ValueError, mod.func1, 'a', 'b', c='d') + """ + ) + excinfo = pytest.raises(ValueError, mod.func1, "a", "b", c="d") excinfo.traceback = excinfo.traceback.filter() entry = excinfo.traceback[-1] p = FormattedExcinfo(funcargs=True) reprfuncargs = p.repr_args(entry) - assert reprfuncargs.args[0] == ('x', repr('a')) - assert reprfuncargs.args[1] == ('y', repr(('b',))) - assert reprfuncargs.args[2] == ('z', repr({'c': 'd'})) + assert reprfuncargs.args[0] == ("x", repr("a")) + assert reprfuncargs.args[1] == ("y", repr(("b",))) + assert reprfuncargs.args[2] == ("z", repr({"c": "d"})) p = FormattedExcinfo(funcargs=True) repr_entry = p.repr_traceback_entry(entry) @@ -641,18 +674,20 @@ raise ValueError() assert tw.lines[0] == "x = 'a', y = ('b',), z = {'c': 'd'}" def test_repr_tracebackentry_short(self, importasmod): - mod = importasmod(""" + mod = importasmod( + """ def func1(): raise ValueError("hello") def entry(): func1() - """) + """ + ) excinfo = pytest.raises(ValueError, mod.entry) p = FormattedExcinfo(style="short") reprtb = p.repr_traceback_entry(excinfo.traceback[-2]) lines = reprtb.lines basename = py.path.local(mod.__file__).basename - assert lines[0] == ' func1()' + assert lines[0] == " func1()" assert basename in str(reprtb.reprfileloc.path) assert reprtb.reprfileloc.lineno == 5 @@ -661,17 +696,19 @@ raise ValueError() reprtb = p.repr_traceback_entry(excinfo.traceback[-1], excinfo) lines = reprtb.lines assert lines[0] == ' raise ValueError("hello")' - assert lines[1] == 'E ValueError: hello' + assert lines[1] == "E ValueError: hello" assert basename in str(reprtb.reprfileloc.path) assert reprtb.reprfileloc.lineno == 3 def test_repr_tracebackentry_no(self, importasmod): - mod = importasmod(""" + mod = importasmod( + """ def func1(): raise ValueError("hello") def entry(): func1() - """) + """ + ) excinfo = pytest.raises(ValueError, mod.entry) p = FormattedExcinfo(style="no") p.repr_traceback_entry(excinfo.traceback[-2]) @@ -679,16 +716,18 @@ raise ValueError() p = FormattedExcinfo(style="no") reprentry = p.repr_traceback_entry(excinfo.traceback[-1], excinfo) lines = reprentry.lines - assert lines[0] == 'E ValueError: hello' + assert lines[0] == "E ValueError: hello" assert not lines[1:] def test_repr_traceback_tbfilter(self, importasmod): - mod = importasmod(""" + mod = importasmod( + """ def f(x): raise ValueError(x) def entry(): f(0) - """) + """ + ) excinfo = pytest.raises(ValueError, mod.entry) p = FormattedExcinfo(tbfilter=True) reprtb = p.repr_traceback(excinfo) @@ -698,15 +737,18 @@ raise ValueError() assert len(reprtb.reprentries) == 3 def test_traceback_short_no_source(self, importasmod, monkeypatch): - mod = importasmod(""" + mod = importasmod( + """ def func1(): raise ValueError("hello") def entry(): func1() - """) + """ + ) excinfo = pytest.raises(ValueError, mod.entry) from _pytest._code.code import Code - monkeypatch.setattr(Code, 'path', 'bogus') + + monkeypatch.setattr(Code, "path", "bogus") excinfo.traceback[0].frame.code.path = "bogus" p = FormattedExcinfo(style="short") reprtb = p.repr_traceback_entry(excinfo.traceback[-2]) @@ -715,18 +757,20 @@ raise ValueError() last_reprtb = last_p.repr_traceback_entry(excinfo.traceback[-1], excinfo) last_lines = last_reprtb.lines monkeypatch.undo() - assert lines[0] == ' func1()' + assert lines[0] == " func1()" assert last_lines[0] == ' raise ValueError("hello")' - assert last_lines[1] == 'E ValueError: hello' + assert last_lines[1] == "E ValueError: hello" def test_repr_traceback_and_excinfo(self, importasmod): - mod = importasmod(""" + mod = importasmod( + """ def f(x): raise ValueError(x) def entry(): f(0) - """) + """ + ) excinfo = pytest.raises(ValueError, mod.entry) for style in ("long", "short"): @@ -738,19 +782,21 @@ raise ValueError() repr = p.repr_excinfo(excinfo) assert repr.reprtraceback assert len(repr.reprtraceback.reprentries) == len(reprtb.reprentries) - if py.std.sys.version_info[0] >= 3: + if sys.version_info[0] >= 3: assert repr.chain[0][0] assert len(repr.chain[0][0].reprentries) == len(reprtb.reprentries) assert repr.reprcrash.path.endswith("mod.py") assert repr.reprcrash.message == "ValueError: 0" def test_repr_traceback_with_invalid_cwd(self, importasmod, monkeypatch): - mod = importasmod(""" + mod = importasmod( + """ def f(x): raise ValueError(x) def entry(): f(0) - """) + """ + ) excinfo = pytest.raises(ValueError, mod.entry) p = FormattedExcinfo() @@ -758,15 +804,17 @@ raise ValueError() def raiseos(): raise OSError(2) - monkeypatch.setattr(py.std.os, 'getcwd', raiseos) + monkeypatch.setattr(os, "getcwd", raiseos) assert p._makepath(__file__) == __file__ p.repr_traceback(excinfo) def test_repr_excinfo_addouterr(self, importasmod): - mod = importasmod(""" + mod = importasmod( + """ def entry(): raise ValueError() - """) + """ + ) excinfo = pytest.raises(ValueError, mod.entry) repr = excinfo.getrepr() repr.addsection("title", "content") @@ -776,10 +824,12 @@ raise ValueError() assert twmock.lines[-2] == ("-", "title") def test_repr_excinfo_reprcrash(self, importasmod): - mod = importasmod(""" + mod = importasmod( + """ def entry(): raise ValueError() - """) + """ + ) excinfo = pytest.raises(ValueError, mod.entry) repr = excinfo.getrepr() assert repr.reprcrash.path.endswith("mod.py") @@ -788,14 +838,16 @@ raise ValueError() assert str(repr.reprcrash).endswith("mod.py:3: ValueError") def test_repr_traceback_recursion(self, importasmod): - mod = importasmod(""" + mod = importasmod( + """ def rec2(x): return rec1(x+1) def rec1(x): return rec2(x-1) def entry(): rec1(42) - """) + """ + ) excinfo = pytest.raises(RuntimeError, mod.entry) for style in ("short", "long", "no"): @@ -805,21 +857,23 @@ raise ValueError() assert str(reprtb) def test_reprexcinfo_getrepr(self, importasmod): - mod = importasmod(""" + mod = importasmod( + """ def f(x): raise ValueError(x) def entry(): f(0) - """) + """ + ) excinfo = pytest.raises(ValueError, mod.entry) for style in ("short", "long", "no"): for showlocals in (True, False): repr = excinfo.getrepr(style=style, showlocals=showlocals) - if py.std.sys.version_info[0] < 3: + if sys.version_info[0] < 3: assert isinstance(repr, ReprExceptionInfo) assert repr.reprtraceback.style == style - if py.std.sys.version_info[0] >= 3: + if sys.version_info[0] >= 3: assert isinstance(repr, ExceptionChainRepr) for repr in repr.chain: assert repr[0].style == style @@ -828,6 +882,7 @@ raise ValueError() from _pytest._code.code import TerminalRepr class MyRepr(TerminalRepr): + def toterminal(self, tw): tw.line(py.builtin._totext("я", "utf-8")) @@ -835,12 +890,14 @@ raise ValueError() assert x == py.builtin._totext("я", "utf-8") def test_toterminal_long(self, importasmod): - mod = importasmod(""" + mod = importasmod( + """ def g(x): raise ValueError(x) def f(): g(3) - """) + """ + ) excinfo = pytest.raises(ValueError, mod.f) excinfo.traceback = excinfo.traceback.filter() repr = excinfo.getrepr() @@ -865,14 +922,16 @@ raise ValueError() assert tw.lines[12] == ":3: ValueError" def test_toterminal_long_missing_source(self, importasmod, tmpdir): - mod = importasmod(""" + mod = importasmod( + """ def g(x): raise ValueError(x) def f(): g(3) - """) + """ + ) excinfo = pytest.raises(ValueError, mod.f) - tmpdir.join('mod.py').remove() + tmpdir.join("mod.py").remove() excinfo.traceback = excinfo.traceback.filter() repr = excinfo.getrepr() tw = TWMock() @@ -894,14 +953,16 @@ raise ValueError() assert tw.lines[10] == ":3: ValueError" def test_toterminal_long_incomplete_source(self, importasmod, tmpdir): - mod = importasmod(""" + mod = importasmod( + """ def g(x): raise ValueError(x) def f(): g(3) - """) + """ + ) excinfo = pytest.raises(ValueError, mod.f) - tmpdir.join('mod.py').write('asdf') + tmpdir.join("mod.py").write("asdf") excinfo.traceback = excinfo.traceback.filter() repr = excinfo.getrepr() tw = TWMock() @@ -923,10 +984,12 @@ raise ValueError() assert tw.lines[10] == ":3: ValueError" def test_toterminal_long_filenames(self, importasmod): - mod = importasmod(""" + mod = importasmod( + """ def f(): raise ValueError() - """) + """ + ) excinfo = pytest.raises(ValueError, mod.f) tw = TWMock() path = py.path.local(mod.__file__) @@ -949,20 +1012,30 @@ raise ValueError() finally: old.chdir() - @pytest.mark.parametrize('reproptions', [ - {'style': style, 'showlocals': showlocals, - 'funcargs': funcargs, 'tbfilter': tbfilter - } for style in ("long", "short", "no") - for showlocals in (True, False) - for tbfilter in (True, False) - for funcargs in (True, False)]) + @pytest.mark.parametrize( + "reproptions", + [ + { + "style": style, + "showlocals": showlocals, + "funcargs": funcargs, + "tbfilter": tbfilter, + } + for style in ("long", "short", "no") + for showlocals in (True, False) + for tbfilter in (True, False) + for funcargs in (True, False) + ], + ) def test_format_excinfo(self, importasmod, reproptions): - mod = importasmod(""" + mod = importasmod( + """ def g(x): raise ValueError(x) def f(): g(3) - """) + """ + ) excinfo = pytest.raises(ValueError, mod.f) tw = py.io.TerminalWriter(stringio=True) repr = excinfo.getrepr(**reproptions) @@ -970,7 +1043,8 @@ raise ValueError() assert tw.stringio.getvalue() def test_traceback_repr_style(self, importasmod): - mod = importasmod(""" + mod = importasmod( + """ def f(): g() def g(): @@ -979,7 +1053,8 @@ raise ValueError() i() def i(): raise ValueError() - """) + """ + ) excinfo = pytest.raises(ValueError, mod.f) excinfo.traceback = excinfo.traceback.filter() excinfo.traceback[1].set_repr_style("short") @@ -1015,7 +1090,8 @@ raise ValueError() @pytest.mark.skipif("sys.version_info[0] < 3") def test_exc_chain_repr(self, importasmod): - mod = importasmod(""" + mod = importasmod( + """ class Err(Exception): pass def f(): @@ -1030,7 +1106,8 @@ raise ValueError() def h(): raise AttributeError() - """) + """ + ) excinfo = pytest.raises(AttributeError, mod.f) r = excinfo.getrepr(style="long") tw = TWMock() @@ -1043,8 +1120,8 @@ raise ValueError() assert tw.lines[3] == "> g()" assert tw.lines[4] == "" line = tw.get_write_msg(5) - assert line.endswith('mod.py') - assert tw.lines[6] == ':6: ' + assert line.endswith("mod.py") + assert tw.lines[6] == ":6: " assert tw.lines[7] == ("_ ", None) assert tw.lines[8] == "" assert tw.lines[9] == " def g():" @@ -1052,10 +1129,13 @@ raise ValueError() assert tw.lines[11] == "E ValueError" assert tw.lines[12] == "" line = tw.get_write_msg(13) - assert line.endswith('mod.py') - assert tw.lines[14] == ':12: ValueError' + assert line.endswith("mod.py") + assert tw.lines[14] == ":12: ValueError" assert tw.lines[15] == "" - assert tw.lines[16] == "The above exception was the direct cause of the following exception:" + assert ( + tw.lines[16] + == "The above exception was the direct cause of the following exception:" + ) assert tw.lines[17] == "" assert tw.lines[18] == " def f():" assert tw.lines[19] == " try:" @@ -1065,10 +1145,13 @@ raise ValueError() assert tw.lines[23] == "E test_exc_chain_repr0.mod.Err" assert tw.lines[24] == "" line = tw.get_write_msg(25) - assert line.endswith('mod.py') + assert line.endswith("mod.py") assert tw.lines[26] == ":8: Err" assert tw.lines[27] == "" - assert tw.lines[28] == "During handling of the above exception, another exception occurred:" + assert ( + tw.lines[28] + == "During handling of the above exception, another exception occurred:" + ) assert tw.lines[29] == "" assert tw.lines[30] == " def f():" assert tw.lines[31] == " try:" @@ -1079,21 +1162,22 @@ raise ValueError() assert tw.lines[36] == "> h()" assert tw.lines[37] == "" line = tw.get_write_msg(38) - assert line.endswith('mod.py') + assert line.endswith("mod.py") assert tw.lines[39] == ":10: " - assert tw.lines[40] == ('_ ', None) + assert tw.lines[40] == ("_ ", None) assert tw.lines[41] == "" assert tw.lines[42] == " def h():" assert tw.lines[43] == "> raise AttributeError()" assert tw.lines[44] == "E AttributeError" assert tw.lines[45] == "" line = tw.get_write_msg(46) - assert line.endswith('mod.py') + assert line.endswith("mod.py") assert tw.lines[47] == ":15: AttributeError" @pytest.mark.skipif("sys.version_info[0] < 3") def test_exc_repr_with_raise_from_none_chain_suppression(self, importasmod): - mod = importasmod(""" + mod = importasmod( + """ def f(): try: g() @@ -1101,7 +1185,8 @@ raise ValueError() raise AttributeError() from None def g(): raise ValueError() - """) + """ + ) excinfo = pytest.raises(AttributeError, mod.f) r = excinfo.getrepr(style="long") tw = TWMock() @@ -1117,15 +1202,24 @@ raise ValueError() assert tw.lines[6] == "E AttributeError" assert tw.lines[7] == "" line = tw.get_write_msg(8) - assert line.endswith('mod.py') + assert line.endswith("mod.py") assert tw.lines[9] == ":6: AttributeError" assert len(tw.lines) == 10 @pytest.mark.skipif("sys.version_info[0] < 3") - @pytest.mark.parametrize('reason, description', [ - ('cause', 'The above exception was the direct cause of the following exception:'), - ('context', 'During handling of the above exception, another exception occurred:'), - ]) + @pytest.mark.parametrize( + "reason, description", + [ + ( + "cause", + "The above exception was the direct cause of the following exception:", + ), + ( + "context", + "During handling of the above exception, another exception occurred:", + ), + ], + ) def test_exc_chain_repr_without_traceback(self, importasmod, reason, description): """ Handle representation of exception chains where one of the exceptions doesn't have a @@ -1133,8 +1227,10 @@ raise ValueError() module (#1984). """ from _pytest.pytester import LineMatcher - exc_handling_code = ' from e' if reason == 'cause' else '' - mod = importasmod(""" + + exc_handling_code = " from e" if reason == "cause" else "" + mod = importasmod( + """ def f(): try: g() @@ -1142,13 +1238,16 @@ raise ValueError() raise RuntimeError('runtime problem'){exc_handling_code} def g(): raise ValueError('invalid value') - """.format(exc_handling_code=exc_handling_code)) + """.format( + exc_handling_code=exc_handling_code + ) + ) with pytest.raises(RuntimeError) as excinfo: mod.f() # emulate the issue described in #1984 - attr = '__%s__' % reason + attr = "__%s__" % reason getattr(excinfo.value, attr).__traceback__ = None r = excinfo.getrepr() @@ -1157,19 +1256,21 @@ raise ValueError() r.toterminal(tw) matcher = LineMatcher(tw.stringio.getvalue().splitlines()) - matcher.fnmatch_lines([ - "ValueError: invalid value", - description, - "* except Exception as e:", - "> * raise RuntimeError('runtime problem')" + exc_handling_code, - "E *RuntimeError: runtime problem", - ]) + matcher.fnmatch_lines( + [ + "ValueError: invalid value", + description, + "* except Exception as e:", + "> * raise RuntimeError('runtime problem')" + exc_handling_code, + "E *RuntimeError: runtime problem", + ] + ) @pytest.mark.parametrize("style", ["short", "long"]) @pytest.mark.parametrize("encoding", [None, "utf8", "utf16"]) def test_repr_traceback_with_unicode(style, encoding): - msg = u'☹' + msg = u"☹" if encoding is not None: msg = msg.encode(encoding) try: @@ -1182,28 +1283,33 @@ def test_repr_traceback_with_unicode(style, encoding): def test_cwd_deleted(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test(tmpdir): tmpdir.chdir() tmpdir.remove() assert False - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(['* 1 failed in *']) - assert 'INTERNALERROR' not in result.stdout.str() + result.stderr.str() + result.stdout.fnmatch_lines(["* 1 failed in *"]) + assert "INTERNALERROR" not in result.stdout.str() + result.stderr.str() def test_exception_repr_extraction_error_on_recursion(): """ Ensure we can properly detect a recursion error even - if some locals raise error on comparision (#2459). + if some locals raise error on comparison (#2459). """ + class numpy_like(object): def __eq__(self, other): if type(other) is numpy_like: - raise ValueError('The truth value of an array ' - 'with more than one element is ambiguous.') + raise ValueError( + "The truth value of an array " + "with more than one element is ambiguous." + ) def a(x): return b(numpy_like()) @@ -1216,14 +1322,17 @@ def test_exception_repr_extraction_error_on_recursion(): except: # noqa from _pytest._code.code import ExceptionInfo from _pytest.pytester import LineMatcher + exc_info = ExceptionInfo() matcher = LineMatcher(str(exc_info.getrepr()).splitlines()) - matcher.fnmatch_lines([ - '!!! Recursion error detected, but an error occurred locating the origin of recursion.', - '*The following exception happened*', - '*ValueError: The truth value of an array*', - ]) + matcher.fnmatch_lines( + [ + "!!! Recursion error detected, but an error occurred locating the origin of recursion.", + "*The following exception happened*", + "*ValueError: The truth value of an array*", + ] + ) def test_no_recursion_index_on_recursion_error(): @@ -1232,14 +1341,17 @@ def test_no_recursion_index_on_recursion_error(): during a recursion error (#2486). """ try: + class RecursionDepthError(object): + def __getattr__(self, attr): - return getattr(self, '_' + attr) + return getattr(self, "_" + attr) RecursionDepthError().trigger except: # noqa from _pytest._code.code import ExceptionInfo + exc_info = ExceptionInfo() - assert 'maximum recursion' in str(exc_info.getrepr()) + assert "maximum recursion" in str(exc_info.getrepr()) else: assert 0 diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_source.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_source.py index 8eda68a6e2f..56dad75671f 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_source.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_source.py @@ -2,19 +2,17 @@ # disable flake check on this file because some constructs are strange # or redundant on purpose and can't be disable on a line-by-line basis from __future__ import absolute_import, division, print_function +import inspect import sys import _pytest._code import py import pytest from _pytest._code import Source -from _pytest._code.source import _ast +from _pytest._code.source import ast -if _ast is not None: - astonly = pytest.mark.nothing -else: - astonly = pytest.mark.xfail("True", reason="only works with AST-compile") +astonly = pytest.mark.nothing failsonjython = pytest.mark.xfail("sys.platform.startswith('java')") @@ -25,14 +23,20 @@ def test_source_str_function(): x = Source(" 3") assert str(x) == "3" - x = Source(""" + x = Source( + """ 3 - """, rstrip=False) + """, + rstrip=False, + ) assert str(x) == "\n3\n " - x = Source(""" + x = Source( + """ 3 - """, rstrip=True) + """, + rstrip=True, + ) assert str(x) == "\n3" @@ -43,70 +47,81 @@ def test_unicode(): return x = Source(unicode("4")) assert str(x) == "4" - co = _pytest._code.compile(unicode('u"\xc3\xa5"', 'utf8'), mode='eval') + co = _pytest._code.compile(unicode('u"\xc3\xa5"', "utf8"), mode="eval") val = eval(co) assert isinstance(val, unicode) def test_source_from_function(): source = _pytest._code.Source(test_source_str_function) - assert str(source).startswith('def test_source_str_function():') + assert str(source).startswith("def test_source_str_function():") def test_source_from_method(): + class TestClass(object): + def test_method(self): pass + source = _pytest._code.Source(TestClass().test_method) - assert source.lines == ["def test_method(self):", - " pass"] + assert source.lines == ["def test_method(self):", " pass"] def test_source_from_lines(): lines = ["a \n", "b\n", "c"] source = _pytest._code.Source(lines) - assert source.lines == ['a ', 'b', 'c'] + assert source.lines == ["a ", "b", "c"] def test_source_from_inner_function(): + def f(): pass + source = _pytest._code.Source(f, deindent=False) - assert str(source).startswith(' def f():') + assert str(source).startswith(" def f():") source = _pytest._code.Source(f) - assert str(source).startswith('def f():') + assert str(source).startswith("def f():") def test_source_putaround_simple(): source = Source("raise ValueError") source = source.putaround( - "try:", """\ + "try:", + """\ except ValueError: x = 42 else: - x = 23""") - assert str(source) == """\ + x = 23""", + ) + assert ( + str(source) + == """\ try: raise ValueError except ValueError: x = 42 else: x = 23""" + ) def test_source_putaround(): source = Source() - source = source.putaround(""" + source = source.putaround( + """ if 1: x=1 - """) + """ + ) assert str(source).strip() == "if 1:\n x=1" def test_source_strips(): source = Source("") assert source == Source() - assert str(source) == '' + assert str(source) == "" assert source.strip() == source @@ -118,10 +133,10 @@ def test_source_strip_multiline(): def test_syntaxerror_rerepresentation(): - ex = pytest.raises(SyntaxError, _pytest._code.compile, 'xyz xyz') + ex = pytest.raises(SyntaxError, _pytest._code.compile, "xyz xyz") assert ex.value.lineno == 1 assert ex.value.offset in (4, 7) # XXX pypy/jython versus cpython? - assert ex.value.text.strip(), 'x x' + assert ex.value.text.strip(), "x x" def test_isparseable(): @@ -134,12 +149,14 @@ def test_isparseable(): class TestAccesses(object): - source = Source("""\ + source = Source( + """\ def f(x): pass def g(x): pass - """) + """ + ) def test_getrange(self): x = self.source[0:2] @@ -160,18 +177,20 @@ class TestAccesses(object): class TestSourceParsingAndCompiling(object): - source = Source("""\ + source = Source( + """\ def f(x): assert (x == 3 + 4) - """).strip() + """ + ).strip() def test_compile(self): co = _pytest._code.compile("x=3") d = {} exec(co, d) - assert d['x'] == 3 + assert d["x"] == 3 def test_compile_and_getsource_simple(self): co = _pytest._code.compile("x=3") @@ -180,20 +199,26 @@ class TestSourceParsingAndCompiling(object): assert str(source) == "x=3" def test_compile_and_getsource_through_same_function(self): + def gensource(source): return _pytest._code.compile(source) - co1 = gensource(""" + + co1 = gensource( + """ def f(): raise KeyError() - """) - co2 = gensource(""" + """ + ) + co2 = gensource( + """ def f(): raise ValueError() - """) - source1 = py.std.inspect.getsource(co1) - assert 'KeyError' in source1 - source2 = py.std.inspect.getsource(co2) - assert 'ValueError' in source2 + """ + ) + source1 = inspect.getsource(co1) + assert "KeyError" in source1 + source2 = inspect.getsource(co2) + assert "ValueError" in source2 def test_getstatement(self): # print str(self.source) @@ -201,13 +226,15 @@ class TestSourceParsingAndCompiling(object): for i in range(1, 4): # print "trying start in line %r" % self.source[i] s = self.source.getstatement(i) - #x = s.deindent() + # x = s.deindent() assert str(s) == ass def test_getstatementrange_triple_quoted(self): # print str(self.source) - source = Source("""hello(''' - ''')""") + source = Source( + """hello(''' + ''')""" + ) s = source.getstatement(0) assert s == str(source) s = source.getstatement(1) @@ -215,7 +242,8 @@ class TestSourceParsingAndCompiling(object): @astonly def test_getstatementrange_within_constructs(self): - source = Source("""\ + source = Source( + """\ try: try: raise ValueError @@ -223,7 +251,8 @@ class TestSourceParsingAndCompiling(object): pass finally: 42 - """) + """ + ) assert len(source) == 7 # check all lineno's that could occur in a traceback # assert source.getstatementrange(0) == (0, 7) @@ -235,19 +264,22 @@ class TestSourceParsingAndCompiling(object): assert source.getstatementrange(6) == (6, 7) def test_getstatementrange_bug(self): - source = Source("""\ + source = Source( + """\ try: x = ( y + z) except: pass - """) + """ + ) assert len(source) == 6 assert source.getstatementrange(2) == (1, 4) def test_getstatementrange_bug2(self): - source = Source("""\ + source = Source( + """\ assert ( 33 == @@ -257,19 +289,22 @@ class TestSourceParsingAndCompiling(object): ), ] ) - """) + """ + ) assert len(source) == 9 assert source.getstatementrange(5) == (0, 9) def test_getstatementrange_ast_issue58(self): - source = Source("""\ + source = Source( + """\ def test_some(): for a in [a for a in CAUSE_ERROR]: pass x = 3 - """) + """ + ) assert getstatement(2, source).lines == source.lines[2:3] assert getstatement(3, source).lines == source.lines[3:4] @@ -284,6 +319,7 @@ class TestSourceParsingAndCompiling(object): def test_compile_to_ast(self): import ast + source = Source("x = 4") mod = source.compile(flag=ast.PyCF_ONLY_AST) assert isinstance(mod, ast.Module) @@ -297,16 +333,17 @@ class TestSourceParsingAndCompiling(object): frame = excinfo.traceback[-1].frame stmt = frame.code.fullsource.getstatement(frame.lineno) # print "block", str(block) - assert str(stmt).strip().startswith('assert') + assert str(stmt).strip().startswith("assert") - @pytest.mark.parametrize('name', ['', None, 'my']) + @pytest.mark.parametrize("name", ["", None, "my"]) def test_compilefuncs_and_path_sanity(self, name): + def check(comp, name): co = comp(self.source, name) if not name: - expected = "codegen %s:%d>" % (mypath, mylineno + 2 + 2) + expected = "codegen %s:%d>" % (mypath, mylineno + 2 + 3) else: - expected = "codegen %r %s:%d>" % (name, mypath, mylineno + 2 + 2) + expected = "codegen %r %s:%d>" % (name, mypath, mylineno + 2 + 3) fn = co.co_filename assert fn.endswith(expected) @@ -318,33 +355,41 @@ class TestSourceParsingAndCompiling(object): check(comp, name) def test_offsetless_synerr(self): - pytest.raises(SyntaxError, _pytest._code.compile, "lambda a,a: 0", mode='eval') + pytest.raises(SyntaxError, _pytest._code.compile, "lambda a,a: 0", mode="eval") def test_getstartingblock_singleline(): + class A(object): + def __init__(self, *args): frame = sys._getframe(1) self.source = _pytest._code.Frame(frame).statement - x = A('x', 'y') + x = A("x", "y") values = [i for i in x.source.lines if i.strip()] assert len(values) == 1 def test_getline_finally(): - def c(): pass - excinfo = pytest.raises(TypeError, """ + + def c(): + pass + + excinfo = pytest.raises( + TypeError, + """ teardown = None try: c(1) finally: if teardown: teardown() - """) + """, + ) source = excinfo.traceback[-1].statement - assert str(source).strip() == 'c(1)' + assert str(source).strip() == "c(1)" def test_getfuncsource_dynamic(): @@ -356,29 +401,35 @@ def test_getfuncsource_dynamic(): """ co = _pytest._code.compile(source) py.builtin.exec_(co, globals()) - assert str(_pytest._code.Source(f)).strip() == 'def f():\n raise ValueError' - assert str(_pytest._code.Source(g)).strip() == 'def g(): pass' + assert str(_pytest._code.Source(f)).strip() == "def f():\n raise ValueError" + assert str(_pytest._code.Source(g)).strip() == "def g(): pass" def test_getfuncsource_with_multine_string(): + def f(): - c = '''while True: + c = """while True: pass -''' - assert str(_pytest._code.Source(f)).strip() == "def f():\n c = '''while True:\n pass\n'''" +""" + + assert ( + str(_pytest._code.Source(f)).strip() + == 'def f():\n c = """while True:\n pass\n"""' + ) def test_deindent(): from _pytest._code.source import deindent as deindent - assert deindent(['\tfoo', '\tbar', ]) == ['foo', 'bar'] + + assert deindent(["\tfoo", "\tbar"]) == ["foo", "bar"] def f(): - c = '''while True: + c = """while True: pass -''' - import inspect +""" + lines = deindent(inspect.getsource(f).splitlines()) - assert lines == ["def f():", " c = '''while True:", " pass", "'''"] + assert lines == ["def f():", ' c = """while True:', " pass", '"""'] source = """ def f(): @@ -386,17 +437,19 @@ def test_deindent(): pass """ lines = deindent(source.splitlines()) - assert lines == ['', 'def f():', ' def g():', ' pass', ' '] + assert lines == ["", "def f():", " def g():", " pass", " "] def test_source_of_class_at_eof_without_newline(tmpdir): # this test fails because the implicit inspect.getsource(A) below # does not return the "x = 1" last line. - source = _pytest._code.Source(''' + source = _pytest._code.Source( + """ class A(object): def method(self): x = 1 - ''') + """ + ) path = tmpdir.join("a.py") path.write(source) s2 = _pytest._code.Source(tmpdir.join("a.py").pyimport().A) @@ -404,12 +457,14 @@ def test_source_of_class_at_eof_without_newline(tmpdir): if True: + def x(): pass def test_getsource_fallback(): from _pytest._code.source import getsource + expected = """def x(): pass""" src = getsource(x) @@ -418,6 +473,7 @@ def test_getsource_fallback(): def test_idem_compile_and_getsource(): from _pytest._code.source import getsource + expected = "def x(): pass" co = _pytest._code.compile(expected) src = getsource(co) @@ -426,25 +482,29 @@ def test_idem_compile_and_getsource(): def test_findsource_fallback(): from _pytest._code.source import findsource + src, lineno = findsource(x) - assert 'test_findsource_simple' in str(src) - assert src[lineno] == ' def x():' + assert "test_findsource_simple" in str(src) + assert src[lineno] == " def x():" def test_findsource(): from _pytest._code.source import findsource - co = _pytest._code.compile("""if 1: + + co = _pytest._code.compile( + """if 1: def x(): pass -""") +""" + ) src, lineno = findsource(co) - assert 'if 1:' in str(src) + assert "if 1:" in str(src) d = {} eval(co, d) - src, lineno = findsource(d['x']) - assert 'if 1:' in str(src) + src, lineno = findsource(d["x"]) + assert "if 1:" in str(src) assert src[lineno] == " def x():" @@ -464,7 +524,7 @@ def test_getfslineno(): fspath, lineno = getfslineno(A) - _, A_lineno = py.std.inspect.findsource(A) + _, A_lineno = inspect.findsource(A) assert fspath.basename == "test_source.py" assert lineno == A_lineno @@ -472,30 +532,37 @@ def test_getfslineno(): class B(object): pass + B.__name__ = "B2" assert getfslineno(B)[1] == -1 def test_code_of_object_instance_with_call(): + class A(object): pass + pytest.raises(TypeError, lambda: _pytest._code.Source(A())) class WithCall(object): + def __call__(self): pass code = _pytest._code.Code(WithCall()) - assert 'pass' in str(code.source()) + assert "pass" in str(code.source()) class Hello(object): + def __call__(self): pass + pytest.raises(TypeError, lambda: _pytest._code.Code(Hello)) def getstatement(lineno, source): from _pytest._code.source import getstatementrange_ast + source = _pytest._code.Source(source, deindent=False) ast, start, end = getstatementrange_ast(lineno, source) return source[start:end] @@ -508,9 +575,14 @@ def test_oneline(): def test_comment_and_no_newline_at_end(): from _pytest._code.source import getstatementrange_ast - source = Source(['def test_basic_complex():', - ' assert 1 == 2', - '# vim: filetype=pyopencl:fdm=marker']) + + source = Source( + [ + "def test_basic_complex():", + " assert 1 == 2", + "# vim: filetype=pyopencl:fdm=marker", + ] + ) ast, start, end = getstatementrange_ast(1, source) assert end == 2 @@ -520,8 +592,7 @@ def test_oneline_and_comment(): assert str(source) == "raise ValueError" -@pytest.mark.xfail(hasattr(sys, "pypy_version_info"), - reason='does not work on pypy') +@pytest.mark.xfail(hasattr(sys, "pypy_version_info"), reason="does not work on pypy") def test_comments(): source = '''def test(): "comment 1" @@ -536,20 +607,22 @@ comment 4 """ ''' for line in range(2, 6): - assert str(getstatement(line, source)) == ' x = 1' + assert str(getstatement(line, source)) == " x = 1" for line in range(6, 10): - assert str(getstatement(line, source)) == ' assert False' + assert str(getstatement(line, source)) == " assert False" assert str(getstatement(10, source)) == '"""' def test_comment_in_statement(): - source = '''test(foo=1, + source = """test(foo=1, # comment 1 bar=2) -''' +""" for line in range(1, 3): - assert str(getstatement(line, source)) == \ - 'test(foo=1,\n # comment 1\n bar=2)' + assert ( + str(getstatement(line, source)) + == "test(foo=1,\n # comment 1\n bar=2)" + ) def test_single_line_else(): @@ -563,19 +636,24 @@ def test_single_line_finally(): def test_issue55(): - source = ('def round_trip(dinp):\n assert 1 == dinp\n' - 'def test_rt():\n round_trip("""\n""")\n') + source = ( + "def round_trip(dinp):\n assert 1 == dinp\n" + 'def test_rt():\n round_trip("""\n""")\n' + ) s = getstatement(3, source) assert str(s) == ' round_trip("""\n""")' def XXXtest_multiline(): - source = getstatement(0, """\ + source = getstatement( + 0, + """\ raise ValueError( 23 ) x = 3 -""") +""", + ) assert str(source) == "raise ValueError(\n 23\n)" diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_source_multiline_block.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_source_multiline_block.py index b356d191f0b..92f7412eb8c 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_source_multiline_block.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_source_multiline_block.py @@ -12,15 +12,18 @@ def test_getstartingblock_multiline(): see hhatto/autopep8#307). It was considered better to just move this single test to its own file and exclude it from autopep8 than try to complicate things. """ + class A(object): + def __init__(self, *args): frame = sys._getframe(1) self.source = _pytest._code.Frame(frame).statement + # fmt: off x = A('x', 'y' , 'z') - + # fmt: on values = [i for i in x.source.lines if i.strip()] assert len(values) == 4 diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/deprecated_test.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/deprecated_test.py index 11c4ad43cbc..39ff1f1fc38 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/deprecated_test.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/deprecated_test.py @@ -3,7 +3,8 @@ import pytest def test_yield_tests_deprecation(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def func1(arg, arg2): assert arg == arg2 def test_gen(): @@ -12,93 +13,129 @@ def test_yield_tests_deprecation(testdir): def test_gen2(): for k in range(10): yield func1, 1, 1 - """) - result = testdir.runpytest('-ra') - result.stdout.fnmatch_lines([ - '*yield tests are deprecated, and scheduled to be removed in pytest 4.0*', - '*2 passed*', - ]) - assert result.stdout.str().count('yield tests are deprecated') == 2 + """ + ) + result = testdir.runpytest("-ra") + result.stdout.fnmatch_lines( + [ + "*yield tests are deprecated, and scheduled to be removed in pytest 4.0*", + "*2 passed*", + ] + ) + assert result.stdout.str().count("yield tests are deprecated") == 2 def test_funcarg_prefix_deprecation(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def pytest_funcarg__value(): return 10 def test_funcarg_prefix(value): assert value == 10 - """) - result = testdir.runpytest('-ra') - result.stdout.fnmatch_lines([ - ('*pytest_funcarg__value: ' - 'declaring fixtures using "pytest_funcarg__" prefix is deprecated ' - 'and scheduled to be removed in pytest 4.0. ' - 'Please remove the prefix and use the @pytest.fixture decorator instead.'), - '*1 passed*', - ]) + """ + ) + result = testdir.runpytest("-ra") + result.stdout.fnmatch_lines( + [ + ( + "*pytest_funcarg__value: " + 'declaring fixtures using "pytest_funcarg__" prefix is deprecated ' + "and scheduled to be removed in pytest 4.0. " + "Please remove the prefix and use the @pytest.fixture decorator instead." + ), + "*1 passed*", + ] + ) def test_pytest_setup_cfg_deprecated(testdir): - testdir.makefile('.cfg', setup=''' + testdir.makefile( + ".cfg", + setup=""" [pytest] addopts = --verbose - ''') + """, + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(['*pytest*section in setup.cfg files is deprecated*use*tool:pytest*instead*']) + result.stdout.fnmatch_lines( + ["*pytest*section in setup.cfg files is deprecated*use*tool:pytest*instead*"] + ) + + +def test_pytest_custom_cfg_deprecated(testdir): + testdir.makefile( + ".cfg", + custom=""" + [pytest] + addopts = --verbose + """, + ) + result = testdir.runpytest("-c", "custom.cfg") + result.stdout.fnmatch_lines( + ["*pytest*section in custom.cfg files is deprecated*use*tool:pytest*instead*"] + ) def test_str_args_deprecated(tmpdir, testdir): """Deprecate passing strings to pytest.main(). Scheduled for removal in pytest-4.0.""" from _pytest.main import EXIT_NOTESTSCOLLECTED + warnings = [] class Collect(object): + def pytest_logwarning(self, message): warnings.append(message) ret = pytest.main("%s -x" % tmpdir, plugins=[Collect()]) - testdir.delete_loaded_modules() - msg = ('passing a string to pytest.main() is deprecated, ' - 'pass a list of arguments instead.') + msg = ( + "passing a string to pytest.main() is deprecated, " + "pass a list of arguments instead." + ) assert msg in warnings assert ret == EXIT_NOTESTSCOLLECTED def test_getfuncargvalue_is_deprecated(request): - pytest.deprecated_call(request.getfuncargvalue, 'tmpdir') + pytest.deprecated_call(request.getfuncargvalue, "tmpdir") def test_resultlog_is_deprecated(testdir): - result = testdir.runpytest('--help') - result.stdout.fnmatch_lines(['*DEPRECATED path for machine-readable result log*']) + result = testdir.runpytest("--help") + result.stdout.fnmatch_lines(["*DEPRECATED path for machine-readable result log*"]) - testdir.makepyfile(''' + testdir.makepyfile( + """ def test(): pass - ''') - result = testdir.runpytest('--result-log=%s' % testdir.tmpdir.join('result.log')) - result.stdout.fnmatch_lines([ - '*--result-log is deprecated and scheduled for removal in pytest 4.0*', - '*See https://docs.pytest.org/*/usage.html#creating-resultlog-format-files for more information*', - ]) + """ + ) + result = testdir.runpytest("--result-log=%s" % testdir.tmpdir.join("result.log")) + result.stdout.fnmatch_lines( + [ + "*--result-log is deprecated and scheduled for removal in pytest 4.0*", + "*See https://docs.pytest.org/*/usage.html#creating-resultlog-format-files for more information*", + ] + ) -@pytest.mark.filterwarnings('always:Metafunc.addcall is deprecated') +@pytest.mark.filterwarnings("always:Metafunc.addcall is deprecated") def test_metafunc_addcall_deprecated(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def pytest_generate_tests(metafunc): metafunc.addcall({'i': 1}) metafunc.addcall({'i': 2}) def test_func(i): pass - """) - res = testdir.runpytest('-s') + """ + ) + res = testdir.runpytest("-s") assert res.ret == 0 - res.stdout.fnmatch_lines([ - "*Metafunc.addcall is deprecated*", - "*2 passed, 2 warnings*", - ]) + res.stdout.fnmatch_lines( + ["*Metafunc.addcall is deprecated*", "*2 passed, 2 warnings*"] + ) def test_terminal_reporter_writer_attr(pytestconfig): @@ -107,21 +144,122 @@ def test_terminal_reporter_writer_attr(pytestconfig): """ try: import xdist # noqa - pytest.skip('xdist workers disable the terminal reporter plugin') + + pytest.skip("xdist workers disable the terminal reporter plugin") except ImportError: pass - terminal_reporter = pytestconfig.pluginmanager.get_plugin('terminalreporter') + terminal_reporter = pytestconfig.pluginmanager.get_plugin("terminalreporter") assert terminal_reporter.writer is terminal_reporter._tw -def test_pytest_catchlog_deprecated(testdir): - testdir.makepyfile(""" +@pytest.mark.parametrize("plugin", ["catchlog", "capturelog"]) +def test_pytest_catchlog_deprecated(testdir, plugin): + testdir.makepyfile( + """ def test_func(pytestconfig): - pytestconfig.pluginmanager.register(None, 'pytest_catchlog') - """) + pytestconfig.pluginmanager.register(None, 'pytest_{}') + """.format( + plugin + ) + ) res = testdir.runpytest() assert res.ret == 0 - res.stdout.fnmatch_lines([ - "*pytest-catchlog plugin has been merged into the core*", - "*1 passed, 1 warnings*", - ]) + res.stdout.fnmatch_lines( + ["*pytest-*log plugin has been merged into the core*", "*1 passed, 1 warnings*"] + ) + + +def test_pytest_plugins_in_non_top_level_conftest_deprecated(testdir): + from _pytest.deprecated import PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST + + subdirectory = testdir.tmpdir.join("subdirectory") + subdirectory.mkdir() + # create the inner conftest with makeconftest and then move it to the subdirectory + testdir.makeconftest( + """ + pytest_plugins=['capture'] + """ + ) + testdir.tmpdir.join("conftest.py").move(subdirectory.join("conftest.py")) + # make the top level conftest + testdir.makeconftest( + """ + import warnings + warnings.filterwarnings('always', category=DeprecationWarning) + """ + ) + testdir.makepyfile( + """ + def test_func(): + pass + """ + ) + res = testdir.runpytest_subprocess() + assert res.ret == 0 + res.stderr.fnmatch_lines( + "*" + str(PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST).splitlines()[0] + ) + + +def test_pytest_plugins_in_non_top_level_conftest_deprecated_no_top_level_conftest( + testdir +): + from _pytest.deprecated import PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST + + subdirectory = testdir.tmpdir.join("subdirectory") + subdirectory.mkdir() + testdir.makeconftest( + """ + import warnings + warnings.filterwarnings('always', category=DeprecationWarning) + pytest_plugins=['capture'] + """ + ) + testdir.tmpdir.join("conftest.py").move(subdirectory.join("conftest.py")) + + testdir.makepyfile( + """ + def test_func(): + pass + """ + ) + + res = testdir.runpytest_subprocess() + assert res.ret == 0 + res.stderr.fnmatch_lines( + "*" + str(PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST).splitlines()[0] + ) + + +def test_pytest_plugins_in_non_top_level_conftest_deprecated_no_false_positives( + testdir +): + from _pytest.deprecated import PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST + + subdirectory = testdir.tmpdir.join("subdirectory") + subdirectory.mkdir() + testdir.makeconftest( + """ + pass + """ + ) + testdir.tmpdir.join("conftest.py").move(subdirectory.join("conftest.py")) + + testdir.makeconftest( + """ + import warnings + warnings.filterwarnings('always', category=DeprecationWarning) + pytest_plugins=['capture'] + """ + ) + testdir.makepyfile( + """ + def test_func(): + pass + """ + ) + res = testdir.runpytest_subprocess() + assert res.ret == 0 + assert str(PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST).splitlines()[ + 0 + ] not in res.stderr.str() diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/.gitignore b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/.gitignore index 490310b6c11..b5331908724 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/.gitignore +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/.gitignore @@ -1,3 +1,3 @@ build/ dist/ -*.spec \ No newline at end of file +*.spec diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/create_executable.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/create_executable.py index f4f6088ef7d..98aa2034c9d 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/create_executable.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/create_executable.py @@ -1,12 +1,12 @@ """ Generates an executable with pytest runner embedded using PyInstaller. """ -if __name__ == '__main__': +if __name__ == "__main__": import pytest import subprocess hidden = [] for x in pytest.freeze_includes(): - hidden.extend(['--hidden-import', x]) - args = ['pyinstaller', '--noconfirm'] + hidden + ['runtests_script.py'] - subprocess.check_call(' '.join(args), shell=True) + hidden.extend(["--hidden-import", x]) + args = ["pyinstaller", "--noconfirm"] + hidden + ["runtests_script.py"] + subprocess.check_call(" ".join(args), shell=True) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/runtests_script.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/runtests_script.py index d281601c068..d03bca8406d 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/runtests_script.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/runtests_script.py @@ -3,7 +3,8 @@ This is the script that is actually frozen into an executable: simply executes py.test main(). """ -if __name__ == '__main__': +if __name__ == "__main__": import sys import pytest + sys.exit(pytest.main()) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/tests/test_trivial.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/tests/test_trivial.py index 45622b850bb..08a55552abb 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/tests/test_trivial.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/tests/test_trivial.py @@ -1,7 +1,6 @@ - def test_upper(): - assert 'foo'.upper() == 'FOO' + assert "foo".upper() == "FOO" def test_lower(): - assert 'FOO'.lower() == 'foo' + assert "FOO".lower() == "foo" diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/tox_run.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/tox_run.py index 3fc38804095..678a69c858a 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/tox_run.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/freeze/tox_run.py @@ -2,11 +2,11 @@ Called by tox.ini: uses the generated executable to run the tests in ./tests/ directory. """ -if __name__ == '__main__': +if __name__ == "__main__": import os import sys - executable = os.path.join(os.getcwd(), 'dist', 'runtests_script', 'runtests_script') - if sys.platform.startswith('win'): - executable += '.exe' - sys.exit(os.system('%s tests' % executable)) + executable = os.path.join(os.getcwd(), "dist", "runtests_script", "runtests_script") + if sys.platform.startswith("win"): + executable += ".exe" + sys.exit(os.system("%s tests" % executable)) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/logging/test_fixture.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/logging/test_fixture.py index c27b31137ff..8d9ae6b518d 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/logging/test_fixture.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/logging/test_fixture.py @@ -1,70 +1,119 @@ # -*- coding: utf-8 -*- import logging +import pytest logger = logging.getLogger(__name__) -sublogger = logging.getLogger(__name__ + '.baz') +sublogger = logging.getLogger(__name__ + ".baz") def test_fixture_help(testdir): - result = testdir.runpytest('--fixtures') - result.stdout.fnmatch_lines(['*caplog*']) + result = testdir.runpytest("--fixtures") + result.stdout.fnmatch_lines(["*caplog*"]) def test_change_level(caplog): caplog.set_level(logging.INFO) - logger.debug('handler DEBUG level') - logger.info('handler INFO level') + logger.debug("handler DEBUG level") + logger.info("handler INFO level") caplog.set_level(logging.CRITICAL, logger=sublogger.name) - sublogger.warning('logger WARNING level') - sublogger.critical('logger CRITICAL level') + sublogger.warning("logger WARNING level") + sublogger.critical("logger CRITICAL level") - assert 'DEBUG' not in caplog.text - assert 'INFO' in caplog.text - assert 'WARNING' not in caplog.text - assert 'CRITICAL' in caplog.text + assert "DEBUG" not in caplog.text + assert "INFO" in caplog.text + assert "WARNING" not in caplog.text + assert "CRITICAL" in caplog.text + + +def test_change_level_undo(testdir): + """Ensure that 'set_level' is undone after the end of the test""" + testdir.makepyfile( + """ + import logging + + def test1(caplog): + caplog.set_level(logging.INFO) + # using + operator here so fnmatch_lines doesn't match the code in the traceback + logging.info('log from ' + 'test1') + assert 0 + + def test2(caplog): + # using + operator here so fnmatch_lines doesn't match the code in the traceback + logging.info('log from ' + 'test2') + assert 0 + """ + ) + result = testdir.runpytest_subprocess() + result.stdout.fnmatch_lines(["*log from test1*", "*2 failed in *"]) + assert "log from test2" not in result.stdout.str() def test_with_statement(caplog): with caplog.at_level(logging.INFO): - logger.debug('handler DEBUG level') - logger.info('handler INFO level') + logger.debug("handler DEBUG level") + logger.info("handler INFO level") with caplog.at_level(logging.CRITICAL, logger=sublogger.name): - sublogger.warning('logger WARNING level') - sublogger.critical('logger CRITICAL level') + sublogger.warning("logger WARNING level") + sublogger.critical("logger CRITICAL level") - assert 'DEBUG' not in caplog.text - assert 'INFO' in caplog.text - assert 'WARNING' not in caplog.text - assert 'CRITICAL' in caplog.text + assert "DEBUG" not in caplog.text + assert "INFO" in caplog.text + assert "WARNING" not in caplog.text + assert "CRITICAL" in caplog.text def test_log_access(caplog): - logger.info('boo %s', 'arg') - assert caplog.records[0].levelname == 'INFO' - assert caplog.records[0].msg == 'boo %s' - assert 'boo arg' in caplog.text + caplog.set_level(logging.INFO) + logger.info("boo %s", "arg") + assert caplog.records[0].levelname == "INFO" + assert caplog.records[0].msg == "boo %s" + assert "boo arg" in caplog.text def test_record_tuples(caplog): - logger.info('boo %s', 'arg') + caplog.set_level(logging.INFO) + logger.info("boo %s", "arg") - assert caplog.record_tuples == [ - (__name__, logging.INFO, 'boo arg'), - ] + assert caplog.record_tuples == [(__name__, logging.INFO, "boo arg")] def test_unicode(caplog): - logger.info(u'bū') - assert caplog.records[0].levelname == 'INFO' - assert caplog.records[0].msg == u'bū' - assert u'bū' in caplog.text + caplog.set_level(logging.INFO) + logger.info(u"bū") + assert caplog.records[0].levelname == "INFO" + assert caplog.records[0].msg == u"bū" + assert u"bū" in caplog.text def test_clear(caplog): - logger.info(u'bū') + caplog.set_level(logging.INFO) + logger.info(u"bū") assert len(caplog.records) + assert caplog.text caplog.clear() assert not len(caplog.records) + assert not caplog.text + + +@pytest.fixture +def logging_during_setup_and_teardown(caplog): + caplog.set_level("INFO") + logger.info("a_setup_log") + yield + logger.info("a_teardown_log") + assert [x.message for x in caplog.get_records("teardown")] == ["a_teardown_log"] + + +def test_caplog_captures_for_all_stages(caplog, logging_during_setup_and_teardown): + assert not caplog.records + assert not caplog.get_records("call") + logger.info("a_call_log") + assert [x.message for x in caplog.get_records("call")] == ["a_call_log"] + + assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"] + + # This reachers into private API, don't use this type of thing in real tests! + assert set(caplog._item.catch_log_handlers.keys()) == {"setup", "call"} diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/logging/test_formatter.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/logging/test_formatter.py new file mode 100644 index 00000000000..ca2a4106537 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/logging/test_formatter.py @@ -0,0 +1,37 @@ +import logging + +import py.io +from _pytest.logging import ColoredLevelFormatter + + +def test_coloredlogformatter(): + logfmt = "%(filename)-25s %(lineno)4d %(levelname)-8s %(message)s" + + record = logging.LogRecord( + name="dummy", + level=logging.INFO, + pathname="dummypath", + lineno=10, + msg="Test Message", + args=(), + exc_info=False, + ) + + class ColorConfig(object): + + class option(object): + pass + + tw = py.io.TerminalWriter() + tw.hasmarkup = True + formatter = ColoredLevelFormatter(tw, logfmt) + output = formatter.format(record) + assert ( + output + == ("dummypath 10 " "\x1b[32mINFO \x1b[0m Test Message") + ) + + tw.hasmarkup = False + formatter = ColoredLevelFormatter(tw, logfmt) + output = formatter.format(record) + assert output == ("dummypath 10 " "INFO Test Message") diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/logging/test_reporting.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/logging/test_reporting.py index c02ee217227..91ed2e4758c 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/logging/test_reporting.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/logging/test_reporting.py @@ -1,29 +1,34 @@ # -*- coding: utf-8 -*- +import re import os + +import six + import pytest def test_nothing_logged(testdir): - testdir.makepyfile(''' + testdir.makepyfile( + """ import sys def test_foo(): sys.stdout.write('text going to stdout') sys.stderr.write('text going to stderr') assert False - ''') + """ + ) result = testdir.runpytest() assert result.ret == 1 - result.stdout.fnmatch_lines(['*- Captured stdout call -*', - 'text going to stdout']) - result.stdout.fnmatch_lines(['*- Captured stderr call -*', - 'text going to stderr']) + result.stdout.fnmatch_lines(["*- Captured stdout call -*", "text going to stdout"]) + result.stdout.fnmatch_lines(["*- Captured stderr call -*", "text going to stderr"]) with pytest.raises(pytest.fail.Exception): - result.stdout.fnmatch_lines(['*- Captured *log call -*']) + result.stdout.fnmatch_lines(["*- Captured *log call -*"]) def test_messages_logged(testdir): - testdir.makepyfile(''' + testdir.makepyfile( + """ import sys import logging @@ -34,19 +39,84 @@ def test_messages_logged(testdir): sys.stderr.write('text going to stderr') logger.info('text going to logger') assert False - ''') - result = testdir.runpytest() + """ + ) + result = testdir.runpytest("--log-level=INFO") assert result.ret == 1 - result.stdout.fnmatch_lines(['*- Captured *log call -*', - '*text going to logger*']) - result.stdout.fnmatch_lines(['*- Captured stdout call -*', - 'text going to stdout']) - result.stdout.fnmatch_lines(['*- Captured stderr call -*', - 'text going to stderr']) + result.stdout.fnmatch_lines(["*- Captured *log call -*", "*text going to logger*"]) + result.stdout.fnmatch_lines(["*- Captured stdout call -*", "text going to stdout"]) + result.stdout.fnmatch_lines(["*- Captured stderr call -*", "text going to stderr"]) + + +def test_root_logger_affected(testdir): + testdir.makepyfile( + """ + import logging + logger = logging.getLogger() + def test_foo(): + logger.info('info text ' + 'going to logger') + logger.warning('warning text ' + 'going to logger') + logger.error('error text ' + 'going to logger') + + assert 0 + """ + ) + log_file = testdir.tmpdir.join("pytest.log").strpath + result = testdir.runpytest("--log-level=ERROR", "--log-file=pytest.log") + assert result.ret == 1 + + # the capture log calls in the stdout section only contain the + # logger.error msg, because --log-level=ERROR + result.stdout.fnmatch_lines(["*error text going to logger*"]) + with pytest.raises(pytest.fail.Exception): + result.stdout.fnmatch_lines(["*warning text going to logger*"]) + with pytest.raises(pytest.fail.Exception): + result.stdout.fnmatch_lines(["*info text going to logger*"]) + + # the log file should contain the warning and the error log messages and + # not the info one, because the default level of the root logger is + # WARNING. + assert os.path.isfile(log_file) + with open(log_file) as rfh: + contents = rfh.read() + assert "info text going to logger" not in contents + assert "warning text going to logger" in contents + assert "error text going to logger" in contents + + +def test_log_cli_level_log_level_interaction(testdir): + testdir.makepyfile( + """ + import logging + logger = logging.getLogger() + + def test_foo(): + logger.debug('debug text ' + 'going to logger') + logger.info('info text ' + 'going to logger') + logger.warning('warning text ' + 'going to logger') + logger.error('error text ' + 'going to logger') + assert 0 + """ + ) + + result = testdir.runpytest("--log-cli-level=INFO", "--log-level=ERROR") + assert result.ret == 1 + + result.stdout.fnmatch_lines( + [ + "*-- live log call --*", + "*INFO*info text going to logger", + "*WARNING*warning text going to logger", + "*ERROR*error text going to logger", + "=* 1 failed in *=", + ] + ) + assert "DEBUG" not in result.stdout.str() def test_setup_logging(testdir): - testdir.makepyfile(''' + testdir.makepyfile( + """ import logging logger = logging.getLogger(__name__) @@ -57,17 +127,23 @@ def test_setup_logging(testdir): def test_foo(): logger.info('text going to logger from call') assert False - ''') - result = testdir.runpytest() + """ + ) + result = testdir.runpytest("--log-level=INFO") assert result.ret == 1 - result.stdout.fnmatch_lines(['*- Captured *log setup -*', - '*text going to logger from setup*', - '*- Captured *log call -*', - '*text going to logger from call*']) + result.stdout.fnmatch_lines( + [ + "*- Captured *log setup -*", + "*text going to logger from setup*", + "*- Captured *log call -*", + "*text going to logger from call*", + ] + ) def test_teardown_logging(testdir): - testdir.makepyfile(''' + testdir.makepyfile( + """ import logging logger = logging.getLogger(__name__) @@ -78,17 +154,23 @@ def test_teardown_logging(testdir): def teardown_function(function): logger.info('text going to logger from teardown') assert False - ''') - result = testdir.runpytest() + """ + ) + result = testdir.runpytest("--log-level=INFO") assert result.ret == 1 - result.stdout.fnmatch_lines(['*- Captured *log call -*', - '*text going to logger from call*', - '*- Captured *log teardown -*', - '*text going to logger from teardown*']) + result.stdout.fnmatch_lines( + [ + "*- Captured *log call -*", + "*text going to logger from call*", + "*- Captured *log teardown -*", + "*text going to logger from teardown*", + ] + ) def test_disable_log_capturing(testdir): - testdir.makepyfile(''' + testdir.makepyfile( + """ import sys import logging @@ -99,26 +181,26 @@ def test_disable_log_capturing(testdir): logger.warning('catch me if you can!') sys.stderr.write('text going to stderr') assert False - ''') - result = testdir.runpytest('--no-print-logs') + """ + ) + result = testdir.runpytest("--no-print-logs") print(result.stdout) assert result.ret == 1 - result.stdout.fnmatch_lines(['*- Captured stdout call -*', - 'text going to stdout']) - result.stdout.fnmatch_lines(['*- Captured stderr call -*', - 'text going to stderr']) + result.stdout.fnmatch_lines(["*- Captured stdout call -*", "text going to stdout"]) + result.stdout.fnmatch_lines(["*- Captured stderr call -*", "text going to stderr"]) with pytest.raises(pytest.fail.Exception): - result.stdout.fnmatch_lines(['*- Captured *log call -*']) + result.stdout.fnmatch_lines(["*- Captured *log call -*"]) def test_disable_log_capturing_ini(testdir): testdir.makeini( - ''' + """ [pytest] log_print=False - ''' + """ ) - testdir.makepyfile(''' + testdir.makepyfile( + """ import sys import logging @@ -129,54 +211,331 @@ def test_disable_log_capturing_ini(testdir): logger.warning('catch me if you can!') sys.stderr.write('text going to stderr') assert False - ''') + """ + ) result = testdir.runpytest() print(result.stdout) assert result.ret == 1 - result.stdout.fnmatch_lines(['*- Captured stdout call -*', - 'text going to stdout']) - result.stdout.fnmatch_lines(['*- Captured stderr call -*', - 'text going to stderr']) + result.stdout.fnmatch_lines(["*- Captured stdout call -*", "text going to stdout"]) + result.stdout.fnmatch_lines(["*- Captured stderr call -*", "text going to stderr"]) with pytest.raises(pytest.fail.Exception): - result.stdout.fnmatch_lines(['*- Captured *log call -*']) + result.stdout.fnmatch_lines(["*- Captured *log call -*"]) + + +@pytest.mark.parametrize("enabled", [True, False]) +def test_log_cli_enabled_disabled(testdir, enabled): + msg = "critical message logged by test" + testdir.makepyfile( + """ + import logging + def test_log_cli(): + logging.critical("{}") + """.format( + msg + ) + ) + if enabled: + testdir.makeini( + """ + [pytest] + log_cli=true + """ + ) + result = testdir.runpytest() + if enabled: + result.stdout.fnmatch_lines( + [ + "test_log_cli_enabled_disabled.py::test_log_cli ", + "*-- live log call --*", + "test_log_cli_enabled_disabled.py* CRITICAL critical message logged by test", + "PASSED*", + ] + ) + else: + assert msg not in result.stdout.str() def test_log_cli_default_level(testdir): # Default log file level - testdir.makepyfile(''' + testdir.makepyfile( + """ import pytest import logging def test_log_cli(request): plugin = request.config.pluginmanager.getplugin('logging-plugin') - assert plugin.log_cli_handler.level == logging.WARNING - logging.getLogger('catchlog').info("This log message won't be shown") - logging.getLogger('catchlog').warning("This log message will be shown") - print('PASSED') - ''') + assert plugin.log_cli_handler.level == logging.NOTSET + logging.getLogger('catchlog').info("INFO message won't be shown") + logging.getLogger('catchlog').warning("WARNING message will be shown") + """ + ) + testdir.makeini( + """ + [pytest] + log_cli=true + """ + ) - result = testdir.runpytest('-s') + result = testdir.runpytest() # fnmatch_lines does an assertion internally - result.stdout.fnmatch_lines([ - 'test_log_cli_default_level.py PASSED', - ]) - result.stderr.fnmatch_lines([ - "* This log message will be shown" - ]) - for line in result.errlines: - try: - assert "This log message won't be shown" in line - pytest.fail("A log message was shown and it shouldn't have been") - except AssertionError: - continue - + result.stdout.fnmatch_lines( + [ + "test_log_cli_default_level.py::test_log_cli ", + "test_log_cli_default_level.py*WARNING message will be shown*", + ] + ) + assert "INFO message won't be shown" not in result.stdout.str() # make sure that that we get a '0' exit code for the testsuite assert result.ret == 0 +def test_log_cli_default_level_multiple_tests(testdir, request): + """Ensure we reset the first newline added by the live logger between tests""" + filename = request.node.name + ".py" + testdir.makepyfile( + """ + import logging + + def test_log_1(): + logging.warning("log message from test_log_1") + + def test_log_2(): + logging.warning("log message from test_log_2") + """ + ) + testdir.makeini( + """ + [pytest] + log_cli=true + """ + ) + + result = testdir.runpytest() + result.stdout.fnmatch_lines( + [ + "{}::test_log_1 ".format(filename), + "*WARNING*log message from test_log_1*", + "PASSED *50%*", + "{}::test_log_2 ".format(filename), + "*WARNING*log message from test_log_2*", + "PASSED *100%*", + "=* 2 passed in *=", + ] + ) + + +def test_log_cli_default_level_sections(testdir, request): + """Check that with live logging enable we are printing the correct headers during + start/setup/call/teardown/finish.""" + filename = request.node.name + ".py" + testdir.makeconftest( + """ + import pytest + import logging + + def pytest_runtest_logstart(): + logging.warning('>>>>> START >>>>>') + + def pytest_runtest_logfinish(): + logging.warning('<<<<< END <<<<<<<') + """ + ) + + testdir.makepyfile( + """ + import pytest + import logging + + @pytest.fixture + def fix(request): + logging.warning("log message from setup of {}".format(request.node.name)) + yield + logging.warning("log message from teardown of {}".format(request.node.name)) + + def test_log_1(fix): + logging.warning("log message from test_log_1") + + def test_log_2(fix): + logging.warning("log message from test_log_2") + """ + ) + testdir.makeini( + """ + [pytest] + log_cli=true + """ + ) + + result = testdir.runpytest() + result.stdout.fnmatch_lines( + [ + "{}::test_log_1 ".format(filename), + "*-- live log start --*", + "*WARNING* >>>>> START >>>>>*", + "*-- live log setup --*", + "*WARNING*log message from setup of test_log_1*", + "*-- live log call --*", + "*WARNING*log message from test_log_1*", + "PASSED *50%*", + "*-- live log teardown --*", + "*WARNING*log message from teardown of test_log_1*", + "*-- live log finish --*", + "*WARNING* <<<<< END <<<<<<<*", + "{}::test_log_2 ".format(filename), + "*-- live log start --*", + "*WARNING* >>>>> START >>>>>*", + "*-- live log setup --*", + "*WARNING*log message from setup of test_log_2*", + "*-- live log call --*", + "*WARNING*log message from test_log_2*", + "PASSED *100%*", + "*-- live log teardown --*", + "*WARNING*log message from teardown of test_log_2*", + "*-- live log finish --*", + "*WARNING* <<<<< END <<<<<<<*", + "=* 2 passed in *=", + ] + ) + + +def test_live_logs_unknown_sections(testdir, request): + """Check that with live logging enable we are printing the correct headers during + start/setup/call/teardown/finish.""" + filename = request.node.name + ".py" + testdir.makeconftest( + """ + import pytest + import logging + + def pytest_runtest_protocol(item, nextitem): + logging.warning('Unknown Section!') + + def pytest_runtest_logstart(): + logging.warning('>>>>> START >>>>>') + + def pytest_runtest_logfinish(): + logging.warning('<<<<< END <<<<<<<') + """ + ) + + testdir.makepyfile( + """ + import pytest + import logging + + @pytest.fixture + def fix(request): + logging.warning("log message from setup of {}".format(request.node.name)) + yield + logging.warning("log message from teardown of {}".format(request.node.name)) + + def test_log_1(fix): + logging.warning("log message from test_log_1") + + """ + ) + testdir.makeini( + """ + [pytest] + log_cli=true + """ + ) + + result = testdir.runpytest() + result.stdout.fnmatch_lines( + [ + "*WARNING*Unknown Section*", + "{}::test_log_1 ".format(filename), + "*WARNING* >>>>> START >>>>>*", + "*-- live log setup --*", + "*WARNING*log message from setup of test_log_1*", + "*-- live log call --*", + "*WARNING*log message from test_log_1*", + "PASSED *100%*", + "*-- live log teardown --*", + "*WARNING*log message from teardown of test_log_1*", + "*WARNING* <<<<< END <<<<<<<*", + "=* 1 passed in *=", + ] + ) + + +def test_sections_single_new_line_after_test_outcome(testdir, request): + """Check that only a single new line is written between log messages during + teardown/finish.""" + filename = request.node.name + ".py" + testdir.makeconftest( + """ + import pytest + import logging + + def pytest_runtest_logstart(): + logging.warning('>>>>> START >>>>>') + + def pytest_runtest_logfinish(): + logging.warning('<<<<< END <<<<<<<') + logging.warning('<<<<< END <<<<<<<') + """ + ) + + testdir.makepyfile( + """ + import pytest + import logging + + @pytest.fixture + def fix(request): + logging.warning("log message from setup of {}".format(request.node.name)) + yield + logging.warning("log message from teardown of {}".format(request.node.name)) + logging.warning("log message from teardown of {}".format(request.node.name)) + + def test_log_1(fix): + logging.warning("log message from test_log_1") + """ + ) + testdir.makeini( + """ + [pytest] + log_cli=true + """ + ) + + result = testdir.runpytest() + result.stdout.fnmatch_lines( + [ + "{}::test_log_1 ".format(filename), + "*-- live log start --*", + "*WARNING* >>>>> START >>>>>*", + "*-- live log setup --*", + "*WARNING*log message from setup of test_log_1*", + "*-- live log call --*", + "*WARNING*log message from test_log_1*", + "PASSED *100%*", + "*-- live log teardown --*", + "*WARNING*log message from teardown of test_log_1*", + "*-- live log finish --*", + "*WARNING* <<<<< END <<<<<<<*", + "*WARNING* <<<<< END <<<<<<<*", + "=* 1 passed in *=", + ] + ) + assert re.search( + r"(.+)live log teardown(.+)\n(.+)WARNING(.+)\n(.+)WARNING(.+)", + result.stdout.str(), + re.MULTILINE, + ) is not None + assert re.search( + r"(.+)live log finish(.+)\n(.+)WARNING(.+)\n(.+)WARNING(.+)", + result.stdout.str(), + re.MULTILINE, + ) is not None + + def test_log_cli_level(testdir): # Default log file level - testdir.makepyfile(''' + testdir.makepyfile( + """ import pytest import logging def test_log_cli(request): @@ -185,42 +544,39 @@ def test_log_cli_level(testdir): logging.getLogger('catchlog').debug("This log message won't be shown") logging.getLogger('catchlog').info("This log message will be shown") print('PASSED') - ''') + """ + ) + testdir.makeini( + """ + [pytest] + log_cli=true + """ + ) - result = testdir.runpytest('-s', '--log-cli-level=INFO') + result = testdir.runpytest("-s", "--log-cli-level=INFO") # fnmatch_lines does an assertion internally - result.stdout.fnmatch_lines([ - 'test_log_cli_level.py PASSED', - ]) - result.stderr.fnmatch_lines([ - "* This log message will be shown" - ]) - for line in result.errlines: - try: - assert "This log message won't be shown" in line - pytest.fail("A log message was shown and it shouldn't have been") - except AssertionError: - continue + result.stdout.fnmatch_lines( + [ + "test_log_cli_level.py*This log message will be shown", + "PASSED", # 'PASSED' on its own line because the log message prints a new line + ] + ) + assert "This log message won't be shown" not in result.stdout.str() # make sure that that we get a '0' exit code for the testsuite assert result.ret == 0 - result = testdir.runpytest('-s', '--log-level=INFO') + result = testdir.runpytest("-s", "--log-level=INFO") # fnmatch_lines does an assertion internally - result.stdout.fnmatch_lines([ - 'test_log_cli_level.py PASSED', - ]) - result.stderr.fnmatch_lines([ - "* This log message will be shown" - ]) - for line in result.errlines: - try: - assert "This log message won't be shown" in line - pytest.fail("A log message was shown and it shouldn't have been") - except AssertionError: - continue + result.stdout.fnmatch_lines( + [ + "test_log_cli_level.py* This log message will be shown", + "PASSED", # 'PASSED' on its own line because the log message prints a new line + ] + ) + assert "This log message won't be shown" not in result.stdout.str() # make sure that that we get a '0' exit code for the testsuite assert result.ret == 0 @@ -230,9 +586,12 @@ def test_log_cli_ini_level(testdir): testdir.makeini( """ [pytest] + log_cli=true log_cli_level = INFO - """) - testdir.makepyfile(''' + """ + ) + testdir.makepyfile( + """ import pytest import logging def test_log_cli(request): @@ -241,31 +600,75 @@ def test_log_cli_ini_level(testdir): logging.getLogger('catchlog').debug("This log message won't be shown") logging.getLogger('catchlog').info("This log message will be shown") print('PASSED') - ''') + """ + ) - result = testdir.runpytest('-s') + result = testdir.runpytest("-s") # fnmatch_lines does an assertion internally - result.stdout.fnmatch_lines([ - 'test_log_cli_ini_level.py PASSED', - ]) - result.stderr.fnmatch_lines([ - "* This log message will be shown" - ]) - for line in result.errlines: - try: - assert "This log message won't be shown" in line - pytest.fail("A log message was shown and it shouldn't have been") - except AssertionError: - continue + result.stdout.fnmatch_lines( + [ + "test_log_cli_ini_level.py* This log message will be shown", + "PASSED", # 'PASSED' on its own line because the log message prints a new line + ] + ) + assert "This log message won't be shown" not in result.stdout.str() # make sure that that we get a '0' exit code for the testsuite assert result.ret == 0 +@pytest.mark.parametrize( + "cli_args", + ["", "--log-level=WARNING", "--log-file-level=WARNING", "--log-cli-level=WARNING"], +) +def test_log_cli_auto_enable(testdir, request, cli_args): + """Check that live logs are enabled if --log-level or --log-cli-level is passed on the CLI. + It should not be auto enabled if the same configs are set on the INI file. + """ + testdir.makepyfile( + """ + import pytest + import logging + + def test_log_1(): + logging.info("log message from test_log_1 not to be shown") + logging.warning("log message from test_log_1") + + """ + ) + testdir.makeini( + """ + [pytest] + log_level=INFO + log_cli_level=INFO + """ + ) + + result = testdir.runpytest(cli_args) + if cli_args == "--log-cli-level=WARNING": + result.stdout.fnmatch_lines( + [ + "*::test_log_1 ", + "*-- live log call --*", + "*WARNING*log message from test_log_1*", + "PASSED *100%*", + "=* 1 passed in *=", + ] + ) + assert "INFO" not in result.stdout.str() + else: + result.stdout.fnmatch_lines( + ["*test_log_cli_auto_enable*100%*", "=* 1 passed in *="] + ) + assert "INFO" not in result.stdout.str() + assert "WARNING" not in result.stdout.str() + + def test_log_file_cli(testdir): # Default log file level - testdir.makepyfile(''' + testdir.makepyfile( + """ import pytest import logging def test_log_file(request): @@ -274,16 +677,17 @@ def test_log_file_cli(testdir): logging.getLogger('catchlog').info("This log message won't be shown") logging.getLogger('catchlog').warning("This log message will be shown") print('PASSED') - ''') + """ + ) - log_file = testdir.tmpdir.join('pytest.log').strpath + log_file = testdir.tmpdir.join("pytest.log").strpath - result = testdir.runpytest('-s', '--log-file={0}'.format(log_file)) + result = testdir.runpytest( + "-s", "--log-file={}".format(log_file), "--log-file-level=WARNING" + ) # fnmatch_lines does an assertion internally - result.stdout.fnmatch_lines([ - 'test_log_file_cli.py PASSED', - ]) + result.stdout.fnmatch_lines(["test_log_file_cli.py PASSED"]) # make sure that that we get a '0' exit code for the testsuite assert result.ret == 0 @@ -296,7 +700,8 @@ def test_log_file_cli(testdir): def test_log_file_cli_level(testdir): # Default log file level - testdir.makepyfile(''' + testdir.makepyfile( + """ import pytest import logging def test_log_file(request): @@ -305,18 +710,17 @@ def test_log_file_cli_level(testdir): logging.getLogger('catchlog').debug("This log message won't be shown") logging.getLogger('catchlog').info("This log message will be shown") print('PASSED') - ''') + """ + ) - log_file = testdir.tmpdir.join('pytest.log').strpath + log_file = testdir.tmpdir.join("pytest.log").strpath - result = testdir.runpytest('-s', - '--log-file={0}'.format(log_file), - '--log-file-level=INFO') + result = testdir.runpytest( + "-s", "--log-file={}".format(log_file), "--log-file-level=INFO" + ) # fnmatch_lines does an assertion internally - result.stdout.fnmatch_lines([ - 'test_log_file_cli_level.py PASSED', - ]) + result.stdout.fnmatch_lines(["test_log_file_cli_level.py PASSED"]) # make sure that that we get a '0' exit code for the testsuite assert result.ret == 0 @@ -327,15 +731,32 @@ def test_log_file_cli_level(testdir): assert "This log message won't be shown" not in contents +def test_log_level_not_changed_by_default(testdir): + testdir.makepyfile( + """ + import logging + def test_log_file(): + assert logging.getLogger().level == logging.WARNING + """ + ) + result = testdir.runpytest("-s") + result.stdout.fnmatch_lines("* 1 passed in *") + + def test_log_file_ini(testdir): - log_file = testdir.tmpdir.join('pytest.log').strpath + log_file = testdir.tmpdir.join("pytest.log").strpath testdir.makeini( """ [pytest] - log_file={0} - """.format(log_file)) - testdir.makepyfile(''' + log_file={} + log_file_level=WARNING + """.format( + log_file + ) + ) + testdir.makepyfile( + """ import pytest import logging def test_log_file(request): @@ -344,14 +765,13 @@ def test_log_file_ini(testdir): logging.getLogger('catchlog').info("This log message won't be shown") logging.getLogger('catchlog').warning("This log message will be shown") print('PASSED') - ''') + """ + ) - result = testdir.runpytest('-s') + result = testdir.runpytest("-s") # fnmatch_lines does an assertion internally - result.stdout.fnmatch_lines([ - 'test_log_file_ini.py PASSED', - ]) + result.stdout.fnmatch_lines(["test_log_file_ini.py PASSED"]) # make sure that that we get a '0' exit code for the testsuite assert result.ret == 0 @@ -363,15 +783,19 @@ def test_log_file_ini(testdir): def test_log_file_ini_level(testdir): - log_file = testdir.tmpdir.join('pytest.log').strpath + log_file = testdir.tmpdir.join("pytest.log").strpath testdir.makeini( """ [pytest] - log_file={0} + log_file={} log_file_level = INFO - """.format(log_file)) - testdir.makepyfile(''' + """.format( + log_file + ) + ) + testdir.makepyfile( + """ import pytest import logging def test_log_file(request): @@ -380,14 +804,13 @@ def test_log_file_ini_level(testdir): logging.getLogger('catchlog').debug("This log message won't be shown") logging.getLogger('catchlog').info("This log message will be shown") print('PASSED') - ''') + """ + ) - result = testdir.runpytest('-s') + result = testdir.runpytest("-s") # fnmatch_lines does an assertion internally - result.stdout.fnmatch_lines([ - 'test_log_file_ini_level.py PASSED', - ]) + result.stdout.fnmatch_lines(["test_log_file_ini_level.py PASSED"]) # make sure that that we get a '0' exit code for the testsuite assert result.ret == 0 @@ -396,3 +819,56 @@ def test_log_file_ini_level(testdir): contents = rfh.read() assert "This log message will be shown" in contents assert "This log message won't be shown" not in contents + + +@pytest.mark.parametrize("has_capture_manager", [True, False]) +def test_live_logging_suspends_capture(has_capture_manager, request): + """Test that capture manager is suspended when we emitting messages for live logging. + + This tests the implementation calls instead of behavior because it is difficult/impossible to do it using + ``testdir`` facilities because they do their own capturing. + + We parametrize the test to also make sure _LiveLoggingStreamHandler works correctly if no capture manager plugin + is installed. + """ + import logging + from functools import partial + from _pytest.capture import CaptureManager + from _pytest.logging import _LiveLoggingStreamHandler + + class MockCaptureManager: + calls = [] + + def suspend_global_capture(self): + self.calls.append("suspend_global_capture") + + def resume_global_capture(self): + self.calls.append("resume_global_capture") + + # sanity check + assert CaptureManager.suspend_capture_item + assert CaptureManager.resume_global_capture + + class DummyTerminal(six.StringIO): + + def section(self, *args, **kwargs): + pass + + out_file = DummyTerminal() + capture_manager = MockCaptureManager() if has_capture_manager else None + handler = _LiveLoggingStreamHandler(out_file, capture_manager) + handler.set_when("call") + + logger = logging.getLogger(__name__ + ".test_live_logging_suspends_capture") + logger.addHandler(handler) + request.addfinalizer(partial(logger.removeHandler, handler)) + + logger.critical("some message") + if has_capture_manager: + assert ( + MockCaptureManager.calls + == ["suspend_global_capture", "resume_global_capture"] + ) + else: + assert MockCaptureManager.calls == [] + assert out_file.getvalue() == "\nsome message\n" diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/approx.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/approx.py index 300e1ce86f7..9e25feb0b4d 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/approx.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/approx.py @@ -8,7 +8,8 @@ from pytest import approx from operator import eq, ne from decimal import Decimal from fractions import Fraction -inf, nan = float('inf'), float('nan') + +inf, nan = float("inf"), float("nan") class MyDocTestRunner(doctest.DocTestRunner): @@ -17,29 +18,47 @@ class MyDocTestRunner(doctest.DocTestRunner): doctest.DocTestRunner.__init__(self) def report_failure(self, out, test, example, got): - raise AssertionError("'{}' evaluates to '{}', not '{}'".format( - example.source.strip(), got.strip(), example.want.strip())) + raise AssertionError( + "'{}' evaluates to '{}', not '{}'".format( + example.source.strip(), got.strip(), example.want.strip() + ) + ) class TestApprox(object): def test_repr_string(self): - plus_minus = u'\u00b1' if sys.version_info[0] > 2 else u'+-' - tol1, tol2, infr = '1.0e-06', '2.0e-06', 'inf' - assert repr(approx(1.0)) == '1.0 {pm} {tol1}'.format(pm=plus_minus, tol1=tol1) - assert repr(approx([1.0, 2.0])) == 'approx([1.0 {pm} {tol1}, 2.0 {pm} {tol2}])'.format( - pm=plus_minus, tol1=tol1, tol2=tol2) - assert repr(approx((1.0, 2.0))) == 'approx((1.0 {pm} {tol1}, 2.0 {pm} {tol2}))'.format( - pm=plus_minus, tol1=tol1, tol2=tol2) - assert repr(approx(inf)) == 'inf' - assert repr(approx(1.0, rel=nan)) == '1.0 {pm} ???'.format(pm=plus_minus) - assert repr(approx(1.0, rel=inf)) == '1.0 {pm} {infr}'.format(pm=plus_minus, infr=infr) - assert repr(approx(1.0j, rel=inf)) == '1j' + plus_minus = u"\u00b1" if sys.version_info[0] > 2 else u"+-" + tol1, tol2, infr = "1.0e-06", "2.0e-06", "inf" + assert repr(approx(1.0)) == "1.0 {pm} {tol1}".format(pm=plus_minus, tol1=tol1) + assert ( + repr(approx([1.0, 2.0])) + == "approx([1.0 {pm} {tol1}, 2.0 {pm} {tol2}])".format( + pm=plus_minus, tol1=tol1, tol2=tol2 + ) + ) + assert ( + repr(approx((1.0, 2.0))) + == "approx((1.0 {pm} {tol1}, 2.0 {pm} {tol2}))".format( + pm=plus_minus, tol1=tol1, tol2=tol2 + ) + ) + assert repr(approx(inf)) == "inf" + assert repr(approx(1.0, rel=nan)) == "1.0 {pm} ???".format(pm=plus_minus) + assert ( + repr(approx(1.0, rel=inf)) + == "1.0 {pm} {infr}".format(pm=plus_minus, infr=infr) + ) + assert repr(approx(1.0j, rel=inf)) == "1j" # Dictionaries aren't ordered, so we need to check both orders. - assert repr(approx({'a': 1.0, 'b': 2.0})) in ( - "approx({{'a': 1.0 {pm} {tol1}, 'b': 2.0 {pm} {tol2}}})".format(pm=plus_minus, tol1=tol1, tol2=tol2), - "approx({{'b': 2.0 {pm} {tol2}, 'a': 1.0 {pm} {tol1}}})".format(pm=plus_minus, tol1=tol1, tol2=tol2), + assert repr(approx({"a": 1.0, "b": 2.0})) in ( + "approx({{'a': 1.0 {pm} {tol1}, 'b': 2.0 {pm} {tol2}}})".format( + pm=plus_minus, tol1=tol1, tol2=tol2 + ), + "approx({{'b': 2.0 {pm} {tol2}, 'a': 1.0 {pm} {tol1}}})".format( + pm=plus_minus, tol1=tol1, tol2=tol2 + ), ) def test_operator_overloading(self): @@ -56,25 +75,19 @@ class TestApprox(object): (12345, 12345.0), (0.0, -0.0), (345678, 345678), - (Decimal('1.0001'), Decimal('1.0001')), + (Decimal("1.0001"), Decimal("1.0001")), (Fraction(1, 3), Fraction(-1, -3)), ] for a, x in examples: assert a == approx(x) def test_opposite_sign(self): - examples = [ - (eq, 1e-100, -1e-100), - (ne, 1e100, -1e100), - ] + examples = [(eq, 1e-100, -1e-100), (ne, 1e100, -1e100)] for op, a, x in examples: assert op(a, approx(x)) def test_zero_tolerance(self): - within_1e10 = [ - (1.1e-100, 1e-100), - (-1.1e-100, -1e-100), - ] + within_1e10 = [(1.1e-100, 1e-100), (-1.1e-100, -1e-100)] for a, x in within_1e10: assert x == approx(x, rel=0.0, abs=0.0) assert a != approx(x, rel=0.0, abs=0.0) @@ -98,12 +111,7 @@ class TestApprox(object): def test_inf_tolerance(self): # Everything should be equal if the tolerance is infinite. - large_diffs = [ - (1, 1000), - (1e-50, 1e50), - (-1.0, -1e300), - (0.0, 10), - ] + large_diffs = [(1, 1000), (1e-50, 1e50), (-1.0, -1e300), (0.0, 10)] for a, x in large_diffs: assert a != approx(x, rel=0.0, abs=0.0) assert a == approx(x, rel=inf, abs=0.0) @@ -113,20 +121,13 @@ class TestApprox(object): def test_inf_tolerance_expecting_zero(self): # If the relative tolerance is zero but the expected value is infinite, # the actual tolerance is a NaN, which should be an error. - illegal_kwargs = [ - dict(rel=inf, abs=0.0), - dict(rel=inf, abs=inf), - ] + illegal_kwargs = [dict(rel=inf, abs=0.0), dict(rel=inf, abs=inf)] for kwargs in illegal_kwargs: with pytest.raises(ValueError): 1 == approx(0, **kwargs) def test_nan_tolerance(self): - illegal_kwargs = [ - dict(rel=nan), - dict(abs=nan), - dict(rel=nan, abs=nan), - ] + illegal_kwargs = [dict(rel=nan), dict(abs=nan), dict(rel=nan, abs=nan)] for kwargs in illegal_kwargs: with pytest.raises(ValueError): 1.1 == approx(1, **kwargs) @@ -148,8 +149,8 @@ class TestApprox(object): (eq, 1e0 + 1e-6, 1e0), (ne, 1e0 + 2e-6, 1e0), # Absolute tolerance used. - (eq, 1e-100, + 1e-106), - (eq, 1e-100, + 2e-106), + (eq, 1e-100, +1e-106), + (eq, 1e-100, +2e-106), (eq, 1e-100, 0), ] for op, a, x in examples: @@ -172,21 +173,13 @@ class TestApprox(object): assert 1e-8 + 1e-16 != approx(1e-8, rel=5e-9, abs=5e-17) def test_relative_tolerance(self): - within_1e8_rel = [ - (1e8 + 1e0, 1e8), - (1e0 + 1e-8, 1e0), - (1e-8 + 1e-16, 1e-8), - ] + within_1e8_rel = [(1e8 + 1e0, 1e8), (1e0 + 1e-8, 1e0), (1e-8 + 1e-16, 1e-8)] for a, x in within_1e8_rel: assert a == approx(x, rel=5e-8, abs=0.0) assert a != approx(x, rel=5e-9, abs=0.0) def test_absolute_tolerance(self): - within_1e8_abs = [ - (1e8 + 9e-9, 1e8), - (1e0 + 9e-9, 1e0), - (1e-8 + 9e-9, 1e-8), - ] + within_1e8_abs = [(1e8 + 9e-9, 1e8), (1e0 + 9e-9, 1e0), (1e-8 + 9e-9, 1e-8)] for a, x in within_1e8_abs: assert a == approx(x, rel=0, abs=5e-8) assert a != approx(x, rel=0, abs=5e-9) @@ -233,10 +226,7 @@ class TestApprox(object): assert op(a, approx(x, nan_ok=True)) def test_int(self): - within_1e6 = [ - (1000001, 1000000), - (-1000001, -1000000), - ] + within_1e6 = [(1000001, 1000000), (-1000001, -1000000)] for a, x in within_1e6: assert a == approx(x, rel=5e-6, abs=0) assert a != approx(x, rel=5e-7, abs=0) @@ -245,14 +235,15 @@ class TestApprox(object): def test_decimal(self): within_1e6 = [ - (Decimal('1.000001'), Decimal('1.0')), - (Decimal('-1.000001'), Decimal('-1.0')), + (Decimal("1.000001"), Decimal("1.0")), + (Decimal("-1.000001"), Decimal("-1.0")), ] for a, x in within_1e6: - assert a == approx(x, rel=Decimal('5e-6'), abs=0) - assert a != approx(x, rel=Decimal('5e-7'), abs=0) - assert approx(x, rel=Decimal('5e-6'), abs=0) == a - assert approx(x, rel=Decimal('5e-7'), abs=0) != a + assert a == approx(x) + assert a == approx(x, rel=Decimal("5e-6"), abs=0) + assert a != approx(x, rel=Decimal("5e-7"), abs=0) + assert approx(x, rel=Decimal("5e-6"), abs=0) == a + assert approx(x, rel=Decimal("5e-7"), abs=0) != a def test_fraction(self): within_1e6 = [ @@ -307,10 +298,10 @@ class TestApprox(object): assert (1, 2) != approx((1, 2, 3)) def test_dict(self): - actual = {'a': 1 + 1e-7, 'b': 2 + 1e-8} + actual = {"a": 1 + 1e-7, "b": 2 + 1e-8} # Dictionaries became ordered in python3.6, so switch up the order here # to make sure it doesn't matter. - expected = {'b': 2, 'a': 1} + expected = {"b": 2, "a": 1} # Return false if any element is outside the tolerance. assert actual == approx(expected, rel=5e-7, abs=0) @@ -319,12 +310,12 @@ class TestApprox(object): assert approx(expected, rel=5e-8, abs=0) != actual def test_dict_wrong_len(self): - assert {'a': 1, 'b': 2} != approx({'a': 1}) - assert {'a': 1, 'b': 2} != approx({'a': 1, 'c': 2}) - assert {'a': 1, 'b': 2} != approx({'a': 1, 'b': 2, 'c': 3}) + assert {"a": 1, "b": 2} != approx({"a": 1}) + assert {"a": 1, "b": 2} != approx({"a": 1, "c": 2}) + assert {"a": 1, "b": 2} != approx({"a": 1, "b": 2, "c": 3}) def test_numpy_array(self): - np = pytest.importorskip('numpy') + np = pytest.importorskip("numpy") actual = np.array([1 + 1e-7, 2 + 1e-8]) expected = np.array([1, 2]) @@ -342,7 +333,7 @@ class TestApprox(object): assert actual != approx(list(expected), rel=5e-8, abs=0) def test_numpy_array_wrong_shape(self): - np = pytest.importorskip('numpy') + np = pytest.importorskip("numpy") a12 = np.array([[1, 2]]) a21 = np.array([[1], [2]]) @@ -353,10 +344,7 @@ class TestApprox(object): def test_doctests(self): parser = doctest.DocTestParser() test = parser.get_doctest( - approx.__doc__, - {'approx': approx}, - approx.__name__, - None, None, + approx.__doc__, {"approx": approx}, approx.__name__, None, None ) runner = MyDocTestRunner() runner.run(test) @@ -366,27 +354,53 @@ class TestApprox(object): Comparing approx instances inside lists should not produce an error in the detailed diff. Integration test for issue #2111. """ - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def test_foo(): assert [3] == [pytest.approx(4)] - """) - expected = '4.0e-06' + """ + ) + expected = "4.0e-06" result = testdir.runpytest() - result.stdout.fnmatch_lines([ - '*At index 0 diff: 3 != 4 * {0}'.format(expected), - '=* 1 failed in *=', - ]) + result.stdout.fnmatch_lines( + ["*At index 0 diff: 3 != 4 * {}".format(expected), "=* 1 failed in *="] + ) - @pytest.mark.parametrize('op', [ - pytest.param(operator.le, id='<='), - pytest.param(operator.lt, id='<'), - pytest.param(operator.ge, id='>='), - pytest.param(operator.gt, id='>'), - ]) + @pytest.mark.parametrize( + "op", + [ + pytest.param(operator.le, id="<="), + pytest.param(operator.lt, id="<"), + pytest.param(operator.ge, id=">="), + pytest.param(operator.gt, id=">"), + ], + ) def test_comparison_operator_type_error(self, op): """ pytest.approx should raise TypeError for operators other than == and != (#2003). """ with pytest.raises(TypeError): op(1, approx(1, rel=1e-6, abs=1e-12)) + + def test_numpy_array_with_scalar(self): + np = pytest.importorskip("numpy") + + actual = np.array([1 + 1e-7, 1 - 1e-8]) + expected = 1.0 + + assert actual == approx(expected, rel=5e-7, abs=0) + assert actual != approx(expected, rel=5e-8, abs=0) + assert approx(expected, rel=5e-7, abs=0) == actual + assert approx(expected, rel=5e-8, abs=0) != actual + + def test_numpy_scalar_with_array(self): + np = pytest.importorskip("numpy") + + actual = 1.0 + expected = np.array([1 + 1e-7, 1 - 1e-8]) + + assert actual == approx(expected, rel=5e-7, abs=0) + assert actual != approx(expected, rel=5e-8, abs=0) + assert approx(expected, rel=5e-7, abs=0) == actual + assert approx(expected, rel=5e-8, abs=0) != actual diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/collect.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/collect.py index 16c2154b8c1..724504b1af7 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/collect.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/collect.py @@ -4,18 +4,17 @@ import sys from textwrap import dedent import _pytest._code -import py import pytest -from _pytest.main import ( - Collector, - EXIT_NOTESTSCOLLECTED +from _pytest.main import EXIT_NOTESTSCOLLECTED +from _pytest.nodes import Collector + +ignore_parametrized_marks = pytest.mark.filterwarnings( + "ignore:Applying marks directly to parameters" ) -ignore_parametrized_marks = pytest.mark.filterwarnings('ignore:Applying marks directly to parameters') - - class TestModule(object): + def test_failing_import(self, testdir): modcol = testdir.getmodulecol("import alksdjalskdjalkjals") pytest.raises(Collector.CollectError, modcol.collect) @@ -25,17 +24,19 @@ class TestModule(object): b = testdir.mkdir("b") p = a.ensure("test_whatever.py") p.pyimport() - del py.std.sys.modules['test_whatever'] + del sys.modules["test_whatever"] b.ensure("test_whatever.py") result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*import*mismatch*", - "*imported*test_whatever*", - "*%s*" % a.join("test_whatever.py"), - "*not the same*", - "*%s*" % b.join("test_whatever.py"), - "*HINT*", - ]) + result.stdout.fnmatch_lines( + [ + "*import*mismatch*", + "*imported*test_whatever*", + "*%s*" % a.join("test_whatever.py"), + "*not the same*", + "*%s*" % b.join("test_whatever.py"), + "*HINT*", + ] + ) def test_import_prepend_append(self, testdir, monkeypatch): syspath = list(sys.path) @@ -46,11 +47,16 @@ class TestModule(object): root2.ensure("x456.py") p = root2.join("test_x456.py") monkeypatch.syspath_prepend(str(root1)) - p.write(dedent("""\ + p.write( + dedent( + """\ import x456 def test(): assert x456.__file__.startswith(%r) - """ % str(root2))) + """ + % str(root2) + ) + ) with root2.as_cwd(): reprec = testdir.inline_run("--import-mode=append") reprec.assertoutcome(passed=0, failed=1) @@ -67,15 +73,17 @@ class TestModule(object): pytest.raises(ImportError, lambda: modcol.obj) def test_invalid_test_module_name(self, testdir): - a = testdir.mkdir('a') - a.ensure('test_one.part1.py') + a = testdir.mkdir("a") + a.ensure("test_one.part1.py") result = testdir.runpytest("-rw") - result.stdout.fnmatch_lines([ - "ImportError while importing test module*test_one.part1*", - "Hint: make sure your test modules/packages have valid Python names.", - ]) + result.stdout.fnmatch_lines( + [ + "ImportError while importing test module*test_one.part1*", + "Hint: make sure your test modules/packages have valid Python names.", + ] + ) - @pytest.mark.parametrize('verbose', [0, 1, 2]) + @pytest.mark.parametrize("verbose", [0, 1, 2]) def test_show_traceback_import_error(self, testdir, verbose): """Import errors when collecting modules should display the traceback (#1976). @@ -87,21 +95,25 @@ class TestModule(object): """, bar_traceback_import_error="", ) - testdir.makepyfile(""" + testdir.makepyfile( + """ import foo_traceback_import_error - """) - args = ('-v',) * verbose + """ + ) + args = ("-v",) * verbose result = testdir.runpytest(*args) - result.stdout.fnmatch_lines([ - "ImportError while importing test module*", - "Traceback:", - "*from bar_traceback_import_error import NOT_AVAILABLE", - "*cannot import name *NOT_AVAILABLE*", - ]) + result.stdout.fnmatch_lines( + [ + "ImportError while importing test module*", + "Traceback:", + "*from bar_traceback_import_error import NOT_AVAILABLE", + "*cannot import name *NOT_AVAILABLE*", + ] + ) assert result.ret == 2 stdout = result.stdout.str() - for name in ('_pytest', os.path.join('py', '_path')): + for name in ("_pytest", os.path.join("py", "_path")): if verbose == 2: assert name in stdout else: @@ -111,44 +123,54 @@ class TestModule(object): """Check test modules collected which raise ImportError with unicode messages are handled properly (#2336). """ - testdir.makepyfile(u""" + testdir.makepyfile( + u""" # -*- coding: utf-8 -*- raise ImportError(u'Something bad happened ☺') - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "ImportError while importing test module*", - "Traceback:", - "*raise ImportError*Something bad happened*", - ]) + result.stdout.fnmatch_lines( + [ + "ImportError while importing test module*", + "Traceback:", + "*raise ImportError*Something bad happened*", + ] + ) assert result.ret == 2 class TestClass(object): + def test_class_with_init_warning(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ class TestClass1(object): def __init__(self): pass - """) + """ + ) result = testdir.runpytest("-rw") - result.stdout.fnmatch_lines([ - "*cannot collect test class 'TestClass1' because it has a __init__ constructor", - ]) + result.stdout.fnmatch_lines( + [ + "*cannot collect test class 'TestClass1' because it has a __init__ constructor" + ] + ) def test_class_subclassobject(self, testdir): - testdir.getmodulecol(""" + testdir.getmodulecol( + """ class test(object): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*collected 0*", - ]) + result.stdout.fnmatch_lines(["*collected 0*"]) def test_static_method(self, testdir): """Support for collecting staticmethod tests (#2528, #2699)""" - testdir.getmodulecol(""" + testdir.getmodulecol( + """ import pytest class Test(object): @staticmethod @@ -162,15 +184,14 @@ class TestClass(object): @staticmethod def test_fix(fix): assert fix == 1 - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*collected 2 items*", - "*2 passed in*", - ]) + result.stdout.fnmatch_lines(["*collected 2 items*", "*2 passed in*"]) def test_setup_teardown_class_as_classmethod(self, testdir): - testdir.makepyfile(test_mod1=""" + testdir.makepyfile( + test_mod1=""" class TestClassMethod(object): @classmethod def setup_class(cls): @@ -180,55 +201,63 @@ class TestClass(object): @classmethod def teardown_class(cls): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*1 passed*", - ]) + result.stdout.fnmatch_lines(["*1 passed*"]) def test_issue1035_obj_has_getattr(self, testdir): - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ class Chameleon(object): def __getattr__(self, name): return True chameleon = Chameleon() - """) + """ + ) colitems = modcol.collect() assert len(colitems) == 0 def test_issue1579_namedtuple(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import collections TestCase = collections.namedtuple('TestCase', ['a']) - """) - result = testdir.runpytest('-rw') + """ + ) + result = testdir.runpytest("-rw") result.stdout.fnmatch_lines( "*cannot collect test class 'TestCase' " "because it has a __new__ constructor*" ) def test_issue2234_property(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ class TestCase(object): @property def prop(self): raise NotImplementedError() - """) + """ + ) result = testdir.runpytest() assert result.ret == EXIT_NOTESTSCOLLECTED class TestGenerator(object): + def test_generative_functions(self, testdir): - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ def func1(arg, arg2): assert arg == arg2 def test_gen(): yield func1, 17, 3*5 yield func1, 42, 6*7 - """) + """ + ) colitems = modcol.collect() assert len(colitems) == 1 gencol = colitems[0] @@ -237,36 +266,40 @@ class TestGenerator(object): assert len(gencolitems) == 2 assert isinstance(gencolitems[0], pytest.Function) assert isinstance(gencolitems[1], pytest.Function) - assert gencolitems[0].name == '[0]' - assert gencolitems[0].obj.__name__ == 'func1' + assert gencolitems[0].name == "[0]" + assert gencolitems[0].obj.__name__ == "func1" def test_generative_methods(self, testdir): - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ def func1(arg, arg2): assert arg == arg2 class TestGenMethods(object): def test_gen(self): yield func1, 17, 3*5 yield func1, 42, 6*7 - """) + """ + ) gencol = modcol.collect()[0].collect()[0].collect()[0] assert isinstance(gencol, pytest.Generator) gencolitems = gencol.collect() assert len(gencolitems) == 2 assert isinstance(gencolitems[0], pytest.Function) assert isinstance(gencolitems[1], pytest.Function) - assert gencolitems[0].name == '[0]' - assert gencolitems[0].obj.__name__ == 'func1' + assert gencolitems[0].name == "[0]" + assert gencolitems[0].obj.__name__ == "func1" def test_generative_functions_with_explicit_names(self, testdir): - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ def func1(arg, arg2): assert arg == arg2 def test_gen(): yield "seventeen", func1, 17, 3*5 yield "fortytwo", func1, 42, 6*7 - """) + """ + ) colitems = modcol.collect() assert len(colitems) == 1 gencol = colitems[0] @@ -276,18 +309,20 @@ class TestGenerator(object): assert isinstance(gencolitems[0], pytest.Function) assert isinstance(gencolitems[1], pytest.Function) assert gencolitems[0].name == "['seventeen']" - assert gencolitems[0].obj.__name__ == 'func1' + assert gencolitems[0].obj.__name__ == "func1" assert gencolitems[1].name == "['fortytwo']" - assert gencolitems[1].obj.__name__ == 'func1' + assert gencolitems[1].obj.__name__ == "func1" def test_generative_functions_unique_explicit_names(self, testdir): # generative - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ def func(): pass def test_gen(): yield "name", func yield "name", func - """) + """ + ) colitems = modcol.collect() assert len(colitems) == 1 gencol = colitems[0] @@ -295,14 +330,16 @@ class TestGenerator(object): pytest.raises(ValueError, "gencol.collect()") def test_generative_methods_with_explicit_names(self, testdir): - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ def func1(arg, arg2): assert arg == arg2 class TestGenMethods(object): def test_gen(self): yield "m1", func1, 17, 3*5 yield "m2", func1, 42, 6*7 - """) + """ + ) gencol = modcol.collect()[0].collect()[0].collect()[0] assert isinstance(gencol, pytest.Generator) gencolitems = gencol.collect() @@ -310,12 +347,13 @@ class TestGenerator(object): assert isinstance(gencolitems[0], pytest.Function) assert isinstance(gencolitems[1], pytest.Function) assert gencolitems[0].name == "['m1']" - assert gencolitems[0].obj.__name__ == 'func1' + assert gencolitems[0].obj.__name__ == "func1" assert gencolitems[1].name == "['m2']" - assert gencolitems[1].obj.__name__ == 'func1' + assert gencolitems[1].obj.__name__ == "func1" def test_order_of_execution_generator_same_codeline(self, testdir, tmpdir): - o = testdir.makepyfile(""" + o = testdir.makepyfile( + """ from __future__ import print_function def test_generative_order_of_execution(): import py, pytest @@ -333,14 +371,16 @@ class TestGenerator(object): for i in expected_list: yield list_append, i yield assert_order_of_execution - """) + """ + ) reprec = testdir.inline_run(o) passed, skipped, failed = reprec.countoutcomes() assert passed == 7 assert not skipped and not failed def test_order_of_execution_generator_different_codeline(self, testdir): - o = testdir.makepyfile(""" + o = testdir.makepyfile( + """ from __future__ import print_function def test_generative_tests_different_codeline(): import py, pytest @@ -365,7 +405,8 @@ class TestGenerator(object): yield list_append_1 yield list_append_2 yield assert_order_of_execution - """) + """ + ) reprec = testdir.inline_run(o) passed, skipped, failed = reprec.countoutcomes() assert passed == 4 @@ -378,7 +419,8 @@ class TestGenerator(object): # that the old 1.3.4 behaviour is preserved such that all # yielded functions all share the same "self" instance that # has been used during collection. - o = testdir.makepyfile(""" + o = testdir.makepyfile( + """ setuplist = [] class TestClass(object): def setup_method(self, func): @@ -407,33 +449,38 @@ class TestGenerator(object): assert len(setuplist) == 3, len(setuplist) assert setuplist[0] == setuplist[2], setuplist assert setuplist[1] != setuplist[2], setuplist - """) - reprec = testdir.inline_run(o, '-v') + """ + ) + reprec = testdir.inline_run(o, "-v") passed, skipped, failed = reprec.countoutcomes() assert passed == 4 assert not skipped and not failed class TestFunction(object): + def test_getmodulecollector(self, testdir): item = testdir.getitem("def test_func(): pass") modcol = item.getparent(pytest.Module) assert isinstance(modcol, pytest.Module) - assert hasattr(modcol.obj, 'test_func') + assert hasattr(modcol.obj, "test_func") def test_function_as_object_instance_ignored(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ class A(object): def __call__(self, tmpdir): 0/0 test_a = A() - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome() def test_function_equality(self, testdir, tmpdir): from _pytest.fixtures import FixtureManager + config = testdir.parseconfigure() session = testdir.Session(config) session._fixturemanager = FixtureManager(session) @@ -444,35 +491,40 @@ class TestFunction(object): def func2(): pass - f1 = pytest.Function(name="name", parent=session, config=config, - args=(1,), callobj=func1) + f1 = pytest.Function( + name="name", parent=session, config=config, args=(1,), callobj=func1 + ) assert f1 == f1 - f2 = pytest.Function(name="name", config=config, - callobj=func2, parent=session) + f2 = pytest.Function(name="name", config=config, callobj=func2, parent=session) assert f1 != f2 def test_issue197_parametrize_emptyset(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.parametrize('arg', []) def test_function(arg): pass - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(skipped=1) def test_single_tuple_unwraps_values(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.parametrize(('arg',), [(1,)]) def test_function(arg): assert arg == 1 - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) def test_issue213_parametrize_value_no_equal(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest class A(object): def __eq__(self, other): @@ -480,13 +532,15 @@ class TestFunction(object): @pytest.mark.parametrize('arg', [A()]) def test_function(arg): assert arg.__class__.__name__ == "A" - """) + """ + ) reprec = testdir.inline_run("--fulltrace") reprec.assertoutcome(passed=1) def test_parametrize_with_non_hashable_values(self, testdir): """Test parametrization with non-hashable values.""" - testdir.makepyfile(""" + testdir.makepyfile( + """ archival_mapping = { '1.0': {'tag': '1.0'}, '1.2.2a1': {'tag': 'release-1.2.2a1'}, @@ -498,13 +552,15 @@ class TestFunction(object): def test_archival_to_version(key, value): assert key in archival_mapping assert value == archival_mapping[key] - """) + """ + ) rec = testdir.inline_run() rec.assertoutcome(passed=2) def test_parametrize_with_non_hashable_values_indirect(self, testdir): """Test parametrization with non-hashable values with indirect parametrization.""" - testdir.makepyfile(""" + testdir.makepyfile( + """ archival_mapping = { '1.0': {'tag': '1.0'}, '1.2.2a1': {'tag': 'release-1.2.2a1'}, @@ -525,13 +581,15 @@ class TestFunction(object): def test_archival_to_version(key, value): assert key in archival_mapping assert value == archival_mapping[key] - """) + """ + ) rec = testdir.inline_run() rec.assertoutcome(passed=2) def test_parametrize_overrides_fixture(self, testdir): """Test parametrization when parameter overrides existing fixture with same name.""" - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture @@ -552,13 +610,15 @@ class TestFunction(object): def test_overridden_via_multiparam(other, value): assert other == 'foo' assert value == 'overridden' - """) + """ + ) rec = testdir.inline_run() rec.assertoutcome(passed=3) def test_parametrize_overrides_parametrized_fixture(self, testdir): """Test parametrization when parameter overrides existing parametrized fixture with same name.""" - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(params=[1, 2]) @@ -569,13 +629,15 @@ class TestFunction(object): ['overridden']) def test_overridden_via_param(value): assert value == 'overridden' - """) + """ + ) rec = testdir.inline_run() rec.assertoutcome(passed=1) @ignore_parametrized_marks def test_parametrize_with_mark(self, testdir): - items = testdir.getitems(""" + items = testdir.getitems( + """ import pytest @pytest.mark.foo @pytest.mark.parametrize('arg', [ @@ -584,18 +646,25 @@ class TestFunction(object): ]) def test_function(arg): pass - """) + """ + ) keywords = [item.keywords for item in items] - assert 'foo' in keywords[0] and 'bar' not in keywords[0] and 'baz' not in keywords[0] - assert 'foo' in keywords[1] and 'bar' in keywords[1] and 'baz' in keywords[1] + assert ( + "foo" in keywords[0] + and "bar" not in keywords[0] + and "baz" not in keywords[0] + ) + assert "foo" in keywords[1] and "bar" in keywords[1] and "baz" in keywords[1] def test_function_equality_with_callspec(self, testdir, tmpdir): - items = testdir.getitems(""" + items = testdir.getitems( + """ import pytest @pytest.mark.parametrize('arg', [1,2]) def test_function(arg): pass - """) + """ + ) assert items[0] != items[1] assert not (items[0] == items[1]) @@ -604,10 +673,12 @@ class TestFunction(object): config = item.config class MyPlugin1(object): + def pytest_pyfunc_call(self, pyfuncitem): raise ValueError class MyPlugin2(object): + def pytest_pyfunc_call(self, pyfuncitem): return True @@ -617,21 +688,24 @@ class TestFunction(object): config.hook.pytest_pyfunc_call(pyfuncitem=item) def test_multiple_parametrize(self, testdir): - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ import pytest @pytest.mark.parametrize('x', [0, 1]) @pytest.mark.parametrize('y', [2, 3]) def test1(x, y): pass - """) + """ + ) colitems = modcol.collect() - assert colitems[0].name == 'test1[2-0]' - assert colitems[1].name == 'test1[2-1]' - assert colitems[2].name == 'test1[3-0]' - assert colitems[3].name == 'test1[3-1]' + assert colitems[0].name == "test1[2-0]" + assert colitems[1].name == "test1[2-1]" + assert colitems[2].name == "test1[3-0]" + assert colitems[3].name == "test1[3-1]" def test_issue751_multiple_parametrize_with_ids(self, testdir): - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ import pytest @pytest.mark.parametrize('x', [0], ids=['c']) @pytest.mark.parametrize('y', [0, 1], ids=['a', 'b']) @@ -640,16 +714,18 @@ class TestFunction(object): pass def test2(self, x, y): pass - """) + """ + ) colitems = modcol.collect()[0].collect()[0].collect() - assert colitems[0].name == 'test1[a-c]' - assert colitems[1].name == 'test1[b-c]' - assert colitems[2].name == 'test2[a-c]' - assert colitems[3].name == 'test2[b-c]' + assert colitems[0].name == "test1[a-c]" + assert colitems[1].name == "test1[b-c]" + assert colitems[2].name == "test2[a-c]" + assert colitems[3].name == "test2[b-c]" @ignore_parametrized_marks def test_parametrize_skipif(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest m = pytest.mark.skipif('True') @@ -657,13 +733,15 @@ class TestFunction(object): @pytest.mark.parametrize('x', [0, 1, m(2)]) def test_skip_if(x): assert x < 2 - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines('* 2 passed, 1 skipped in *') + result.stdout.fnmatch_lines("* 2 passed, 1 skipped in *") @ignore_parametrized_marks def test_parametrize_skip(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest m = pytest.mark.skip('') @@ -671,13 +749,15 @@ class TestFunction(object): @pytest.mark.parametrize('x', [0, 1, m(2)]) def test_skip(x): assert x < 2 - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines('* 2 passed, 1 skipped in *') + result.stdout.fnmatch_lines("* 2 passed, 1 skipped in *") @ignore_parametrized_marks def test_parametrize_skipif_no_skip(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest m = pytest.mark.skipif('False') @@ -685,13 +765,15 @@ class TestFunction(object): @pytest.mark.parametrize('x', [0, 1, m(2)]) def test_skipif_no_skip(x): assert x < 2 - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines('* 1 failed, 2 passed in *') + result.stdout.fnmatch_lines("* 1 failed, 2 passed in *") @ignore_parametrized_marks def test_parametrize_xfail(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest m = pytest.mark.xfail('True') @@ -699,13 +781,15 @@ class TestFunction(object): @pytest.mark.parametrize('x', [0, 1, m(2)]) def test_xfail(x): assert x < 2 - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines('* 2 passed, 1 xfailed in *') + result.stdout.fnmatch_lines("* 2 passed, 1 xfailed in *") @ignore_parametrized_marks def test_parametrize_passed(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest m = pytest.mark.xfail('True') @@ -713,13 +797,15 @@ class TestFunction(object): @pytest.mark.parametrize('x', [0, 1, m(2)]) def test_xfail(x): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines('* 2 passed, 1 xpassed in *') + result.stdout.fnmatch_lines("* 2 passed, 1 xpassed in *") @ignore_parametrized_marks def test_parametrize_xfail_passed(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest m = pytest.mark.xfail('False') @@ -727,26 +813,32 @@ class TestFunction(object): @pytest.mark.parametrize('x', [0, 1, m(2)]) def test_passed(x): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines('* 3 passed in *') + result.stdout.fnmatch_lines("* 3 passed in *") def test_function_original_name(self, testdir): - items = testdir.getitems(""" + items = testdir.getitems( + """ import pytest @pytest.mark.parametrize('arg', [1,2]) def test_func(arg): pass - """) - assert [x.originalname for x in items] == ['test_func', 'test_func'] + """ + ) + assert [x.originalname for x in items] == ["test_func", "test_func"] class TestSorting(object): + def test_check_equality(self, testdir): - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ def test_pass(): pass def test_fail(): assert 0 - """) + """ + ) fn1 = testdir.collect_by_name(modcol, "test_pass") assert isinstance(fn1, pytest.Function) fn2 = testdir.collect_by_name(modcol, "test_pass") @@ -754,8 +846,8 @@ class TestSorting(object): assert fn1 == fn2 assert fn1 != modcol - if py.std.sys.version_info < (3, 0): - assert cmp(fn1, fn2) == 0 + if sys.version_info < (3, 0): + assert cmp(fn1, fn2) == 0 # NOQA assert hash(fn1) == hash(fn2) fn3 = testdir.collect_by_name(modcol, "test_fail") @@ -771,7 +863,8 @@ class TestSorting(object): assert modcol != fn def test_allow_sane_sorting_for_decorators(self, testdir): - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ def dec(f): g = lambda: f(2) g.place_as = f @@ -785,50 +878,61 @@ class TestSorting(object): def test_a(y): pass test_a = dec(test_a) - """) + """ + ) colitems = modcol.collect() assert len(colitems) == 2 - assert [item.name for item in colitems] == ['test_b', 'test_a'] + assert [item.name for item in colitems] == ["test_b", "test_a"] class TestConftestCustomization(object): + def test_pytest_pycollect_module(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest class MyModule(pytest.Module): pass def pytest_pycollect_makemodule(path, parent): if path.basename == "test_xyz.py": return MyModule(path, parent) - """) + """ + ) testdir.makepyfile("def test_some(): pass") testdir.makepyfile(test_xyz="def test_func(): pass") result = testdir.runpytest("--collect-only") - result.stdout.fnmatch_lines([ - "* 3 def test_traceback_error_during_import(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ x = 1 x = 2 x = 17 asd - """) + """ + ) result = testdir.runpytest() assert result.ret != 0 out = result.stdout.str() assert "x = 1" not in out assert "x = 2" not in out - result.stdout.fnmatch_lines([ - " *asd*", - "E*NameError*", - ]) + result.stdout.fnmatch_lines([" *asd*", "E*NameError*"]) result = testdir.runpytest("--fulltrace") out = result.stdout.str() assert "x = 1" in out assert "x = 2" in out - result.stdout.fnmatch_lines([ - ">*asd*", - "E*NameError*", - ]) + result.stdout.fnmatch_lines([">*asd*", "E*NameError*"]) def test_traceback_filter_error_during_fixture_collection(self, testdir): """integration test for issue #995. """ - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def fail_me(func): @@ -1009,15 +1133,13 @@ class TestTracebackCutting(object): def test_failing_fixture(fail_fixture): pass - """) + """ + ) result = testdir.runpytest() assert result.ret != 0 out = result.stdout.str() assert "INTERNALERROR>" not in out - result.stdout.fnmatch_lines([ - "*ValueError: fail me*", - "* 1 error in *", - ]) + result.stdout.fnmatch_lines(["*ValueError: fail me*", "* 1 error in *"]) def test_filter_traceback_generated_code(self): """test that filter_traceback() works with the fact that @@ -1028,10 +1150,11 @@ class TestTracebackCutting(object): This fixes #995. """ from _pytest.python import filter_traceback + try: ns = {} - exec('def foo(): raise ValueError', ns) - ns['foo']() + exec("def foo(): raise ValueError", ns) + ns["foo"]() except ValueError: _, _, tb = sys.exc_info() @@ -1046,26 +1169,32 @@ class TestTracebackCutting(object): This fixes #1133. """ from _pytest.python import filter_traceback + testdir.syspathinsert() - testdir.makepyfile(filter_traceback_entry_as_str=''' + testdir.makepyfile( + filter_traceback_entry_as_str=""" def foo(): raise ValueError - ''') + """ + ) try: import filter_traceback_entry_as_str + filter_traceback_entry_as_str.foo() except ValueError: _, _, tb = sys.exc_info() - testdir.tmpdir.join('filter_traceback_entry_as_str.py').remove() + testdir.tmpdir.join("filter_traceback_entry_as_str.py").remove() tb = _pytest._code.Traceback(tb) assert isinstance(tb[-1].path, str) assert filter_traceback(tb[-1]) class TestReportInfo(object): + def test_itemreport_reportinfo(self, testdir, linecomp): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest class MyFunction(pytest.Function): def reportinfo(self): @@ -1073,7 +1202,8 @@ class TestReportInfo(object): def pytest_pycollect_makeitem(collector, name, obj): if name == "test_func": return MyFunction(name, parent=collector) - """) + """ + ) item = testdir.getitem("def test_func(): pass") item.config.pluginmanager.getplugin("runner") assert item.location == ("ABCDE", 42, "custom") @@ -1086,11 +1216,13 @@ class TestReportInfo(object): assert modpath == "test_func" def test_class_reportinfo(self, testdir): - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ # lineno 0 class TestClass(object): def test_hello(self): pass - """) + """ + ) classcol = testdir.collect_by_name(modcol, "TestClass") fspath, lineno, msg = classcol.reportinfo() assert fspath == modcol.fspath @@ -1098,13 +1230,15 @@ class TestReportInfo(object): assert msg == "TestClass" def test_generator_reportinfo(self, testdir): - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ # lineno 0 def test_gen(): def check(x): assert x yield check, 3 - """) + """ + ) gencol = testdir.collect_by_name(modcol, "test_gen") fspath, lineno, modpath = gencol.reportinfo() assert fspath == modcol.fspath @@ -1130,7 +1264,8 @@ class TestReportInfo(object): def test_reportinfo_with_nasty_getattr(self, testdir): # https://github.com/pytest-dev/pytest/issues/1204 - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ # lineno 0 class TestClass(object): def __getattr__(self, name): @@ -1138,85 +1273,88 @@ class TestReportInfo(object): def test_foo(self): pass - """) + """ + ) classcol = testdir.collect_by_name(modcol, "TestClass") instance = classcol.collect()[0] fspath, lineno, msg = instance.reportinfo() def test_customized_python_discovery(testdir): - testdir.makeini(""" + testdir.makeini( + """ [pytest] python_files=check_*.py python_classes=Check python_functions=check - """) - p = testdir.makepyfile(""" + """ + ) + p = testdir.makepyfile( + """ def check_simple(): pass class CheckMyApp(object): def check_meth(self): pass - """) + """ + ) p2 = p.new(basename=p.basename.replace("test", "check")) p.move(p2) result = testdir.runpytest("--collect-only", "-s") - result.stdout.fnmatch_lines([ - "*check_customized*", - "*check_simple*", - "*CheckMyApp*", - "*check_meth*", - ]) + result.stdout.fnmatch_lines( + ["*check_customized*", "*check_simple*", "*CheckMyApp*", "*check_meth*"] + ) result = testdir.runpytest() assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*2 passed*", - ]) + result.stdout.fnmatch_lines(["*2 passed*"]) def test_customized_python_discovery_functions(testdir): - testdir.makeini(""" + testdir.makeini( + """ [pytest] python_functions=_test - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ def _test_underscore(): pass - """) + """ + ) result = testdir.runpytest("--collect-only", "-s") - result.stdout.fnmatch_lines([ - "*_test_underscore*", - ]) + result.stdout.fnmatch_lines(["*_test_underscore*"]) result = testdir.runpytest() assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*1 passed*", - ]) + result.stdout.fnmatch_lines(["*1 passed*"]) def test_collector_attributes(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest def pytest_pycollect_makeitem(collector): assert collector.Function == pytest.Function assert collector.Class == pytest.Class assert collector.Instance == pytest.Instance assert collector.Module == pytest.Module - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ def test_hello(): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*1 passed*", - ]) + result.stdout.fnmatch_lines(["*1 passed*"]) def test_customize_through_attributes(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest class MyFunction(pytest.Function): pass @@ -1228,22 +1366,24 @@ def test_customize_through_attributes(testdir): def pytest_pycollect_makeitem(collector, name, obj): if name.startswith("MyTestClass"): return MyClass(name, parent=collector) - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ class MyTestClass(object): def test_hello(self): pass - """) + """ + ) result = testdir.runpytest("--collect-only") - result.stdout.fnmatch_lines([ - "*MyClass*", - "*MyInstance*", - "*MyFunction*test_hello*", - ]) + result.stdout.fnmatch_lines( + ["*MyClass*", "*MyInstance*", "*MyFunction*test_hello*"] + ) def test_unorderable_types(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ class TestJoinEmpty(object): pass @@ -1253,7 +1393,8 @@ def test_unorderable_types(testdir): Test.__name__ = "TestFoo" return Test TestFoo = make_test() - """) + """ + ) result = testdir.runpytest() assert "TypeError" not in result.stdout.str() assert result.ret == EXIT_NOTESTSCOLLECTED @@ -1264,7 +1405,8 @@ def test_collect_functools_partial(testdir): Test that collection of functools.partial object works, and arguments to the wrapped functions are dealt correctly (see #811). """ - testdir.makepyfile(""" + testdir.makepyfile( + """ import functools import pytest @@ -1298,7 +1440,8 @@ def test_collect_functools_partial(testdir): test_fail_1 = functools.partial(check2, 2) test_fail_2 = functools.partial(check3, 2) - """) + """ + ) result = testdir.inline_run() result.assertoutcome(passed=6, failed=2) @@ -1309,7 +1452,8 @@ def test_dont_collect_non_function_callable(testdir): In this case an INTERNALERROR occurred trying to report the failure of a test like this one because py test failed to get the source lines. """ - testdir.makepyfile(""" + testdir.makepyfile( + """ class Oh(object): def __call__(self): pass @@ -1318,13 +1462,16 @@ def test_dont_collect_non_function_callable(testdir): def test_real(): pass - """) - result = testdir.runpytest('-rw') - result.stdout.fnmatch_lines([ - '*collected 1 item*', - "*cannot collect 'test_a' because it is not a function*", - '*1 passed, 1 warnings in *', - ]) + """ + ) + result = testdir.runpytest("-rw") + result.stdout.fnmatch_lines( + [ + "*collected 1 item*", + "*cannot collect 'test_a' because it is not a function*", + "*1 passed, 1 warnings in *", + ] + ) def test_class_injection_does_not_break_collection(testdir): @@ -1334,36 +1481,38 @@ def test_class_injection_does_not_break_collection(testdir): is modified during collection time, and the original method list is still used for collection. """ - testdir.makeconftest(""" + testdir.makeconftest( + """ from test_inject import TestClass def pytest_generate_tests(metafunc): TestClass.changed_var = {} - """) - testdir.makepyfile(test_inject=''' + """ + ) + testdir.makepyfile( + test_inject=''' class TestClass(object): def test_injection(self): """Test being parametrized.""" pass - ''') + ''' + ) result = testdir.runpytest() assert "RuntimeError: dictionary changed size during iteration" not in result.stdout.str() - result.stdout.fnmatch_lines(['*1 passed*']) + result.stdout.fnmatch_lines(["*1 passed*"]) def test_syntax_error_with_non_ascii_chars(testdir): """Fix decoding issue while formatting SyntaxErrors during collection (#578) """ - testdir.makepyfile(u""" + testdir.makepyfile( + u""" # -*- coding: UTF-8 -*- ☃ - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - '*ERROR collecting*', - '*SyntaxError*', - '*1 error in*', - ]) + result.stdout.fnmatch_lines(["*ERROR collecting*", "*SyntaxError*", "*1 error in*"]) def test_skip_duplicates_by_default(testdir): @@ -1373,15 +1522,17 @@ def test_skip_duplicates_by_default(testdir): """ a = testdir.mkdir("a") fh = a.join("test_a.py") - fh.write(_pytest._code.Source(""" + fh.write( + _pytest._code.Source( + """ import pytest def test_real(): pass - """)) + """ + ) + ) result = testdir.runpytest(a.strpath, a.strpath) - result.stdout.fnmatch_lines([ - '*collected 1 item*', - ]) + result.stdout.fnmatch_lines(["*collected 1 item*"]) def test_keep_duplicates(testdir): @@ -1391,12 +1542,14 @@ def test_keep_duplicates(testdir): """ a = testdir.mkdir("a") fh = a.join("test_a.py") - fh.write(_pytest._code.Source(""" + fh.write( + _pytest._code.Source( + """ import pytest def test_real(): pass - """)) + """ + ) + ) result = testdir.runpytest("--keep-duplicates", a.strpath, a.strpath) - result.stdout.fnmatch_lines([ - '*collected 2 item*', - ]) + result.stdout.fnmatch_lines(["*collected 2 item*"]) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/fixture.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/fixture.py index b159e8ebb8e..6d2bb663b6c 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/fixture.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/fixture.py @@ -3,28 +3,34 @@ from textwrap import dedent import _pytest._code import pytest from _pytest.pytester import get_public_names -from _pytest.fixtures import FixtureLookupError +from _pytest.fixtures import FixtureLookupError, FixtureRequest from _pytest import fixtures def test_getfuncargnames(): + def f(): pass + assert not fixtures.getfuncargnames(f) def g(arg): pass - assert fixtures.getfuncargnames(g) == ('arg',) + + assert fixtures.getfuncargnames(g) == ("arg",) def h(arg1, arg2="hello"): pass - assert fixtures.getfuncargnames(h) == ('arg1',) + + assert fixtures.getfuncargnames(h) == ("arg1",) def h(arg1, arg2, arg3="hello"): pass - assert fixtures.getfuncargnames(h) == ('arg1', 'arg2') + + assert fixtures.getfuncargnames(h) == ("arg1", "arg2") class A(object): + def f(self, arg1, arg2="hello"): pass @@ -32,17 +38,19 @@ def test_getfuncargnames(): def static(arg1, arg2): pass - assert fixtures.getfuncargnames(A().f) == ('arg1',) - assert fixtures.getfuncargnames(A.static, cls=A) == ('arg1', 'arg2') + assert fixtures.getfuncargnames(A().f) == ("arg1",) + assert fixtures.getfuncargnames(A.static, cls=A) == ("arg1", "arg2") class TestFillFixtures(object): + def test_fillfuncargs_exposed(self): # used by oejskit, kept for compatibility assert pytest._fillfuncargs == fixtures.fillfixtures def test_funcarg_lookupfails(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture @@ -51,17 +59,17 @@ class TestFillFixtures(object): def test_func(some): pass - """) + """ + ) result = testdir.runpytest() # "--collect-only") assert result.ret != 0 - result.stdout.fnmatch_lines([ - "*def test_func(some)*", - "*fixture*some*not found*", - "*xyzsomething*", - ]) + result.stdout.fnmatch_lines( + ["*def test_func(some)*", "*fixture*some*not found*", "*xyzsomething*"] + ) def test_funcarg_basic(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest @pytest.fixture @@ -72,15 +80,17 @@ class TestFillFixtures(object): return 42 def test_func(some, other): pass - """) + """ + ) fixtures.fillfixtures(item) del item.funcargs["request"] assert len(get_public_names(item.funcargs)) == 2 - assert item.funcargs['some'] == "test_func" - assert item.funcargs['other'] == 42 + assert item.funcargs["some"] == "test_func" + assert item.funcargs["other"] == 42 def test_funcarg_lookup_modulelevel(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture @@ -92,12 +102,14 @@ class TestFillFixtures(object): assert something == "test_method" def test_func(something): assert something == "test_func" - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=2) def test_funcarg_lookup_classlevel(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest class TestClass(object): @@ -107,27 +119,34 @@ class TestFillFixtures(object): def test_method(self, something): assert something is self - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "*1 passed*" - ]) + result.stdout.fnmatch_lines(["*1 passed*"]) def test_conftest_funcargs_only_available_in_subdir(self, testdir): sub1 = testdir.mkpydir("sub1") sub2 = testdir.mkpydir("sub2") - sub1.join("conftest.py").write(_pytest._code.Source(""" + sub1.join("conftest.py").write( + _pytest._code.Source( + """ import pytest @pytest.fixture def arg1(request): pytest.raises(Exception, "request.getfixturevalue('arg2')") - """)) - sub2.join("conftest.py").write(_pytest._code.Source(""" + """ + ) + ) + sub2.join("conftest.py").write( + _pytest._code.Source( + """ import pytest @pytest.fixture def arg2(request): pytest.raises(Exception, "request.getfixturevalue('arg1')") - """)) + """ + ) + ) sub1.join("test_in_sub1.py").write("def test_1(arg1): pass") sub2.join("test_in_sub2.py").write("def test_2(arg2): pass") @@ -135,7 +154,8 @@ class TestFillFixtures(object): result.assert_outcomes(passed=2) def test_extend_fixture_module_class(self, testdir): - testfile = testdir.makepyfile(""" + testfile = testdir.makepyfile( + """ import pytest @pytest.fixture @@ -150,21 +170,25 @@ class TestFillFixtures(object): def test_spam(self, spam): assert spam == 'spamspam' - """) + """ + ) result = testdir.runpytest() result.stdout.fnmatch_lines(["*1 passed*"]) result = testdir.runpytest(testfile) result.stdout.fnmatch_lines(["*1 passed*"]) def test_extend_fixture_conftest_module(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture def spam(): return 'spam' - """) - testfile = testdir.makepyfile(""" + """ + ) + testfile = testdir.makepyfile( + """ import pytest @pytest.fixture @@ -173,48 +197,62 @@ class TestFillFixtures(object): def test_spam(spam): assert spam == 'spamspam' - """) + """ + ) result = testdir.runpytest() result.stdout.fnmatch_lines(["*1 passed*"]) result = testdir.runpytest(testfile) result.stdout.fnmatch_lines(["*1 passed*"]) def test_extend_fixture_conftest_conftest(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture def spam(): return 'spam' - """) + """ + ) pkg = testdir.mkpydir("pkg") - pkg.join("conftest.py").write(_pytest._code.Source(""" + pkg.join("conftest.py").write( + _pytest._code.Source( + """ import pytest @pytest.fixture def spam(spam): return spam * 2 - """)) + """ + ) + ) testfile = pkg.join("test_spam.py") - testfile.write(_pytest._code.Source(""" + testfile.write( + _pytest._code.Source( + """ def test_spam(spam): assert spam == "spamspam" - """)) + """ + ) + ) result = testdir.runpytest() result.stdout.fnmatch_lines(["*1 passed*"]) result = testdir.runpytest(testfile) result.stdout.fnmatch_lines(["*1 passed*"]) def test_extend_fixture_conftest_plugin(self, testdir): - testdir.makepyfile(testplugin=""" + testdir.makepyfile( + testplugin=""" import pytest @pytest.fixture def foo(): return 7 - """) + """ + ) testdir.syspathinsert() - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest pytest_plugins = 'testplugin' @@ -222,50 +260,62 @@ class TestFillFixtures(object): @pytest.fixture def foo(foo): return foo + 7 - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ def test_foo(foo): assert foo == 14 - """) - result = testdir.runpytest('-s') + """ + ) + result = testdir.runpytest("-s") assert result.ret == 0 def test_extend_fixture_plugin_plugin(self, testdir): # Two plugins should extend each order in loading order - testdir.makepyfile(testplugin0=""" + testdir.makepyfile( + testplugin0=""" import pytest @pytest.fixture def foo(): return 7 - """) - testdir.makepyfile(testplugin1=""" + """ + ) + testdir.makepyfile( + testplugin1=""" import pytest @pytest.fixture def foo(foo): return foo + 7 - """) + """ + ) testdir.syspathinsert() - testdir.makepyfile(""" + testdir.makepyfile( + """ pytest_plugins = ['testplugin0', 'testplugin1'] def test_foo(foo): assert foo == 14 - """) + """ + ) result = testdir.runpytest() assert result.ret == 0 def test_override_parametrized_fixture_conftest_module(self, testdir): """Test override of the parametrized fixture with non-parametrized one on the test module level.""" - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture(params=[1, 2, 3]) def spam(request): return request.param - """) - testfile = testdir.makepyfile(""" + """ + ) + testfile = testdir.makepyfile( + """ import pytest @pytest.fixture @@ -274,7 +324,8 @@ class TestFillFixtures(object): def test_spam(spam): assert spam == 'spam' - """) + """ + ) result = testdir.runpytest() result.stdout.fnmatch_lines(["*1 passed*"]) result = testdir.runpytest(testfile) @@ -282,26 +333,36 @@ class TestFillFixtures(object): def test_override_parametrized_fixture_conftest_conftest(self, testdir): """Test override of the parametrized fixture with non-parametrized one on the conftest level.""" - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture(params=[1, 2, 3]) def spam(request): return request.param - """) - subdir = testdir.mkpydir('subdir') - subdir.join("conftest.py").write(_pytest._code.Source(""" + """ + ) + subdir = testdir.mkpydir("subdir") + subdir.join("conftest.py").write( + _pytest._code.Source( + """ import pytest @pytest.fixture def spam(): return 'spam' - """)) + """ + ) + ) testfile = subdir.join("test_spam.py") - testfile.write(_pytest._code.Source(""" + testfile.write( + _pytest._code.Source( + """ def test_spam(spam): assert spam == "spam" - """)) + """ + ) + ) result = testdir.runpytest() result.stdout.fnmatch_lines(["*1 passed*"]) result = testdir.runpytest(testfile) @@ -309,14 +370,17 @@ class TestFillFixtures(object): def test_override_non_parametrized_fixture_conftest_module(self, testdir): """Test override of the non-parametrized fixture with parametrized one on the test module level.""" - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture def spam(): return 'spam' - """) - testfile = testdir.makepyfile(""" + """ + ) + testfile = testdir.makepyfile( + """ import pytest @pytest.fixture(params=[1, 2, 3]) @@ -328,7 +392,8 @@ class TestFillFixtures(object): def test_spam(spam): assert spam == params['spam'] params['spam'] += 1 - """) + """ + ) result = testdir.runpytest() result.stdout.fnmatch_lines(["*3 passed*"]) result = testdir.runpytest(testfile) @@ -336,61 +401,83 @@ class TestFillFixtures(object): def test_override_non_parametrized_fixture_conftest_conftest(self, testdir): """Test override of the non-parametrized fixture with parametrized one on the conftest level.""" - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture def spam(): return 'spam' - """) - subdir = testdir.mkpydir('subdir') - subdir.join("conftest.py").write(_pytest._code.Source(""" + """ + ) + subdir = testdir.mkpydir("subdir") + subdir.join("conftest.py").write( + _pytest._code.Source( + """ import pytest @pytest.fixture(params=[1, 2, 3]) def spam(request): return request.param - """)) + """ + ) + ) testfile = subdir.join("test_spam.py") - testfile.write(_pytest._code.Source(""" + testfile.write( + _pytest._code.Source( + """ params = {'spam': 1} def test_spam(spam): assert spam == params['spam'] params['spam'] += 1 - """)) + """ + ) + ) result = testdir.runpytest() result.stdout.fnmatch_lines(["*3 passed*"]) result = testdir.runpytest(testfile) result.stdout.fnmatch_lines(["*3 passed*"]) - def test_override_autouse_fixture_with_parametrized_fixture_conftest_conftest(self, testdir): + def test_override_autouse_fixture_with_parametrized_fixture_conftest_conftest( + self, testdir + ): """Test override of the autouse fixture with parametrized one on the conftest level. This test covers the issue explained in issue 1601 """ - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture(autouse=True) def spam(): return 'spam' - """) - subdir = testdir.mkpydir('subdir') - subdir.join("conftest.py").write(_pytest._code.Source(""" + """ + ) + subdir = testdir.mkpydir("subdir") + subdir.join("conftest.py").write( + _pytest._code.Source( + """ import pytest @pytest.fixture(params=[1, 2, 3]) def spam(request): return request.param - """)) + """ + ) + ) testfile = subdir.join("test_spam.py") - testfile.write(_pytest._code.Source(""" + testfile.write( + _pytest._code.Source( + """ params = {'spam': 1} def test_spam(spam): assert spam == params['spam'] params['spam'] += 1 - """)) + """ + ) + ) result = testdir.runpytest() result.stdout.fnmatch_lines(["*3 passed*"]) result = testdir.runpytest(testfile) @@ -399,25 +486,30 @@ class TestFillFixtures(object): def test_autouse_fixture_plugin(self, testdir): # A fixture from a plugin has no baseid set, which screwed up # the autouse fixture handling. - testdir.makepyfile(testplugin=""" + testdir.makepyfile( + testplugin=""" import pytest @pytest.fixture(autouse=True) def foo(request): request.function.foo = 7 - """) + """ + ) testdir.syspathinsert() - testdir.makepyfile(""" + testdir.makepyfile( + """ pytest_plugins = 'testplugin' def test_foo(request): assert request.function.foo == 7 - """) + """ + ) result = testdir.runpytest() assert result.ret == 0 def test_funcarg_lookup_error(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture @@ -431,25 +523,31 @@ class TestFillFixtures(object): @pytest.fixture def d_fixture(): pass - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ def test_lookup_error(unknown): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*ERROR at setup of test_lookup_error*", - " def test_lookup_error(unknown):*", - "E fixture 'unknown' not found", - "> available fixtures:*a_fixture,*b_fixture,*c_fixture,*d_fixture*monkeypatch,*", # sorted - "> use 'py*test --fixtures *' for help on them.", - "*1 error*", - ]) + result.stdout.fnmatch_lines( + [ + "*ERROR at setup of test_lookup_error*", + " def test_lookup_error(unknown):*", + "E fixture 'unknown' not found", + "> available fixtures:*a_fixture,*b_fixture,*c_fixture,*d_fixture*monkeypatch,*", # sorted + "> use 'py*test --fixtures *' for help on them.", + "*1 error*", + ] + ) assert "INTERNAL" not in result.stdout.str() def test_fixture_excinfo_leak(self, testdir): # on python2 sys.excinfo would leak into fixture executions - testdir.makepyfile(""" + testdir.makepyfile( + """ import sys import traceback import pytest @@ -465,31 +563,36 @@ class TestFillFixtures(object): if sys.exc_info()[0]: # python3 bug :) traceback.print_exc() assert sys.exc_info() == (None, None, None) - """) + """ + ) result = testdir.runpytest() assert result.ret == 0 class TestRequestBasic(object): + def test_request_attributes(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest @pytest.fixture def something(request): pass def test_func(something): pass - """) + """ + ) req = fixtures.FixtureRequest(item) assert req.function == item.obj assert req.keywords == item.keywords - assert hasattr(req.module, 'test_func') + assert hasattr(req.module, "test_func") assert req.cls is None assert req.function.__name__ == "test_func" assert req.config == item.config assert repr(req).find(req.function.__name__) != -1 def test_request_attributes_method(self, testdir): - item, = testdir.getitems(""" + item, = testdir.getitems( + """ import pytest class TestB(object): @@ -498,13 +601,15 @@ class TestRequestBasic(object): return 1 def test_func(self, something): pass - """) + """ + ) req = item._request assert req.cls.__name__ == "TestB" assert req.instance.__class__ == req.cls def test_request_contains_funcarg_arg2fixturedefs(self, testdir): - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ import pytest @pytest.fixture def something(request): @@ -512,22 +617,64 @@ class TestRequestBasic(object): class TestClass(object): def test_method(self, something): pass - """) + """ + ) item1, = testdir.genitems([modcol]) assert item1.name == "test_method" arg2fixturedefs = fixtures.FixtureRequest(item1)._arg2fixturedefs assert len(arg2fixturedefs) == 1 - assert arg2fixturedefs['something'][0].argname == "something" + assert arg2fixturedefs["something"][0].argname == "something" + + def test_request_garbage(self, testdir): + testdir.makepyfile( + """ + import sys + import pytest + from _pytest.fixtures import PseudoFixtureDef + import gc + + @pytest.fixture(autouse=True) + def something(request): + # this method of test doesn't work on pypy + if hasattr(sys, "pypy_version_info"): + yield + else: + original = gc.get_debug() + gc.set_debug(gc.DEBUG_SAVEALL) + gc.collect() + + yield + + gc.collect() + leaked_types = sum(1 for _ in gc.garbage + if isinstance(_, PseudoFixtureDef)) + + gc.garbage[:] = [] + + try: + assert leaked_types == 0 + finally: + gc.set_debug(original) + + def test_func(): + pass + """ + ) + reprec = testdir.inline_run() + reprec.assertoutcome(passed=1) def test_getfixturevalue_recursive(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture def something(request): return 1 - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ import pytest @pytest.fixture @@ -535,14 +682,15 @@ class TestRequestBasic(object): return request.getfixturevalue("something") + 1 def test_func(something): assert something == 2 - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) - @pytest.mark.parametrize( - 'getfixmethod', ('getfixturevalue', 'getfuncargvalue')) + @pytest.mark.parametrize("getfixmethod", ("getfixturevalue", "getfuncargvalue")) def test_getfixturevalue(self, testdir, getfixmethod): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest values = [2] @pytest.fixture @@ -551,9 +699,11 @@ class TestRequestBasic(object): def other(request): return values.pop() def test_func(something): pass - """) + """ + ) import contextlib - if getfixmethod == 'getfuncargvalue': + + if getfixmethod == "getfuncargvalue": warning_expectation = pytest.warns(DeprecationWarning) else: # see #1830 for a cleaner way to accomplish this @@ -582,14 +732,16 @@ class TestRequestBasic(object): assert "request" in item.funcargs def test_request_addfinalizer(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest teardownlist = [] @pytest.fixture def something(request): request.addfinalizer(lambda: teardownlist.append(1)) def test_func(something): pass - """) + """ + ) item.session._setupstate.prepare(item) pytest._fillfuncargs(item) # successively check finalization calls @@ -601,22 +753,27 @@ class TestRequestBasic(object): assert teardownlist == [1] def test_mark_as_fixture_with_prefix_and_decorator_fails(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture def pytest_funcarg__marked_with_prefix_and_decorator(): pass - """) + """ + ) result = testdir.runpytest_subprocess() assert result.ret != 0 - result.stdout.fnmatch_lines([ - "*AssertionError: fixtures cannot have*@pytest.fixture*", - "*pytest_funcarg__marked_with_prefix_and_decorator*" - ]) + result.stdout.fnmatch_lines( + [ + "*AssertionError: fixtures cannot have*@pytest.fixture*", + "*pytest_funcarg__marked_with_prefix_and_decorator*", + ] + ) def test_request_addfinalizer_failing_setup(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [1] @pytest.fixture @@ -627,12 +784,14 @@ class TestRequestBasic(object): pass def test_finalizer_ran(): assert not values - """) + """ + ) reprec = testdir.inline_run("-s") reprec.assertoutcome(failed=1, passed=1) def test_request_addfinalizer_failing_setup_module(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [1, 2] @pytest.fixture(scope="module") @@ -642,13 +801,15 @@ class TestRequestBasic(object): assert 0 def test_fix(myfix): pass - """) + """ + ) reprec = testdir.inline_run("-s") mod = reprec.getcalls("pytest_runtest_setup")[0].item.module assert not mod.values def test_request_addfinalizer_partial_setup_failure(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest values = [] @pytest.fixture @@ -658,18 +819,20 @@ class TestRequestBasic(object): pass def test_second(): assert len(values) == 1 - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "*1 error*" # XXX the whole module collection fails - ]) + result.stdout.fnmatch_lines( + ["*1 error*"] # XXX the whole module collection fails + ) def test_request_subrequest_addfinalizer_exceptions(self, testdir): """ Ensure exceptions raised during teardown by a finalizer are suppressed until all finalizers are called, re-raising the first exception (#2440) """ - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] def _excepts(where): @@ -690,12 +853,12 @@ class TestRequestBasic(object): pass def test_second(): assert values == [3, 2, 1] - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - '*Exception: Error in excepts fixture', - '* 2 passed, 1 error in *', - ]) + result.stdout.fnmatch_lines( + ["*Exception: Error in excepts fixture", "* 2 passed, 1 error in *"] + ) def test_request_getmodulepath(self, testdir): modcol = testdir.getmodulecol("def test_somefunc(): pass") @@ -704,7 +867,8 @@ class TestRequestBasic(object): assert req.fspath == modcol.fspath def test_request_fixturenames(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest from _pytest.pytester import get_public_names @pytest.fixture() @@ -720,12 +884,14 @@ class TestRequestBasic(object): assert set(get_public_names(request.fixturenames)) == \ set(["tmpdir", "sarg", "arg1", "request", "farg", "tmpdir_factory"]) - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) def test_funcargnames_compatattr(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def pytest_generate_tests(metafunc): assert metafunc.funcargnames == metafunc.fixturenames @@ -737,12 +903,14 @@ class TestRequestBasic(object): def test_hello(fn): assert fn[0] == fn[1] - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) def test_setupdecorator_and_xunit(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @pytest.fixture(scope='module', autouse=True) @@ -767,47 +935,57 @@ class TestRequestBasic(object): def test_all(): assert values == ["module", "function", "class", "function", "method", "function"] - """) + """ + ) reprec = testdir.inline_run("-v") reprec.assertoutcome(passed=3) def test_fixtures_sub_subdir_normalize_sep(self, testdir): # this tests that normalization of nodeids takes place b = testdir.mkdir("tests").mkdir("unit") - b.join("conftest.py").write(_pytest._code.Source(""" + b.join("conftest.py").write( + _pytest._code.Source( + """ import pytest @pytest.fixture def arg1(): pass - """)) + """ + ) + ) p = b.join("test_module.py") p.write("def test_func(arg1): pass") result = testdir.runpytest(p, "--fixtures") assert result.ret == 0 - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *fixtures defined*conftest* *arg1* - """) + """ + ) def test_show_fixtures_color_yes(self, testdir): testdir.makepyfile("def test_this(): assert 1") - result = testdir.runpytest('--color=yes', '--fixtures') - assert '\x1b[32mtmpdir' in result.stdout.str() + result = testdir.runpytest("--color=yes", "--fixtures") + assert "\x1b[32mtmpdir" in result.stdout.str() def test_newstyle_with_request(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture() def arg(request): pass def test_1(arg): pass - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) def test_setupcontext_no_param(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(params=[1,2]) def arg(request): @@ -818,14 +996,17 @@ class TestRequestBasic(object): assert not hasattr(request, "param") def test_1(arg): assert arg in (1,2) - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=2) class TestRequestMarking(object): + def test_applymarker(self, testdir): - item1, item2 = testdir.getitems(""" + item1, item2 = testdir.getitems( + """ import pytest @pytest.fixture @@ -836,18 +1017,20 @@ class TestRequestMarking(object): pass def test_func2(self, something): pass - """) + """ + ) req1 = fixtures.FixtureRequest(item1) - assert 'xfail' not in item1.keywords + assert "xfail" not in item1.keywords req1.applymarker(pytest.mark.xfail) - assert 'xfail' in item1.keywords - assert 'skipif' not in item1.keywords + assert "xfail" in item1.keywords + assert "skipif" not in item1.keywords req1.applymarker(pytest.mark.skipif) - assert 'skipif' in item1.keywords + assert "skipif" in item1.keywords pytest.raises(ValueError, "req1.applymarker(42)") def test_accesskeywords(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture() def keywords(request): @@ -856,12 +1039,14 @@ class TestRequestMarking(object): def test_function(keywords): assert keywords["XYZ"] assert "abc" not in keywords - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) def test_accessmarker_dynamic(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture() def keywords(request): @@ -870,8 +1055,10 @@ class TestRequestMarking(object): @pytest.fixture(scope="class", autouse=True) def marking(request): request.applymarker(pytest.mark.XYZ("hello")) - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ import pytest def test_fun1(keywords): assert keywords["XYZ"] is not None @@ -879,14 +1066,17 @@ class TestRequestMarking(object): def test_fun2(keywords): assert keywords["XYZ"] is not None assert "abc" not in keywords - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=2) class TestRequestCachedSetup(object): + def test_request_cachedsetup_defaultmodule(self, testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ mysetup = ["hello",].pop import pytest @@ -900,11 +1090,13 @@ class TestRequestCachedSetup(object): class TestClass(object): def test_func1a(self, something): assert something == "hello" - """) + """ + ) reprec.assertoutcome(passed=2) def test_request_cachedsetup_class(self, testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ mysetup = ["hello", "hello2", "hello3"].pop import pytest @@ -920,7 +1112,8 @@ class TestRequestCachedSetup(object): assert something == "hello" def test_func2b(self, something): assert something == "hello" - """) + """ + ) reprec.assertoutcome(passed=4) def test_request_cachedsetup_extrakey(self, testdir): @@ -952,7 +1145,7 @@ class TestRequestCachedSetup(object): values.append("teardown") req1.cached_setup(setup, teardown, scope="function") - assert values == ['setup'] + assert values == ["setup"] # artificial call of finalizer setupstate = req1._pyfuncitem.session._setupstate setupstate._callfinalizers(item1) @@ -963,7 +1156,8 @@ class TestRequestCachedSetup(object): assert values == ["setup", "teardown", "setup", "teardown"] def test_request_cached_setup_two_args(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture @@ -974,14 +1168,14 @@ class TestRequestCachedSetup(object): return request.cached_setup(lambda: 17) def test_two_different_setups(arg1, arg2): assert arg1 != arg2 - """) + """ + ) result = testdir.runpytest("-v") - result.stdout.fnmatch_lines([ - "*1 passed*" - ]) + result.stdout.fnmatch_lines(["*1 passed*"]) def test_request_cached_setup_getfixturevalue(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture @@ -993,14 +1187,14 @@ class TestRequestCachedSetup(object): return request.cached_setup(lambda: 10) def test_two_funcarg(arg1): assert arg1 == 11 - """) + """ + ) result = testdir.runpytest("-v") - result.stdout.fnmatch_lines([ - "*1 passed*" - ]) + result.stdout.fnmatch_lines(["*1 passed*"]) def test_request_cached_setup_functional(self, testdir): - testdir.makepyfile(test_0=""" + testdir.makepyfile( + test_0=""" import pytest values = [] @pytest.fixture @@ -1017,19 +1211,21 @@ class TestRequestCachedSetup(object): assert something == [1] def test_list_twice(something): assert something == [1] - """) - testdir.makepyfile(test_1=""" + """ + ) + testdir.makepyfile( + test_1=""" import test_0 # should have run already def test_check_test0_has_teardown_correct(): assert test_0.values == [2] - """) + """ + ) result = testdir.runpytest("-v") - result.stdout.fnmatch_lines([ - "*3 passed*" - ]) + result.stdout.fnmatch_lines(["*3 passed*"]) def test_issue117_sessionscopeteardown(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture @@ -1041,18 +1237,18 @@ class TestRequestCachedSetup(object): return app def test_func(app): pass - """) + """ + ) result = testdir.runpytest() assert result.ret != 0 - result.stdout.fnmatch_lines([ - "*3/x*", - "*ZeroDivisionError*", - ]) + result.stdout.fnmatch_lines(["*3/x*", "*ZeroDivisionError*"]) class TestFixtureUsages(object): + def test_noargfixturedec(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture def arg1(): @@ -1060,12 +1256,14 @@ class TestFixtureUsages(object): def test_func(arg1): assert arg1 == 1 - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) def test_receives_funcargs(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture() def arg1(): @@ -1080,12 +1278,14 @@ class TestFixtureUsages(object): def test_all(arg1, arg2): assert arg1 == 1 assert arg2 == 2 - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=2) def test_receives_funcargs_scope_mismatch(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope="function") def arg1(): @@ -1097,17 +1297,21 @@ class TestFixtureUsages(object): def test_add(arg2): assert arg2 == 2 - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*ScopeMismatch*involved factories*", - "* def arg2*", - "* def arg1*", - "*1 error*" - ]) + result.stdout.fnmatch_lines( + [ + "*ScopeMismatch*involved factories*", + "* def arg2*", + "* def arg1*", + "*1 error*", + ] + ) def test_receives_funcargs_scope_mismatch_issue660(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope="function") def arg1(): @@ -1119,16 +1323,16 @@ class TestFixtureUsages(object): def test_add(arg1, arg2): assert arg2 == 2 - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*ScopeMismatch*involved factories*", - "* def arg2*", - "*1 error*" - ]) + result.stdout.fnmatch_lines( + ["*ScopeMismatch*involved factories*", "* def arg2*", "*1 error*"] + ) def test_invalid_scope(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope="functions") def badscope(): @@ -1136,15 +1340,19 @@ class TestFixtureUsages(object): def test_nothing(badscope): pass - """) + """ + ) result = testdir.runpytest_inprocess() result.stdout.fnmatch_lines( - ("*ValueError: fixture badscope from test_invalid_scope.py has an unsupported" - " scope value 'functions'") + ( + "*ValueError: fixture badscope from test_invalid_scope.py has an unsupported" + " scope value 'functions'" + ) ) def test_funcarg_parametrized_and_used_twice(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @pytest.fixture(params=[1,2]) @@ -1159,14 +1367,14 @@ class TestFixtureUsages(object): def test_add(arg1, arg2): assert arg2 == arg1 + 1 assert len(values) == arg1 - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*2 passed*" - ]) + result.stdout.fnmatch_lines(["*2 passed*"]) def test_factory_uses_unknown_funcarg_as_dependency_error(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture() @@ -1179,31 +1387,37 @@ class TestFixtureUsages(object): def test_missing(call_fail): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *pytest.fixture()* *def call_fail(fail)* *pytest.fixture()* *def fail* *fixture*'missing'*not found* - """) + """ + ) def test_factory_setup_as_classes_fails(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest class arg1(object): def __init__(self, request): self.x = 1 arg1 = pytest.fixture()(arg1) - """) + """ + ) reprec = testdir.inline_run() values = reprec.getfailedcollections() assert len(values) == 1 def test_request_can_be_overridden(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture() def request(request): @@ -1211,12 +1425,14 @@ class TestFixtureUsages(object): return request def test_request(request): assert request.a == 1 - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) def test_usefixtures_marker(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @@ -1234,41 +1450,51 @@ class TestFixtureUsages(object): assert self.hello == "world" assert len(values) == 1 pytest.mark.usefixtures("myfix")(TestClass) - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=2) def test_usefixtures_ini(self, testdir): - testdir.makeini(""" + testdir.makeini( + """ [pytest] usefixtures = myfix - """) - testdir.makeconftest(""" + """ + ) + testdir.makeconftest( + """ import pytest @pytest.fixture(scope="class") def myfix(request): request.cls.hello = "world" - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ class TestClass(object): def test_one(self): assert self.hello == "world" def test_two(self): assert self.hello == "world" - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=2) def test_usefixtures_seen_in_showmarkers(self, testdir): result = testdir.runpytest("--markers") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *usefixtures(fixturename1*mark tests*fixtures* - """) + """ + ) def test_request_instance_issue203(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest class TestClass(object): @@ -1278,12 +1504,14 @@ class TestFixtureUsages(object): self.arg1 = 1 def test_hello(self, setup1): assert self.arg1 == 1 - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) def test_fixture_parametrized_with_iterator(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @@ -1303,7 +1531,8 @@ class TestFixtureUsages(object): values.append(arg) def test_2(arg2): values.append(arg2*10) - """) + """ + ) reprec = testdir.inline_run("-v") reprec.assertoutcome(passed=4) values = reprec.getcalls("pytest_runtest_call")[0].item.module.values @@ -1315,7 +1544,8 @@ class TestFixtureManagerParseFactories(object): @pytest.fixture def testdir(self, request): testdir = request.getfixturevalue("testdir") - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture @@ -1329,11 +1559,13 @@ class TestFixtureManagerParseFactories(object): @pytest.fixture def item(request): return request._pyfuncitem - """) + """ + ) return testdir def test_parsefactories_evil_objects_issue214(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ class A(object): def __call__(self): pass @@ -1342,24 +1574,28 @@ class TestFixtureManagerParseFactories(object): a = A() def test_hello(): pass - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1, failed=0) def test_parsefactories_conftest(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_hello(item, fm): for name in ("fm", "hello", "item"): faclist = fm.getfixturedefs(name, item.nodeid) assert len(faclist) == 1 fac = faclist[0] assert fac.func.__name__ == name - """) + """ + ) reprec = testdir.inline_run("-s") reprec.assertoutcome(passed=1) def test_parsefactories_conftest_and_module_and_class(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture @@ -1376,7 +1612,8 @@ class TestFixtureManagerParseFactories(object): assert faclist[0].func(item._request) == "conftest" assert faclist[1].func(item._request) == "module" assert faclist[2].func(item._request) == "class" - """) + """ + ) reprec = testdir.inline_run("-s") reprec.assertoutcome(passed=1) @@ -1385,28 +1622,44 @@ class TestFixtureManagerParseFactories(object): # https://mail.python.org/pipermail/pytest-dev/2014-September/002617.html runner = testdir.mkdir("runner") package = testdir.mkdir("package") - package.join("conftest.py").write(dedent("""\ + package.join("conftest.py").write( + dedent( + """\ import pytest @pytest.fixture def one(): return 1 - """)) - package.join("test_x.py").write(dedent("""\ + """ + ) + ) + package.join("test_x.py").write( + dedent( + """\ def test_x(one): assert one == 1 - """)) + """ + ) + ) sub = package.mkdir("sub") sub.join("__init__.py").ensure() - sub.join("conftest.py").write(dedent("""\ + sub.join("conftest.py").write( + dedent( + """\ import pytest @pytest.fixture def one(): return 2 - """)) - sub.join("test_y.py").write(dedent("""\ + """ + ) + ) + sub.join("test_y.py").write( + dedent( + """\ def test_x(one): assert one == 2 - """)) + """ + ) + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=2) with runner.as_cwd(): @@ -1418,7 +1671,8 @@ class TestAutouseDiscovery(object): @pytest.fixture def testdir(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture(autouse=True) def perfunction(request, tmpdir): @@ -1438,23 +1692,27 @@ class TestAutouseDiscovery(object): @pytest.fixture def item(request): return request._pyfuncitem - """) + """ + ) return testdir def test_parsefactories_conftest(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ from _pytest.pytester import get_public_names def test_check_setup(item, fm): autousenames = fm._getautousenames(item.nodeid) assert len(get_public_names(autousenames)) == 2 assert "perfunction2" in autousenames assert "perfunction" in autousenames - """) + """ + ) reprec = testdir.inline_run("-s") reprec.assertoutcome(passed=1) def test_two_classes_separated_autouse(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest class TestA(object): values = [] @@ -1470,12 +1728,14 @@ class TestAutouseDiscovery(object): self.values.append(1) def test_setup2(self): assert self.values == [1] - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=2) def test_setup_at_classlevel(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest class TestClass(object): @pytest.fixture(autouse=True) @@ -1485,13 +1745,15 @@ class TestAutouseDiscovery(object): assert self.funcname == "test_method1" def test_method2(self): assert self.funcname == "test_method2" - """) + """ + ) reprec = testdir.inline_run("-s") reprec.assertoutcome(passed=2) @pytest.mark.xfail(reason="'enabled' feature not implemented") def test_setup_enabled_functionnode(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def enabled(parentnode, markers): @@ -1511,16 +1773,18 @@ class TestAutouseDiscovery(object): @pytest.mark.needsdb def test_func2(request): assert "db" in request.fixturenames - """) + """ + ) reprec = testdir.inline_run("-s") reprec.assertoutcome(passed=2) def test_callables_nocode(self, testdir): """ - a imported mock.call would break setup/factory discovery + an imported mock.call would break setup/factory discovery due to it being callable and __code__ not being a code object """ - testdir.makepyfile(""" + testdir.makepyfile( + """ class _call(tuple): def __call__(self, *k, **kw): pass @@ -1528,29 +1792,35 @@ class TestAutouseDiscovery(object): return self call = _call() - """) + """ + ) reprec = testdir.inline_run("-s") reprec.assertoutcome(failed=0, passed=0) def test_autouse_in_conftests(self, testdir): a = testdir.mkdir("a") b = testdir.mkdir("a1") - conftest = testdir.makeconftest(""" + conftest = testdir.makeconftest( + """ import pytest @pytest.fixture(autouse=True) def hello(): xxx - """) + """ + ) conftest.move(a.join(conftest.basename)) a.join("test_something.py").write("def test_func(): pass") b.join("test_otherthing.py").write("def test_func(): pass") result = testdir.runpytest() - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *1 passed*1 error* - """) + """ + ) def test_autouse_in_module_and_two_classes(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @pytest.fixture(autouse=True) @@ -1568,32 +1838,43 @@ class TestAutouseDiscovery(object): class TestA2(object): def test_world(self): assert values == ["module", "module", "A", "module"], values - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=3) class TestAutouseManagement(object): + def test_autouse_conftest_mid_directory(self, testdir): pkgdir = testdir.mkpydir("xyz123") - pkgdir.join("conftest.py").write(_pytest._code.Source(""" + pkgdir.join("conftest.py").write( + _pytest._code.Source( + """ import pytest @pytest.fixture(autouse=True) def app(): import sys sys._myapp = "hello" - """)) + """ + ) + ) t = pkgdir.ensure("tests", "test_app.py") - t.write(_pytest._code.Source(""" + t.write( + _pytest._code.Source( + """ import sys def test_app(): assert sys._myapp == "hello" - """)) + """ + ) + ) reprec = testdir.inline_run("-s") reprec.assertoutcome(passed=1) def test_autouse_honored_for_yield(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(autouse=True) def tst(): @@ -1604,12 +1885,14 @@ class TestAutouseManagement(object): assert x == abs(hello) yield f, 3 yield f, -3 - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=2) def test_funcarg_and_setup(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @pytest.fixture(scope="module") @@ -1629,12 +1912,14 @@ class TestAutouseManagement(object): assert len(values) == 2 assert values == [1,2] assert arg == 0 - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=2) def test_uses_parametrized_resource(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @pytest.fixture(params=[1,2]) @@ -1653,12 +1938,14 @@ class TestAutouseManagement(object): else: 0/0 - """) + """ + ) reprec = testdir.inline_run("-s") reprec.assertoutcome(passed=2) def test_session_parametrized_function(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @@ -1678,12 +1965,14 @@ class TestAutouseManagement(object): def test_result(arg): assert len(values) == arg assert values[:arg] == [1,2][:arg] - """) + """ + ) reprec = testdir.inline_run("-v", "-s") reprec.assertoutcome(passed=4) def test_class_function_parametrization_finalization(self, testdir): - p = testdir.makeconftest(""" + p = testdir.makeconftest( + """ import pytest import pprint @@ -1702,8 +1991,10 @@ class TestAutouseManagement(object): def fin(): values.append("fin_%s%s" % (carg, farg)) request.addfinalizer(fin) - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ import pytest class TestClass(object): @@ -1712,8 +2003,9 @@ class TestAutouseManagement(object): class TestClass2(object): def test_2(self): pass - """) - confcut = "--confcutdir={0}".format(testdir.tmpdir) + """ + ) + confcut = "--confcutdir={}".format(testdir.tmpdir) reprec = testdir.inline_run("-v", "-s", confcut) reprec.assertoutcome(passed=8) config = reprec.getcalls("pytest_unconfigure")[0].config @@ -1721,7 +2013,8 @@ class TestAutouseManagement(object): assert values == ["fin_a1", "fin_a2", "fin_b1", "fin_b2"] * 2 def test_scope_ordering(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @pytest.fixture(scope="function", autouse=True) @@ -1737,15 +2030,19 @@ class TestAutouseManagement(object): class TestHallo(object): def test_method(self): assert values == [1,3,2] - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) def test_parametrization_setup_teardown_ordering(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] def pytest_generate_tests(metafunc): + if metafunc.cls is None: + assert metafunc.function is test_finish if metafunc.cls is not None: metafunc.parametrize("item", [1,2], scope="class") class TestClass(object): @@ -1762,12 +2059,14 @@ class TestAutouseManagement(object): print (values) assert values == ["setup-1", "step1-1", "step2-1", "teardown-1", "setup-2", "step1-2", "step2-2", "teardown-2",] - """) - reprec = testdir.inline_run() + """ + ) + reprec = testdir.inline_run("-s") reprec.assertoutcome(passed=5) def test_ordering_autouse_before_explicit(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @@ -1779,7 +2078,8 @@ class TestAutouseManagement(object): values.append(2) def test_hello(arg1): assert values == [1,2] - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) @@ -1787,7 +2087,8 @@ class TestAutouseManagement(object): @pytest.mark.parametrize("param1", ["", "params=[1]"], ids=["p00", "p01"]) @pytest.mark.parametrize("param2", ["", "params=[1]"], ids=["p10", "p11"]) def test_ordering_dependencies_torndown_first(self, testdir, param1, param2): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @pytest.fixture(%(param1)s) @@ -1803,14 +2104,18 @@ class TestAutouseManagement(object): pass def test_check(): assert values == ["new1", "new2", "fin2", "fin1"] - """ % locals()) + """ + % locals() + ) reprec = testdir.inline_run("-s") reprec.assertoutcome(passed=2) class TestFixtureMarker(object): + def test_parametrize(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(params=["a", "b", "c"]) def arg(request): @@ -1820,12 +2125,14 @@ class TestFixtureMarker(object): values.append(arg) def test_result(): assert values == list("abc") - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=4) def test_multiple_parametrization_issue_736(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(params=[1,2,3]) @@ -1836,17 +2143,22 @@ class TestFixtureMarker(object): def test_issue(foo, foobar): assert foo in [1,2,3] assert foobar in [4,5,6] - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=9) - @pytest.mark.parametrize('param_args', ["'fixt, val'", "'fixt,val'", "['fixt', 'val']", "('fixt', 'val')"]) + @pytest.mark.parametrize( + "param_args", + ["'fixt, val'", "'fixt,val'", "['fixt', 'val']", "('fixt', 'val')"], + ) def test_override_parametrized_fixture_issue_979(self, testdir, param_args): """Make sure a parametrized argument can override a parametrized fixture. This was a regression introduced in the fix for #736. """ - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(params=[1, 2]) @@ -1856,12 +2168,15 @@ class TestFixtureMarker(object): @pytest.mark.parametrize(%s, [(3, 'x'), (4, 'x')]) def test_foo(fixt, val): pass - """ % param_args) + """ + % param_args + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=2) def test_scope_session(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @pytest.fixture(scope="module") @@ -1878,12 +2193,14 @@ class TestFixtureMarker(object): def test3(self, arg): assert arg == 1 assert len(values) == 1 - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=3) def test_scope_session_exc(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @pytest.fixture(scope="session") @@ -1897,12 +2214,14 @@ class TestFixtureMarker(object): pass def test_last(): assert values == [1] - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(skipped=2, passed=1) def test_scope_session_exc_two_fix(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] m = [] @@ -1921,7 +2240,8 @@ class TestFixtureMarker(object): def test_last(): assert values == [1] assert m == [] - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(skipped=2, passed=1) @@ -1949,13 +2269,14 @@ class TestFixtureMarker(object): test_real=""" def test_last(req_list): assert req_list == [1] - """ + """, ) reprec = testdir.inline_run() reprec.assertoutcome(skipped=2, passed=1) def test_scope_module_uses_session(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @pytest.fixture(scope="module") @@ -1972,12 +2293,14 @@ class TestFixtureMarker(object): def test3(self, arg): assert arg == 1 assert len(values) == 1 - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=3) def test_scope_module_and_finalizer(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest finalized_list = [] created_list = [] @@ -1992,7 +2315,8 @@ class TestFixtureMarker(object): @pytest.fixture def finalized(request): return len(finalized_list) - """) + """ + ) testdir.makepyfile( test_mod1=""" def test_1(arg, created, finalized): @@ -2009,23 +2333,30 @@ class TestFixtureMarker(object): def test_4(arg, created, finalized): assert created == 3 assert finalized == 2 - """) + """, + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=4) - @pytest.mark.parametrize("method", [ - 'request.getfixturevalue("arg")', - 'request.cached_setup(lambda: None, scope="function")', - ], ids=["getfixturevalue", "cached_setup"]) + @pytest.mark.parametrize( + "method", + [ + 'request.getfixturevalue("arg")', + 'request.cached_setup(lambda: None, scope="function")', + ], + ids=["getfixturevalue", "cached_setup"], + ) def test_scope_mismatch_various(self, testdir, method): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest finalized = [] created = [] @pytest.fixture(scope="function") def arg(request): pass - """) + """ + ) testdir.makepyfile( test_mod1=""" import pytest @@ -2034,20 +2365,24 @@ class TestFixtureMarker(object): %s def test_1(arg): pass - """ % method) + """ + % method + ) result = testdir.runpytest() assert result.ret != 0 - result.stdout.fnmatch_lines([ - "*ScopeMismatch*You tried*function*session*request*", - ]) + result.stdout.fnmatch_lines( + ["*ScopeMismatch*You tried*function*session*request*"] + ) def test_register_only_with_mark(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture() def arg(): return 1 - """) + """ + ) testdir.makepyfile( test_mod1=""" import pytest @@ -2056,12 +2391,14 @@ class TestFixtureMarker(object): return arg + 1 def test_1(arg): assert arg == 2 - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) def test_parametrize_and_scope(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope="module", params=["a", "b", "c"]) def arg(request): @@ -2069,7 +2406,8 @@ class TestFixtureMarker(object): values = [] def test_param(arg): values.append(arg) - """) + """ + ) reprec = testdir.inline_run("-v") reprec.assertoutcome(passed=3) values = reprec.getcalls("pytest_runtest_call")[0].item.module.values @@ -2079,28 +2417,30 @@ class TestFixtureMarker(object): assert "c" in values def test_scope_mismatch(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture(scope="function") def arg(request): pass - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ import pytest @pytest.fixture(scope="session") def arg(arg): pass def test_mismatch(arg): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*ScopeMismatch*", - "*1 error*", - ]) + result.stdout.fnmatch_lines(["*ScopeMismatch*", "*1 error*"]) def test_parametrize_separated_order(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope="module", params=[1, 2]) @@ -2112,18 +2452,22 @@ class TestFixtureMarker(object): values.append(arg) def test_2(arg): values.append(arg) - """) + """ + ) reprec = testdir.inline_run("-v") reprec.assertoutcome(passed=4) values = reprec.getcalls("pytest_runtest_call")[0].item.module.values assert values == [1, 1, 2, 2] def test_module_parametrized_ordering(self, testdir): - testdir.makeini(""" + testdir.makeini( + """ [pytest] console_output_style=classic - """) - testdir.makeconftest(""" + """ + ) + testdir.makeconftest( + """ import pytest @pytest.fixture(scope="session", params="s1 s2".split()) @@ -2132,13 +2476,16 @@ class TestFixtureMarker(object): @pytest.fixture(scope="module", params="m1 m2".split()) def marg(): pass - """) - testdir.makepyfile(test_mod1=""" + """ + ) + testdir.makepyfile( + test_mod1=""" def test_func(sarg): pass def test_func1(marg): pass - """, test_mod2=""" + """, + test_mod2=""" def test_func2(sarg): pass def test_func3(sarg, marg): @@ -2147,9 +2494,11 @@ class TestFixtureMarker(object): pass def test_func4(marg): pass - """) + """, + ) result = testdir.runpytest("-v") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ test_mod1.py::test_func[s1] PASSED test_mod2.py::test_func2[s1] PASSED test_mod2.py::test_func3[s1-m1] PASSED @@ -2166,14 +2515,67 @@ class TestFixtureMarker(object): test_mod2.py::test_func4[m2] PASSED test_mod1.py::test_func1[m1] PASSED test_mod1.py::test_func1[m2] PASSED - """) + """ + ) - def test_class_ordering(self, testdir): - testdir.makeini(""" + def test_dynamic_parametrized_ordering(self, testdir): + testdir.makeini( + """ [pytest] console_output_style=classic - """) - testdir.makeconftest(""" + """ + ) + testdir.makeconftest( + """ + import pytest + + def pytest_configure(config): + class DynamicFixturePlugin(object): + @pytest.fixture(scope='session', params=['flavor1', 'flavor2']) + def flavor(self, request): + return request.param + config.pluginmanager.register(DynamicFixturePlugin(), 'flavor-fixture') + + @pytest.fixture(scope='session', params=['vxlan', 'vlan']) + def encap(request): + return request.param + + @pytest.fixture(scope='session', autouse='True') + def reprovision(request, flavor, encap): + pass + """ + ) + testdir.makepyfile( + """ + def test(reprovision): + pass + def test2(reprovision): + pass + """ + ) + result = testdir.runpytest("-v") + result.stdout.fnmatch_lines( + """ + test_dynamic_parametrized_ordering.py::test[flavor1-vxlan] PASSED + test_dynamic_parametrized_ordering.py::test2[flavor1-vxlan] PASSED + test_dynamic_parametrized_ordering.py::test[flavor2-vxlan] PASSED + test_dynamic_parametrized_ordering.py::test2[flavor2-vxlan] PASSED + test_dynamic_parametrized_ordering.py::test[flavor2-vlan] PASSED + test_dynamic_parametrized_ordering.py::test2[flavor2-vlan] PASSED + test_dynamic_parametrized_ordering.py::test[flavor1-vlan] PASSED + test_dynamic_parametrized_ordering.py::test2[flavor1-vlan] PASSED + """ + ) + + def test_class_ordering(self, testdir): + testdir.makeini( + """ + [pytest] + console_output_style=classic + """ + ) + testdir.makeconftest( + """ import pytest values = [] @@ -2191,8 +2593,10 @@ class TestFixtureMarker(object): def fin(): values.append("fin_%s%s" % (carg, farg)) request.addfinalizer(fin) - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ import pytest class TestClass2(object): @@ -2203,25 +2607,29 @@ class TestFixtureMarker(object): class TestClass(object): def test_3(self): pass - """) + """ + ) result = testdir.runpytest("-vs") - result.stdout.fnmatch_lines(""" - test_class_ordering.py::TestClass2::test_1[1-a] PASSED - test_class_ordering.py::TestClass2::test_1[2-a] PASSED - test_class_ordering.py::TestClass2::test_2[1-a] PASSED - test_class_ordering.py::TestClass2::test_2[2-a] PASSED - test_class_ordering.py::TestClass2::test_1[1-b] PASSED - test_class_ordering.py::TestClass2::test_1[2-b] PASSED - test_class_ordering.py::TestClass2::test_2[1-b] PASSED - test_class_ordering.py::TestClass2::test_2[2-b] PASSED - test_class_ordering.py::TestClass::test_3[1-a] PASSED - test_class_ordering.py::TestClass::test_3[2-a] PASSED - test_class_ordering.py::TestClass::test_3[1-b] PASSED - test_class_ordering.py::TestClass::test_3[2-b] PASSED - """) + result.stdout.re_match_lines( + r""" + test_class_ordering.py::TestClass2::test_1\[a-1\] PASSED + test_class_ordering.py::TestClass2::test_1\[a-2\] PASSED + test_class_ordering.py::TestClass2::test_2\[a-1\] PASSED + test_class_ordering.py::TestClass2::test_2\[a-2\] PASSED + test_class_ordering.py::TestClass2::test_1\[b-1\] PASSED + test_class_ordering.py::TestClass2::test_1\[b-2\] PASSED + test_class_ordering.py::TestClass2::test_2\[b-1\] PASSED + test_class_ordering.py::TestClass2::test_2\[b-2\] PASSED + test_class_ordering.py::TestClass::test_3\[a-1\] PASSED + test_class_ordering.py::TestClass::test_3\[a-2\] PASSED + test_class_ordering.py::TestClass::test_3\[b-1\] PASSED + test_class_ordering.py::TestClass::test_3\[b-2\] PASSED + """ + ) def test_parametrize_separated_order_higher_scope_first(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope="function", params=[1, 2]) @@ -2247,25 +2655,57 @@ class TestFixtureMarker(object): values.append("test3") def test_4(modarg, arg): values.append("test4") - """) + """ + ) reprec = testdir.inline_run("-v") reprec.assertoutcome(passed=12) values = reprec.getcalls("pytest_runtest_call")[0].item.module.values expected = [ - 'create:1', 'test1', 'fin:1', 'create:2', 'test1', - 'fin:2', 'create:mod1', 'test2', 'create:1', 'test3', - 'fin:1', 'create:2', 'test3', 'fin:2', 'create:1', - 'test4', 'fin:1', 'create:2', 'test4', 'fin:2', - 'fin:mod1', 'create:mod2', 'test2', 'create:1', 'test3', - 'fin:1', 'create:2', 'test3', 'fin:2', 'create:1', - 'test4', 'fin:1', 'create:2', 'test4', 'fin:2', - 'fin:mod2'] + "create:1", + "test1", + "fin:1", + "create:2", + "test1", + "fin:2", + "create:mod1", + "test2", + "create:1", + "test3", + "fin:1", + "create:2", + "test3", + "fin:2", + "create:1", + "test4", + "fin:1", + "create:2", + "test4", + "fin:2", + "fin:mod1", + "create:mod2", + "test2", + "create:1", + "test3", + "fin:1", + "create:2", + "test3", + "fin:2", + "create:1", + "test4", + "fin:1", + "create:2", + "test4", + "fin:2", + "fin:mod2", + ] import pprint + pprint.pprint(list(zip(values, expected))) assert values == expected def test_parametrized_fixture_teardown_order(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(params=[1,2], scope="class") def param1(request): @@ -2294,15 +2734,19 @@ class TestFixtureMarker(object): def test_finish(): assert not values - """) + """ + ) result = testdir.runpytest("-v") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *3 passed* - """) + """ + ) assert "error" not in result.stdout.str() def test_fixture_finalizer(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest import sys @@ -2313,9 +2757,12 @@ class TestFixtureMarker(object): sys.stdout.write('Finalized') request.addfinalizer(finalize) return {} - """) + """ + ) b = testdir.mkdir("subdir") - b.join("test_overridden_fixture_finalizer.py").write(dedent(""" + b.join("test_overridden_fixture_finalizer.py").write( + dedent( + """ import pytest @pytest.fixture def browser(browser): @@ -2324,13 +2771,16 @@ class TestFixtureMarker(object): def test_browser(browser): assert browser['visited'] is True - """)) + """ + ) + ) reprec = testdir.runpytest("-s") - for test in ['test_browser']: - reprec.stdout.fnmatch_lines('*Finalized*') + for test in ["test_browser"]: + reprec.stdout.fnmatch_lines("*Finalized*") def test_class_scope_with_normal_tests(self, testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ import pytest class Box(object): @@ -2350,13 +2800,15 @@ class TestFixtureMarker(object): class Test2(object): def test_c(self, a): - assert a == 3""") + assert a == 3""" + ) reprec = testdir.inline_run(testpath) - for test in ['test_a', 'test_b', 'test_c']: + for test in ["test_a", "test_b", "test_c"]: assert reprec.matchreport(test).passed def test_request_is_clean(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @pytest.fixture(params=[1, 2]) @@ -2364,13 +2816,15 @@ class TestFixtureMarker(object): request.addfinalizer(lambda: values.append(request.param)) def test_fix(fix): pass - """) + """ + ) reprec = testdir.inline_run("-s") values = reprec.getcalls("pytest_runtest_call")[0].item.module.values assert values == [1, 2] def test_parametrize_separated_lifecycle(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @@ -2383,11 +2837,13 @@ class TestFixtureMarker(object): values.append(arg) def test_2(arg): values.append(arg) - """) + """ + ) reprec = testdir.inline_run("-vs") reprec.assertoutcome(passed=4) values = reprec.getcalls("pytest_runtest_call")[0].item.module.values import pprint + pprint.pprint(values) # assert len(values) == 6 assert values[0] == values[1] == 1 @@ -2396,7 +2852,8 @@ class TestFixtureMarker(object): assert values[5] == "fin2" def test_parametrize_function_scoped_finalizers_called(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope="function", params=[1, 2]) @@ -2413,14 +2870,16 @@ class TestFixtureMarker(object): def test_3(): assert len(values) == 8 assert values == [1, "fin1", 2, "fin2", 1, "fin1", 2, "fin2"] - """) + """ + ) reprec = testdir.inline_run("-v") reprec.assertoutcome(passed=5) @pytest.mark.issue246 @pytest.mark.parametrize("scope", ["session", "function", "module"]) def test_finalizer_order_on_parametrization(self, scope, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @@ -2447,13 +2906,16 @@ class TestFixtureMarker(object): pass def test_other(): pass - """ % {"scope": scope}) + """ + % {"scope": scope} + ) reprec = testdir.inline_run("-lvs") reprec.assertoutcome(passed=3) @pytest.mark.issue396 def test_class_scope_parametrization_ordering(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] @pytest.fixture(params=["John", "Doe"], scope="class") @@ -2471,16 +2933,30 @@ class TestFixtureMarker(object): def test_population(self, human): values.append("test_population") - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=6) values = reprec.getcalls("pytest_runtest_call")[0].item.module.values - assert values == ["test_hello", "fin John", "test_hello", "fin Doe", - "test_name", "test_population", "fin John", - "test_name", "test_population", "fin Doe"] + assert ( + values + == [ + "test_hello", + "fin John", + "test_hello", + "fin Doe", + "test_name", + "test_population", + "fin John", + "test_name", + "test_population", + "fin Doe", + ] + ) def test_parametrize_setup_function(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope="module", params=[1, 2]) @@ -2506,12 +2982,14 @@ class TestFixtureMarker(object): assert values == ["setup1", 1, 1, "fin1", "setup2", 2, 2, ] - """) + """ + ) reprec = testdir.inline_run("-v") reprec.assertoutcome(passed=6) def test_fixture_marked_function_not_collected_as_test(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture def test_app(): @@ -2519,12 +2997,14 @@ class TestFixtureMarker(object): def test_something(test_app): assert test_app == 1 - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) def test_params_and_ids(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(params=[object(), object()], @@ -2534,14 +3014,14 @@ class TestFixtureMarker(object): def test_foo(fix): assert 1 - """) - res = testdir.runpytest('-v') - res.stdout.fnmatch_lines([ - '*test_foo*alpha*', - '*test_foo*beta*']) + """ + ) + res = testdir.runpytest("-v") + res.stdout.fnmatch_lines(["*test_foo*alpha*", "*test_foo*beta*"]) def test_params_and_ids_yieldfixture(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.yield_fixture(params=[object(), object()], @@ -2551,15 +3031,15 @@ class TestFixtureMarker(object): def test_foo(fix): assert 1 - """) - res = testdir.runpytest('-v') - res.stdout.fnmatch_lines([ - '*test_foo*alpha*', - '*test_foo*beta*']) + """ + ) + res = testdir.runpytest("-v") + res.stdout.fnmatch_lines(["*test_foo*alpha*", "*test_foo*beta*"]) @pytest.mark.issue920 def test_deterministic_fixture_collection(self, testdir, monkeypatch): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope="module", @@ -2580,27 +3060,40 @@ class TestFixtureMarker(object): # sometimes we get unexpected passes. hashing B seems # to help? assert hash(B) or True - """) + """ + ) monkeypatch.setenv("PYTHONHASHSEED", "1") out1 = testdir.runpytest_subprocess("-v") monkeypatch.setenv("PYTHONHASHSEED", "2") out2 = testdir.runpytest_subprocess("-v") - out1 = [line for line in out1.outlines if line.startswith("test_deterministic_fixture_collection.py::test_foo")] - out2 = [line for line in out2.outlines if line.startswith("test_deterministic_fixture_collection.py::test_foo")] + out1 = [ + line + for line in out1.outlines + if line.startswith("test_deterministic_fixture_collection.py::test_foo") + ] + out2 = [ + line + for line in out2.outlines + if line.startswith("test_deterministic_fixture_collection.py::test_foo") + ] assert len(out1) == 12 assert out1 == out2 class TestRequestScopeAccess(object): - pytestmark = pytest.mark.parametrize(("scope", "ok", "error"), [ - ["session", "", "fspath class function module"], - ["module", "module fspath", "cls function"], - ["class", "module fspath cls", "function"], - ["function", "module fspath cls function", ""] - ]) + pytestmark = pytest.mark.parametrize( + ("scope", "ok", "error"), + [ + ["session", "", "fspath class function module"], + ["module", "module fspath", "cls function"], + ["class", "module fspath cls", "function"], + ["function", "module fspath cls function", ""], + ], + ) def test_setup(self, testdir, scope, ok, error): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope=%r, autouse=True) def myscoped(request): @@ -2613,12 +3106,15 @@ class TestRequestScopeAccess(object): assert request.config def test_func(): pass - """ % (scope, ok.split(), error.split())) + """ + % (scope, ok.split(), error.split()) + ) reprec = testdir.inline_run("-l") reprec.assertoutcome(passed=1) def test_funcarg(self, testdir, scope, ok, error): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope=%r) def arg(request): @@ -2631,31 +3127,35 @@ class TestRequestScopeAccess(object): assert request.config def test_func(arg): pass - """ % (scope, ok.split(), error.split())) + """ + % (scope, ok.split(), error.split()) + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) class TestErrors(object): + def test_subfactory_missing_funcarg(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture() def gen(qwe123): return 1 def test_something(gen): pass - """) + """ + ) result = testdir.runpytest() assert result.ret != 0 - result.stdout.fnmatch_lines([ - "*def gen(qwe123):*", - "*fixture*qwe123*not found*", - "*1 error*", - ]) + result.stdout.fnmatch_lines( + ["*def gen(qwe123):*", "*fixture*qwe123*not found*", "*1 error*"] + ) def test_issue498_fixture_finalizer_failing(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture def fix1(request): @@ -2671,55 +3171,54 @@ class TestErrors(object): values.append(fix1) def test_3(): assert values[0] != values[1] - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *ERROR*teardown*test_1* *KeyError* *ERROR*teardown*test_2* *KeyError* *3 pass*2 error* - """) + """ + ) def test_setupfunc_missing_funcarg(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(autouse=True) def gen(qwe123): return 1 def test_something(): pass - """) + """ + ) result = testdir.runpytest() assert result.ret != 0 - result.stdout.fnmatch_lines([ - "*def gen(qwe123):*", - "*fixture*qwe123*not found*", - "*1 error*", - ]) + result.stdout.fnmatch_lines( + ["*def gen(qwe123):*", "*fixture*qwe123*not found*", "*1 error*"] + ) class TestShowFixtures(object): + def test_funcarg_compat(self, testdir): config = testdir.parseconfigure("--funcargs") assert config.option.showfixtures def test_show_fixtures(self, testdir): result = testdir.runpytest("--fixtures") - result.stdout.fnmatch_lines([ - "*tmpdir*", - "*temporary directory*", - ]) + result.stdout.fnmatch_lines(["*tmpdir*", "*temporary directory*"]) def test_show_fixtures_verbose(self, testdir): result = testdir.runpytest("--fixtures", "-v") - result.stdout.fnmatch_lines([ - "*tmpdir*--*tmpdir.py*", - "*temporary directory*", - ]) + result.stdout.fnmatch_lines(["*tmpdir*--*tmpdir.py*", "*temporary directory*"]) def test_show_fixtures_testmodule(self, testdir): - p = testdir.makepyfile(''' + p = testdir.makepyfile( + ''' import pytest @pytest.fixture def _arg0(): @@ -2727,39 +3226,50 @@ class TestShowFixtures(object): @pytest.fixture def arg1(): """ hello world """ - ''') + ''' + ) result = testdir.runpytest("--fixtures", p) - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *tmpdir *fixtures defined from* *arg1* *hello world* - """) + """ + ) assert "arg0" not in result.stdout.str() @pytest.mark.parametrize("testmod", [True, False]) def test_show_fixtures_conftest(self, testdir, testmod): - testdir.makeconftest(''' + testdir.makeconftest( + ''' import pytest @pytest.fixture def arg1(): """ hello world """ - ''') + ''' + ) if testmod: - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_hello(): pass - """) + """ + ) result = testdir.runpytest("--fixtures") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *tmpdir* *fixtures defined from*conftest* *arg1* *hello world* - """) + """ + ) def test_show_fixtures_trimmed_doc(self, testdir): - p = testdir.makepyfile(dedent(''' + p = testdir.makepyfile( + dedent( + ''' import pytest @pytest.fixture def arg1(): @@ -2775,9 +3285,13 @@ class TestShowFixtures(object): line2 """ - ''')) + ''' + ) + ) result = testdir.runpytest("--fixtures", p) - result.stdout.fnmatch_lines(dedent(""" + result.stdout.fnmatch_lines( + dedent( + """ * fixtures defined from test_show_fixtures_trimmed_doc * arg2 line1 @@ -2786,10 +3300,14 @@ class TestShowFixtures(object): line1 line2 - """)) + """ + ) + ) def test_show_fixtures_indented_doc(self, testdir): - p = testdir.makepyfile(dedent(''' + p = testdir.makepyfile( + dedent( + ''' import pytest @pytest.fixture def fixture1(): @@ -2797,17 +3315,25 @@ class TestShowFixtures(object): line1 indented line """ - ''')) + ''' + ) + ) result = testdir.runpytest("--fixtures", p) - result.stdout.fnmatch_lines(dedent(""" + result.stdout.fnmatch_lines( + dedent( + """ * fixtures defined from test_show_fixtures_indented_doc * fixture1 line1 indented line - """)) + """ + ) + ) def test_show_fixtures_indented_doc_first_line_unindented(self, testdir): - p = testdir.makepyfile(dedent(''' + p = testdir.makepyfile( + dedent( + ''' import pytest @pytest.fixture def fixture1(): @@ -2815,41 +3341,56 @@ class TestShowFixtures(object): line2 indented line """ - ''')) + ''' + ) + ) result = testdir.runpytest("--fixtures", p) - result.stdout.fnmatch_lines(dedent(""" + result.stdout.fnmatch_lines( + dedent( + """ * fixtures defined from test_show_fixtures_indented_doc_first_line_unindented * fixture1 line1 line2 indented line - """)) + """ + ) + ) def test_show_fixtures_indented_in_class(self, testdir): - p = testdir.makepyfile(dedent(''' + p = testdir.makepyfile( + dedent( + ''' import pytest - class TestClass: + class TestClass(object): @pytest.fixture def fixture1(self): """line1 line2 indented line """ - ''')) + ''' + ) + ) result = testdir.runpytest("--fixtures", p) - result.stdout.fnmatch_lines(dedent(""" + result.stdout.fnmatch_lines( + dedent( + """ * fixtures defined from test_show_fixtures_indented_in_class * fixture1 line1 line2 indented line - """)) + """ + ) + ) def test_show_fixtures_different_files(self, testdir): """ #833: --fixtures only shows fixtures from first file """ - testdir.makepyfile(test_a=''' + testdir.makepyfile( + test_a=''' import pytest @pytest.fixture @@ -2859,8 +3400,10 @@ class TestShowFixtures(object): def test_a(fix_a): pass - ''') - testdir.makepyfile(test_b=''' + ''' + ) + testdir.makepyfile( + test_b=''' import pytest @pytest.fixture @@ -2870,9 +3413,11 @@ class TestShowFixtures(object): def test_b(fix_b): pass - ''') + ''' + ) result = testdir.runpytest("--fixtures") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ * fixtures defined from test_a * fix_a Fixture A @@ -2880,21 +3425,27 @@ class TestShowFixtures(object): * fixtures defined from test_b * fix_b Fixture B - """) + """ + ) def test_show_fixtures_with_same_name(self, testdir): - testdir.makeconftest(''' + testdir.makeconftest( + ''' import pytest @pytest.fixture def arg1(): """Hello World in conftest.py""" return "Hello World" - ''') - testdir.makepyfile(''' + ''' + ) + testdir.makepyfile( + """ def test_foo(arg1): assert arg1 == "Hello World" - ''') - testdir.makepyfile(''' + """ + ) + testdir.makepyfile( + ''' import pytest @pytest.fixture def arg1(): @@ -2902,9 +3453,11 @@ class TestShowFixtures(object): return "Hi" def test_bar(arg1): assert arg1 == "Hi" - ''') + ''' + ) result = testdir.runpytest("--fixtures") - result.stdout.fnmatch_lines(''' + result.stdout.fnmatch_lines( + """ * fixtures defined from conftest * arg1 Hello World in conftest.py @@ -2912,14 +3465,25 @@ class TestShowFixtures(object): * fixtures defined from test_show_fixtures_with_same_name * arg1 Hi from test module - ''') + """ + ) + + def test_fixture_disallow_twice(self): + """Test that applying @pytest.fixture twice generates an error (#2334).""" + with pytest.raises(ValueError): + + @pytest.fixture + @pytest.fixture + def foo(): + pass -@pytest.mark.parametrize('flavor', ['fixture', 'yield_fixture']) +@pytest.mark.parametrize("flavor", ["fixture", "yield_fixture"]) class TestContextManagerFixtureFuncs(object): def test_simple(self, testdir, flavor): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.{flavor} def arg1(): @@ -2931,19 +3495,25 @@ class TestContextManagerFixtureFuncs(object): def test_2(arg1): print ("test2 %s" % arg1) assert 0 - """.format(flavor=flavor)) + """.format( + flavor=flavor + ) + ) result = testdir.runpytest("-s") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *setup* *test1 1* *teardown* *setup* *test2 1* *teardown* - """) + """ + ) def test_scoped(self, testdir, flavor): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.{flavor}(scope="module") def arg1(): @@ -2954,17 +3524,23 @@ class TestContextManagerFixtureFuncs(object): print ("test1 %s" % arg1) def test_2(arg1): print ("test2 %s" % arg1) - """.format(flavor=flavor)) + """.format( + flavor=flavor + ) + ) result = testdir.runpytest("-s") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *setup* *test1 1* *test2 1* *teardown* - """) + """ + ) def test_setup_exception(self, testdir, flavor): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.{flavor}(scope="module") def arg1(): @@ -2972,15 +3548,21 @@ class TestContextManagerFixtureFuncs(object): yield 1 def test_1(arg1): pass - """.format(flavor=flavor)) + """.format( + flavor=flavor + ) + ) result = testdir.runpytest("-s") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *pytest.fail*setup* *1 error* - """) + """ + ) def test_teardown_exception(self, testdir, flavor): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.{flavor}(scope="module") def arg1(): @@ -2988,15 +3570,21 @@ class TestContextManagerFixtureFuncs(object): pytest.fail("teardown") def test_1(arg1): pass - """.format(flavor=flavor)) + """.format( + flavor=flavor + ) + ) result = testdir.runpytest("-s") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *pytest.fail*teardown* *1 passed*1 error* - """) + """ + ) def test_yields_more_than_one(self, testdir, flavor): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.{flavor}(scope="module") def arg1(): @@ -3004,29 +3592,40 @@ class TestContextManagerFixtureFuncs(object): yield 2 def test_1(arg1): pass - """.format(flavor=flavor)) + """.format( + flavor=flavor + ) + ) result = testdir.runpytest("-s") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *fixture function* *test_yields*:2* - """) + """ + ) def test_custom_name(self, testdir, flavor): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.{flavor}(name='meow') def arg1(): return 'mew' def test_1(meow): print(meow) - """.format(flavor=flavor)) + """.format( + flavor=flavor + ) + ) result = testdir.runpytest("-s") result.stdout.fnmatch_lines("*mew*") class TestParameterizedSubRequest(object): + def test_call_from_fixture(self, testdir): - testfile = testdir.makepyfile(""" + testfile = testdir.makepyfile( + """ import pytest @pytest.fixture(params=[0, 1, 2]) @@ -3039,20 +3638,26 @@ class TestParameterizedSubRequest(object): def test_foo(request, get_named_fixture): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ E*Failed: The requested fixture has no parameter defined for the current test. E* E*Requested fixture 'fix_with_param' defined in: - E*{0}:4 + E*{}:4 E*Requested here: - E*{1}:9 + E*{}:9 *1 error* - """.format(testfile.basename, testfile.basename)) + """.format( + testfile.basename, testfile.basename + ) + ) def test_call_from_test(self, testdir): - testfile = testdir.makepyfile(""" + testfile = testdir.makepyfile( + """ import pytest @pytest.fixture(params=[0, 1, 2]) @@ -3061,93 +3666,121 @@ class TestParameterizedSubRequest(object): def test_foo(request): request.getfixturevalue('fix_with_param') - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ E*Failed: The requested fixture has no parameter defined for the current test. E* E*Requested fixture 'fix_with_param' defined in: - E*{0}:4 + E*{}:4 E*Requested here: - E*{1}:8 + E*{}:8 *1 failed* - """.format(testfile.basename, testfile.basename)) + """.format( + testfile.basename, testfile.basename + ) + ) def test_external_fixture(self, testdir): - conffile = testdir.makeconftest(""" + conffile = testdir.makeconftest( + """ import pytest @pytest.fixture(params=[0, 1, 2]) def fix_with_param(request): return request.param - """) + """ + ) - testfile = testdir.makepyfile(""" + testfile = testdir.makepyfile( + """ def test_foo(request): request.getfixturevalue('fix_with_param') - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ E*Failed: The requested fixture has no parameter defined for the current test. E* E*Requested fixture 'fix_with_param' defined in: - E*{0}:4 + E*{}:4 E*Requested here: - E*{1}:2 + E*{}:2 *1 failed* - """.format(conffile.basename, testfile.basename)) + """.format( + conffile.basename, testfile.basename + ) + ) def test_non_relative_path(self, testdir): - tests_dir = testdir.mkdir('tests') - fixdir = testdir.mkdir('fixtures') + tests_dir = testdir.mkdir("tests") + fixdir = testdir.mkdir("fixtures") fixfile = fixdir.join("fix.py") - fixfile.write(_pytest._code.Source(""" + fixfile.write( + _pytest._code.Source( + """ import pytest @pytest.fixture(params=[0, 1, 2]) def fix_with_param(request): return request.param - """)) + """ + ) + ) testfile = tests_dir.join("test_foos.py") - testfile.write(_pytest._code.Source(""" + testfile.write( + _pytest._code.Source( + """ from fix import fix_with_param def test_foo(request): request.getfixturevalue('fix_with_param') - """)) + """ + ) + ) tests_dir.chdir() testdir.syspathinsert(fixdir) result = testdir.runpytest() - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ E*Failed: The requested fixture has no parameter defined for the current test. E* E*Requested fixture 'fix_with_param' defined in: - E*{0}:5 + E*{}:5 E*Requested here: - E*{1}:5 + E*{}:5 *1 failed* - """.format(fixfile.strpath, testfile.basename)) + """.format( + fixfile.strpath, testfile.basename + ) + ) def test_pytest_fixture_setup_and_post_finalizer_hook(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ from __future__ import print_function def pytest_fixture_setup(fixturedef, request): print('ROOT setup hook called for {0} from {1}'.format(fixturedef.argname, request.node.name)) def pytest_fixture_post_finalizer(fixturedef, request): print('ROOT finalizer hook called for {0} from {1}'.format(fixturedef.argname, request.node.name)) - """) - testdir.makepyfile(**{ - 'tests/conftest.py': """ + """ + ) + testdir.makepyfile( + **{ + "tests/conftest.py": """ from __future__ import print_function def pytest_fixture_setup(fixturedef, request): print('TESTS setup hook called for {0} from {1}'.format(fixturedef.argname, request.node.name)) def pytest_fixture_post_finalizer(fixturedef, request): print('TESTS finalizer hook called for {0} from {1}'.format(fixturedef.argname, request.node.name)) """, - 'tests/test_hooks.py': """ + "tests/test_hooks.py": """ from __future__ import print_function import pytest @@ -3158,14 +3791,221 @@ def test_pytest_fixture_setup_and_post_finalizer_hook(testdir): def test_func(my_fixture): print('TEST test_func') assert my_fixture == 'some' - """ - }) + """, + } + ) result = testdir.runpytest("-s") assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*TESTS setup hook called for my_fixture from test_func*", - "*ROOT setup hook called for my_fixture from test_func*", - "*TEST test_func*", - "*TESTS finalizer hook called for my_fixture from test_func*", - "*ROOT finalizer hook called for my_fixture from test_func*", - ]) + result.stdout.fnmatch_lines( + [ + "*TESTS setup hook called for my_fixture from test_func*", + "*ROOT setup hook called for my_fixture from test_func*", + "*TEST test_func*", + "*TESTS finalizer hook called for my_fixture from test_func*", + "*ROOT finalizer hook called for my_fixture from test_func*", + ] + ) + + +class TestScopeOrdering(object): + """Class of tests that ensure fixtures are ordered based on their scopes (#2405)""" + + @pytest.mark.parametrize("use_mark", [True, False]) + def test_func_closure_module_auto(self, testdir, use_mark): + """Semantically identical to the example posted in #2405 when ``use_mark=True``""" + testdir.makepyfile( + """ + import pytest + + @pytest.fixture(scope='module', autouse={autouse}) + def m1(): pass + + if {use_mark}: + pytestmark = pytest.mark.usefixtures('m1') + + @pytest.fixture(scope='function', autouse=True) + def f1(): pass + + def test_func(m1): + pass + """.format( + autouse=not use_mark, use_mark=use_mark + ) + ) + items, _ = testdir.inline_genitems() + request = FixtureRequest(items[0]) + assert request.fixturenames == "m1 f1".split() + + def test_func_closure_with_native_fixtures(self, testdir, monkeypatch): + """Sanity check that verifies the order returned by the closures and the actual fixture execution order: + The execution order may differ because of fixture inter-dependencies. + """ + monkeypatch.setattr(pytest, "FIXTURE_ORDER", [], raising=False) + testdir.makepyfile( + """ + import pytest + + FIXTURE_ORDER = pytest.FIXTURE_ORDER + + @pytest.fixture(scope="session") + def s1(): + FIXTURE_ORDER.append('s1') + + @pytest.fixture(scope="module") + def m1(): + FIXTURE_ORDER.append('m1') + + @pytest.fixture(scope='session') + def my_tmpdir_factory(): + FIXTURE_ORDER.append('my_tmpdir_factory') + + @pytest.fixture + def my_tmpdir(my_tmpdir_factory): + FIXTURE_ORDER.append('my_tmpdir') + + @pytest.fixture + def f1(my_tmpdir): + FIXTURE_ORDER.append('f1') + + @pytest.fixture + def f2(): + FIXTURE_ORDER.append('f2') + + def test_foo(f1, m1, f2, s1): pass + """ + ) + items, _ = testdir.inline_genitems() + request = FixtureRequest(items[0]) + # order of fixtures based on their scope and position in the parameter list + assert request.fixturenames == "s1 my_tmpdir_factory m1 f1 f2 my_tmpdir".split() + testdir.runpytest() + # actual fixture execution differs: dependent fixtures must be created first ("my_tmpdir") + assert pytest.FIXTURE_ORDER == "s1 my_tmpdir_factory m1 my_tmpdir f1 f2".split() + + def test_func_closure_module(self, testdir): + testdir.makepyfile( + """ + import pytest + + @pytest.fixture(scope='module') + def m1(): pass + + @pytest.fixture(scope='function') + def f1(): pass + + def test_func(f1, m1): + pass + """ + ) + items, _ = testdir.inline_genitems() + request = FixtureRequest(items[0]) + assert request.fixturenames == "m1 f1".split() + + def test_func_closure_scopes_reordered(self, testdir): + """Test ensures that fixtures are ordered by scope regardless of the order of the parameters, although + fixtures of same scope keep the declared order + """ + testdir.makepyfile( + """ + import pytest + + @pytest.fixture(scope='session') + def s1(): pass + + @pytest.fixture(scope='module') + def m1(): pass + + @pytest.fixture(scope='function') + def f1(): pass + + @pytest.fixture(scope='function') + def f2(): pass + + class Test: + + @pytest.fixture(scope='class') + def c1(cls): pass + + def test_func(self, f2, f1, c1, m1, s1): + pass + """ + ) + items, _ = testdir.inline_genitems() + request = FixtureRequest(items[0]) + assert request.fixturenames == "s1 m1 c1 f2 f1".split() + + def test_func_closure_same_scope_closer_root_first(self, testdir): + """Auto-use fixtures of same scope are ordered by closer-to-root first""" + testdir.makeconftest( + """ + import pytest + + @pytest.fixture(scope='module', autouse=True) + def m_conf(): pass + """ + ) + testdir.makepyfile( + **{ + "sub/conftest.py": """ + import pytest + + @pytest.fixture(scope='module', autouse=True) + def m_sub(): pass + """, + "sub/test_func.py": """ + import pytest + + @pytest.fixture(scope='module', autouse=True) + def m_test(): pass + + @pytest.fixture(scope='function') + def f1(): pass + + def test_func(m_test, f1): + pass + """, + } + ) + items, _ = testdir.inline_genitems() + request = FixtureRequest(items[0]) + assert request.fixturenames == "m_conf m_sub m_test f1".split() + + def test_func_closure_all_scopes_complex(self, testdir): + """Complex test involving all scopes and mixing autouse with normal fixtures""" + testdir.makeconftest( + """ + import pytest + + @pytest.fixture(scope='session') + def s1(): pass + """ + ) + testdir.makepyfile( + """ + import pytest + + @pytest.fixture(scope='module', autouse=True) + def m1(): pass + + @pytest.fixture(scope='module') + def m2(s1): pass + + @pytest.fixture(scope='function') + def f1(): pass + + @pytest.fixture(scope='function') + def f2(): pass + + class Test: + + @pytest.fixture(scope='class', autouse=True) + def c1(self): + pass + + def test_func(self, f2, f1, m2): + pass + """ + ) + items, _ = testdir.inline_genitems() + request = FixtureRequest(items[0]) + assert request.fixturenames == "s1 m1 m2 c1 f2 f1".split() diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/integration.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/integration.py index 6ea29fa98b9..f348fdc29fd 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/integration.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/integration.py @@ -4,8 +4,10 @@ from _pytest import runner class TestOEJSKITSpecials(object): + def test_funcarg_non_pycollectobj(self, testdir): # rough jstests usage - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest def pytest_pycollect_makeitem(collector, name, obj): if name == "MyClass": @@ -13,25 +15,29 @@ class TestOEJSKITSpecials(object): class MyCollector(pytest.Collector): def reportinfo(self): return self.fspath, 3, "xyz" - """) - modcol = testdir.getmodulecol(""" + """ + ) + modcol = testdir.getmodulecol( + """ import pytest @pytest.fixture def arg1(request): return 42 class MyClass(object): pass - """) + """ + ) # this hook finds funcarg factories rep = runner.collect_one_node(collector=modcol) clscol = rep.result[0] clscol.obj = lambda arg1: None clscol.funcargs = {} pytest._fillfuncargs(clscol) - assert clscol.funcargs['arg1'] == 42 + assert clscol.funcargs["arg1"] == 42 def test_autouse_fixture(self, testdir): # rough jstests usage - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest def pytest_pycollect_makeitem(collector, name, obj): if name == "MyClass": @@ -39,8 +45,10 @@ class TestOEJSKITSpecials(object): class MyCollector(pytest.Collector): def reportinfo(self): return self.fspath, 3, "xyz" - """) - modcol = testdir.getmodulecol(""" + """ + ) + modcol = testdir.getmodulecol( + """ import pytest @pytest.fixture(autouse=True) def hello(): @@ -50,7 +58,8 @@ class TestOEJSKITSpecials(object): return 42 class MyClass(object): pass - """) + """ + ) # this hook finds funcarg factories rep = runner.collect_one_node(modcol) clscol = rep.result[0] @@ -61,6 +70,7 @@ class TestOEJSKITSpecials(object): def test_wrapped_getfslineno(): + def func(): pass @@ -72,12 +82,14 @@ def test_wrapped_getfslineno(): @wrap def wrapped_func(x, y, z): pass + fs, lineno = python.getfslineno(wrapped_func) fs2, lineno2 = python.getfslineno(wrap) assert lineno > lineno2, "getfslineno does not unwrap correctly" class TestMockDecoration(object): + def test_wrapped_getfuncargnames(self): from _pytest.compat import getfuncargnames @@ -96,12 +108,17 @@ class TestMockDecoration(object): values = getfuncargnames(f) assert values == ("x",) + @pytest.mark.xfail( + strict=False, reason="getfuncargnames breaks if mock is imported" + ) def test_wrapped_getfuncargnames_patching(self): from _pytest.compat import getfuncargnames def wrap(f): + def func(): pass + func.__wrapped__ = f func.patchings = ["qwe"] return func @@ -115,7 +132,8 @@ class TestMockDecoration(object): def test_unittest_mock(self, testdir): pytest.importorskip("unittest.mock") - testdir.makepyfile(""" + testdir.makepyfile( + """ import unittest.mock class T(unittest.TestCase): @unittest.mock.patch("os.path.abspath") @@ -123,13 +141,15 @@ class TestMockDecoration(object): import os os.path.abspath("hello") abspath.assert_any_call("hello") - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) def test_unittest_mock_and_fixture(self, testdir): pytest.importorskip("unittest.mock") - testdir.makepyfile(""" + testdir.makepyfile( + """ import os.path import unittest.mock import pytest @@ -143,13 +163,39 @@ class TestMockDecoration(object): def test_hello(inject_me): import os os.path.abspath("hello") - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) + def test_unittest_mock_and_pypi_mock(self, testdir): + pytest.importorskip("unittest.mock") + pytest.importorskip("mock", "1.0.1") + testdir.makepyfile( + """ + import mock + import unittest.mock + class TestBoth(object): + @unittest.mock.patch("os.path.abspath") + def test_hello(self, abspath): + import os + os.path.abspath("hello") + abspath.assert_any_call("hello") + + @mock.patch("os.path.abspath") + def test_hello_mock(self, abspath): + import os + os.path.abspath("hello") + abspath.assert_any_call("hello") + """ + ) + reprec = testdir.inline_run() + reprec.assertoutcome(passed=2) + def test_mock(self, testdir): pytest.importorskip("mock", "1.0.1") - testdir.makepyfile(""" + testdir.makepyfile( + """ import os import unittest import mock @@ -169,17 +215,20 @@ class TestMockDecoration(object): os.path.normpath(os.path.abspath("hello")) normpath.assert_any_call("this") assert os.path.basename("123") == "mock_basename" - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=2) calls = reprec.getcalls("pytest_runtest_logreport") - funcnames = [call.report.location[2] for call in calls - if call.report.when == "call"] + funcnames = [ + call.report.location[2] for call in calls if call.report.when == "call" + ] assert funcnames == ["T.test_hello", "test_someting"] def test_mock_sorting(self, testdir): pytest.importorskip("mock", "1.0.1") - testdir.makepyfile(""" + testdir.makepyfile( + """ import os import mock @@ -192,7 +241,8 @@ class TestMockDecoration(object): @mock.patch("os.path.abspath") def test_three(abspath): pass - """) + """ + ) reprec = testdir.inline_run() calls = reprec.getreports("pytest_runtest_logreport") calls = [x for x in calls if x.when == "call"] @@ -201,7 +251,8 @@ class TestMockDecoration(object): def test_mock_double_patch_issue473(self, testdir): pytest.importorskip("mock", "1.0.1") - testdir.makepyfile(""" + testdir.makepyfile( + """ from mock import patch from pytest import mark @@ -211,20 +262,25 @@ class TestMockDecoration(object): class TestSimple(object): def test_simple_thing(self, mock_path, mock_getcwd): pass - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) class TestReRunTests(object): + def test_rerun(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ from _pytest.runner import runtestprotocol def pytest_runtest_protocol(item, nextitem): runtestprotocol(item, log=False, nextitem=nextitem) runtestprotocol(item, log=True, nextitem=nextitem) - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ import pytest count = 0 req = None @@ -237,36 +293,46 @@ class TestReRunTests(object): count += 1 def test_fix(fix): pass - """) + """ + ) result = testdir.runpytest("-s") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *fix count 0* *fix count 1* - """) - result.stdout.fnmatch_lines(""" + """ + ) + result.stdout.fnmatch_lines( + """ *2 passed* - """) + """ + ) def test_pytestconfig_is_session_scoped(): from _pytest.fixtures import pytestconfig + assert pytestconfig._pytestfixturefunction.scope == "session" class TestNoselikeTestAttribute(object): + def test_module_with_global_test(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ __test__ = False def test_hello(): pass - """) + """ + ) reprec = testdir.inline_run() assert not reprec.getfailedcollections() calls = reprec.getreports("pytest_runtest_logreport") assert not calls def test_class_and_method(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ __test__ = True def test_func(): pass @@ -276,14 +342,16 @@ class TestNoselikeTestAttribute(object): __test__ = False def test_method(self): pass - """) + """ + ) reprec = testdir.inline_run() assert not reprec.getfailedcollections() calls = reprec.getreports("pytest_runtest_logreport") assert not calls def test_unittest_class(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import unittest class TC(unittest.TestCase): def test_1(self): @@ -292,7 +360,8 @@ class TestNoselikeTestAttribute(object): __test__ = False def test_2(self): pass - """) + """ + ) reprec = testdir.inline_run() assert not reprec.getfailedcollections() call = reprec.getcalls("pytest_collection_modifyitems")[0] @@ -306,7 +375,8 @@ class TestNoselikeTestAttribute(object): RPC wrapper), we shouldn't assume this meant "__test__ = True". """ # https://github.com/pytest-dev/pytest/issues/1204 - testdir.makepyfile(""" + testdir.makepyfile( + """ class MetaModel(type): def __getattr__(cls, key): @@ -322,7 +392,8 @@ class TestNoselikeTestAttribute(object): def test_blah(self): pass - """) + """ + ) reprec = testdir.inline_run() assert not reprec.getfailedcollections() call = reprec.getcalls("pytest_collection_modifyitems")[0] @@ -333,7 +404,8 @@ class TestNoselikeTestAttribute(object): class TestParameterize(object): def test_idfn_marker(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def idfn(param): @@ -347,15 +419,14 @@ class TestParameterize(object): @pytest.mark.parametrize('a,b', [(0, 2), (1, 2)], ids=idfn) def test_params(a, b): pass - """) - res = testdir.runpytest('--collect-only') - res.stdout.fnmatch_lines([ - "*spam-2*", - "*ham-2*", - ]) + """ + ) + res = testdir.runpytest("--collect-only") + res.stdout.fnmatch_lines(["*spam-2*", "*ham-2*"]) def test_idfn_fixture(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def idfn(param): @@ -376,9 +447,7 @@ class TestParameterize(object): def test_params(a, b): pass - """) - res = testdir.runpytest('--collect-only') - res.stdout.fnmatch_lines([ - "*spam-2*", - "*ham-2*", - ]) + """ + ) + res = testdir.runpytest("--collect-only") + res.stdout.fnmatch_lines(["*spam-2*", "*ham-2*"]) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/metafunc.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/metafunc.py index 2ffb7bb5da2..e181d3131f5 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/metafunc.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/metafunc.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re import sys - +import attr import _pytest._code import py import pytest @@ -14,7 +14,8 @@ PY3 = sys.version_info >= (3, 0) class TestMetafunc(object): - def Metafunc(self, func): + + def Metafunc(self, func, config=None): # the unit tests of this class check if things work correctly # on the funcarg level, so we don't need a full blown # initiliazation @@ -24,39 +25,52 @@ class TestMetafunc(object): def __init__(self, names): self.names_closure = names + @attr.s + class DefinitionMock(object): + obj = attr.ib() + names = fixtures.getfuncargnames(func) fixtureinfo = FixtureInfo(names) - return python.Metafunc(func, fixtureinfo, None) + definition = DefinitionMock(func) + return python.Metafunc(definition, fixtureinfo, config) def test_no_funcargs(self, testdir): + def function(): pass + metafunc = self.Metafunc(function) assert not metafunc.fixturenames repr(metafunc._calls) def test_function_basic(self): + def func(arg1, arg2="qwe"): pass + metafunc = self.Metafunc(func) assert len(metafunc.fixturenames) == 1 - assert 'arg1' in metafunc.fixturenames + assert "arg1" in metafunc.fixturenames assert metafunc.function is func assert metafunc.cls is None def test_addcall_no_args(self): + def func(arg1): pass + metafunc = self.Metafunc(func) metafunc.addcall() assert len(metafunc._calls) == 1 call = metafunc._calls[0] assert call.id == "0" - assert not hasattr(call, 'param') + assert not hasattr(call, "param") def test_addcall_id(self): + def func(arg1): pass + metafunc = self.Metafunc(func) pytest.raises(ValueError, "metafunc.addcall(id=None)") @@ -69,8 +83,10 @@ class TestMetafunc(object): assert metafunc._calls[1].id == "2" def test_addcall_param(self): + def func(arg1): pass + metafunc = self.Metafunc(func) class obj(object): @@ -85,6 +101,7 @@ class TestMetafunc(object): assert metafunc._calls[2].getparam("arg1") == 1 def test_addcall_funcargs(self): + def func(x): pass @@ -97,13 +114,15 @@ class TestMetafunc(object): metafunc.addcall(funcargs={"x": 3}) pytest.raises(pytest.fail.Exception, "metafunc.addcall({'xyz': 0})") assert len(metafunc._calls) == 2 - assert metafunc._calls[0].funcargs == {'x': 2} - assert metafunc._calls[1].funcargs == {'x': 3} - assert not hasattr(metafunc._calls[1], 'param') + assert metafunc._calls[0].funcargs == {"x": 2} + assert metafunc._calls[1].funcargs == {"x": 3} + assert not hasattr(metafunc._calls[1], "param") def test_parametrize_error(self): + def func(x, y): pass + metafunc = self.Metafunc(func) metafunc.parametrize("x", [1, 2]) pytest.raises(ValueError, lambda: metafunc.parametrize("x", [5, 6])) @@ -113,56 +132,84 @@ class TestMetafunc(object): pytest.raises(ValueError, lambda: metafunc.parametrize("y", [5, 6])) def test_parametrize_bad_scope(self, testdir): + def func(x): pass + metafunc = self.Metafunc(func) try: - metafunc.parametrize("x", [1], scope='doggy') + metafunc.parametrize("x", [1], scope="doggy") except ValueError as ve: assert "has an unsupported scope value 'doggy'" in str(ve) def test_parametrize_and_id(self): + def func(x, y): pass + metafunc = self.Metafunc(func) - metafunc.parametrize("x", [1, 2], ids=['basic', 'advanced']) + metafunc.parametrize("x", [1, 2], ids=["basic", "advanced"]) metafunc.parametrize("y", ["abc", "def"]) ids = [x.id for x in metafunc._calls] assert ids == ["basic-abc", "basic-def", "advanced-abc", "advanced-def"] def test_parametrize_and_id_unicode(self): """Allow unicode strings for "ids" parameter in Python 2 (##1905)""" + def func(x): pass + metafunc = self.Metafunc(func) - metafunc.parametrize("x", [1, 2], ids=[u'basic', u'advanced']) + metafunc.parametrize("x", [1, 2], ids=[u"basic", u"advanced"]) ids = [x.id for x in metafunc._calls] assert ids == [u"basic", u"advanced"] def test_parametrize_with_wrong_number_of_ids(self, testdir): + def func(x, y): pass + metafunc = self.Metafunc(func) - pytest.raises(ValueError, lambda: - metafunc.parametrize("x", [1, 2], ids=['basic'])) + pytest.raises( + ValueError, lambda: metafunc.parametrize("x", [1, 2], ids=["basic"]) + ) - pytest.raises(ValueError, lambda: - metafunc.parametrize(("x", "y"), [("abc", "def"), - ("ghi", "jkl")], ids=["one"])) + pytest.raises( + ValueError, + lambda: metafunc.parametrize( + ("x", "y"), [("abc", "def"), ("ghi", "jkl")], ids=["one"] + ), + ) @pytest.mark.issue510 def test_parametrize_empty_list(self): + def func(y): pass - metafunc = self.Metafunc(func) + + class MockConfig(object): + + def getini(self, name): + return "" + + @property + def hook(self): + return self + + def pytest_make_parametrize_id(self, **kw): + pass + + metafunc = self.Metafunc(func, MockConfig()) metafunc.parametrize("y", []) - assert 'skip' == metafunc._calls[0].marks[0].name + assert "skip" == metafunc._calls[0].marks[0].name def test_parametrize_with_userobjects(self): + def func(x, y): pass + metafunc = self.Metafunc(func) class A(object): @@ -176,14 +223,18 @@ class TestMetafunc(object): assert metafunc._calls[3].id == "x1-b" @hypothesis.given(strategies.text() | strategies.binary()) + @hypothesis.settings( + deadline=400.0 + ) # very close to std deadline and CI boxes are not reliable in CPU power def test_idval_hypothesis(self, value): from _pytest.python import _idval - escaped = _idval(value, 'a', 6, None) + + escaped = _idval(value, "a", 6, None) assert isinstance(escaped, str) if PY3: - escaped.encode('ascii') + escaped.encode("ascii") else: - escaped.decode('ascii') + escaped.decode("ascii") def test_unicode_idval(self): """This tests that Unicode strings outside the ASCII character set get @@ -192,31 +243,20 @@ class TestMetafunc(object): """ from _pytest.python import _idval + values = [ + (u"", ""), + (u"ascii", "ascii"), + (u"ação", "a\\xe7\\xe3o"), + (u"josé@blah.com", "jos\\xe9@blah.com"), ( - u'', - '' - ), - ( - u'ascii', - 'ascii' - ), - ( - u'ação', - 'a\\xe7\\xe3o' - ), - ( - u'josé@blah.com', - 'jos\\xe9@blah.com' - ), - ( - u'δοκ.ιμή@παράδειγμα.δοκιμή', - '\\u03b4\\u03bf\\u03ba.\\u03b9\\u03bc\\u03ae@\\u03c0\\u03b1\\u03c1\\u03ac\\u03b4\\u03b5\\u03b9\\u03b3' - '\\u03bc\\u03b1.\\u03b4\\u03bf\\u03ba\\u03b9\\u03bc\\u03ae' + u"δοκ.ιμή@παράδειγμα.δοκιμή", + "\\u03b4\\u03bf\\u03ba.\\u03b9\\u03bc\\u03ae@\\u03c0\\u03b1\\u03c1\\u03ac\\u03b4\\u03b5\\u03b9\\u03b3" + "\\u03bc\\u03b1.\\u03b4\\u03bf\\u03ba\\u03b9\\u03bc\\u03ae", ), ] for val, expected in values: - assert _idval(val, 'a', 6, None) == expected + assert _idval(val, "a", 6, None) == expected def test_bytes_idval(self): """unittest for the expected behavior to obtain ids for parametrized @@ -226,69 +266,99 @@ class TestMetafunc(object): - python3: bytes objects are always escaped using "binary escape". """ from _pytest.python import _idval + values = [ - (b'', ''), - (b'\xc3\xb4\xff\xe4', '\\xc3\\xb4\\xff\\xe4'), - (b'ascii', 'ascii'), - (u'αρά'.encode('utf-8'), '\\xce\\xb1\\xcf\\x81\\xce\\xac'), + (b"", ""), + (b"\xc3\xb4\xff\xe4", "\\xc3\\xb4\\xff\\xe4"), + (b"ascii", "ascii"), + (u"αρά".encode("utf-8"), "\\xce\\xb1\\xcf\\x81\\xce\\xac"), ] for val, expected in values: - assert _idval(val, 'a', 6, None) == expected + assert _idval(val, "a", 6, None) == expected + + def test_class_or_function_idval(self): + """unittest for the expected behavior to obtain ids for parametrized + values that are classes or functions: their __name__. + """ + from _pytest.python import _idval + + class TestClass(object): + pass + + def test_function(): + pass + + values = [(TestClass, "TestClass"), (test_function, "test_function")] + for val, expected in values: + assert _idval(val, "a", 6, None) == expected @pytest.mark.issue250 def test_idmaker_autoname(self): from _pytest.python import idmaker - result = idmaker(("a", "b"), [pytest.param("string", 1.0), - pytest.param("st-ring", 2.0)]) + + result = idmaker( + ("a", "b"), [pytest.param("string", 1.0), pytest.param("st-ring", 2.0)] + ) assert result == ["string-1.0", "st-ring-2.0"] - result = idmaker(("a", "b"), [pytest.param(object(), 1.0), - pytest.param(object(), object())]) + result = idmaker( + ("a", "b"), [pytest.param(object(), 1.0), pytest.param(object(), object())] + ) assert result == ["a0-1.0", "a1-b1"] # unicode mixing, issue250 result = idmaker( - (py.builtin._totext("a"), "b"), - [pytest.param({}, b'\xc3\xb4')]) - assert result == ['a0-\\xc3\\xb4'] + (py.builtin._totext("a"), "b"), [pytest.param({}, b"\xc3\xb4")] + ) + assert result == ["a0-\\xc3\\xb4"] def test_idmaker_with_bytes_regex(self): from _pytest.python import idmaker - result = idmaker(("a"), [pytest.param(re.compile(b'foo'), 1.0)]) + + result = idmaker(("a"), [pytest.param(re.compile(b"foo"), 1.0)]) assert result == ["foo"] def test_idmaker_native_strings(self): from _pytest.python import idmaker + totext = py.builtin._totext - result = idmaker(("a", "b"), [ - pytest.param(1.0, -1.1), - pytest.param(2, -202), - pytest.param("three", "three hundred"), - pytest.param(True, False), - pytest.param(None, None), - pytest.param(re.compile('foo'), re.compile('bar')), - pytest.param(str, int), - pytest.param(list("six"), [66, 66]), - pytest.param(set([7]), set("seven")), - pytest.param(tuple("eight"), (8, -8, 8)), - pytest.param(b'\xc3\xb4', b"name"), - pytest.param(b'\xc3\xb4', totext("other")), - ]) - assert result == ["1.0--1.1", - "2--202", - "three-three hundred", - "True-False", - "None-None", - "foo-bar", - "str-int", - "a7-b7", - "a8-b8", - "a9-b9", - "\\xc3\\xb4-name", - "\\xc3\\xb4-other", - ] + result = idmaker( + ("a", "b"), + [ + pytest.param(1.0, -1.1), + pytest.param(2, -202), + pytest.param("three", "three hundred"), + pytest.param(True, False), + pytest.param(None, None), + pytest.param(re.compile("foo"), re.compile("bar")), + pytest.param(str, int), + pytest.param(list("six"), [66, 66]), + pytest.param({7}, set("seven")), + pytest.param(tuple("eight"), (8, -8, 8)), + pytest.param(b"\xc3\xb4", b"name"), + pytest.param(b"\xc3\xb4", totext("other")), + ], + ) + assert ( + result + == [ + "1.0--1.1", + "2--202", + "three-three hundred", + "True-False", + "None-None", + "foo-bar", + "str-int", + "a7-b7", + "a8-b8", + "a9-b9", + "\\xc3\\xb4-name", + "\\xc3\\xb4-other", + ] + ) def test_idmaker_enum(self): from _pytest.python import idmaker + enum = pytest.importorskip("enum") e = enum.Enum("Foo", "one, two") result = idmaker(("a", "b"), [pytest.param(e.one, e.two)]) @@ -302,31 +372,34 @@ class TestMetafunc(object): if isinstance(val, Exception): return repr(val) - result = idmaker(("a", "b"), [ - pytest.param(10.0, IndexError()), - pytest.param(20, KeyError()), - pytest.param("three", [1, 2, 3]), - ], idfn=ids) - assert result == ["10.0-IndexError()", - "20-KeyError()", - "three-b2", - ] + result = idmaker( + ("a", "b"), + [ + pytest.param(10.0, IndexError()), + pytest.param(20, KeyError()), + pytest.param("three", [1, 2, 3]), + ], + idfn=ids, + ) + assert result == ["10.0-IndexError()", "20-KeyError()", "three-b2"] @pytest.mark.issue351 def test_idmaker_idfn_unique_names(self): from _pytest.python import idmaker def ids(val): - return 'a' + return "a" - result = idmaker(("a", "b"), [pytest.param(10.0, IndexError()), - pytest.param(20, KeyError()), - pytest.param("three", [1, 2, 3]), - ], idfn=ids) - assert result == ["a-a0", - "a-a1", - "a-a2", - ] + result = idmaker( + ("a", "b"), + [ + pytest.param(10.0, IndexError()), + pytest.param(20, KeyError()), + pytest.param("three", [1, 2, 3]), + ], + idfn=ids, + ) + assert result == ["a-a0", "a-a1", "a-a2"] @pytest.mark.issue351 def test_idmaker_idfn_exception(self): @@ -341,33 +414,41 @@ class TestMetafunc(object): rec = WarningsRecorder() with rec: - idmaker(("a", "b"), [ - pytest.param(10.0, IndexError()), - pytest.param(20, KeyError()), - pytest.param("three", [1, 2, 3]), - ], idfn=ids) + idmaker( + ("a", "b"), + [ + pytest.param(10.0, IndexError()), + pytest.param(20, KeyError()), + pytest.param("three", [1, 2, 3]), + ], + idfn=ids, + ) - assert [str(i.message) for i in rec.list] == [ - "Raised while trying to determine id of parameter a at position 0." - "\nUpdate your code as this will raise an error in pytest-4.0.", - "Raised while trying to determine id of parameter b at position 0." - "\nUpdate your code as this will raise an error in pytest-4.0.", - "Raised while trying to determine id of parameter a at position 1." - "\nUpdate your code as this will raise an error in pytest-4.0.", - "Raised while trying to determine id of parameter b at position 1." - "\nUpdate your code as this will raise an error in pytest-4.0.", - "Raised while trying to determine id of parameter a at position 2." - "\nUpdate your code as this will raise an error in pytest-4.0.", - "Raised while trying to determine id of parameter b at position 2." - "\nUpdate your code as this will raise an error in pytest-4.0.", - ] + assert ( + [str(i.message) for i in rec.list] + == [ + "Raised while trying to determine id of parameter a at position 0." + "\nUpdate your code as this will raise an error in pytest-4.0.", + "Raised while trying to determine id of parameter b at position 0." + "\nUpdate your code as this will raise an error in pytest-4.0.", + "Raised while trying to determine id of parameter a at position 1." + "\nUpdate your code as this will raise an error in pytest-4.0.", + "Raised while trying to determine id of parameter b at position 1." + "\nUpdate your code as this will raise an error in pytest-4.0.", + "Raised while trying to determine id of parameter a at position 2." + "\nUpdate your code as this will raise an error in pytest-4.0.", + "Raised while trying to determine id of parameter b at position 2." + "\nUpdate your code as this will raise an error in pytest-4.0.", + ] + ) def test_parametrize_ids_exception(self, testdir): """ :param testdir: the instance of Testdir class, a temporary test directory. """ - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def ids(arg): @@ -376,54 +457,67 @@ class TestMetafunc(object): @pytest.mark.parametrize("arg", ["a", "b"], ids=ids) def test_foo(arg): pass - """) + """ + ) with pytest.warns(DeprecationWarning): result = testdir.runpytest("--collect-only") - result.stdout.fnmatch_lines([ - "", - " ", - " ", - ]) + result.stdout.fnmatch_lines( + [ + "", + " ", + " ", + ] + ) def test_idmaker_with_ids(self): from _pytest.python import idmaker - result = idmaker(("a", "b"), [pytest.param(1, 2), - pytest.param(3, 4)], - ids=["a", None]) + + result = idmaker( + ("a", "b"), [pytest.param(1, 2), pytest.param(3, 4)], ids=["a", None] + ) assert result == ["a", "3-4"] def test_idmaker_with_paramset_id(self): from _pytest.python import idmaker - result = idmaker(("a", "b"), [pytest.param(1, 2, id="me"), - pytest.param(3, 4, id="you")], - ids=["a", None]) + + result = idmaker( + ("a", "b"), + [pytest.param(1, 2, id="me"), pytest.param(3, 4, id="you")], + ids=["a", None], + ) assert result == ["me", "you"] def test_idmaker_with_ids_unique_names(self): from _pytest.python import idmaker - result = idmaker(("a"), map(pytest.param, [1, 2, 3, 4, 5]), - ids=["a", "a", "b", "c", "b"]) + + result = idmaker( + ("a"), map(pytest.param, [1, 2, 3, 4, 5]), ids=["a", "a", "b", "c", "b"] + ) assert result == ["a0", "a1", "b0", "c", "b1"] def test_addcall_and_parametrize(self): + def func(x, y): pass + metafunc = self.Metafunc(func) - metafunc.addcall({'x': 1}) - metafunc.parametrize('y', [2, 3]) + metafunc.addcall({"x": 1}) + metafunc.parametrize("y", [2, 3]) assert len(metafunc._calls) == 2 - assert metafunc._calls[0].funcargs == {'x': 1, 'y': 2} - assert metafunc._calls[1].funcargs == {'x': 1, 'y': 3} + assert metafunc._calls[0].funcargs == {"x": 1, "y": 2} + assert metafunc._calls[1].funcargs == {"x": 1, "y": 3} assert metafunc._calls[0].id == "0-2" assert metafunc._calls[1].id == "0-3" @pytest.mark.issue714 def test_parametrize_indirect(self): + def func(x, y): pass + metafunc = self.Metafunc(func) - metafunc.parametrize('x', [1], indirect=True) - metafunc.parametrize('y', [2, 3], indirect=True) + metafunc.parametrize("x", [1], indirect=True) + metafunc.parametrize("y", [2, 3], indirect=True) assert len(metafunc._calls) == 2 assert metafunc._calls[0].funcargs == {} assert metafunc._calls[1].funcargs == {} @@ -432,29 +526,35 @@ class TestMetafunc(object): @pytest.mark.issue714 def test_parametrize_indirect_list(self): + def func(x, y): pass + metafunc = self.Metafunc(func) - metafunc.parametrize('x, y', [('a', 'b')], indirect=['x']) - assert metafunc._calls[0].funcargs == dict(y='b') - assert metafunc._calls[0].params == dict(x='a') + metafunc.parametrize("x, y", [("a", "b")], indirect=["x"]) + assert metafunc._calls[0].funcargs == dict(y="b") + assert metafunc._calls[0].params == dict(x="a") @pytest.mark.issue714 def test_parametrize_indirect_list_all(self): + def func(x, y): pass + metafunc = self.Metafunc(func) - metafunc.parametrize('x, y', [('a', 'b')], indirect=['x', 'y']) + metafunc.parametrize("x, y", [("a", "b")], indirect=["x", "y"]) assert metafunc._calls[0].funcargs == {} - assert metafunc._calls[0].params == dict(x='a', y='b') + assert metafunc._calls[0].params == dict(x="a", y="b") @pytest.mark.issue714 def test_parametrize_indirect_list_empty(self): + def func(x, y): pass + metafunc = self.Metafunc(func) - metafunc.parametrize('x, y', [('a', 'b')], indirect=[]) - assert metafunc._calls[0].funcargs == dict(x='a', y='b') + metafunc.parametrize("x, y", [("a", "b")], indirect=[]) + assert metafunc._calls[0].funcargs == dict(x="a", y="b") assert metafunc._calls[0].params == {} @pytest.mark.issue714 @@ -468,7 +568,8 @@ class TestMetafunc(object): :param testdir: the instance of Testdir class, a temporary test directory. """ - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope='function') def x(request): @@ -480,20 +581,20 @@ class TestMetafunc(object): def test_simple(x,y): assert len(x) == 3 assert len(y) == 1 - """) + """ + ) result = testdir.runpytest("-v") - result.stdout.fnmatch_lines([ - "*test_simple*a-b*", - "*1 passed*", - ]) + result.stdout.fnmatch_lines(["*test_simple*a-b*", "*1 passed*"]) @pytest.mark.issue714 def test_parametrize_indirect_list_error(self, testdir): + def func(x, y): pass + metafunc = self.Metafunc(func) with pytest.raises(ValueError): - metafunc.parametrize('x, y', [('a', 'b')], indirect=['x', 'z']) + metafunc.parametrize("x, y", [("a", "b")], indirect=["x", "z"]) @pytest.mark.issue714 def test_parametrize_uses_no_fixture_error_indirect_false(self, testdir): @@ -502,21 +603,22 @@ class TestMetafunc(object): fixtures in their test function, rather than silently ignoring this and letting the test potentially pass. """ - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.parametrize('x, y', [('a', 'b')], indirect=False) def test_simple(x): assert len(x) == 3 - """) + """ + ) result = testdir.runpytest("--collect-only") - result.stdout.fnmatch_lines([ - "*uses no argument 'y'*", - ]) + result.stdout.fnmatch_lines(["*uses no argument 'y'*"]) @pytest.mark.issue714 def test_parametrize_uses_no_fixture_error_indirect_true(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope='function') def x(request): @@ -528,15 +630,15 @@ class TestMetafunc(object): @pytest.mark.parametrize('x, y', [('a', 'b')], indirect=True) def test_simple(x): assert len(x) == 3 - """) + """ + ) result = testdir.runpytest("--collect-only") - result.stdout.fnmatch_lines([ - "*uses no fixture 'y'*", - ]) + result.stdout.fnmatch_lines(["*uses no fixture 'y'*"]) @pytest.mark.issue714 def test_parametrize_indirect_uses_no_fixture_error_indirect_string(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope='function') def x(request): @@ -545,15 +647,15 @@ class TestMetafunc(object): @pytest.mark.parametrize('x, y', [('a', 'b')], indirect='y') def test_simple(x): assert len(x) == 3 - """) + """ + ) result = testdir.runpytest("--collect-only") - result.stdout.fnmatch_lines([ - "*uses no fixture 'y'*", - ]) + result.stdout.fnmatch_lines(["*uses no fixture 'y'*"]) @pytest.mark.issue714 def test_parametrize_indirect_uses_no_fixture_error_indirect_list(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope='function') def x(request): @@ -562,15 +664,15 @@ class TestMetafunc(object): @pytest.mark.parametrize('x, y', [('a', 'b')], indirect=['y']) def test_simple(x): assert len(x) == 3 - """) + """ + ) result = testdir.runpytest("--collect-only") - result.stdout.fnmatch_lines([ - "*uses no fixture 'y'*", - ]) + result.stdout.fnmatch_lines(["*uses no fixture 'y'*"]) @pytest.mark.issue714 def test_parametrize_argument_not_in_indirect_list(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope='function') def x(request): @@ -579,19 +681,37 @@ class TestMetafunc(object): @pytest.mark.parametrize('x, y', [('a', 'b')], indirect=['x']) def test_simple(x): assert len(x) == 3 - """) + """ + ) result = testdir.runpytest("--collect-only") - result.stdout.fnmatch_lines([ - "*uses no argument 'y'*", - ]) + result.stdout.fnmatch_lines(["*uses no argument 'y'*"]) + + def test_parametrize_gives_indicative_error_on_function_with_default_argument( + self, testdir + ): + testdir.makepyfile( + """ + import pytest + + @pytest.mark.parametrize('x, y', [('a', 'b')]) + def test_simple(x, y=1): + assert len(x) == 1 + """ + ) + result = testdir.runpytest("--collect-only") + result.stdout.fnmatch_lines( + ["*already takes an argument 'y' with a default value"] + ) def test_addcalls_and_parametrize_indirect(self): + def func(x, y): pass + metafunc = self.Metafunc(func) metafunc.addcall(param="123") - metafunc.parametrize('x', [1], indirect=True) - metafunc.parametrize('y', [2, 3], indirect=True) + metafunc.parametrize("x", [1], indirect=True) + metafunc.parametrize("y", [2, 3], indirect=True) assert len(metafunc._calls) == 2 assert metafunc._calls[0].funcargs == {} assert metafunc._calls[1].funcargs == {} @@ -599,7 +719,8 @@ class TestMetafunc(object): assert metafunc._calls[1].params == dict(x=1, y=3) def test_parametrize_functional(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def pytest_generate_tests(metafunc): metafunc.parametrize('x', [1,2], indirect=True) @@ -611,13 +732,12 @@ class TestMetafunc(object): def test_simple(x,y): assert x in (10,20) assert y == 2 - """) + """ + ) result = testdir.runpytest("-v") - result.stdout.fnmatch_lines([ - "*test_simple*1-2*", - "*test_simple*2-2*", - "*2 passed*", - ]) + result.stdout.fnmatch_lines( + ["*test_simple*1-2*", "*test_simple*2-2*", "*2 passed*"] + ) def test_parametrize_onearg(self): metafunc = self.Metafunc(lambda x: None) @@ -646,7 +766,8 @@ class TestMetafunc(object): assert metafunc._calls[1].id == "3-4" def test_parametrize_multiple_times(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest pytestmark = pytest.mark.parametrize("x", [1,2]) def test_func(x): @@ -655,23 +776,27 @@ class TestMetafunc(object): pytestmark = pytest.mark.parametrize("y", [3,4]) def test_meth(self, x, y): assert 0, x - """) + """ + ) result = testdir.runpytest() assert result.ret == 1 result.assert_outcomes(failed=6) def test_parametrize_CSV(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.parametrize("x, y,", [(1,2), (2,3)]) def test_func(x, y): assert x+1 == y - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=2) def test_parametrize_class_scenarios(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ # same as doc/en/example/parametrize scenario example def pytest_generate_tests(metafunc): idlist = [] @@ -695,10 +820,12 @@ class TestMetafunc(object): def test_3(self, arg, arg2): pass - """) + """ + ) result = testdir.runpytest("-v") assert result.ret == 0 - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *test_1*1* *test_2*1* *test_3*1* @@ -706,31 +833,39 @@ class TestMetafunc(object): *test_2*2* *test_3*2* *6 passed* - """) + """ + ) def test_format_args(self): + def function1(): pass - assert fixtures._format_args(function1) == '()' + + assert fixtures._format_args(function1) == "()" def function2(arg1): pass + assert fixtures._format_args(function2) == "(arg1)" def function3(arg1, arg2="qwe"): pass + assert fixtures._format_args(function3) == "(arg1, arg2='qwe')" def function4(arg1, *args, **kwargs): pass + assert fixtures._format_args(function4) == "(arg1, *args, **kwargs)" class TestMetafuncFunctional(object): + def test_attributes(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ # assumes that generate/provide runs in the same process - import py, pytest + import sys, pytest def pytest_generate_tests(metafunc): metafunc.addcall(param=metafunc) @@ -749,40 +884,44 @@ class TestMetafuncFunctional(object): def test_method(self, metafunc, pytestconfig): assert metafunc.config == pytestconfig assert metafunc.module.__name__ == __name__ - if py.std.sys.version_info > (3, 0): + if sys.version_info > (3, 0): unbound = TestClass.test_method else: unbound = TestClass.test_method.im_func # XXX actually have an unbound test function here? assert metafunc.function == unbound assert metafunc.cls == TestClass - """) + """ + ) result = testdir.runpytest(p, "-v") result.assert_outcomes(passed=2) def test_addcall_with_two_funcargs_generators(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_generate_tests(metafunc): assert "arg1" in metafunc.fixturenames metafunc.addcall(funcargs=dict(arg1=1, arg2=2)) - """) - p = testdir.makepyfile(""" + """ + ) + p = testdir.makepyfile( + """ def pytest_generate_tests(metafunc): metafunc.addcall(funcargs=dict(arg1=1, arg2=1)) class TestClass(object): def test_myfunc(self, arg1, arg2): assert arg1 == arg2 - """) + """ + ) result = testdir.runpytest("-v", p) - result.stdout.fnmatch_lines([ - "*test_myfunc*0*PASS*", - "*test_myfunc*1*FAIL*", - "*1 failed, 1 passed*" - ]) + result.stdout.fnmatch_lines( + ["*test_myfunc*0*PASS*", "*test_myfunc*1*FAIL*", "*1 failed, 1 passed*"] + ) def test_two_functions(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def pytest_generate_tests(metafunc): metafunc.addcall(param=10) metafunc.addcall(param=20) @@ -796,34 +935,42 @@ class TestMetafuncFunctional(object): assert arg1 == 10 def test_func2(arg1): assert arg1 in (10, 20) - """) + """ + ) result = testdir.runpytest("-v", p) - result.stdout.fnmatch_lines([ - "*test_func1*0*PASS*", - "*test_func1*1*FAIL*", - "*test_func2*PASS*", - "*1 failed, 3 passed*" - ]) + result.stdout.fnmatch_lines( + [ + "*test_func1*0*PASS*", + "*test_func1*1*FAIL*", + "*test_func2*PASS*", + "*1 failed, 3 passed*", + ] + ) def test_noself_in_method(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def pytest_generate_tests(metafunc): assert 'xyz' not in metafunc.fixturenames class TestHello(object): def test_hello(xyz): pass - """) + """ + ) result = testdir.runpytest(p) result.assert_outcomes(passed=1) def test_generate_plugin_and_module(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_generate_tests(metafunc): assert "arg1" in metafunc.fixturenames metafunc.addcall(id="world", param=(2,100)) - """) - p = testdir.makepyfile(""" + """ + ) + p = testdir.makepyfile( + """ def pytest_generate_tests(metafunc): metafunc.addcall(param=(1,1), id="hello") @@ -838,31 +985,34 @@ class TestMetafuncFunctional(object): class TestClass(object): def test_myfunc(self, arg1, arg2): assert arg1 == arg2 - """) + """ + ) result = testdir.runpytest("-v", p) - result.stdout.fnmatch_lines([ - "*test_myfunc*hello*PASS*", - "*test_myfunc*world*FAIL*", - "*1 failed, 1 passed*" - ]) + result.stdout.fnmatch_lines( + [ + "*test_myfunc*hello*PASS*", + "*test_myfunc*world*FAIL*", + "*1 failed, 1 passed*", + ] + ) def test_generate_tests_in_class(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ class TestClass(object): def pytest_generate_tests(self, metafunc): metafunc.addcall(funcargs={'hello': 'world'}, id="hello") def test_myfunc(self, hello): assert hello == "world" - """) + """ + ) result = testdir.runpytest("-v", p) - result.stdout.fnmatch_lines([ - "*test_myfunc*hello*PASS*", - "*1 passed*" - ]) + result.stdout.fnmatch_lines(["*test_myfunc*hello*PASS*", "*1 passed*"]) def test_two_functions_not_same_instance(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def pytest_generate_tests(metafunc): metafunc.addcall({'arg1': 10}) metafunc.addcall({'arg1': 20}) @@ -871,16 +1021,16 @@ class TestMetafuncFunctional(object): def test_func(self, arg1): assert not hasattr(self, 'x') self.x = 1 - """) + """ + ) result = testdir.runpytest("-v", p) - result.stdout.fnmatch_lines([ - "*test_func*0*PASS*", - "*test_func*1*PASS*", - "*2 pass*", - ]) + result.stdout.fnmatch_lines( + ["*test_func*0*PASS*", "*test_func*1*PASS*", "*2 pass*"] + ) def test_issue28_setup_method_in_generate_tests(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def pytest_generate_tests(metafunc): metafunc.addcall({'arg1': 1}) @@ -889,29 +1039,29 @@ class TestMetafuncFunctional(object): assert arg1 == self.val def setup_method(self, func): self.val = 1 - """) + """ + ) result = testdir.runpytest(p) result.assert_outcomes(passed=1) def test_parametrize_functional2(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def pytest_generate_tests(metafunc): metafunc.parametrize("arg1", [1,2]) metafunc.parametrize("arg2", [4,5]) def test_hello(arg1, arg2): assert 0, (arg1, arg2) - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*(1, 4)*", - "*(1, 5)*", - "*(2, 4)*", - "*(2, 5)*", - "*4 failed*", - ]) + result.stdout.fnmatch_lines( + ["*(1, 4)*", "*(1, 5)*", "*(2, 4)*", "*(2, 5)*", "*4 failed*"] + ) def test_parametrize_and_inner_getfixturevalue(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def pytest_generate_tests(metafunc): metafunc.parametrize("arg1", [1], indirect=True) metafunc.parametrize("arg2", [10], indirect=True) @@ -928,15 +1078,14 @@ class TestMetafuncFunctional(object): def test_func1(arg1, arg2): assert arg1 == 11 - """) + """ + ) result = testdir.runpytest("-v", p) - result.stdout.fnmatch_lines([ - "*test_func1*1*PASS*", - "*1 passed*" - ]) + result.stdout.fnmatch_lines(["*test_func1*1*PASS*", "*1 passed*"]) def test_parametrize_on_setup_arg(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def pytest_generate_tests(metafunc): assert "arg1" in metafunc.fixturenames metafunc.parametrize("arg1", [1], indirect=True) @@ -952,19 +1101,20 @@ class TestMetafuncFunctional(object): def test_func(arg2): assert arg2 == 10 - """) + """ + ) result = testdir.runpytest("-v", p) - result.stdout.fnmatch_lines([ - "*test_func*1*PASS*", - "*1 passed*" - ]) + result.stdout.fnmatch_lines(["*test_func*1*PASS*", "*1 passed*"]) def test_parametrize_with_ids(self, testdir): - testdir.makeini(""" + testdir.makeini( + """ [pytest] console_output_style=classic - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ import pytest def pytest_generate_tests(metafunc): metafunc.parametrize(("a", "b"), [(1,1), (1,2)], @@ -972,16 +1122,17 @@ class TestMetafuncFunctional(object): def test_function(a, b): assert a == b - """) + """ + ) result = testdir.runpytest("-v") assert result.ret == 1 - result.stdout.fnmatch_lines_random([ - "*test_function*basic*PASSED", - "*test_function*advanced*FAILED", - ]) + result.stdout.fnmatch_lines_random( + ["*test_function*basic*PASSED", "*test_function*advanced*FAILED"] + ) def test_parametrize_without_ids(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def pytest_generate_tests(metafunc): metafunc.parametrize(("a", "b"), @@ -989,15 +1140,19 @@ class TestMetafuncFunctional(object): def test_function(a, b): assert 1 - """) + """ + ) result = testdir.runpytest("-v") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *test_function*1-b0* *test_function*1.3-b1* - """) + """ + ) def test_parametrize_with_None_in_ids(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def pytest_generate_tests(metafunc): metafunc.parametrize(("a", "b"), [(1,1), (1,1), (1,2)], @@ -1005,18 +1160,22 @@ class TestMetafuncFunctional(object): def test_function(a, b): assert a == b - """) + """ + ) result = testdir.runpytest("-v") assert result.ret == 1 - result.stdout.fnmatch_lines_random([ - "*test_function*basic*PASSED*", - "*test_function*1-1*PASSED*", - "*test_function*advanced*FAILED*", - ]) + result.stdout.fnmatch_lines_random( + [ + "*test_function*basic*PASSED*", + "*test_function*1-1*PASSED*", + "*test_function*advanced*FAILED*", + ] + ) def test_fixture_parametrized_empty_ids(self, testdir): """Fixtures parametrized with empty ids cause an internal error (#1849).""" - testdir.makepyfile(''' + testdir.makepyfile( + """ import pytest @pytest.fixture(scope="module", ids=[], params=[]) @@ -1025,36 +1184,44 @@ class TestMetafuncFunctional(object): def test_temp(temp): pass - ''') + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(['* 1 skipped *']) + result.stdout.fnmatch_lines(["* 1 skipped *"]) def test_parametrized_empty_ids(self, testdir): """Tests parametrized with empty ids cause an internal error (#1849).""" - testdir.makepyfile(''' + testdir.makepyfile( + """ import pytest @pytest.mark.parametrize('temp', [], ids=list()) def test_temp(temp): pass - ''') + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(['* 1 skipped *']) + result.stdout.fnmatch_lines(["* 1 skipped *"]) def test_parametrized_ids_invalid_type(self, testdir): """Tests parametrized with ids as non-strings (#1857).""" - testdir.makepyfile(''' + testdir.makepyfile( + """ import pytest @pytest.mark.parametrize("x, expected", [(10, 20), (40, 80)], ids=(None, 2)) def test_ids_numbers(x,expected): assert x * 2 == expected - ''') + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(['*ids must be list of strings, found: 2 (type: int)*']) + result.stdout.fnmatch_lines( + ["*ids must be list of strings, found: 2 (type: int)*"] + ) def test_parametrize_with_identical_ids_get_unique_names(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def pytest_generate_tests(metafunc): metafunc.parametrize(("a", "b"), [(1,1), (1,2)], @@ -1062,18 +1229,18 @@ class TestMetafuncFunctional(object): def test_function(a, b): assert a == b - """) + """ + ) result = testdir.runpytest("-v") assert result.ret == 1 - result.stdout.fnmatch_lines_random([ - "*test_function*a0*PASSED*", - "*test_function*a1*FAILED*" - ]) + result.stdout.fnmatch_lines_random( + ["*test_function*a0*PASSED*", "*test_function*a1*FAILED*"] + ) - @pytest.mark.parametrize(("scope", "length"), - [("module", 2), ("function", 4)]) + @pytest.mark.parametrize(("scope", "length"), [("module", 2), ("function", 4)]) def test_parametrize_scope_overrides(self, testdir, scope, length): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest values = [] def pytest_generate_tests(metafunc): @@ -1090,12 +1257,15 @@ class TestMetafuncFunctional(object): assert arg in (1,2) def test_checklength(): assert len(values) == %d - """ % (scope, length)) + """ + % (scope, length) + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=5) def test_parametrize_issue323(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope='module', params=range(966)) @@ -1106,12 +1276,14 @@ class TestMetafuncFunctional(object): pass def test_it2(foo): pass - """) + """ + ) reprec = testdir.inline_run("--collect-only") assert not reprec.getcalls("pytest_internalerror") def test_usefixtures_seen_in_generate_tests(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def pytest_generate_tests(metafunc): assert "abc" in metafunc.fixturenames @@ -1120,28 +1292,38 @@ class TestMetafuncFunctional(object): @pytest.mark.usefixtures("abc") def test_function(): pass - """) + """ + ) reprec = testdir.runpytest() reprec.assert_outcomes(passed=1) def test_generate_tests_only_done_in_subdir(self, testdir): sub1 = testdir.mkpydir("sub1") sub2 = testdir.mkpydir("sub2") - sub1.join("conftest.py").write(_pytest._code.Source(""" + sub1.join("conftest.py").write( + _pytest._code.Source( + """ def pytest_generate_tests(metafunc): assert metafunc.function.__name__ == "test_1" - """)) - sub2.join("conftest.py").write(_pytest._code.Source(""" + """ + ) + ) + sub2.join("conftest.py").write( + _pytest._code.Source( + """ def pytest_generate_tests(metafunc): assert metafunc.function.__name__ == "test_2" - """)) + """ + ) + ) sub1.join("test_in_sub1.py").write("def test_1(): pass") sub2.join("test_in_sub2.py").write("def test_2(): pass") result = testdir.runpytest("--keep-duplicates", "-v", "-s", sub1, sub2, sub1) result.assert_outcomes(passed=3) def test_generate_same_function_names_issue403(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def make_tests(): @@ -1152,25 +1334,31 @@ class TestMetafuncFunctional(object): test_x = make_tests() test_y = make_tests() - """) + """ + ) reprec = testdir.runpytest() reprec.assert_outcomes(passed=4) @pytest.mark.issue463 - @pytest.mark.parametrize('attr', ['parametrise', 'parameterize', - 'parameterise']) + @pytest.mark.parametrize("attr", ["parametrise", "parameterize", "parameterise"]) def test_parametrize_misspelling(self, testdir, attr): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest - @pytest.mark.{0}("x", range(2)) + @pytest.mark.{}("x", range(2)) def test_foo(x): pass - """.format(attr)) - reprec = testdir.inline_run('--collectonly') + """.format( + attr + ) + ) + reprec = testdir.inline_run("--collectonly") failures = reprec.getfailures() assert len(failures) == 1 - expectederror = "MarkerError: test_foo has '{0}', spelling should be 'parametrize'".format(attr) + expectederror = "MarkerError: test_foo has '{}', spelling should be 'parametrize'".format( + attr + ) assert expectederror in failures[0].longrepr.reprcrash.message @@ -1180,7 +1368,8 @@ class TestMetafuncFunctionalAuto(object): """ def test_parametrize_auto_scope(self, testdir): - testdir.makepyfile(''' + testdir.makepyfile( + """ import pytest @pytest.fixture(scope='session', autouse=True) @@ -1195,12 +1384,14 @@ class TestMetafuncFunctionalAuto(object): def test_2(animal): assert animal == 'fish' - ''') + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(['* 3 passed *']) + result.stdout.fnmatch_lines(["* 3 passed *"]) def test_parametrize_auto_scope_indirect(self, testdir): - testdir.makepyfile(''' + testdir.makepyfile( + """ import pytest @pytest.fixture(scope='session') @@ -1216,12 +1407,14 @@ class TestMetafuncFunctionalAuto(object): def test_2(animal, echo): assert animal == 'fish' assert echo in (1, 2, 3) - ''') + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(['* 3 passed *']) + result.stdout.fnmatch_lines(["* 3 passed *"]) def test_parametrize_auto_scope_override_fixture(self, testdir): - testdir.makepyfile(''' + testdir.makepyfile( + """ import pytest @pytest.fixture(scope='session', autouse=True) @@ -1231,12 +1424,14 @@ class TestMetafuncFunctionalAuto(object): @pytest.mark.parametrize('animal', ["dog", "cat"]) def test_1(animal): assert animal in ('dog', 'cat') - ''') + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(['* 2 passed *']) + result.stdout.fnmatch_lines(["* 2 passed *"]) def test_parametrize_all_indirects(self, testdir): - testdir.makepyfile(''' + testdir.makepyfile( + """ import pytest @pytest.fixture() @@ -1256,12 +1451,14 @@ class TestMetafuncFunctionalAuto(object): def test_2(animal, echo): assert animal == 'fish' assert echo in (1, 2, 3) - ''') + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(['* 3 passed *']) + result.stdout.fnmatch_lines(["* 3 passed *"]) def test_parametrize_issue634(self, testdir): - testdir.makepyfile(''' + testdir.makepyfile( + """ import pytest @pytest.fixture(scope='module') @@ -1286,14 +1483,15 @@ class TestMetafuncFunctionalAuto(object): if test_with: params = test_with metafunc.parametrize('foo', params, indirect=True) - ''') + """ + ) result = testdir.runpytest("-s") output = result.stdout.str() - assert output.count('preparing foo-2') == 1 - assert output.count('preparing foo-3') == 1 + assert output.count("preparing foo-2") == 1 + assert output.count("preparing foo-3") == 1 -@pytest.mark.filterwarnings('ignore:Applying marks directly to parameters') +@pytest.mark.filterwarnings("ignore:Applying marks directly to parameters") @pytest.mark.issue308 class TestMarkersWithParametrization(object): @@ -1313,10 +1511,10 @@ class TestMarkersWithParametrization(object): items = testdir.getitems(s) assert len(items) == 3 for item in items: - assert 'foo' in item.keywords - assert 'bar' not in items[0].keywords - assert 'bar' in items[1].keywords - assert 'bar' not in items[2].keywords + assert "foo" in item.keywords + assert "bar" not in items[0].keywords + assert "bar" in items[1].keywords + assert "bar" not in items[2].keywords def test_select_based_on_mark(self, testdir): s = """ @@ -1331,7 +1529,7 @@ class TestMarkersWithParametrization(object): assert n + 1 == expected """ testdir.makepyfile(s) - rec = testdir.inline_run("-m", 'foo') + rec = testdir.inline_run("-m", "foo") passed, skipped, fail = rec.listoutcomes() assert len(passed) == 1 assert len(skipped) == 0 @@ -1353,7 +1551,7 @@ class TestMarkersWithParametrization(object): """ items = testdir.getitems(s) assert len(items) == 3 - for mark in ['foo', 'bar']: + for mark in ["foo", "bar"]: assert mark not in items[0].keywords assert mark in items[1].keywords assert mark not in items[2].keywords @@ -1439,7 +1637,7 @@ class TestMarkersWithParametrization(object): reprec = testdir.inline_run() reprec.assertoutcome(passed=2, skipped=1) - @pytest.mark.parametrize('strict', [True, False]) + @pytest.mark.parametrize("strict", [True, False]) def test_xfail_passing_is_xpass(self, testdir, strict): s = """ import pytest @@ -1451,7 +1649,9 @@ class TestMarkersWithParametrization(object): ]) def test_increment(n, expected): assert n + 1 == expected - """.format(strict=strict) + """.format( + strict=strict + ) testdir.makepyfile(s) reprec = testdir.inline_run() passed, failed = (2, 1) if strict else (3, 0) @@ -1482,7 +1682,8 @@ class TestMarkersWithParametrization(object): @pytest.mark.issue290 def test_parametrize_ID_generation_string_int_works(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture @@ -1492,11 +1693,12 @@ class TestMarkersWithParametrization(object): 'limit', (0, '0')) def test_limit(limit, myfixture): return - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=2) - @pytest.mark.parametrize('strict', [True, False]) + @pytest.mark.parametrize("strict", [True, False]) def test_parametrize_marked_value(self, testdir, strict): s = """ import pytest @@ -1513,36 +1715,42 @@ class TestMarkersWithParametrization(object): ]) def test_increment(n, expected): assert n + 1 == expected - """.format(strict=strict) + """.format( + strict=strict + ) testdir.makepyfile(s) reprec = testdir.inline_run() passed, failed = (0, 2) if strict else (2, 0) reprec.assertoutcome(passed=passed, failed=failed) def test_pytest_make_parametrize_id(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_make_parametrize_id(config, val): return str(val * 2) - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ import pytest @pytest.mark.parametrize("x", range(2)) def test_func(x): pass - """) + """ + ) result = testdir.runpytest("-v") - result.stdout.fnmatch_lines([ - "*test_func*0*PASS*", - "*test_func*2*PASS*", - ]) + result.stdout.fnmatch_lines(["*test_func*0*PASS*", "*test_func*2*PASS*"]) def test_pytest_make_parametrize_id_with_argname(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_make_parametrize_id(config, val, argname): return str(val * 2 if argname == 'x' else val * 10) - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ import pytest @pytest.mark.parametrize("x", range(2)) @@ -1552,10 +1760,9 @@ class TestMarkersWithParametrization(object): @pytest.mark.parametrize("y", [1]) def test_func_b(y): pass - """) + """ + ) result = testdir.runpytest("-v") - result.stdout.fnmatch_lines([ - "*test_func_a*0*PASS*", - "*test_func_a*2*PASS*", - "*test_func_b*10*PASS*", - ]) + result.stdout.fnmatch_lines( + ["*test_func_a*0*PASS*", "*test_func_a*2*PASS*", "*test_func_b*10*PASS*"] + ) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/raises.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/raises.py index 321ee349ee6..64199c3b6f5 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/raises.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/raises.py @@ -1,8 +1,10 @@ +from _pytest.outcomes import Failed import pytest import sys class TestRaises(object): + def test_raises(self): source = "int('qwe')" excinfo = pytest.raises(ValueError, source) @@ -17,19 +19,23 @@ class TestRaises(object): pytest.raises(SyntaxError, "qwe qwe qwe") def test_raises_function(self): - pytest.raises(ValueError, int, 'hello') + pytest.raises(ValueError, int, "hello") def test_raises_callable_no_exception(self): + class A(object): + def __call__(self): pass + try: pytest.raises(ValueError, A()) except pytest.raises.Exception: pass def test_raises_as_contextmanager(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ from __future__ import with_statement import py, pytest import _pytest._code @@ -51,25 +57,29 @@ class TestRaises(object): with pytest.raises(ZeroDivisionError): with pytest.raises(ValueError): 1/0 - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - '*3 passed*', - ]) + result.stdout.fnmatch_lines(["*3 passed*"]) def test_noclass(self): with pytest.raises(TypeError): - pytest.raises('wrong', lambda: None) + pytest.raises("wrong", lambda: None) + + def test_invalid_arguments_to_raises(self): + with pytest.raises(TypeError, match="unknown"): + with pytest.raises(TypeError, unknown="bogus"): + raise ValueError() def test_tuple(self): with pytest.raises((KeyError, ValueError)): - raise KeyError('oops') + raise KeyError("oops") def test_no_raise_message(self): try: - pytest.raises(ValueError, int, '0') + pytest.raises(ValueError, int, "0") except pytest.raises.Exception as e: - assert e.msg == "DID NOT RAISE {0}".format(repr(ValueError)) + assert e.msg == "DID NOT RAISE {}".format(repr(ValueError)) else: assert False, "Expected pytest.raises.Exception" @@ -77,7 +87,7 @@ class TestRaises(object): with pytest.raises(ValueError): pass except pytest.raises.Exception as e: - assert e.msg == "DID NOT RAISE {0}".format(repr(ValueError)) + assert e.msg == "DID NOT RAISE {}".format(repr(ValueError)) else: assert False, "Expected pytest.raises.Exception" @@ -91,7 +101,7 @@ class TestRaises(object): else: assert False, "Expected pytest.raises.Exception" - @pytest.mark.parametrize('method', ['function', 'with']) + @pytest.mark.parametrize("method", ["function", "with"]) def test_raises_cyclic_reference(self, method): """ Ensure pytest.raises does not leave a reference cycle (#1965). @@ -99,11 +109,12 @@ class TestRaises(object): import gc class T(object): + def __call__(self): raise ValueError t = T() - if method == 'function': + if method == "function": pytest.raises(ValueError, t) else: with pytest.raises(ValueError): @@ -121,14 +132,46 @@ class TestRaises(object): def test_raises_match(self): msg = r"with base \d+" with pytest.raises(ValueError, match=msg): - int('asdf') + int("asdf") msg = "with base 10" with pytest.raises(ValueError, match=msg): - int('asdf') + int("asdf") msg = "with base 16" - expr = r"Pattern '{0}' not found in 'invalid literal for int\(\) with base 10: 'asdf''".format(msg) + expr = r"Pattern '{}' not found in 'invalid literal for int\(\) with base 10: 'asdf''".format( + msg + ) with pytest.raises(AssertionError, match=expr): with pytest.raises(ValueError, match=msg): - int('asdf', base=10) + int("asdf", base=10) + + def test_raises_match_wrong_type(self): + """Raising an exception with the wrong type and match= given. + + pytest should throw the unexpected exception - the pattern match is not + really relevant if we got a different exception. + """ + with pytest.raises(ValueError): + with pytest.raises(IndexError, match="nomatch"): + int("asdf") + + def test_raises_exception_looks_iterable(self): + from six import add_metaclass + + class Meta(type(object)): + + def __getitem__(self, item): + return 1 / 0 + + def __len__(self): + return 1 + + @add_metaclass(Meta) + class ClassLooksIterableException(Exception): + pass + + with pytest.raises( + Failed, match="DID NOT RAISE " + ): + pytest.raises(ClassLooksIterableException, lambda: None) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/setup_only.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/setup_only.py index ab34312fcc8..4ae24b15a6d 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/setup_only.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/setup_only.py @@ -1,14 +1,14 @@ import pytest -@pytest.fixture(params=['--setup-only', '--setup-plan', '--setup-show'], - scope='module') +@pytest.fixture(params=["--setup-only", "--setup-plan", "--setup-show"], scope="module") def mode(request): return request.param def test_show_only_active_fixtures(testdir, mode): - p = testdir.makepyfile(''' + p = testdir.makepyfile( + ''' import pytest @pytest.fixture def _arg0(): @@ -18,21 +18,21 @@ def test_show_only_active_fixtures(testdir, mode): """arg1 docstring""" def test_arg1(arg1): pass - ''') + ''' + ) result = testdir.runpytest(mode, p) assert result.ret == 0 - result.stdout.fnmatch_lines([ - '*SETUP F arg1*', - '*test_arg1 (fixtures used: arg1)*', - '*TEARDOWN F arg1*', - ]) + result.stdout.fnmatch_lines( + ["*SETUP F arg1*", "*test_arg1 (fixtures used: arg1)*", "*TEARDOWN F arg1*"] + ) assert "_arg0" not in result.stdout.str() def test_show_different_scopes(testdir, mode): - p = testdir.makepyfile(''' + p = testdir.makepyfile( + ''' import pytest @pytest.fixture def arg_function(): @@ -42,50 +42,60 @@ def test_show_different_scopes(testdir, mode): """session scoped fixture""" def test_arg1(arg_session, arg_function): pass - ''') + ''' + ) result = testdir.runpytest(mode, p) assert result.ret == 0 - result.stdout.fnmatch_lines([ - 'SETUP S arg_session*', - '*SETUP F arg_function*', - '*test_arg1 (fixtures used: arg_function, arg_session)*', - '*TEARDOWN F arg_function*', - 'TEARDOWN S arg_session*', - ]) + result.stdout.fnmatch_lines( + [ + "SETUP S arg_session*", + "*SETUP F arg_function*", + "*test_arg1 (fixtures used: arg_function, arg_session)*", + "*TEARDOWN F arg_function*", + "TEARDOWN S arg_session*", + ] + ) def test_show_nested_fixtures(testdir, mode): - testdir.makeconftest(''' + testdir.makeconftest( + ''' import pytest @pytest.fixture(scope='session') def arg_same(): """session scoped fixture""" - ''') - p = testdir.makepyfile(''' + ''' + ) + p = testdir.makepyfile( + ''' import pytest @pytest.fixture(scope='function') def arg_same(arg_same): """function scoped fixture""" def test_arg1(arg_same): pass - ''') + ''' + ) result = testdir.runpytest(mode, p) assert result.ret == 0 - result.stdout.fnmatch_lines([ - 'SETUP S arg_same*', - '*SETUP F arg_same (fixtures used: arg_same)*', - '*test_arg1 (fixtures used: arg_same)*', - '*TEARDOWN F arg_same*', - 'TEARDOWN S arg_same*', - ]) + result.stdout.fnmatch_lines( + [ + "SETUP S arg_same*", + "*SETUP F arg_same (fixtures used: arg_same)*", + "*test_arg1 (fixtures used: arg_same)*", + "*TEARDOWN F arg_same*", + "TEARDOWN S arg_same*", + ] + ) def test_show_fixtures_with_autouse(testdir, mode): - p = testdir.makepyfile(''' + p = testdir.makepyfile( + ''' import pytest @pytest.fixture def arg_function(): @@ -95,92 +105,104 @@ def test_show_fixtures_with_autouse(testdir, mode): """session scoped fixture""" def test_arg1(arg_function): pass - ''') + ''' + ) result = testdir.runpytest(mode, p) assert result.ret == 0 - result.stdout.fnmatch_lines([ - 'SETUP S arg_session*', - '*SETUP F arg_function*', - '*test_arg1 (fixtures used: arg_function, arg_session)*', - ]) + result.stdout.fnmatch_lines( + [ + "SETUP S arg_session*", + "*SETUP F arg_function*", + "*test_arg1 (fixtures used: arg_function, arg_session)*", + ] + ) def test_show_fixtures_with_parameters(testdir, mode): - testdir.makeconftest(''' + testdir.makeconftest( + ''' import pytest @pytest.fixture(scope='session', params=['foo', 'bar']) def arg_same(): """session scoped fixture""" - ''') - p = testdir.makepyfile(''' + ''' + ) + p = testdir.makepyfile( + ''' import pytest @pytest.fixture(scope='function') def arg_other(arg_same): """function scoped fixture""" def test_arg1(arg_other): pass - ''') + ''' + ) result = testdir.runpytest(mode, p) assert result.ret == 0 - result.stdout.fnmatch_lines([ - 'SETUP S arg_same?foo?', - 'TEARDOWN S arg_same?foo?', - 'SETUP S arg_same?bar?', - 'TEARDOWN S arg_same?bar?', - ]) + result.stdout.fnmatch_lines( + [ + "SETUP S arg_same?foo?", + "TEARDOWN S arg_same?foo?", + "SETUP S arg_same?bar?", + "TEARDOWN S arg_same?bar?", + ] + ) def test_show_fixtures_with_parameter_ids(testdir, mode): - testdir.makeconftest(''' + testdir.makeconftest( + ''' import pytest @pytest.fixture( scope='session', params=['foo', 'bar'], ids=['spam', 'ham']) def arg_same(): """session scoped fixture""" - ''') - p = testdir.makepyfile(''' + ''' + ) + p = testdir.makepyfile( + ''' import pytest @pytest.fixture(scope='function') def arg_other(arg_same): """function scoped fixture""" def test_arg1(arg_other): pass - ''') + ''' + ) result = testdir.runpytest(mode, p) assert result.ret == 0 - result.stdout.fnmatch_lines([ - 'SETUP S arg_same?spam?', - 'SETUP S arg_same?ham?', - ]) + result.stdout.fnmatch_lines( + ["SETUP S arg_same?spam?", "SETUP S arg_same?ham?"] + ) def test_show_fixtures_with_parameter_ids_function(testdir, mode): - p = testdir.makepyfile(''' + p = testdir.makepyfile( + """ import pytest @pytest.fixture(params=['foo', 'bar'], ids=lambda p: p.upper()) def foobar(): pass def test_foobar(foobar): pass - ''') + """ + ) result = testdir.runpytest(mode, p) assert result.ret == 0 - result.stdout.fnmatch_lines([ - '*SETUP F foobar?FOO?', - '*SETUP F foobar?BAR?', - ]) + result.stdout.fnmatch_lines(["*SETUP F foobar?FOO?", "*SETUP F foobar?BAR?"]) def test_dynamic_fixture_request(testdir): - p = testdir.makepyfile(''' + p = testdir.makepyfile( + """ import pytest @pytest.fixture() def dynamically_requested_fixture(): @@ -190,19 +212,23 @@ def test_dynamic_fixture_request(testdir): request.getfixturevalue('dynamically_requested_fixture') def test_dyn(dependent_fixture): pass - ''') + """ + ) - result = testdir.runpytest('--setup-only', p) + result = testdir.runpytest("--setup-only", p) assert result.ret == 0 - result.stdout.fnmatch_lines([ - '*SETUP F dynamically_requested_fixture', - '*TEARDOWN F dynamically_requested_fixture' - ]) + result.stdout.fnmatch_lines( + [ + "*SETUP F dynamically_requested_fixture", + "*TEARDOWN F dynamically_requested_fixture", + ] + ) def test_capturing(testdir): - p = testdir.makepyfile(''' + p = testdir.makepyfile( + """ import pytest, sys @pytest.fixture() def one(): @@ -213,31 +239,31 @@ def test_capturing(testdir): assert 0 def test_capturing(two): pass - ''') + """ + ) - result = testdir.runpytest('--setup-only', p) - result.stdout.fnmatch_lines([ - 'this should be captured', - 'this should also be captured' - ]) + result = testdir.runpytest("--setup-only", p) + result.stdout.fnmatch_lines( + ["this should be captured", "this should also be captured"] + ) def test_show_fixtures_and_execute_test(testdir): """ Verifies that setups are shown and tests are executed. """ - p = testdir.makepyfile(''' + p = testdir.makepyfile( + """ import pytest @pytest.fixture def arg(): assert True def test_arg(arg): assert False - ''') + """ + ) result = testdir.runpytest("--setup-show", p) assert result.ret == 1 - result.stdout.fnmatch_lines([ - '*SETUP F arg*', - '*test_arg (fixtures used: arg)F*', - '*TEARDOWN F arg*', - ]) + result.stdout.fnmatch_lines( + ["*SETUP F arg*", "*test_arg (fixtures used: arg)F*", "*TEARDOWN F arg*"] + ) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/setup_plan.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/setup_plan.py index 8c98224692a..0321939a8aa 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/setup_plan.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/setup_plan.py @@ -1,19 +1,19 @@ def test_show_fixtures_and_test(testdir): """ Verifies that fixtures are not executed. """ - p = testdir.makepyfile(''' + p = testdir.makepyfile( + """ import pytest @pytest.fixture def arg(): assert False def test_arg(arg): assert False - ''') + """ + ) result = testdir.runpytest("--setup-plan", p) assert result.ret == 0 - result.stdout.fnmatch_lines([ - '*SETUP F arg*', - '*test_arg (fixtures used: arg)', - '*TEARDOWN F arg*', - ]) + result.stdout.fnmatch_lines( + ["*SETUP F arg*", "*test_arg (fixtures used: arg)", "*TEARDOWN F arg*"] + ) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/show_fixtures_per_test.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/show_fixtures_per_test.py index 741f33946a0..e14344d4ebf 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/show_fixtures_per_test.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/show_fixtures_per_test.py @@ -2,13 +2,14 @@ def test_no_items_should_not_show_output(testdir): - result = testdir.runpytest('--fixtures-per-test') - assert 'fixtures used by' not in result.stdout.str() + result = testdir.runpytest("--fixtures-per-test") + assert "fixtures used by" not in result.stdout.str() assert result.ret == 0 def test_fixtures_in_module(testdir): - p = testdir.makepyfile(''' + p = testdir.makepyfile( + ''' import pytest @pytest.fixture def _arg0(): @@ -18,22 +19,26 @@ def test_fixtures_in_module(testdir): """arg1 docstring""" def test_arg1(arg1): pass - ''') + ''' + ) result = testdir.runpytest("--fixtures-per-test", p) assert result.ret == 0 - result.stdout.fnmatch_lines([ - '*fixtures used by test_arg1*', - '*(test_fixtures_in_module.py:9)*', - 'arg1', - ' arg1 docstring', - ]) + result.stdout.fnmatch_lines( + [ + "*fixtures used by test_arg1*", + "*(test_fixtures_in_module.py:9)*", + "arg1", + " arg1 docstring", + ] + ) assert "_arg0" not in result.stdout.str() def test_fixtures_in_conftest(testdir): - testdir.makeconftest(''' + testdir.makeconftest( + ''' import pytest @pytest.fixture def arg1(): @@ -46,35 +51,41 @@ def test_fixtures_in_conftest(testdir): """arg3 docstring """ - ''') - p = testdir.makepyfile(''' + ''' + ) + p = testdir.makepyfile( + """ def test_arg2(arg2): pass def test_arg3(arg3): pass - ''') + """ + ) result = testdir.runpytest("--fixtures-per-test", p) assert result.ret == 0 - result.stdout.fnmatch_lines([ - '*fixtures used by test_arg2*', - '*(test_fixtures_in_conftest.py:2)*', - 'arg2', - ' arg2 docstring', - '*fixtures used by test_arg3*', - '*(test_fixtures_in_conftest.py:4)*', - 'arg1', - ' arg1 docstring', - 'arg2', - ' arg2 docstring', - 'arg3', - ' arg3', - ' docstring', - ]) + result.stdout.fnmatch_lines( + [ + "*fixtures used by test_arg2*", + "*(test_fixtures_in_conftest.py:2)*", + "arg2", + " arg2 docstring", + "*fixtures used by test_arg3*", + "*(test_fixtures_in_conftest.py:4)*", + "arg1", + " arg1 docstring", + "arg2", + " arg2 docstring", + "arg3", + " arg3", + " docstring", + ] + ) def test_should_show_fixtures_used_by_test(testdir): - testdir.makeconftest(''' + testdir.makeconftest( + ''' import pytest @pytest.fixture def arg1(): @@ -82,30 +93,36 @@ def test_should_show_fixtures_used_by_test(testdir): @pytest.fixture def arg2(): """arg2 from conftest""" - ''') - p = testdir.makepyfile(''' + ''' + ) + p = testdir.makepyfile( + ''' import pytest @pytest.fixture def arg1(): """arg1 from testmodule""" def test_args(arg1, arg2): pass - ''') + ''' + ) result = testdir.runpytest("--fixtures-per-test", p) assert result.ret == 0 - result.stdout.fnmatch_lines([ - '*fixtures used by test_args*', - '*(test_should_show_fixtures_used_by_test.py:6)*', - 'arg1', - ' arg1 from testmodule', - 'arg2', - ' arg2 from conftest', - ]) + result.stdout.fnmatch_lines( + [ + "*fixtures used by test_args*", + "*(test_should_show_fixtures_used_by_test.py:6)*", + "arg1", + " arg1 from testmodule", + "arg2", + " arg2 from conftest", + ] + ) def test_verbose_include_private_fixtures_and_loc(testdir): - testdir.makeconftest(''' + testdir.makeconftest( + ''' import pytest @pytest.fixture def _arg1(): @@ -113,46 +130,54 @@ def test_verbose_include_private_fixtures_and_loc(testdir): @pytest.fixture def arg2(_arg1): """arg2 from conftest""" - ''') - p = testdir.makepyfile(''' + ''' + ) + p = testdir.makepyfile( + ''' import pytest @pytest.fixture def arg3(): """arg3 from testmodule""" def test_args(arg2, arg3): pass - ''') + ''' + ) result = testdir.runpytest("--fixtures-per-test", "-v", p) assert result.ret == 0 - result.stdout.fnmatch_lines([ - '*fixtures used by test_args*', - '*(test_verbose_include_private_fixtures_and_loc.py:6)*', - '_arg1 -- conftest.py:3', - ' _arg1 from conftest', - 'arg2 -- conftest.py:6', - ' arg2 from conftest', - 'arg3 -- test_verbose_include_private_fixtures_and_loc.py:3', - ' arg3 from testmodule', - ]) + result.stdout.fnmatch_lines( + [ + "*fixtures used by test_args*", + "*(test_verbose_include_private_fixtures_and_loc.py:6)*", + "_arg1 -- conftest.py:3", + " _arg1 from conftest", + "arg2 -- conftest.py:6", + " arg2 from conftest", + "arg3 -- test_verbose_include_private_fixtures_and_loc.py:3", + " arg3 from testmodule", + ] + ) def test_doctest_items(testdir): - testdir.makepyfile(''' + testdir.makepyfile( + ''' def foo(): """ >>> 1 + 1 2 """ - ''') - testdir.maketxtfile(''' + ''' + ) + testdir.maketxtfile( + """ >>> 1 + 1 2 - ''') - result = testdir.runpytest("--fixtures-per-test", "--doctest-modules", - "--doctest-glob=*.txt", "-v") + """ + ) + result = testdir.runpytest( + "--fixtures-per-test", "--doctest-modules", "--doctest-glob=*.txt", "-v" + ) assert result.ret == 0 - result.stdout.fnmatch_lines([ - '*collected 2 items*', - ]) + result.stdout.fnmatch_lines(["*collected 2 items*"]) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/test_deprecations.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/test_deprecations.py index 5001f765f6c..b0c11f0b03b 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/test_deprecations.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/python/test_deprecations.py @@ -18,5 +18,5 @@ def test_pycollector_makeitem_is_deprecated(): collector = PyCollectorMock() with pytest.deprecated_call(): - collector.makeitem('foo', 'bar') + collector.makeitem("foo", "bar") assert collector.called diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_argcomplete.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_argcomplete.py index c9261257743..b042de5ce5b 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_argcomplete.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_argcomplete.py @@ -1,5 +1,6 @@ from __future__ import absolute_import, division, print_function -import py +import subprocess +import sys import pytest # test for _argcomplete but not specific for any application @@ -10,12 +11,13 @@ def equal_with_bash(prefix, ffc, fc, out=None): res_bash = set(fc(prefix)) retval = set(res) == res_bash if out: - out.write('equal_with_bash %s %s\n' % (retval, res)) + out.write("equal_with_bash %s %s\n" % (retval, res)) if not retval: - out.write(' python - bash: %s\n' % (set(res) - res_bash)) - out.write(' bash - python: %s\n' % (res_bash - set(res))) + out.write(" python - bash: %s\n" % (set(res) - res_bash)) + out.write(" bash - python: %s\n" % (res_bash - set(res))) return retval + # copied from argcomplete.completers as import from there # also pulls in argcomplete.__init__ which opens filedescriptor 9 # this gives an IOError at the end of testrun @@ -23,67 +25,76 @@ def equal_with_bash(prefix, ffc, fc, out=None): def _wrapcall(*args, **kargs): try: - if py.std.sys.version_info > (2, 7): - return py.std.subprocess.check_output(*args, **kargs).decode().splitlines() - if 'stdout' in kargs: - raise ValueError('stdout argument not allowed, it will be overridden.') - process = py.std.subprocess.Popen( - stdout=py.std.subprocess.PIPE, *args, **kargs) + if sys.version_info > (2, 7): + return subprocess.check_output(*args, **kargs).decode().splitlines() + if "stdout" in kargs: + raise ValueError("stdout argument not allowed, it will be overridden.") + process = subprocess.Popen(stdout=subprocess.PIPE, *args, **kargs) output, unused_err = process.communicate() retcode = process.poll() if retcode: cmd = kargs.get("args") if cmd is None: cmd = args[0] - raise py.std.subprocess.CalledProcessError(retcode, cmd) + raise subprocess.CalledProcessError(retcode, cmd) return output.decode().splitlines() - except py.std.subprocess.CalledProcessError: + except subprocess.CalledProcessError: return [] class FilesCompleter(object): - 'File completer class, optionally takes a list of allowed extensions' + "File completer class, optionally takes a list of allowed extensions" def __init__(self, allowednames=(), directories=True): # Fix if someone passes in a string instead of a list if type(allowednames) is str: allowednames = [allowednames] - self.allowednames = [x.lstrip('*').lstrip('.') for x in allowednames] + self.allowednames = [x.lstrip("*").lstrip(".") for x in allowednames] self.directories = directories def __call__(self, prefix, **kwargs): completion = [] if self.allowednames: if self.directories: - files = _wrapcall(['bash', '-c', - "compgen -A directory -- '{p}'".format(p=prefix)]) - completion += [f + '/' for f in files] + files = _wrapcall( + ["bash", "-c", "compgen -A directory -- '{p}'".format(p=prefix)] + ) + completion += [f + "/" for f in files] for x in self.allowednames: - completion += _wrapcall(['bash', '-c', - "compgen -A file -X '!*.{0}' -- '{p}'".format(x, p=prefix)]) + completion += _wrapcall( + [ + "bash", + "-c", + "compgen -A file -X '!*.{0}' -- '{p}'".format(x, p=prefix), + ] + ) else: - completion += _wrapcall(['bash', '-c', - "compgen -A file -- '{p}'".format(p=prefix)]) + completion += _wrapcall( + ["bash", "-c", "compgen -A file -- '{p}'".format(p=prefix)] + ) - anticomp = _wrapcall(['bash', '-c', - "compgen -A directory -- '{p}'".format(p=prefix)]) + anticomp = _wrapcall( + ["bash", "-c", "compgen -A directory -- '{p}'".format(p=prefix)] + ) completion = list(set(completion) - set(anticomp)) if self.directories: - completion += [f + '/' for f in anticomp] + completion += [f + "/" for f in anticomp] return completion class TestArgComplete(object): + @pytest.mark.skipif("sys.platform in ('win32', 'darwin')") def test_compare_with_compgen(self): from _pytest._argcomplete import FastFilesCompleter + ffc = FastFilesCompleter() fc = FilesCompleter() - for x in ['/', '/d', '/data', 'qqq', '']: - assert equal_with_bash(x, ffc, fc, out=py.std.sys.stdout) + for x in ["/", "/d", "/data", "qqq", ""]: + assert equal_with_bash(x, ffc, fc, out=sys.stdout) @pytest.mark.skipif("sys.platform in ('win32', 'darwin')") def test_remove_dir_prefix(self): @@ -91,7 +102,8 @@ class TestArgComplete(object): ls /usr/ """ from _pytest._argcomplete import FastFilesCompleter + ffc = FastFilesCompleter() fc = FilesCompleter() - for x in '/usr/'.split(): - assert not equal_with_bash(x, ffc, fc, out=py.std.sys.stdout) + for x in "/usr/".split(): + assert not equal_with_bash(x, ffc, fc, out=sys.stdout) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_assertion.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_assertion.py index 328fe7fa918..393cf817c7e 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_assertion.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_assertion.py @@ -19,23 +19,23 @@ def mock_config(): verbose = False def getoption(self, name): - if name == 'verbose': + if name == "verbose": return self.verbose - raise KeyError('Not mocked out: %s' % name) + raise KeyError("Not mocked out: %s" % name) return Config() class TestImportHookInstallation(object): - @pytest.mark.parametrize('initial_conftest', [True, False]) - @pytest.mark.parametrize('mode', ['plain', 'rewrite']) + @pytest.mark.parametrize("initial_conftest", [True, False]) + @pytest.mark.parametrize("mode", ["plain", "rewrite"]) def test_conftest_assertion_rewrite(self, testdir, initial_conftest, mode): """Test that conftest files are using assertion rewrite on import. (#1619) """ - testdir.tmpdir.join('foo/tests').ensure(dir=1) - conftest_path = 'conftest.py' if initial_conftest else 'foo/conftest.py' + testdir.tmpdir.join("foo/tests").ensure(dir=1) + conftest_path = "conftest.py" if initial_conftest else "foo/conftest.py" contents = { conftest_path: """ import pytest @@ -45,17 +45,17 @@ class TestImportHookInstallation(object): assert values.pop(0) == value return check """, - 'foo/tests/test_foo.py': """ + "foo/tests/test_foo.py": """ def test(check_first): check_first([10, 30], 30) - """ + """, } testdir.makepyfile(**contents) - result = testdir.runpytest_subprocess('--assert=%s' % mode) - if mode == 'plain': - expected = 'E AssertionError' - elif mode == 'rewrite': - expected = '*assert 10 == 30*' + result = testdir.runpytest_subprocess("--assert=%s" % mode) + if mode == "plain": + expected = "E AssertionError" + elif mode == "rewrite": + expected = "*assert 10 == 30*" else: assert 0 result.stdout.fnmatch_lines([expected]) @@ -65,25 +65,25 @@ class TestImportHookInstallation(object): Assertions in the pytester plugin must also benefit from assertion rewriting (#1920). """ - testdir.makepyfile(""" + testdir.makepyfile( + """ pytest_plugins = ['pytester'] def test_dummy_failure(testdir): # how meta! testdir.makepyfile('def test(): assert 0') r = testdir.inline_run() r.assertoutcome(passed=1) - """) + """ + ) result = testdir.runpytest_subprocess() - result.stdout.fnmatch_lines([ - '*assert 1 == 0*', - ]) + result.stdout.fnmatch_lines(["*assert 1 == 0*"]) - @pytest.mark.parametrize('mode', ['plain', 'rewrite']) + @pytest.mark.parametrize("mode", ["plain", "rewrite"]) def test_pytest_plugins_rewrite(self, testdir, mode): contents = { - 'conftest.py': """ + "conftest.py": """ pytest_plugins = ['ham'] """, - 'ham.py': """ + "ham.py": """ import pytest @pytest.fixture def check_first(): @@ -91,70 +91,72 @@ class TestImportHookInstallation(object): assert values.pop(0) == value return check """, - 'test_foo.py': """ + "test_foo.py": """ def test_foo(check_first): check_first([10, 30], 30) """, } testdir.makepyfile(**contents) - result = testdir.runpytest_subprocess('--assert=%s' % mode) - if mode == 'plain': - expected = 'E AssertionError' - elif mode == 'rewrite': - expected = '*assert 10 == 30*' + result = testdir.runpytest_subprocess("--assert=%s" % mode) + if mode == "plain": + expected = "E AssertionError" + elif mode == "rewrite": + expected = "*assert 10 == 30*" else: assert 0 result.stdout.fnmatch_lines([expected]) - @pytest.mark.parametrize('mode', ['str', 'list']) + @pytest.mark.parametrize("mode", ["str", "list"]) def test_pytest_plugins_rewrite_module_names(self, testdir, mode): """Test that pluginmanager correct marks pytest_plugins variables for assertion rewriting if they are defined as plain strings or list of strings (#1888). """ - plugins = '"ham"' if mode == 'str' else '["ham"]' + plugins = '"ham"' if mode == "str" else '["ham"]' contents = { - 'conftest.py': """ + "conftest.py": """ pytest_plugins = {plugins} - """.format(plugins=plugins), - 'ham.py': """ + """.format( + plugins=plugins + ), + "ham.py": """ import pytest """, - 'test_foo.py': """ + "test_foo.py": """ def test_foo(pytestconfig): assert 'ham' in pytestconfig.pluginmanager.rewrite_hook._must_rewrite """, } testdir.makepyfile(**contents) - result = testdir.runpytest_subprocess('--assert=rewrite') + result = testdir.runpytest_subprocess("--assert=rewrite") assert result.ret == 0 def test_pytest_plugins_rewrite_module_names_correctly(self, testdir): """Test that we match files correctly when they are marked for rewriting (#2939).""" contents = { - 'conftest.py': """ + "conftest.py": """ pytest_plugins = "ham" """, - 'ham.py': "", - 'hamster.py': "", - 'test_foo.py': """ + "ham.py": "", + "hamster.py": "", + "test_foo.py": """ def test_foo(pytestconfig): assert pytestconfig.pluginmanager.rewrite_hook.find_module('ham') is not None assert pytestconfig.pluginmanager.rewrite_hook.find_module('hamster') is None """, } testdir.makepyfile(**contents) - result = testdir.runpytest_subprocess('--assert=rewrite') + result = testdir.runpytest_subprocess("--assert=rewrite") assert result.ret == 0 - @pytest.mark.parametrize('mode', ['plain', 'rewrite']) - @pytest.mark.parametrize('plugin_state', ['development', 'installed']) + @pytest.mark.parametrize("mode", ["plain", "rewrite"]) + @pytest.mark.parametrize("plugin_state", ["development", "installed"]) def test_installed_plugin_rewrite(self, testdir, mode, plugin_state): # Make sure the hook is installed early enough so that plugins # installed via setuptools are rewritten. - testdir.tmpdir.join('hampkg').ensure(dir=1) + testdir.tmpdir.join("hampkg").ensure(dir=1) contents = { - 'hampkg/__init__.py': """ + "hampkg/__init__.py": """ import pytest @pytest.fixture @@ -163,7 +165,7 @@ class TestImportHookInstallation(object): assert values.pop(0) == value return check """, - 'spamplugin.py': """ + "spamplugin.py": """ import pytest from hampkg import check_first2 @@ -173,7 +175,7 @@ class TestImportHookInstallation(object): assert values.pop(0) == value return check """, - 'mainwrapper.py': """ + "mainwrapper.py": """ import pytest, pkg_resources plugin_state = "{plugin_state}" @@ -209,8 +211,10 @@ class TestImportHookInstallation(object): pkg_resources.iter_entry_points = iter_entry_points pytest.main() - """.format(plugin_state=plugin_state), - 'test_foo.py': """ + """.format( + plugin_state=plugin_state + ), + "test_foo.py": """ def test(check_first): check_first([10, 30], 30) @@ -219,42 +223,44 @@ class TestImportHookInstallation(object): """, } testdir.makepyfile(**contents) - result = testdir.run(sys.executable, 'mainwrapper.py', '-s', '--assert=%s' % mode) - if mode == 'plain': - expected = 'E AssertionError' - elif mode == 'rewrite': - expected = '*assert 10 == 30*' + result = testdir.run( + sys.executable, "mainwrapper.py", "-s", "--assert=%s" % mode + ) + if mode == "plain": + expected = "E AssertionError" + elif mode == "rewrite": + expected = "*assert 10 == 30*" else: assert 0 result.stdout.fnmatch_lines([expected]) def test_rewrite_ast(self, testdir): - testdir.tmpdir.join('pkg').ensure(dir=1) + testdir.tmpdir.join("pkg").ensure(dir=1) contents = { - 'pkg/__init__.py': """ + "pkg/__init__.py": """ import pytest pytest.register_assert_rewrite('pkg.helper') """, - 'pkg/helper.py': """ + "pkg/helper.py": """ def tool(): a, b = 2, 3 assert a == b """, - 'pkg/plugin.py': """ + "pkg/plugin.py": """ import pytest, pkg.helper @pytest.fixture def tool(): return pkg.helper.tool """, - 'pkg/other.py': """ + "pkg/other.py": """ values = [3, 2] def tool(): assert values.pop() == 3 """, - 'conftest.py': """ + "conftest.py": """ pytest_plugins = ['pkg.plugin'] """, - 'test_pkg.py': """ + "test_pkg.py": """ import pkg.other def test_tool(tool): tool() @@ -263,23 +269,29 @@ class TestImportHookInstallation(object): """, } testdir.makepyfile(**contents) - result = testdir.runpytest_subprocess('--assert=rewrite') - result.stdout.fnmatch_lines(['>*assert a == b*', - 'E*assert 2 == 3*', - '>*assert values.pop() == 3*', - 'E*AssertionError']) + result = testdir.runpytest_subprocess("--assert=rewrite") + result.stdout.fnmatch_lines( + [ + ">*assert a == b*", + "E*assert 2 == 3*", + ">*assert values.pop() == 3*", + "E*AssertionError", + ] + ) def test_register_assert_rewrite_checks_types(self): with pytest.raises(TypeError): - pytest.register_assert_rewrite(['pytest_tests_internal_non_existing']) - pytest.register_assert_rewrite('pytest_tests_internal_non_existing', - 'pytest_tests_internal_non_existing2') + pytest.register_assert_rewrite(["pytest_tests_internal_non_existing"]) + pytest.register_assert_rewrite( + "pytest_tests_internal_non_existing", "pytest_tests_internal_non_existing2" + ) class TestBinReprIntegration(object): def test_pytest_assertrepr_compare_called(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest values = [] def pytest_assertrepr_compare(op, left, right): @@ -288,91 +300,107 @@ class TestBinReprIntegration(object): @pytest.fixture def list(request): return values - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ def test_hello(): assert 0 == 1 def test_check(list): assert list == [("==", 0, 1)] - """) + """ + ) result = testdir.runpytest("-v") - result.stdout.fnmatch_lines([ - "*test_hello*FAIL*", - "*test_check*PASS*", - ]) + result.stdout.fnmatch_lines(["*test_hello*FAIL*", "*test_check*PASS*"]) def callequal(left, right, verbose=False): config = mock_config() config.verbose = verbose - return plugin.pytest_assertrepr_compare(config, '==', left, right) + return plugin.pytest_assertrepr_compare(config, "==", left, right) class TestAssert_reprcompare(object): + def test_different_types(self): - assert callequal([0, 1], 'foo') is None + assert callequal([0, 1], "foo") is None def test_summary(self): summary = callequal([0, 1], [0, 2])[0] assert len(summary) < 65 def test_text_diff(self): - diff = callequal('spam', 'eggs')[1:] - assert '- spam' in diff - assert '+ eggs' in diff + diff = callequal("spam", "eggs")[1:] + assert "- spam" in diff + assert "+ eggs" in diff def test_text_skipping(self): - lines = callequal('a' * 50 + 'spam', 'a' * 50 + 'eggs') - assert 'Skipping' in lines[1] + lines = callequal("a" * 50 + "spam", "a" * 50 + "eggs") + assert "Skipping" in lines[1] for line in lines: - assert 'a' * 50 not in line + assert "a" * 50 not in line def test_text_skipping_verbose(self): - lines = callequal('a' * 50 + 'spam', 'a' * 50 + 'eggs', verbose=True) - assert '- ' + 'a' * 50 + 'spam' in lines - assert '+ ' + 'a' * 50 + 'eggs' in lines + lines = callequal("a" * 50 + "spam", "a" * 50 + "eggs", verbose=True) + assert "- " + "a" * 50 + "spam" in lines + assert "+ " + "a" * 50 + "eggs" in lines def test_multiline_text_diff(self): - left = 'foo\nspam\nbar' - right = 'foo\neggs\nbar' + left = "foo\nspam\nbar" + right = "foo\neggs\nbar" diff = callequal(left, right) - assert '- spam' in diff - assert '+ eggs' in diff + assert "- spam" in diff + assert "+ eggs" in diff def test_list(self): expl = callequal([0, 1], [0, 2]) assert len(expl) > 1 @pytest.mark.parametrize( - ['left', 'right', 'expected'], [ - ([0, 1], [0, 2], """ + ["left", "right", "expected"], + [ + ( + [0, 1], + [0, 2], + """ Full diff: - [0, 1] ? ^ + [0, 2] ? ^ - """), - ({0: 1}, {0: 2}, """ + """, + ), + ( + {0: 1}, + {0: 2}, + """ Full diff: - {0: 1} ? ^ + {0: 2} ? ^ - """), - (set([0, 1]), set([0, 2]), """ + """, + ), + ( + {0, 1}, + {0, 2}, + """ Full diff: - set([0, 1]) ? ^ + set([0, 2]) ? ^ - """ if not PY3 else """ + """ + if not PY3 + else """ Full diff: - {0, 1} ? ^ + {0, 2} ? ^ - """) - ] + """, + ), + ], ) def test_iterable_full_diff(self, left, right, expected): """Test the full diff assertion failure explanation. @@ -381,8 +409,8 @@ class TestAssert_reprcompare(object): when verbose is True, then ndiff of the pprint is returned. """ expl = callequal(left, right, verbose=False) - assert expl[-1] == 'Use -v to get the full diff' - expl = '\n'.join(callequal(left, right, verbose=True)) + assert expl[-1] == "Use -v to get the full diff" + expl = "\n".join(callequal(left, right, verbose=True)) assert expl.endswith(textwrap.dedent(expected).strip()) def test_list_different_lengths(self): @@ -392,48 +420,46 @@ class TestAssert_reprcompare(object): assert len(expl) > 1 def test_dict(self): - expl = callequal({'a': 0}, {'a': 1}) + expl = callequal({"a": 0}, {"a": 1}) assert len(expl) > 1 def test_dict_omitting(self): - lines = callequal({'a': 0, 'b': 1}, {'a': 1, 'b': 1}) - assert lines[1].startswith('Omitting 1 identical item') - assert 'Common items' not in lines + lines = callequal({"a": 0, "b": 1}, {"a": 1, "b": 1}) + assert lines[1].startswith("Omitting 1 identical item") + assert "Common items" not in lines for line in lines[1:]: - assert 'b' not in line + assert "b" not in line def test_dict_omitting_with_verbosity_1(self): """ Ensure differing items are visible for verbosity=1 (#1512) """ - lines = callequal({'a': 0, 'b': 1}, {'a': 1, 'b': 1}, verbose=1) - assert lines[1].startswith('Omitting 1 identical item') - assert lines[2].startswith('Differing items') + lines = callequal({"a": 0, "b": 1}, {"a": 1, "b": 1}, verbose=1) + assert lines[1].startswith("Omitting 1 identical item") + assert lines[2].startswith("Differing items") assert lines[3] == "{'a': 0} != {'a': 1}" - assert 'Common items' not in lines + assert "Common items" not in lines def test_dict_omitting_with_verbosity_2(self): - lines = callequal({'a': 0, 'b': 1}, {'a': 1, 'b': 1}, verbose=2) - assert lines[1].startswith('Common items:') - assert 'Omitting' not in lines[1] + lines = callequal({"a": 0, "b": 1}, {"a": 1, "b": 1}, verbose=2) + assert lines[1].startswith("Common items:") + assert "Omitting" not in lines[1] assert lines[2] == "{'b': 1}" def test_set(self): - expl = callequal(set([0, 1]), set([0, 2])) + expl = callequal({0, 1}, {0, 2}) assert len(expl) > 1 def test_frozenzet(self): - expl = callequal(frozenset([0, 1]), set([0, 2])) + expl = callequal(frozenset([0, 1]), {0, 2}) assert len(expl) > 1 def test_Sequence(self): - col = py.builtin._tryimport( - "collections.abc", - "collections", - "sys") + col = py.builtin._tryimport("collections.abc", "collections", "sys") if not hasattr(col, "MutableSequence"): pytest.skip("cannot import MutableSequence") MutableSequence = col.MutableSequence class TestSequence(MutableSequence): # works with a Sequence subclass + def __init__(self, iterable): self.elements = list(iterable) @@ -462,62 +488,71 @@ class TestAssert_reprcompare(object): assert len(expl) > 1 def test_list_bad_repr(self): + class A(object): + def __repr__(self): raise ValueError(42) + expl = callequal([], [A()]) - assert 'ValueError' in "".join(expl) - expl = callequal({}, {'1': A()}) - assert 'faulty' in "".join(expl) + assert "ValueError" in "".join(expl) + expl = callequal({}, {"1": A()}) + assert "faulty" in "".join(expl) def test_one_repr_empty(self): """ the faulty empty string repr did trigger - a unbound local error in _diff_text + an unbound local error in _diff_text """ + class A(str): + def __repr__(self): - return '' - expl = callequal(A(), '') + return "" + + expl = callequal(A(), "") assert not expl def test_repr_no_exc(self): - expl = ' '.join(callequal('foo', 'bar')) - assert 'raised in repr()' not in expl + expl = " ".join(callequal("foo", "bar")) + assert "raised in repr()" not in expl def test_unicode(self): - left = py.builtin._totext('£€', 'utf-8') - right = py.builtin._totext('£', 'utf-8') + left = py.builtin._totext("£€", "utf-8") + right = py.builtin._totext("£", "utf-8") expl = callequal(left, right) - assert expl[0] == py.builtin._totext("'£€' == '£'", 'utf-8') - assert expl[1] == py.builtin._totext('- £€', 'utf-8') - assert expl[2] == py.builtin._totext('+ £', 'utf-8') + assert expl[0] == py.builtin._totext("'£€' == '£'", "utf-8") + assert expl[1] == py.builtin._totext("- £€", "utf-8") + assert expl[2] == py.builtin._totext("+ £", "utf-8") def test_nonascii_text(self): """ :issue: 877 non ascii python2 str caused a UnicodeDecodeError """ + class A(str): + def __repr__(self): - return '\xff' - expl = callequal(A(), '1') + return "\xff" + + expl = callequal(A(), "1") assert expl def test_format_nonascii_explanation(self): - assert util.format_explanation('λ') + assert util.format_explanation("λ") def test_mojibake(self): # issue 429 - left = 'e' - right = '\xc3\xa9' - if not isinstance(left, py.builtin.bytes): - left = py.builtin.bytes(left, 'utf-8') - right = py.builtin.bytes(right, 'utf-8') + left = "e" + right = "\xc3\xa9" + if not isinstance(left, bytes): + left = bytes(left, "utf-8") + right = bytes(right, "utf-8") expl = callequal(left, right) for line in expl: assert isinstance(line, py.builtin.text) - msg = py.builtin._totext('\n').join(expl) + msg = py.builtin._totext("\n").join(expl) assert msg @@ -525,91 +560,87 @@ class TestFormatExplanation(object): def test_special_chars_full(self, testdir): # Issue 453, for the bug this would raise IndexError - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_foo(): assert '\\n}' == '' - """) + """ + ) result = testdir.runpytest() assert result.ret == 1 - result.stdout.fnmatch_lines([ - "*AssertionError*", - ]) + result.stdout.fnmatch_lines(["*AssertionError*"]) def test_fmt_simple(self): - expl = 'assert foo' - assert util.format_explanation(expl) == 'assert foo' + expl = "assert foo" + assert util.format_explanation(expl) == "assert foo" def test_fmt_where(self): - expl = '\n'.join(['assert 1', - '{1 = foo', - '} == 2']) - res = '\n'.join(['assert 1 == 2', - ' + where 1 = foo']) + expl = "\n".join(["assert 1", "{1 = foo", "} == 2"]) + res = "\n".join(["assert 1 == 2", " + where 1 = foo"]) assert util.format_explanation(expl) == res def test_fmt_and(self): - expl = '\n'.join(['assert 1', - '{1 = foo', - '} == 2', - '{2 = bar', - '}']) - res = '\n'.join(['assert 1 == 2', - ' + where 1 = foo', - ' + and 2 = bar']) + expl = "\n".join(["assert 1", "{1 = foo", "} == 2", "{2 = bar", "}"]) + res = "\n".join(["assert 1 == 2", " + where 1 = foo", " + and 2 = bar"]) assert util.format_explanation(expl) == res def test_fmt_where_nested(self): - expl = '\n'.join(['assert 1', - '{1 = foo', - '{foo = bar', - '}', - '} == 2']) - res = '\n'.join(['assert 1 == 2', - ' + where 1 = foo', - ' + where foo = bar']) + expl = "\n".join(["assert 1", "{1 = foo", "{foo = bar", "}", "} == 2"]) + res = "\n".join(["assert 1 == 2", " + where 1 = foo", " + where foo = bar"]) assert util.format_explanation(expl) == res def test_fmt_newline(self): - expl = '\n'.join(['assert "foo" == "bar"', - '~- foo', - '~+ bar']) - res = '\n'.join(['assert "foo" == "bar"', - ' - foo', - ' + bar']) + expl = "\n".join(['assert "foo" == "bar"', "~- foo", "~+ bar"]) + res = "\n".join(['assert "foo" == "bar"', " - foo", " + bar"]) assert util.format_explanation(expl) == res def test_fmt_newline_escaped(self): - expl = '\n'.join(['assert foo == bar', - 'baz']) - res = 'assert foo == bar\\nbaz' + expl = "\n".join(["assert foo == bar", "baz"]) + res = "assert foo == bar\\nbaz" assert util.format_explanation(expl) == res def test_fmt_newline_before_where(self): - expl = '\n'.join(['the assertion message here', - '>assert 1', - '{1 = foo', - '} == 2', - '{2 = bar', - '}']) - res = '\n'.join(['the assertion message here', - 'assert 1 == 2', - ' + where 1 = foo', - ' + and 2 = bar']) + expl = "\n".join( + [ + "the assertion message here", + ">assert 1", + "{1 = foo", + "} == 2", + "{2 = bar", + "}", + ] + ) + res = "\n".join( + [ + "the assertion message here", + "assert 1 == 2", + " + where 1 = foo", + " + and 2 = bar", + ] + ) assert util.format_explanation(expl) == res def test_fmt_multi_newline_before_where(self): - expl = '\n'.join(['the assertion', - '~message here', - '>assert 1', - '{1 = foo', - '} == 2', - '{2 = bar', - '}']) - res = '\n'.join(['the assertion', - ' message here', - 'assert 1 == 2', - ' + where 1 = foo', - ' + and 2 = bar']) + expl = "\n".join( + [ + "the assertion", + "~message here", + ">assert 1", + "{1 = foo", + "} == 2", + "{2 = bar", + "}", + ] + ) + res = "\n".join( + [ + "the assertion", + " message here", + "assert 1 == 2", + " + where 1 = foo", + " + and 2 = bar", + ] + ) assert util.format_explanation(expl) == res @@ -627,58 +658,58 @@ class TestTruncateExplanation(object): assert result == expl def test_doesnt_truncate_at_when_input_is_5_lines_and_LT_max_chars(self): - expl = ['a' * 100 for x in range(5)] + expl = ["a" * 100 for x in range(5)] result = truncate._truncate_explanation(expl, max_lines=8, max_chars=8 * 80) assert result == expl def test_truncates_at_8_lines_when_given_list_of_empty_strings(self): - expl = ['' for x in range(50)] + expl = ["" for x in range(50)] result = truncate._truncate_explanation(expl, max_lines=8, max_chars=100) assert result != expl assert len(result) == 8 + self.LINES_IN_TRUNCATION_MSG assert "Full output truncated" in result[-1] assert "43 lines hidden" in result[-1] - last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG - 1] + last_line_before_trunc_msg = result[-self.LINES_IN_TRUNCATION_MSG - 1] assert last_line_before_trunc_msg.endswith("...") def test_truncates_at_8_lines_when_first_8_lines_are_LT_max_chars(self): - expl = ['a' for x in range(100)] + expl = ["a" for x in range(100)] result = truncate._truncate_explanation(expl, max_lines=8, max_chars=8 * 80) assert result != expl assert len(result) == 8 + self.LINES_IN_TRUNCATION_MSG assert "Full output truncated" in result[-1] assert "93 lines hidden" in result[-1] - last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG - 1] + last_line_before_trunc_msg = result[-self.LINES_IN_TRUNCATION_MSG - 1] assert last_line_before_trunc_msg.endswith("...") def test_truncates_at_8_lines_when_first_8_lines_are_EQ_max_chars(self): - expl = ['a' * 80 for x in range(16)] + expl = ["a" * 80 for x in range(16)] result = truncate._truncate_explanation(expl, max_lines=8, max_chars=8 * 80) assert result != expl assert len(result) == 8 + self.LINES_IN_TRUNCATION_MSG assert "Full output truncated" in result[-1] assert "9 lines hidden" in result[-1] - last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG - 1] + last_line_before_trunc_msg = result[-self.LINES_IN_TRUNCATION_MSG - 1] assert last_line_before_trunc_msg.endswith("...") def test_truncates_at_4_lines_when_first_4_lines_are_GT_max_chars(self): - expl = ['a' * 250 for x in range(10)] + expl = ["a" * 250 for x in range(10)] result = truncate._truncate_explanation(expl, max_lines=8, max_chars=999) assert result != expl assert len(result) == 4 + self.LINES_IN_TRUNCATION_MSG assert "Full output truncated" in result[-1] assert "7 lines hidden" in result[-1] - last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG - 1] + last_line_before_trunc_msg = result[-self.LINES_IN_TRUNCATION_MSG - 1] assert last_line_before_trunc_msg.endswith("...") def test_truncates_at_1_line_when_first_line_is_GT_max_chars(self): - expl = ['a' * 250 for x in range(1000)] + expl = ["a" * 250 for x in range(1000)] result = truncate._truncate_explanation(expl, max_lines=8, max_chars=100) assert result != expl assert len(result) == 1 + self.LINES_IN_TRUNCATION_MSG assert "Full output truncated" in result[-1] assert "1000 lines hidden" in result[-1] - last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG - 1] + last_line_before_trunc_msg = result[-self.LINES_IN_TRUNCATION_MSG - 1] assert last_line_before_trunc_msg.endswith("...") def test_full_output_truncated(self, monkeypatch, testdir): @@ -687,128 +718,160 @@ class TestTruncateExplanation(object): line_count = 7 line_len = 100 expected_truncated_lines = 2 - testdir.makepyfile(r""" + testdir.makepyfile( + r""" def test_many_lines(): a = list([str(i)[0] * %d for i in range(%d)]) b = a[::2] a = '\n'.join(map(str, a)) b = '\n'.join(map(str, b)) assert a == b - """ % (line_len, line_count)) - monkeypatch.delenv('CI', raising=False) + """ + % (line_len, line_count) + ) + monkeypatch.delenv("CI", raising=False) result = testdir.runpytest() # without -vv, truncate the message showing a few diff lines only - result.stdout.fnmatch_lines([ - "*- 1*", - "*- 3*", - "*- 5*", - "*truncated (%d lines hidden)*use*-vv*" % expected_truncated_lines, - ]) + result.stdout.fnmatch_lines( + [ + "*- 1*", + "*- 3*", + "*- 5*", + "*truncated (%d lines hidden)*use*-vv*" % expected_truncated_lines, + ] + ) - result = testdir.runpytest('-vv') - result.stdout.fnmatch_lines([ - "* 6*", - ]) + result = testdir.runpytest("-vv") + result.stdout.fnmatch_lines(["* 6*"]) - monkeypatch.setenv('CI', '1') + monkeypatch.setenv("CI", "1") result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "* 6*", - ]) + result.stdout.fnmatch_lines(["* 6*"]) def test_python25_compile_issue257(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_rewritten(): assert 1 == 2 # some comment - """) + """ + ) result = testdir.runpytest() assert result.ret == 1 - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *E*assert 1 == 2* *1 failed* - """) + """ + ) def test_rewritten(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_rewritten(): assert "@py_builtins" in globals() - """) + """ + ) assert testdir.runpytest().ret == 0 def test_reprcompare_notin(mock_config): detail = plugin.pytest_assertrepr_compare( - mock_config, 'not in', 'foo', 'aaafoobbb')[1:] - assert detail == ["'foo' is contained here:", ' aaafoobbb', '? +++'] + mock_config, "not in", "foo", "aaafoobbb" + )[ + 1: + ] + assert detail == ["'foo' is contained here:", " aaafoobbb", "? +++"] + + +def test_reprcompare_whitespaces(mock_config): + detail = plugin.pytest_assertrepr_compare(mock_config, "==", "\r\n", "\n") + assert ( + detail + == [ + r"'\r\n' == '\n'", + r"Strings contain only whitespace, escaping them using repr()", + r"- '\r\n'", + r"? --", + r"+ '\n'", + ] + ) def test_pytest_assertrepr_compare_integration(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_hello(): x = set(range(100)) y = x.copy() y.remove(50) assert x == y - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*def test_hello():*", - "*assert x == y*", - "*E*Extra items*left*", - "*E*50*", - ]) + result.stdout.fnmatch_lines( + ["*def test_hello():*", "*assert x == y*", "*E*Extra items*left*", "*E*50*"] + ) def test_sequence_comparison_uses_repr(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_hello(): x = set("hello x") y = set("hello y") assert x == y - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*def test_hello():*", - "*assert x == y*", - "*E*Extra items*left*", - "*E*'x'*", - "*E*Extra items*right*", - "*E*'y'*", - ]) + result.stdout.fnmatch_lines( + [ + "*def test_hello():*", + "*assert x == y*", + "*E*Extra items*left*", + "*E*'x'*", + "*E*Extra items*right*", + "*E*'y'*", + ] + ) def test_assertrepr_loaded_per_dir(testdir): - testdir.makepyfile(test_base=['def test_base(): assert 1 == 2']) - a = testdir.mkdir('a') - a_test = a.join('test_a.py') - a_test.write('def test_a(): assert 1 == 2') - a_conftest = a.join('conftest.py') + testdir.makepyfile(test_base=["def test_base(): assert 1 == 2"]) + a = testdir.mkdir("a") + a_test = a.join("test_a.py") + a_test.write("def test_a(): assert 1 == 2") + a_conftest = a.join("conftest.py") a_conftest.write('def pytest_assertrepr_compare(): return ["summary a"]') - b = testdir.mkdir('b') - b_test = b.join('test_b.py') - b_test.write('def test_b(): assert 1 == 2') - b_conftest = b.join('conftest.py') + b = testdir.mkdir("b") + b_test = b.join("test_b.py") + b_test.write("def test_b(): assert 1 == 2") + b_conftest = b.join("conftest.py") b_conftest.write('def pytest_assertrepr_compare(): return ["summary b"]') result = testdir.runpytest() - result.stdout.fnmatch_lines([ - '*def test_base():*', - '*E*assert 1 == 2*', - '*def test_a():*', - '*E*assert summary a*', - '*def test_b():*', - '*E*assert summary b*']) + result.stdout.fnmatch_lines( + [ + "*def test_base():*", + "*E*assert 1 == 2*", + "*def test_a():*", + "*E*assert summary a*", + "*def test_b():*", + "*E*assert summary b*", + ] + ) def test_assertion_options(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_hello(): x = 3 assert x == 4 - """) + """ + ) result = testdir.runpytest() assert "3 == 4" in result.stdout.str() result = testdir.runpytest_subprocess("--assert=plain") @@ -816,72 +879,82 @@ def test_assertion_options(testdir): def test_triple_quoted_string_issue113(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_hello(): assert "" == ''' - '''""") + '''""" + ) result = testdir.runpytest("--fulltrace") - result.stdout.fnmatch_lines([ - "*1 failed*", - ]) - assert 'SyntaxError' not in result.stdout.str() + result.stdout.fnmatch_lines(["*1 failed*"]) + assert "SyntaxError" not in result.stdout.str() def test_traceback_failure(testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ def g(): return 2 def f(x): assert x == g() def test_onefails(): f(3) - """) + """ + ) result = testdir.runpytest(p1, "--tb=long") - result.stdout.fnmatch_lines([ - "*test_traceback_failure.py F*", - "====* FAILURES *====", - "____*____", - "", - " def test_onefails():", - "> f(3)", - "", - "*test_*.py:6: ", - "_ _ _ *", - # "", - " def f(x):", - "> assert x == g()", - "E assert 3 == 2", - "E + where 2 = g()", - "", - "*test_traceback_failure.py:4: AssertionError" - ]) + result.stdout.fnmatch_lines( + [ + "*test_traceback_failure.py F*", + "====* FAILURES *====", + "____*____", + "", + " def test_onefails():", + "> f(3)", + "", + "*test_*.py:6: ", + "_ _ _ *", + # "", + " def f(x):", + "> assert x == g()", + "E assert 3 == 2", + "E + where 2 = g()", + "", + "*test_traceback_failure.py:4: AssertionError", + ] + ) result = testdir.runpytest(p1) # "auto" - result.stdout.fnmatch_lines([ - "*test_traceback_failure.py F*", - "====* FAILURES *====", - "____*____", - "", - " def test_onefails():", - "> f(3)", - "", - "*test_*.py:6: ", - "", - " def f(x):", - "> assert x == g()", - "E assert 3 == 2", - "E + where 2 = g()", - "", - "*test_traceback_failure.py:4: AssertionError" - ]) + result.stdout.fnmatch_lines( + [ + "*test_traceback_failure.py F*", + "====* FAILURES *====", + "____*____", + "", + " def test_onefails():", + "> f(3)", + "", + "*test_*.py:6: ", + "", + " def f(x):", + "> assert x == g()", + "E assert 3 == 2", + "E + where 2 = g()", + "", + "*test_traceback_failure.py:4: AssertionError", + ] + ) -@pytest.mark.skipif(sys.version_info[:2] <= (3, 3), reason='Python 3.4+ shows chained exceptions on multiprocess') +@pytest.mark.skipif( + sys.version_info[:2] <= (3, 3), + reason="Python 3.4+ shows chained exceptions on multiprocess", +) def test_exception_handling_no_traceback(testdir): """ Handle chain exceptions in tasks submitted by the multiprocess module (#1984). """ - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ from multiprocessing import Pool def process_task(n): @@ -894,64 +967,76 @@ def test_exception_handling_no_traceback(testdir): def test_multitask_job(): multitask_job() - """) + """ + ) result = testdir.runpytest(p1, "--tb=long") - result.stdout.fnmatch_lines([ - "====* FAILURES *====", - "*multiprocessing.pool.RemoteTraceback:*", - "Traceback (most recent call last):", - "*assert n == 10", - "The above exception was the direct cause of the following exception:", - "> * multitask_job()", - ]) + result.stdout.fnmatch_lines( + [ + "====* FAILURES *====", + "*multiprocessing.pool.RemoteTraceback:*", + "Traceback (most recent call last):", + "*assert n == 10", + "The above exception was the direct cause of the following exception:", + "> * multitask_job()", + ] + ) -@pytest.mark.skipif("'__pypy__' in sys.builtin_module_names or sys.platform.startswith('java')") +@pytest.mark.skipif( + "'__pypy__' in sys.builtin_module_names or sys.platform.startswith('java')" +) def test_warn_missing(testdir): testdir.makepyfile("") result = testdir.run(sys.executable, "-OO", "-m", "pytest", "-h") - result.stderr.fnmatch_lines([ - "*WARNING*assert statements are not executed*", - ]) + result.stderr.fnmatch_lines(["*WARNING*assert statements are not executed*"]) result = testdir.run(sys.executable, "-OO", "-m", "pytest") - result.stderr.fnmatch_lines([ - "*WARNING*assert statements are not executed*", - ]) + result.stderr.fnmatch_lines(["*WARNING*assert statements are not executed*"]) def test_recursion_source_decode(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_something(): pass - """) - testdir.makeini(""" + """ + ) + testdir.makeini( + """ [pytest] python_files = *.py - """) + """ + ) result = testdir.runpytest("--collect-only") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ - """) + """ + ) def test_AssertionError_message(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_hello(): x,y = 1,2 assert 0, (x,y) - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *def test_hello* *assert 0, (x,y)* *AssertionError: (1, 2)* - """) + """ + ) -@pytest.mark.skipif(PY3, reason='This bug does not exist on PY3') +@pytest.mark.skipif(PY3, reason="This bug does not exist on PY3") def test_set_with_unsortable_elements(): # issue #718 class UnsortableKey(object): + def __init__(self, name): self.name = name @@ -959,7 +1044,7 @@ def test_set_with_unsortable_elements(): raise RuntimeError() def __repr__(self): - return 'repr({0})'.format(self.name) + return "repr({})".format(self.name) def __eq__(self, other): return self.name == other.name @@ -967,12 +1052,13 @@ def test_set_with_unsortable_elements(): def __hash__(self): return hash(self.name) - left_set = set(UnsortableKey(str(i)) for i in range(1, 3)) - right_set = set(UnsortableKey(str(i)) for i in range(2, 4)) + left_set = {UnsortableKey(str(i)) for i in range(1, 3)} + right_set = {UnsortableKey(str(i)) for i in range(2, 4)} expl = callequal(left_set, right_set, verbose=True) # skip first line because it contains the "construction" of the set, which does not have a guaranteed order expl = expl[1:] - dedent = textwrap.dedent(""" + dedent = textwrap.dedent( + """ Extra items in the left set: repr(1) Extra items in the right set: @@ -981,86 +1067,106 @@ def test_set_with_unsortable_elements(): - repr(1) repr(2) + repr(3) - """).strip() - assert '\n'.join(expl) == dedent + """ + ).strip() + assert "\n".join(expl) == dedent def test_diff_newline_at_end(monkeypatch, testdir): - testdir.makepyfile(r""" + testdir.makepyfile( + r""" def test_diff(): assert 'asdf' == 'asdf\n' - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(r""" + result.stdout.fnmatch_lines( + r""" *assert 'asdf' == 'asdf\n' * - asdf * + asdf * ? + - """) + """ + ) def test_assert_tuple_warning(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_tuple(): assert(False, 'you shall not pass') - """) - result = testdir.runpytest('-rw') - result.stdout.fnmatch_lines([ - '*test_assert_tuple_warning.py:2', - '*assertion is always true*', - ]) + """ + ) + result = testdir.runpytest("-rw") + result.stdout.fnmatch_lines( + ["*test_assert_tuple_warning.py:2", "*assertion is always true*"] + ) def test_assert_indirect_tuple_no_warning(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_tuple(): tpl = ('foo', 'bar') assert tpl - """) - result = testdir.runpytest('-rw') - output = '\n'.join(result.stdout.lines) - assert 'WR1' not in output + """ + ) + result = testdir.runpytest("-rw") + output = "\n".join(result.stdout.lines) + assert "WR1" not in output def test_assert_with_unicode(monkeypatch, testdir): - testdir.makepyfile(u""" + testdir.makepyfile( + u""" # -*- coding: utf-8 -*- def test_unicode(): assert u'유니코드' == u'Unicode' - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(['*AssertionError*']) + result.stdout.fnmatch_lines(["*AssertionError*"]) def test_raise_unprintable_assertion_error(testdir): - testdir.makepyfile(r""" + testdir.makepyfile( + r""" def test_raise_assertion_error(): raise AssertionError('\xff') - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([r"> raise AssertionError('\xff')", 'E AssertionError: *']) + result.stdout.fnmatch_lines( + [r"> raise AssertionError('\xff')", "E AssertionError: *"] + ) def test_raise_assertion_error_raisin_repr(testdir): - testdir.makepyfile(u""" + testdir.makepyfile( + u""" class RaisingRepr(object): def __repr__(self): raise Exception() def test_raising_repr(): raise AssertionError(RaisingRepr()) - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(['E AssertionError: ']) + result.stdout.fnmatch_lines( + ["E AssertionError: "] + ) def test_issue_1944(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def f(): return assert f() == 10 - """) + """ + ) result = testdir.runpytest() result.stdout.fnmatch_lines(["*1 error*"]) assert "AttributeError: 'Module' object has no attribute '_obj'" not in result.stdout.str() diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_assertrewrite.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_assertrewrite.py index 0e22c6dac47..144f625bc6c 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_assertrewrite.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_assertrewrite.py @@ -5,13 +5,18 @@ import os import py_compile import stat import sys +import textwrap import zipfile import py import pytest import _pytest._code from _pytest.assertion import util -from _pytest.assertion.rewrite import rewrite_asserts, PYTEST_TAG, AssertionRewritingHook +from _pytest.assertion.rewrite import ( + rewrite_asserts, + PYTEST_TAG, + AssertionRewritingHook, +) from _pytest.main import EXIT_NOTESTSCOLLECTED ast = pytest.importorskip("ast") @@ -38,7 +43,7 @@ def rewrite(src): def getmsg(f, extra_ns=None, must_pass=False): """Rewrite the assertions in f, run it, and get the failure message.""" - src = '\n'.join(_pytest._code.Code(f).source().lines) + src = "\n".join(_pytest._code.Code(f).source().lines) mod = rewrite(src) code = compile(mod, "", "exec") ns = {} @@ -60,18 +65,35 @@ def getmsg(f, extra_ns=None, must_pass=False): pytest.fail("function didn't raise at all") +def adjust_body_for_new_docstring_in_module_node(m): + """Module docstrings in 3.8 are part of Module node. + This was briefly in 3.7 as well but got reverted in beta 5. + + It's not in the body so we remove it so the following body items have + the same indexes on all Python versions: + + TODO: + + We have a complicated sys.version_info if in here to ease testing on + various Python 3.7 versions, but we should remove the 3.7 check after + 3.7 is released as stable to make this check more straightforward. + """ + if ( + sys.version_info < (3, 8) + and not ((3, 7) <= sys.version_info <= (3, 7, 0, "beta", 4)) + ): + assert len(m.body) > 1 + assert isinstance(m.body[0], ast.Expr) + assert isinstance(m.body[0].value, ast.Str) + del m.body[0] + + class TestAssertionRewrite(object): def test_place_initial_imports(self): s = """'Doc string'\nother = stuff""" m = rewrite(s) - # Module docstrings in 3.7 are part of Module node, it's not in the body - # so we remove it so the following body items have the same indexes on - # all Python versions - if sys.version_info < (3, 7): - assert isinstance(m.body[0], ast.Expr) - assert isinstance(m.body[0].value, ast.Str) - del m.body[0] + adjust_body_for_new_docstring_in_module_node(m) for imp in m.body[0:2]: assert isinstance(imp, ast.Import) assert imp.lineno == 2 @@ -87,10 +109,7 @@ class TestAssertionRewrite(object): assert isinstance(m.body[3], ast.Expr) s = """'doc string'\nfrom __future__ import with_statement""" m = rewrite(s) - if sys.version_info < (3, 7): - assert isinstance(m.body[0], ast.Expr) - assert isinstance(m.body[0].value, ast.Str) - del m.body[0] + adjust_body_for_new_docstring_in_module_node(m) assert isinstance(m.body[0], ast.ImportFrom) for imp in m.body[1:3]: assert isinstance(imp, ast.Import) @@ -98,10 +117,7 @@ class TestAssertionRewrite(object): assert imp.col_offset == 0 s = """'doc string'\nfrom __future__ import with_statement\nother""" m = rewrite(s) - if sys.version_info < (3, 7): - assert isinstance(m.body[0], ast.Expr) - assert isinstance(m.body[0].value, ast.Str) - del m.body[0] + adjust_body_for_new_docstring_in_module_node(m) assert isinstance(m.body[0], ast.ImportFrom) for imp in m.body[1:3]: assert isinstance(imp, ast.Import) @@ -119,18 +135,25 @@ class TestAssertionRewrite(object): def test_dont_rewrite(self): s = """'PYTEST_DONT_REWRITE'\nassert 14""" m = rewrite(s) - if sys.version_info < (3, 7): - assert len(m.body) == 2 - assert isinstance(m.body[0], ast.Expr) - assert isinstance(m.body[0].value, ast.Str) - del m.body[0] - else: - assert len(m.body) == 1 + adjust_body_for_new_docstring_in_module_node(m) + assert len(m.body) == 1 assert m.body[0].msg is None + def test_dont_rewrite_plugin(self, testdir): + contents = { + "conftest.py": "pytest_plugins = 'plugin'; import plugin", + "plugin.py": "'PYTEST_DONT_REWRITE'", + "test_foo.py": "def test_foo(): pass", + } + testdir.makepyfile(**contents) + result = testdir.runpytest_subprocess() + assert "warnings" not in "".join(result.outlines) + def test_name(self): + def f(): assert False + assert getmsg(f) == "assert False" def f(): @@ -158,72 +181,77 @@ class TestAssertionRewrite(object): assert getmsg(f, {"cls": X}) == "assert cls == 42" def test_assert_already_has_message(self): + def f(): assert False, "something bad!" + assert getmsg(f) == "AssertionError: something bad!\nassert False" def test_assertion_message(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_foo(): assert 1 == 2, "The failure message" - """) + """ + ) result = testdir.runpytest() assert result.ret == 1 - result.stdout.fnmatch_lines([ - "*AssertionError*The failure message*", - "*assert 1 == 2*", - ]) + result.stdout.fnmatch_lines( + ["*AssertionError*The failure message*", "*assert 1 == 2*"] + ) def test_assertion_message_multiline(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_foo(): assert 1 == 2, "A multiline\\nfailure message" - """) + """ + ) result = testdir.runpytest() assert result.ret == 1 - result.stdout.fnmatch_lines([ - "*AssertionError*A multiline*", - "*failure message*", - "*assert 1 == 2*", - ]) + result.stdout.fnmatch_lines( + ["*AssertionError*A multiline*", "*failure message*", "*assert 1 == 2*"] + ) def test_assertion_message_tuple(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_foo(): assert 1 == 2, (1, 2) - """) + """ + ) result = testdir.runpytest() assert result.ret == 1 - result.stdout.fnmatch_lines([ - "*AssertionError*%s*" % repr((1, 2)), - "*assert 1 == 2*", - ]) + result.stdout.fnmatch_lines( + ["*AssertionError*%s*" % repr((1, 2)), "*assert 1 == 2*"] + ) def test_assertion_message_expr(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_foo(): assert 1 == 2, 1 + 2 - """) + """ + ) result = testdir.runpytest() assert result.ret == 1 - result.stdout.fnmatch_lines([ - "*AssertionError*3*", - "*assert 1 == 2*", - ]) + result.stdout.fnmatch_lines(["*AssertionError*3*", "*assert 1 == 2*"]) def test_assertion_message_escape(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_foo(): assert 1 == 2, 'To be escaped: %' - """) + """ + ) result = testdir.runpytest() assert result.ret == 1 - result.stdout.fnmatch_lines([ - "*AssertionError: To be escaped: %", - "*assert 1 == 2", - ]) + result.stdout.fnmatch_lines( + ["*AssertionError: To be escaped: %", "*assert 1 == 2"] + ) def test_boolop(self): + def f(): f = g = False assert f and g @@ -262,14 +290,20 @@ class TestAssertionRewrite(object): def f(): assert x() and x() - assert getmsg(f, {"x": x}) == """assert (False) + assert ( + getmsg(f, {"x": x}) + == """assert (False) + where False = x()""" + ) def f(): assert False or x() - assert getmsg(f, {"x": x}) == """assert (False or False) + assert ( + getmsg(f, {"x": x}) + == """assert (False or False) + where False = x()""" + ) def f(): assert 1 in {} and 2 in {} @@ -297,6 +331,7 @@ class TestAssertionRewrite(object): getmsg(f, must_pass=True) def test_short_circuit_evaluation(self): + def f(): assert True or explode # noqa @@ -309,6 +344,7 @@ class TestAssertionRewrite(object): getmsg(f, must_pass=True) def test_unary_op(self): + def f(): x = True assert not x @@ -334,6 +370,7 @@ class TestAssertionRewrite(object): assert getmsg(f) == "assert (+0 + 0)" def test_binary_op(self): + def f(): x = 1 y = -1 @@ -343,9 +380,11 @@ class TestAssertionRewrite(object): def f(): assert not 5 % 4 + assert getmsg(f) == "assert not (5 % 4)" def test_boolop_percent(self): + def f(): assert 3 % 2 and False @@ -353,11 +392,13 @@ class TestAssertionRewrite(object): def f(): assert False or 4 % 2 + assert getmsg(f) == "assert (False or (4 % 2))" @pytest.mark.skipif("sys.version_info < (3,5)") def test_at_operator_issue1290(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ class Matrix(object): def __init__(self, num): self.num = num @@ -365,10 +406,12 @@ class TestAssertionRewrite(object): return self.num * other.num def test_multmat_operator(): - assert Matrix(2) @ Matrix(3) == 6""") + assert Matrix(2) @ Matrix(3) == 6""" + ) testdir.runpytest().assert_outcomes(passed=1) def test_call(self): + def g(a=42, *args, **kwargs): return False @@ -377,48 +420,70 @@ class TestAssertionRewrite(object): def f(): assert g() - assert getmsg(f, ns) == """assert False + assert ( + getmsg(f, ns) + == """assert False + where False = g()""" + ) def f(): assert g(1) - assert getmsg(f, ns) == """assert False + assert ( + getmsg(f, ns) + == """assert False + where False = g(1)""" + ) def f(): assert g(1, 2) - assert getmsg(f, ns) == """assert False + assert ( + getmsg(f, ns) + == """assert False + where False = g(1, 2)""" + ) def f(): assert g(1, g=42) - assert getmsg(f, ns) == """assert False + assert ( + getmsg(f, ns) + == """assert False + where False = g(1, g=42)""" + ) def f(): assert g(1, 3, g=23) - assert getmsg(f, ns) == """assert False + assert ( + getmsg(f, ns) + == """assert False + where False = g(1, 3, g=23)""" + ) def f(): seq = [1, 2, 3] assert g(*seq) - assert getmsg(f, ns) == """assert False + assert ( + getmsg(f, ns) + == """assert False + where False = g(*[1, 2, 3])""" + ) def f(): x = "a" assert g(**{x: 2}) - assert getmsg(f, ns) == """assert False + assert ( + getmsg(f, ns) + == """assert False + where False = g(**{'a': 2})""" + ) def test_attribute(self): + class X(object): g = 3 @@ -427,15 +492,21 @@ class TestAssertionRewrite(object): def f(): assert not x.g # noqa - assert getmsg(f, ns) == """assert not 3 + assert ( + getmsg(f, ns) + == """assert not 3 + where 3 = x.g""" + ) def f(): x.a = False # noqa - assert x.a # noqa + assert x.a # noqa - assert getmsg(f, ns) == """assert False + assert ( + getmsg(f, ns) + == """assert False + where False = x.a""" + ) def test_comparisons(self): @@ -476,10 +547,13 @@ class TestAssertionRewrite(object): values = list(range(10)) assert len(values) == 11 - assert getmsg(f).startswith("""assert 10 == 11 - + where 10 = len([""") + assert getmsg(f).startswith( + """assert 10 == 11 + + where 10 = len([""" + ) def test_custom_reprcompare(self, monkeypatch): + def my_reprcompare(op, left, right): return "42" @@ -501,7 +575,9 @@ class TestAssertionRewrite(object): assert getmsg(f) == "assert 5 <= 4" def test_assert_raising_nonzero_in_comparison(self): + def f(): + class A(object): def __nonzero__(self): @@ -521,13 +597,16 @@ class TestAssertionRewrite(object): assert " < 0" in getmsg(f) def test_formatchar(self): + def f(): assert "%test" == "test" assert getmsg(f).startswith("assert '%test' == 'test'") def test_custom_repr(self): + def f(): + class Foo(object): a = 1 @@ -544,18 +623,22 @@ class TestRewriteOnImport(object): def test_pycache_is_a_file(self, testdir): testdir.tmpdir.join("__pycache__").write("Hello") - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_rewritten(): - assert "@py_builtins" in globals()""") + assert "@py_builtins" in globals()""" + ) assert testdir.runpytest().ret == 0 def test_pycache_is_readonly(self, testdir): cache = testdir.tmpdir.mkdir("__pycache__") old_mode = cache.stat().mode cache.chmod(old_mode ^ stat.S_IWRITE) - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_rewritten(): - assert "@py_builtins" in globals()""") + assert "@py_builtins" in globals()""" + ) try: assert testdir.runpytest().ret == 0 finally: @@ -571,19 +654,28 @@ class TestRewriteOnImport(object): finally: f.close() z.chmod(256) - testdir.makepyfile(""" + testdir.makepyfile( + """ import sys sys.path.append(%r) - import test_gum.test_lizard""" % (z_fn,)) + import test_gum.test_lizard""" + % (z_fn,) + ) assert testdir.runpytest().ret == EXIT_NOTESTSCOLLECTED def test_readonly(self, testdir): sub = testdir.mkdir("testing") sub.join("test_readonly.py").write( - py.builtin._totext(""" + py.builtin._totext( + """ def test_rewritten(): assert "@py_builtins" in globals() - """).encode("utf-8"), "wb") + """ + ).encode( + "utf-8" + ), + "wb", + ) old_mode = sub.stat().mode sub.chmod(320) try: @@ -592,27 +684,33 @@ def test_rewritten(): sub.chmod(old_mode) def test_dont_write_bytecode(self, testdir, monkeypatch): - testdir.makepyfile(""" + testdir.makepyfile( + """ import os def test_no_bytecode(): assert "__pycache__" in __cached__ assert not os.path.exists(__cached__) - assert not os.path.exists(os.path.dirname(__cached__))""") + assert not os.path.exists(os.path.dirname(__cached__))""" + ) monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", "1") assert testdir.runpytest_subprocess().ret == 0 def test_orphaned_pyc_file(self, testdir): - if sys.version_info < (3, 0) and hasattr(sys, 'pypy_version_info'): + if sys.version_info < (3, 0) and hasattr(sys, "pypy_version_info"): pytest.skip("pypy2 doesn't run orphaned pyc files") - testdir.makepyfile(""" + testdir.makepyfile( + """ import orphan def test_it(): assert orphan.value == 17 - """) - testdir.makepyfile(orphan=""" + """ + ) + testdir.makepyfile( + orphan=""" value = 17 - """) + """ + ) py_compile.compile("orphan.py") os.remove("orphan.py") @@ -628,14 +726,16 @@ def test_rewritten(): @pytest.mark.skipif('"__pypy__" in sys.modules') def test_pyc_vs_pyo(self, testdir, monkeypatch): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def test_optimized(): "hello" assert test_optimized.__doc__ is None""" - ) - p = py.path.local.make_numbered_dir(prefix="runpytest-", keep=None, - rootdir=testdir.tmpdir) + ) + p = py.path.local.make_numbered_dir( + prefix="runpytest-", keep=None, rootdir=testdir.tmpdir + ) tmp = "--basetemp=%s" % p monkeypatch.setenv("PYTHONOPTIMIZE", "2") monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=False) @@ -651,9 +751,11 @@ def test_rewritten(): pkg = testdir.tmpdir.join("pkg") pkg.mkdir() pkg.join("__init__.py").ensure() - pkg.join("test_blah.py").write(""" + pkg.join("test_blah.py").write( + """ def test_rewritten(): - assert "@py_builtins" in globals()""") + assert "@py_builtins" in globals()""" + ) assert testdir.runpytest().ret == 0 def test_translate_newlines(self, testdir): @@ -662,11 +764,13 @@ def test_rewritten(): testdir.tmpdir.join("test_newlines.py").write(b, "wb") assert testdir.runpytest().ret == 0 - @pytest.mark.skipif(sys.version_info < (3, 4), - reason='packages without __init__.py not supported on python 2') + @pytest.mark.skipif( + sys.version_info < (3, 4), + reason="packages without __init__.py not supported on python 2", + ) def test_package_without__init__py(self, testdir): - pkg = testdir.mkdir('a_package_without_init_py') - pkg.join('module.py').ensure() + pkg = testdir.mkdir("a_package_without_init_py") + pkg.join("module.py").ensure() testdir.makepyfile("import a_package_without_init_py.module") assert testdir.runpytest().ret == EXIT_NOTESTSCOLLECTED @@ -677,18 +781,22 @@ def test_rewritten(): def mywarn(code, msg): warnings.append((code, msg)) - monkeypatch.setattr(hook.config, 'warn', mywarn) - hook.mark_rewrite('_pytest') - assert '_pytest' in warnings[0][1] + monkeypatch.setattr(hook.config, "warn", mywarn) + hook.mark_rewrite("_pytest") + assert "_pytest" in warnings[0][1] def test_rewrite_module_imported_from_conftest(self, testdir): - testdir.makeconftest(''' + testdir.makeconftest( + """ import test_rewrite_module_imported - ''') - testdir.makepyfile(test_rewrite_module_imported=''' + """ + ) + testdir.makepyfile( + test_rewrite_module_imported=""" def test_rewritten(): assert "@py_builtins" in globals() - ''') + """ + ) assert testdir.runpytest_subprocess().ret == 0 def test_remember_rewritten_modules(self, pytestconfig, testdir, monkeypatch): @@ -697,46 +805,50 @@ def test_rewritten(): doesn't give false positives (#2005). """ monkeypatch.syspath_prepend(testdir.tmpdir) - testdir.makepyfile(test_remember_rewritten_modules='') + testdir.makepyfile(test_remember_rewritten_modules="") warnings = [] hook = AssertionRewritingHook(pytestconfig) - monkeypatch.setattr(hook.config, 'warn', lambda code, msg: warnings.append(msg)) - hook.find_module('test_remember_rewritten_modules') - hook.load_module('test_remember_rewritten_modules') - hook.mark_rewrite('test_remember_rewritten_modules') - hook.mark_rewrite('test_remember_rewritten_modules') + monkeypatch.setattr(hook.config, "warn", lambda code, msg: warnings.append(msg)) + hook.find_module("test_remember_rewritten_modules") + hook.load_module("test_remember_rewritten_modules") + hook.mark_rewrite("test_remember_rewritten_modules") + hook.mark_rewrite("test_remember_rewritten_modules") assert warnings == [] def test_rewrite_warning_using_pytest_plugins(self, testdir): - testdir.makepyfile(**{ - 'conftest.py': "pytest_plugins = ['core', 'gui', 'sci']", - 'core.py': "", - 'gui.py': "pytest_plugins = ['core', 'sci']", - 'sci.py': "pytest_plugins = ['core']", - 'test_rewrite_warning_pytest_plugins.py': "def test(): pass", - }) + testdir.makepyfile( + **{ + "conftest.py": "pytest_plugins = ['core', 'gui', 'sci']", + "core.py": "", + "gui.py": "pytest_plugins = ['core', 'sci']", + "sci.py": "pytest_plugins = ['core']", + "test_rewrite_warning_pytest_plugins.py": "def test(): pass", + } + ) testdir.chdir() result = testdir.runpytest_subprocess() - result.stdout.fnmatch_lines(['*= 1 passed in *=*']) - assert 'pytest-warning summary' not in result.stdout.str() + result.stdout.fnmatch_lines(["*= 1 passed in *=*"]) + assert "pytest-warning summary" not in result.stdout.str() def test_rewrite_warning_using_pytest_plugins_env_var(self, testdir, monkeypatch): - monkeypatch.setenv('PYTEST_PLUGINS', 'plugin') - testdir.makepyfile(**{ - 'plugin.py': "", - 'test_rewrite_warning_using_pytest_plugins_env_var.py': """ + monkeypatch.setenv("PYTEST_PLUGINS", "plugin") + testdir.makepyfile( + **{ + "plugin.py": "", + "test_rewrite_warning_using_pytest_plugins_env_var.py": """ import plugin pytest_plugins = ['plugin'] def test(): pass """, - }) + } + ) testdir.chdir() result = testdir.runpytest_subprocess() - result.stdout.fnmatch_lines(['*= 1 passed in *=*']) - assert 'pytest-warning summary' not in result.stdout.str() + result.stdout.fnmatch_lines(["*= 1 passed in *=*"]) + assert "pytest-warning summary" not in result.stdout.str() - @pytest.mark.skipif(sys.version_info[0] > 2, reason='python 2 only') + @pytest.mark.skipif(sys.version_info[0] > 2, reason="python 2 only") def test_rewrite_future_imports(self, testdir): """Test that rewritten modules don't inherit the __future__ flags from the assertrewrite module. @@ -746,28 +858,32 @@ def test_rewritten(): The test below will fail if __future__.division is enabled """ - testdir.makepyfile(''' + testdir.makepyfile( + """ def test(): x = 1 / 2 assert type(x) is int - ''') + """ + ) result = testdir.runpytest() assert result.ret == 0 class TestAssertionRewriteHookDetails(object): + def test_loader_is_package_false_for_module(self, testdir): - testdir.makepyfile(test_fun=""" + testdir.makepyfile( + test_fun=""" def test_loader(): assert not __loader__.is_package(__name__) - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "* 1 passed*", - ]) + result.stdout.fnmatch_lines(["* 1 passed*"]) def test_loader_is_package_true_for_package(self, testdir): - testdir.makepyfile(test_fun=""" + testdir.makepyfile( + test_fun=""" def test_loader(): assert not __loader__.is_package(__name__) @@ -776,12 +892,11 @@ class TestAssertionRewriteHookDetails(object): def test_missing(): assert not __loader__.is_package('pytest_not_there') - """) - testdir.mkpydir('fun') + """ + ) + testdir.mkpydir("fun") result = testdir.runpytest() - result.stdout.fnmatch_lines([ - '* 3 passed*', - ]) + result.stdout.fnmatch_lines(["* 3 passed*"]) @pytest.mark.skipif("sys.version_info[0] >= 3") @pytest.mark.xfail("hasattr(sys, 'pypy_translation_info')") @@ -794,56 +909,65 @@ class TestAssertionRewriteHookDetails(object): @pytest.mark.skipif("sys.version_info[0] >= 3") def test_detect_coding_cookie(self, testdir): - testdir.makepyfile(test_cookie=""" + testdir.makepyfile( + test_cookie=""" # -*- coding: utf-8 -*- u"St\xc3\xa4d" def test_rewritten(): - assert "@py_builtins" in globals()""") + assert "@py_builtins" in globals()""" + ) assert testdir.runpytest().ret == 0 @pytest.mark.skipif("sys.version_info[0] >= 3") def test_detect_coding_cookie_second_line(self, testdir): - testdir.makepyfile(test_cookie=""" + testdir.makepyfile( + test_cookie=""" # -*- coding: utf-8 -*- u"St\xc3\xa4d" def test_rewritten(): - assert "@py_builtins" in globals()""") + assert "@py_builtins" in globals()""" + ) assert testdir.runpytest().ret == 0 @pytest.mark.skipif("sys.version_info[0] >= 3") def test_detect_coding_cookie_crlf(self, testdir): - testdir.makepyfile(test_cookie=""" + testdir.makepyfile( + test_cookie=""" # -*- coding: utf-8 -*- u"St\xc3\xa4d" def test_rewritten(): - assert "@py_builtins" in globals()""") + assert "@py_builtins" in globals()""" + ) assert testdir.runpytest().ret == 0 def test_sys_meta_path_munged(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_meta_path(): - import sys; sys.meta_path = []""") + import sys; sys.meta_path = []""" + ) assert testdir.runpytest().ret == 0 def test_write_pyc(self, testdir, tmpdir, monkeypatch): from _pytest.assertion.rewrite import _write_pyc from _pytest.assertion import AssertionState - try: - import __builtin__ as b - except ImportError: - import builtins as b + import atomicwrites + from contextlib import contextmanager + config = testdir.parseconfig([]) state = AssertionState(config, "rewrite") source_path = tmpdir.ensure("source.py") pycpath = tmpdir.join("pyc").strpath assert _write_pyc(state, [1], source_path.stat(), pycpath) - def open(*args): + @contextmanager + def atomic_write_failed(fn, mode="r", overwrite=False): e = IOError() e.errno = 10 raise e + yield # noqa - monkeypatch.setattr(b, "open", open) + monkeypatch.setattr(atomicwrites, "atomic_write", atomic_write_failed) assert not _write_pyc(state, [1], source_path.stat(), pycpath) def test_resources_provider_for_loader(self, testdir): @@ -855,9 +979,9 @@ class TestAssertionRewriteHookDetails(object): """ pytest.importorskip("pkg_resources") - testdir.mkpydir('testpkg') + testdir.mkpydir("testpkg") contents = { - 'testpkg/test_pkg': """ + "testpkg/test_pkg": """ import pkg_resources import pytest @@ -868,10 +992,10 @@ class TestAssertionRewriteHookDetails(object): res = pkg_resources.resource_string(__name__, 'resource.txt') res = res.decode('ascii') assert res == 'Load me please.' - """, + """ } testdir.makepyfile(**contents) - testdir.maketxtfile(**{'testpkg/resource': "Load me please."}) + testdir.maketxtfile(**{"testpkg/resource": "Load me please."}) result = testdir.runpytest_subprocess() result.assert_outcomes(passed=1) @@ -885,28 +1009,33 @@ class TestAssertionRewriteHookDetails(object): import py_compile from _pytest.assertion.rewrite import _read_pyc - source = tmpdir.join('source.py') - pyc = source + 'c' + source = tmpdir.join("source.py") + pyc = source + "c" - source.write('def test(): pass') + source.write("def test(): pass") py_compile.compile(str(source), str(pyc)) - contents = pyc.read(mode='rb') + contents = pyc.read(mode="rb") strip_bytes = 20 # header is around 8 bytes, strip a little more assert len(contents) > strip_bytes - pyc.write(contents[:strip_bytes], mode='wb') + pyc.write(contents[:strip_bytes], mode="wb") assert _read_pyc(source, str(pyc)) is None # no error def test_reload_is_same(self, testdir): # A file that will be picked up during collecting. testdir.tmpdir.join("file.py").ensure() - testdir.tmpdir.join("pytest.ini").write(py.std.textwrap.dedent(""" + testdir.tmpdir.join("pytest.ini").write( + textwrap.dedent( + """ [pytest] python_files = *.py - """)) + """ + ) + ) - testdir.makepyfile(test_fun=""" + testdir.makepyfile( + test_fun=""" import sys try: from imp import reload @@ -916,30 +1045,34 @@ class TestAssertionRewriteHookDetails(object): def test_loader(): import file assert sys.modules["file"] is reload(file) - """) - result = testdir.runpytest('-s') - result.stdout.fnmatch_lines([ - "* 1 passed*", - ]) + """ + ) + result = testdir.runpytest("-s") + result.stdout.fnmatch_lines(["* 1 passed*"]) def test_get_data_support(self, testdir): """Implement optional PEP302 api (#808). """ path = testdir.mkpydir("foo") - path.join("test_foo.py").write(_pytest._code.Source(""" + path.join("test_foo.py").write( + _pytest._code.Source( + """ class Test(object): def test_foo(self): import pkgutil data = pkgutil.get_data('foo.test_foo', 'data.txt') assert data == b'Hey' - """)) - path.join('data.txt').write('Hey') + """ + ) + ) + path.join("data.txt").write("Hey") result = testdir.runpytest() - result.stdout.fnmatch_lines('*1 passed*') + result.stdout.fnmatch_lines("*1 passed*") def test_issue731(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ class LongReprWithBraces(object): def __repr__(self): return 'LongReprWithBraces({' + ('a' * 80) + '}' + ('a' * 120) + ')' @@ -950,47 +1083,62 @@ def test_issue731(testdir): def test_long_repr(): obj = LongReprWithBraces() assert obj.some_method() - """) + """ + ) result = testdir.runpytest() - assert 'unbalanced braces' not in result.stdout.str() + assert "unbalanced braces" not in result.stdout.str() class TestIssue925(object): + def test_simple_case(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_ternary_display(): assert (False == False) == False - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines('*E*assert (False == False) == False') + result.stdout.fnmatch_lines("*E*assert (False == False) == False") def test_long_case(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_ternary_display(): assert False == (False == True) == True - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines('*E*assert (False == True) == True') + result.stdout.fnmatch_lines("*E*assert (False == True) == True") def test_many_brackets(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_ternary_display(): assert True == ((False == True) == True) - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines('*E*assert True == ((False == True) == True)') + result.stdout.fnmatch_lines("*E*assert True == ((False == True) == True)") class TestIssue2121(): + def test_simple(self, testdir): - testdir.tmpdir.join("tests/file.py").ensure().write(""" + testdir.tmpdir.join("tests/file.py").ensure().write( + """ def test_simple_failure(): assert 1 + 1 == 3 -""") - testdir.tmpdir.join("pytest.ini").write(py.std.textwrap.dedent(""" +""" + ) + testdir.tmpdir.join("pytest.ini").write( + textwrap.dedent( + """ [pytest] python_files = tests/**.py - """)) + """ + ) + ) result = testdir.runpytest() - result.stdout.fnmatch_lines('*E*assert (1 + 1) == 3') + result.stdout.fnmatch_lines("*E*assert (1 + 1) == 3") diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_cache.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_cache.py deleted file mode 100755 index a37170cdd2b..00000000000 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_cache.py +++ /dev/null @@ -1,605 +0,0 @@ -from __future__ import absolute_import, division, print_function -import sys -import py -import _pytest -import pytest -import os -import shutil - -pytest_plugins = "pytester", - - -class TestNewAPI(object): - def test_config_cache_makedir(self, testdir): - testdir.makeini("[pytest]") - config = testdir.parseconfigure() - with pytest.raises(ValueError): - config.cache.makedir("key/name") - - p = config.cache.makedir("name") - assert p.check() - - def test_config_cache_dataerror(self, testdir): - testdir.makeini("[pytest]") - config = testdir.parseconfigure() - cache = config.cache - pytest.raises(TypeError, lambda: cache.set("key/name", cache)) - config.cache.set("key/name", 0) - config.cache._getvaluepath("key/name").write("123invalid") - val = config.cache.get("key/name", -2) - assert val == -2 - - def test_cache_writefail_cachfile_silent(self, testdir): - testdir.makeini("[pytest]") - testdir.tmpdir.join('.cache').write('gone wrong') - config = testdir.parseconfigure() - cache = config.cache - cache.set('test/broken', []) - - @pytest.mark.skipif(sys.platform.startswith('win'), reason='no chmod on windows') - def test_cache_writefail_permissions(self, testdir): - testdir.makeini("[pytest]") - testdir.tmpdir.ensure_dir('.cache').chmod(0) - config = testdir.parseconfigure() - cache = config.cache - cache.set('test/broken', []) - - @pytest.mark.skipif(sys.platform.startswith('win'), reason='no chmod on windows') - def test_cache_failure_warns(self, testdir): - testdir.tmpdir.ensure_dir('.cache').chmod(0) - testdir.makepyfile(""" - def test_error(): - raise Exception - - """) - result = testdir.runpytest('-rw') - assert result.ret == 1 - result.stdout.fnmatch_lines([ - "*could not create cache path*", - "*1 warnings*", - ]) - - def test_config_cache(self, testdir): - testdir.makeconftest(""" - def pytest_configure(config): - # see that we get cache information early on - assert hasattr(config, "cache") - """) - testdir.makepyfile(""" - def test_session(pytestconfig): - assert hasattr(pytestconfig, "cache") - """) - result = testdir.runpytest() - assert result.ret == 0 - result.stdout.fnmatch_lines(["*1 passed*"]) - - def test_cachefuncarg(self, testdir): - testdir.makepyfile(""" - import pytest - def test_cachefuncarg(cache): - val = cache.get("some/thing", None) - assert val is None - cache.set("some/thing", [1]) - pytest.raises(TypeError, lambda: cache.get("some/thing")) - val = cache.get("some/thing", []) - assert val == [1] - """) - result = testdir.runpytest() - assert result.ret == 0 - result.stdout.fnmatch_lines(["*1 passed*"]) - - def test_custom_rel_cache_dir(self, testdir): - rel_cache_dir = os.path.join('custom_cache_dir', 'subdir') - testdir.makeini(""" - [pytest] - cache_dir = {cache_dir} - """.format(cache_dir=rel_cache_dir)) - testdir.makepyfile(test_errored='def test_error():\n assert False') - testdir.runpytest() - assert testdir.tmpdir.join(rel_cache_dir).isdir() - - def test_custom_abs_cache_dir(self, testdir, tmpdir_factory): - tmp = str(tmpdir_factory.mktemp('tmp')) - abs_cache_dir = os.path.join(tmp, 'custom_cache_dir') - testdir.makeini(""" - [pytest] - cache_dir = {cache_dir} - """.format(cache_dir=abs_cache_dir)) - testdir.makepyfile(test_errored='def test_error():\n assert False') - testdir.runpytest() - assert py.path.local(abs_cache_dir).isdir() - - def test_custom_cache_dir_with_env_var(self, testdir, monkeypatch): - monkeypatch.setenv('env_var', 'custom_cache_dir') - testdir.makeini(""" - [pytest] - cache_dir = {cache_dir} - """.format(cache_dir='$env_var')) - testdir.makepyfile(test_errored='def test_error():\n assert False') - testdir.runpytest() - assert testdir.tmpdir.join('custom_cache_dir').isdir() - - -def test_cache_reportheader(testdir): - testdir.makepyfile(""" - def test_hello(): - pass - """) - result = testdir.runpytest("-v") - result.stdout.fnmatch_lines([ - "cachedir: .cache" - ]) - - -def test_cache_show(testdir): - result = testdir.runpytest("--cache-show") - assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*cache is empty*" - ]) - testdir.makeconftest(""" - def pytest_configure(config): - config.cache.set("my/name", [1,2,3]) - config.cache.set("other/some", {1:2}) - dp = config.cache.makedir("mydb") - dp.ensure("hello") - dp.ensure("world") - """) - result = testdir.runpytest() - assert result.ret == 5 # no tests executed - result = testdir.runpytest("--cache-show") - result.stdout.fnmatch_lines_random([ - "*cachedir:*", - "-*cache values*-", - "*my/name contains:", - " [1, 2, 3]", - "*other/some contains*", - " {*1*: 2}", - "-*cache directories*-", - "*mydb/hello*length 0*", - "*mydb/world*length 0*", - ]) - - -class TestLastFailed(object): - - def test_lastfailed_usecase(self, testdir, monkeypatch): - monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1) - p = testdir.makepyfile(""" - def test_1(): - assert 0 - def test_2(): - assert 0 - def test_3(): - assert 1 - """) - result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*2 failed*", - ]) - p.write(_pytest._code.Source(""" - def test_1(): - assert 1 - - def test_2(): - assert 1 - - def test_3(): - assert 0 - """)) - result = testdir.runpytest("--lf") - result.stdout.fnmatch_lines([ - "*2 passed*1 desel*", - ]) - result = testdir.runpytest("--lf") - result.stdout.fnmatch_lines([ - "*1 failed*2 passed*", - ]) - result = testdir.runpytest("--lf", "--cache-clear") - result.stdout.fnmatch_lines([ - "*1 failed*2 passed*", - ]) - - # Run this again to make sure clear-cache is robust - if os.path.isdir('.cache'): - shutil.rmtree('.cache') - result = testdir.runpytest("--lf", "--cache-clear") - result.stdout.fnmatch_lines([ - "*1 failed*2 passed*", - ]) - - def test_failedfirst_order(self, testdir): - testdir.tmpdir.join('test_a.py').write(_pytest._code.Source(""" - def test_always_passes(): - assert 1 - """)) - testdir.tmpdir.join('test_b.py').write(_pytest._code.Source(""" - def test_always_fails(): - assert 0 - """)) - result = testdir.runpytest() - # Test order will be collection order; alphabetical - result.stdout.fnmatch_lines([ - "test_a.py*", - "test_b.py*", - ]) - result = testdir.runpytest("--ff") - # Test order will be failing tests firs - result.stdout.fnmatch_lines([ - "test_b.py*", - "test_a.py*", - ]) - - def test_lastfailed_failedfirst_order(self, testdir): - testdir.makepyfile(**{ - 'test_a.py': """ - def test_always_passes(): - assert 1 - """, - 'test_b.py': """ - def test_always_fails(): - assert 0 - """, - }) - result = testdir.runpytest() - # Test order will be collection order; alphabetical - result.stdout.fnmatch_lines([ - "test_a.py*", - "test_b.py*", - ]) - result = testdir.runpytest("--lf", "--ff") - # Test order will be failing tests firs - result.stdout.fnmatch_lines([ - "test_b.py*", - ]) - assert 'test_a.py' not in result.stdout.str() - - def test_lastfailed_difference_invocations(self, testdir, monkeypatch): - monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1) - testdir.makepyfile(test_a=""" - def test_a1(): - assert 0 - def test_a2(): - assert 1 - """, test_b=""" - def test_b1(): - assert 0 - """) - p = testdir.tmpdir.join("test_a.py") - p2 = testdir.tmpdir.join("test_b.py") - - result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*2 failed*", - ]) - result = testdir.runpytest("--lf", p2) - result.stdout.fnmatch_lines([ - "*1 failed*", - ]) - p2.write(_pytest._code.Source(""" - def test_b1(): - assert 1 - """)) - result = testdir.runpytest("--lf", p2) - result.stdout.fnmatch_lines([ - "*1 passed*", - ]) - result = testdir.runpytest("--lf", p) - result.stdout.fnmatch_lines([ - "*1 failed*1 desel*", - ]) - - def test_lastfailed_usecase_splice(self, testdir, monkeypatch): - monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1) - testdir.makepyfile(""" - def test_1(): - assert 0 - """) - p2 = testdir.tmpdir.join("test_something.py") - p2.write(_pytest._code.Source(""" - def test_2(): - assert 0 - """)) - result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*2 failed*", - ]) - result = testdir.runpytest("--lf", p2) - result.stdout.fnmatch_lines([ - "*1 failed*", - ]) - result = testdir.runpytest("--lf") - result.stdout.fnmatch_lines([ - "*2 failed*", - ]) - - def test_lastfailed_xpass(self, testdir): - testdir.inline_runsource(""" - import pytest - @pytest.mark.xfail - def test_hello(): - assert 1 - """) - config = testdir.parseconfigure() - lastfailed = config.cache.get("cache/lastfailed", -1) - assert lastfailed == -1 - - def test_non_serializable_parametrize(self, testdir): - """Test that failed parametrized tests with unmarshable parameters - don't break pytest-cache. - """ - testdir.makepyfile(r""" - import pytest - - @pytest.mark.parametrize('val', [ - b'\xac\x10\x02G', - ]) - def test_fail(val): - assert False - """) - result = testdir.runpytest() - result.stdout.fnmatch_lines('*1 failed in*') - - def test_terminal_report_lastfailed(self, testdir): - test_a = testdir.makepyfile(test_a=""" - def test_a1(): - pass - def test_a2(): - pass - """) - test_b = testdir.makepyfile(test_b=""" - def test_b1(): - assert 0 - def test_b2(): - assert 0 - """) - result = testdir.runpytest() - result.stdout.fnmatch_lines([ - 'collected 4 items', - '*2 failed, 2 passed in*', - ]) - - result = testdir.runpytest('--lf') - result.stdout.fnmatch_lines([ - 'collected 4 items', - 'run-last-failure: rerun previous 2 failures', - '*2 failed, 2 deselected in*', - ]) - - result = testdir.runpytest(test_a, '--lf') - result.stdout.fnmatch_lines([ - 'collected 2 items', - 'run-last-failure: run all (no recorded failures)', - '*2 passed in*', - ]) - - result = testdir.runpytest(test_b, '--lf') - result.stdout.fnmatch_lines([ - 'collected 2 items', - 'run-last-failure: rerun previous 2 failures', - '*2 failed in*', - ]) - - result = testdir.runpytest('test_b.py::test_b1', '--lf') - result.stdout.fnmatch_lines([ - 'collected 1 item', - 'run-last-failure: rerun previous 1 failure', - '*1 failed in*', - ]) - - def test_terminal_report_failedfirst(self, testdir): - testdir.makepyfile(test_a=""" - def test_a1(): - assert 0 - def test_a2(): - pass - """) - result = testdir.runpytest() - result.stdout.fnmatch_lines([ - 'collected 2 items', - '*1 failed, 1 passed in*', - ]) - - result = testdir.runpytest('--ff') - result.stdout.fnmatch_lines([ - 'collected 2 items', - 'run-last-failure: rerun previous 1 failure first', - '*1 failed, 1 passed in*', - ]) - - def test_lastfailed_collectfailure(self, testdir, monkeypatch): - - testdir.makepyfile(test_maybe=""" - import py - env = py.std.os.environ - if '1' == env['FAILIMPORT']: - raise ImportError('fail') - def test_hello(): - assert '0' == env['FAILTEST'] - """) - - def rlf(fail_import, fail_run): - monkeypatch.setenv('FAILIMPORT', fail_import) - monkeypatch.setenv('FAILTEST', fail_run) - - testdir.runpytest('-q') - config = testdir.parseconfigure() - lastfailed = config.cache.get("cache/lastfailed", -1) - return lastfailed - - lastfailed = rlf(fail_import=0, fail_run=0) - assert lastfailed == -1 - - lastfailed = rlf(fail_import=1, fail_run=0) - assert list(lastfailed) == ['test_maybe.py'] - - lastfailed = rlf(fail_import=0, fail_run=1) - assert list(lastfailed) == ['test_maybe.py::test_hello'] - - def test_lastfailed_failure_subset(self, testdir, monkeypatch): - - testdir.makepyfile(test_maybe=""" - import py - env = py.std.os.environ - if '1' == env['FAILIMPORT']: - raise ImportError('fail') - def test_hello(): - assert '0' == env['FAILTEST'] - """) - - testdir.makepyfile(test_maybe2=""" - import py - env = py.std.os.environ - if '1' == env['FAILIMPORT']: - raise ImportError('fail') - def test_hello(): - assert '0' == env['FAILTEST'] - - def test_pass(): - pass - """) - - def rlf(fail_import, fail_run, args=()): - monkeypatch.setenv('FAILIMPORT', fail_import) - monkeypatch.setenv('FAILTEST', fail_run) - - result = testdir.runpytest('-q', '--lf', *args) - config = testdir.parseconfigure() - lastfailed = config.cache.get("cache/lastfailed", -1) - return result, lastfailed - - result, lastfailed = rlf(fail_import=0, fail_run=0) - assert lastfailed == -1 - result.stdout.fnmatch_lines([ - '*3 passed*', - ]) - - result, lastfailed = rlf(fail_import=1, fail_run=0) - assert sorted(list(lastfailed)) == ['test_maybe.py', 'test_maybe2.py'] - - result, lastfailed = rlf(fail_import=0, fail_run=0, - args=('test_maybe2.py',)) - assert list(lastfailed) == ['test_maybe.py'] - - # edge case of test selection - even if we remember failures - # from other tests we still need to run all tests if no test - # matches the failures - result, lastfailed = rlf(fail_import=0, fail_run=0, - args=('test_maybe2.py',)) - assert list(lastfailed) == ['test_maybe.py'] - result.stdout.fnmatch_lines([ - '*2 passed*', - ]) - - def test_lastfailed_creates_cache_when_needed(self, testdir): - # Issue #1342 - testdir.makepyfile(test_empty='') - testdir.runpytest('-q', '--lf') - assert not os.path.exists('.cache') - - testdir.makepyfile(test_successful='def test_success():\n assert True') - testdir.runpytest('-q', '--lf') - assert not os.path.exists('.cache') - - testdir.makepyfile(test_errored='def test_error():\n assert False') - testdir.runpytest('-q', '--lf') - assert os.path.exists('.cache') - - def test_xfail_not_considered_failure(self, testdir): - testdir.makepyfile(''' - import pytest - @pytest.mark.xfail - def test(): - assert 0 - ''') - result = testdir.runpytest() - result.stdout.fnmatch_lines('*1 xfailed*') - assert self.get_cached_last_failed(testdir) == [] - - def test_xfail_strict_considered_failure(self, testdir): - testdir.makepyfile(''' - import pytest - @pytest.mark.xfail(strict=True) - def test(): - pass - ''') - result = testdir.runpytest() - result.stdout.fnmatch_lines('*1 failed*') - assert self.get_cached_last_failed(testdir) == ['test_xfail_strict_considered_failure.py::test'] - - @pytest.mark.parametrize('mark', ['mark.xfail', 'mark.skip']) - def test_failed_changed_to_xfail_or_skip(self, testdir, mark): - testdir.makepyfile(''' - import pytest - def test(): - assert 0 - ''') - result = testdir.runpytest() - assert self.get_cached_last_failed(testdir) == ['test_failed_changed_to_xfail_or_skip.py::test'] - assert result.ret == 1 - - testdir.makepyfile(''' - import pytest - @pytest.{mark} - def test(): - assert 0 - '''.format(mark=mark)) - result = testdir.runpytest() - assert result.ret == 0 - assert self.get_cached_last_failed(testdir) == [] - assert result.ret == 0 - - def get_cached_last_failed(self, testdir): - config = testdir.parseconfigure() - return sorted(config.cache.get("cache/lastfailed", {})) - - def test_cache_cumulative(self, testdir): - """ - Test workflow where user fixes errors gradually file by file using --lf. - """ - # 1. initial run - test_bar = testdir.makepyfile(test_bar=""" - def test_bar_1(): - pass - def test_bar_2(): - assert 0 - """) - test_foo = testdir.makepyfile(test_foo=""" - def test_foo_3(): - pass - def test_foo_4(): - assert 0 - """) - testdir.runpytest() - assert self.get_cached_last_failed(testdir) == ['test_bar.py::test_bar_2', 'test_foo.py::test_foo_4'] - - # 2. fix test_bar_2, run only test_bar.py - testdir.makepyfile(test_bar=""" - def test_bar_1(): - pass - def test_bar_2(): - pass - """) - result = testdir.runpytest(test_bar) - result.stdout.fnmatch_lines('*2 passed*') - # ensure cache does not forget that test_foo_4 failed once before - assert self.get_cached_last_failed(testdir) == ['test_foo.py::test_foo_4'] - - result = testdir.runpytest('--last-failed') - result.stdout.fnmatch_lines('*1 failed, 3 deselected*') - assert self.get_cached_last_failed(testdir) == ['test_foo.py::test_foo_4'] - - # 3. fix test_foo_4, run only test_foo.py - test_foo = testdir.makepyfile(test_foo=""" - def test_foo_3(): - pass - def test_foo_4(): - pass - """) - result = testdir.runpytest(test_foo, '--last-failed') - result.stdout.fnmatch_lines('*1 passed, 1 deselected*') - assert self.get_cached_last_failed(testdir) == [] - - result = testdir.runpytest('--last-failed') - result.stdout.fnmatch_lines('*4 passed*') - assert self.get_cached_last_failed(testdir) == [] diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_cacheprovider.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_cacheprovider.py new file mode 100644 index 00000000000..33d1dd8448c --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_cacheprovider.py @@ -0,0 +1,820 @@ +from __future__ import absolute_import, division, print_function +import sys +import py +import _pytest +import pytest +import os +import shutil + +pytest_plugins = "pytester", + + +class TestNewAPI(object): + + def test_config_cache_makedir(self, testdir): + testdir.makeini("[pytest]") + config = testdir.parseconfigure() + with pytest.raises(ValueError): + config.cache.makedir("key/name") + + p = config.cache.makedir("name") + assert p.check() + + def test_config_cache_dataerror(self, testdir): + testdir.makeini("[pytest]") + config = testdir.parseconfigure() + cache = config.cache + pytest.raises(TypeError, lambda: cache.set("key/name", cache)) + config.cache.set("key/name", 0) + config.cache._getvaluepath("key/name").write("123invalid") + val = config.cache.get("key/name", -2) + assert val == -2 + + def test_cache_writefail_cachfile_silent(self, testdir): + testdir.makeini("[pytest]") + testdir.tmpdir.join(".pytest_cache").write("gone wrong") + config = testdir.parseconfigure() + cache = config.cache + cache.set("test/broken", []) + + @pytest.mark.skipif(sys.platform.startswith("win"), reason="no chmod on windows") + def test_cache_writefail_permissions(self, testdir): + testdir.makeini("[pytest]") + testdir.tmpdir.ensure_dir(".pytest_cache").chmod(0) + config = testdir.parseconfigure() + cache = config.cache + cache.set("test/broken", []) + + @pytest.mark.skipif(sys.platform.startswith("win"), reason="no chmod on windows") + def test_cache_failure_warns(self, testdir): + testdir.tmpdir.ensure_dir(".pytest_cache").chmod(0) + testdir.makepyfile( + """ + def test_error(): + raise Exception + + """ + ) + result = testdir.runpytest("-rw") + assert result.ret == 1 + result.stdout.fnmatch_lines(["*could not create cache path*", "*2 warnings*"]) + + def test_config_cache(self, testdir): + testdir.makeconftest( + """ + def pytest_configure(config): + # see that we get cache information early on + assert hasattr(config, "cache") + """ + ) + testdir.makepyfile( + """ + def test_session(pytestconfig): + assert hasattr(pytestconfig, "cache") + """ + ) + result = testdir.runpytest() + assert result.ret == 0 + result.stdout.fnmatch_lines(["*1 passed*"]) + + def test_cachefuncarg(self, testdir): + testdir.makepyfile( + """ + import pytest + def test_cachefuncarg(cache): + val = cache.get("some/thing", None) + assert val is None + cache.set("some/thing", [1]) + pytest.raises(TypeError, lambda: cache.get("some/thing")) + val = cache.get("some/thing", []) + assert val == [1] + """ + ) + result = testdir.runpytest() + assert result.ret == 0 + result.stdout.fnmatch_lines(["*1 passed*"]) + + def test_custom_rel_cache_dir(self, testdir): + rel_cache_dir = os.path.join("custom_cache_dir", "subdir") + testdir.makeini( + """ + [pytest] + cache_dir = {cache_dir} + """.format( + cache_dir=rel_cache_dir + ) + ) + testdir.makepyfile(test_errored="def test_error():\n assert False") + testdir.runpytest() + assert testdir.tmpdir.join(rel_cache_dir).isdir() + + def test_custom_abs_cache_dir(self, testdir, tmpdir_factory): + tmp = str(tmpdir_factory.mktemp("tmp")) + abs_cache_dir = os.path.join(tmp, "custom_cache_dir") + testdir.makeini( + """ + [pytest] + cache_dir = {cache_dir} + """.format( + cache_dir=abs_cache_dir + ) + ) + testdir.makepyfile(test_errored="def test_error():\n assert False") + testdir.runpytest() + assert py.path.local(abs_cache_dir).isdir() + + def test_custom_cache_dir_with_env_var(self, testdir, monkeypatch): + monkeypatch.setenv("env_var", "custom_cache_dir") + testdir.makeini( + """ + [pytest] + cache_dir = {cache_dir} + """.format( + cache_dir="$env_var" + ) + ) + testdir.makepyfile(test_errored="def test_error():\n assert False") + testdir.runpytest() + assert testdir.tmpdir.join("custom_cache_dir").isdir() + + +def test_cache_reportheader(testdir): + testdir.makepyfile( + """ + def test_hello(): + pass + """ + ) + result = testdir.runpytest("-v") + result.stdout.fnmatch_lines(["cachedir: .pytest_cache"]) + + +def test_cache_show(testdir): + result = testdir.runpytest("--cache-show") + assert result.ret == 0 + result.stdout.fnmatch_lines(["*cache is empty*"]) + testdir.makeconftest( + """ + def pytest_configure(config): + config.cache.set("my/name", [1,2,3]) + config.cache.set("other/some", {1:2}) + dp = config.cache.makedir("mydb") + dp.ensure("hello") + dp.ensure("world") + """ + ) + result = testdir.runpytest() + assert result.ret == 5 # no tests executed + result = testdir.runpytest("--cache-show") + result.stdout.fnmatch_lines_random( + [ + "*cachedir:*", + "-*cache values*-", + "*my/name contains:", + " [1, 2, 3]", + "*other/some contains*", + " {*1*: 2}", + "-*cache directories*-", + "*mydb/hello*length 0*", + "*mydb/world*length 0*", + ] + ) + + +class TestLastFailed(object): + + def test_lastfailed_usecase(self, testdir, monkeypatch): + monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1) + p = testdir.makepyfile( + """ + def test_1(): + assert 0 + def test_2(): + assert 0 + def test_3(): + assert 1 + """ + ) + result = testdir.runpytest() + result.stdout.fnmatch_lines(["*2 failed*"]) + p.write( + _pytest._code.Source( + """ + def test_1(): + assert 1 + + def test_2(): + assert 1 + + def test_3(): + assert 0 + """ + ) + ) + result = testdir.runpytest("--lf") + result.stdout.fnmatch_lines(["*2 passed*1 desel*"]) + result = testdir.runpytest("--lf") + result.stdout.fnmatch_lines(["*1 failed*2 passed*"]) + result = testdir.runpytest("--lf", "--cache-clear") + result.stdout.fnmatch_lines(["*1 failed*2 passed*"]) + + # Run this again to make sure clear-cache is robust + if os.path.isdir(".pytest_cache"): + shutil.rmtree(".pytest_cache") + result = testdir.runpytest("--lf", "--cache-clear") + result.stdout.fnmatch_lines(["*1 failed*2 passed*"]) + + def test_failedfirst_order(self, testdir): + testdir.tmpdir.join("test_a.py").write( + _pytest._code.Source( + """ + def test_always_passes(): + assert 1 + """ + ) + ) + testdir.tmpdir.join("test_b.py").write( + _pytest._code.Source( + """ + def test_always_fails(): + assert 0 + """ + ) + ) + result = testdir.runpytest() + # Test order will be collection order; alphabetical + result.stdout.fnmatch_lines(["test_a.py*", "test_b.py*"]) + result = testdir.runpytest("--ff") + # Test order will be failing tests firs + result.stdout.fnmatch_lines(["test_b.py*", "test_a.py*"]) + + def test_lastfailed_failedfirst_order(self, testdir): + testdir.makepyfile( + **{ + "test_a.py": """ + def test_always_passes(): + assert 1 + """, + "test_b.py": """ + def test_always_fails(): + assert 0 + """, + } + ) + result = testdir.runpytest() + # Test order will be collection order; alphabetical + result.stdout.fnmatch_lines(["test_a.py*", "test_b.py*"]) + result = testdir.runpytest("--lf", "--ff") + # Test order will be failing tests firs + result.stdout.fnmatch_lines(["test_b.py*"]) + assert "test_a.py" not in result.stdout.str() + + def test_lastfailed_difference_invocations(self, testdir, monkeypatch): + monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1) + testdir.makepyfile( + test_a=""" + def test_a1(): + assert 0 + def test_a2(): + assert 1 + """, + test_b=""" + def test_b1(): + assert 0 + """, + ) + p = testdir.tmpdir.join("test_a.py") + p2 = testdir.tmpdir.join("test_b.py") + + result = testdir.runpytest() + result.stdout.fnmatch_lines(["*2 failed*"]) + result = testdir.runpytest("--lf", p2) + result.stdout.fnmatch_lines(["*1 failed*"]) + p2.write( + _pytest._code.Source( + """ + def test_b1(): + assert 1 + """ + ) + ) + result = testdir.runpytest("--lf", p2) + result.stdout.fnmatch_lines(["*1 passed*"]) + result = testdir.runpytest("--lf", p) + result.stdout.fnmatch_lines(["*1 failed*1 desel*"]) + + def test_lastfailed_usecase_splice(self, testdir, monkeypatch): + monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1) + testdir.makepyfile( + """ + def test_1(): + assert 0 + """ + ) + p2 = testdir.tmpdir.join("test_something.py") + p2.write( + _pytest._code.Source( + """ + def test_2(): + assert 0 + """ + ) + ) + result = testdir.runpytest() + result.stdout.fnmatch_lines(["*2 failed*"]) + result = testdir.runpytest("--lf", p2) + result.stdout.fnmatch_lines(["*1 failed*"]) + result = testdir.runpytest("--lf") + result.stdout.fnmatch_lines(["*2 failed*"]) + + def test_lastfailed_xpass(self, testdir): + testdir.inline_runsource( + """ + import pytest + @pytest.mark.xfail + def test_hello(): + assert 1 + """ + ) + config = testdir.parseconfigure() + lastfailed = config.cache.get("cache/lastfailed", -1) + assert lastfailed == -1 + + def test_non_serializable_parametrize(self, testdir): + """Test that failed parametrized tests with unmarshable parameters + don't break pytest-cache. + """ + testdir.makepyfile( + r""" + import pytest + + @pytest.mark.parametrize('val', [ + b'\xac\x10\x02G', + ]) + def test_fail(val): + assert False + """ + ) + result = testdir.runpytest() + result.stdout.fnmatch_lines("*1 failed in*") + + def test_terminal_report_lastfailed(self, testdir): + test_a = testdir.makepyfile( + test_a=""" + def test_a1(): + pass + def test_a2(): + pass + """ + ) + test_b = testdir.makepyfile( + test_b=""" + def test_b1(): + assert 0 + def test_b2(): + assert 0 + """ + ) + result = testdir.runpytest() + result.stdout.fnmatch_lines(["collected 4 items", "*2 failed, 2 passed in*"]) + + result = testdir.runpytest("--lf") + result.stdout.fnmatch_lines( + [ + "collected 4 items / 2 deselected", + "run-last-failure: rerun previous 2 failures", + "*2 failed, 2 deselected in*", + ] + ) + + result = testdir.runpytest(test_a, "--lf") + result.stdout.fnmatch_lines( + [ + "collected 2 items", + "run-last-failure: run all (no recorded failures)", + "*2 passed in*", + ] + ) + + result = testdir.runpytest(test_b, "--lf") + result.stdout.fnmatch_lines( + [ + "collected 2 items", + "run-last-failure: rerun previous 2 failures", + "*2 failed in*", + ] + ) + + result = testdir.runpytest("test_b.py::test_b1", "--lf") + result.stdout.fnmatch_lines( + [ + "collected 1 item", + "run-last-failure: rerun previous 1 failure", + "*1 failed in*", + ] + ) + + def test_terminal_report_failedfirst(self, testdir): + testdir.makepyfile( + test_a=""" + def test_a1(): + assert 0 + def test_a2(): + pass + """ + ) + result = testdir.runpytest() + result.stdout.fnmatch_lines(["collected 2 items", "*1 failed, 1 passed in*"]) + + result = testdir.runpytest("--ff") + result.stdout.fnmatch_lines( + [ + "collected 2 items", + "run-last-failure: rerun previous 1 failure first", + "*1 failed, 1 passed in*", + ] + ) + + def test_lastfailed_collectfailure(self, testdir, monkeypatch): + + testdir.makepyfile( + test_maybe=""" + import os + env = os.environ + if '1' == env['FAILIMPORT']: + raise ImportError('fail') + def test_hello(): + assert '0' == env['FAILTEST'] + """ + ) + + def rlf(fail_import, fail_run): + monkeypatch.setenv("FAILIMPORT", fail_import) + monkeypatch.setenv("FAILTEST", fail_run) + + testdir.runpytest("-q") + config = testdir.parseconfigure() + lastfailed = config.cache.get("cache/lastfailed", -1) + return lastfailed + + lastfailed = rlf(fail_import=0, fail_run=0) + assert lastfailed == -1 + + lastfailed = rlf(fail_import=1, fail_run=0) + assert list(lastfailed) == ["test_maybe.py"] + + lastfailed = rlf(fail_import=0, fail_run=1) + assert list(lastfailed) == ["test_maybe.py::test_hello"] + + def test_lastfailed_failure_subset(self, testdir, monkeypatch): + + testdir.makepyfile( + test_maybe=""" + import os + env = os.environ + if '1' == env['FAILIMPORT']: + raise ImportError('fail') + def test_hello(): + assert '0' == env['FAILTEST'] + """ + ) + + testdir.makepyfile( + test_maybe2=""" + import os + env = os.environ + if '1' == env['FAILIMPORT']: + raise ImportError('fail') + def test_hello(): + assert '0' == env['FAILTEST'] + + def test_pass(): + pass + """ + ) + + def rlf(fail_import, fail_run, args=()): + monkeypatch.setenv("FAILIMPORT", fail_import) + monkeypatch.setenv("FAILTEST", fail_run) + + result = testdir.runpytest("-q", "--lf", *args) + config = testdir.parseconfigure() + lastfailed = config.cache.get("cache/lastfailed", -1) + return result, lastfailed + + result, lastfailed = rlf(fail_import=0, fail_run=0) + assert lastfailed == -1 + result.stdout.fnmatch_lines(["*3 passed*"]) + + result, lastfailed = rlf(fail_import=1, fail_run=0) + assert sorted(list(lastfailed)) == ["test_maybe.py", "test_maybe2.py"] + + result, lastfailed = rlf(fail_import=0, fail_run=0, args=("test_maybe2.py",)) + assert list(lastfailed) == ["test_maybe.py"] + + # edge case of test selection - even if we remember failures + # from other tests we still need to run all tests if no test + # matches the failures + result, lastfailed = rlf(fail_import=0, fail_run=0, args=("test_maybe2.py",)) + assert list(lastfailed) == ["test_maybe.py"] + result.stdout.fnmatch_lines(["*2 passed*"]) + + def test_lastfailed_creates_cache_when_needed(self, testdir): + # Issue #1342 + testdir.makepyfile(test_empty="") + testdir.runpytest("-q", "--lf") + assert not os.path.exists(".pytest_cache/v/cache/lastfailed") + + testdir.makepyfile(test_successful="def test_success():\n assert True") + testdir.runpytest("-q", "--lf") + assert not os.path.exists(".pytest_cache/v/cache/lastfailed") + + testdir.makepyfile(test_errored="def test_error():\n assert False") + testdir.runpytest("-q", "--lf") + assert os.path.exists(".pytest_cache/v/cache/lastfailed") + + def test_xfail_not_considered_failure(self, testdir): + testdir.makepyfile( + """ + import pytest + @pytest.mark.xfail + def test(): + assert 0 + """ + ) + result = testdir.runpytest() + result.stdout.fnmatch_lines("*1 xfailed*") + assert self.get_cached_last_failed(testdir) == [] + + def test_xfail_strict_considered_failure(self, testdir): + testdir.makepyfile( + """ + import pytest + @pytest.mark.xfail(strict=True) + def test(): + pass + """ + ) + result = testdir.runpytest() + result.stdout.fnmatch_lines("*1 failed*") + assert ( + self.get_cached_last_failed(testdir) + == ["test_xfail_strict_considered_failure.py::test"] + ) + + @pytest.mark.parametrize("mark", ["mark.xfail", "mark.skip"]) + def test_failed_changed_to_xfail_or_skip(self, testdir, mark): + testdir.makepyfile( + """ + import pytest + def test(): + assert 0 + """ + ) + result = testdir.runpytest() + assert ( + self.get_cached_last_failed(testdir) + == ["test_failed_changed_to_xfail_or_skip.py::test"] + ) + assert result.ret == 1 + + testdir.makepyfile( + """ + import pytest + @pytest.{mark} + def test(): + assert 0 + """.format( + mark=mark + ) + ) + result = testdir.runpytest() + assert result.ret == 0 + assert self.get_cached_last_failed(testdir) == [] + assert result.ret == 0 + + def get_cached_last_failed(self, testdir): + config = testdir.parseconfigure() + return sorted(config.cache.get("cache/lastfailed", {})) + + def test_cache_cumulative(self, testdir): + """ + Test workflow where user fixes errors gradually file by file using --lf. + """ + # 1. initial run + test_bar = testdir.makepyfile( + test_bar=""" + def test_bar_1(): + pass + def test_bar_2(): + assert 0 + """ + ) + test_foo = testdir.makepyfile( + test_foo=""" + def test_foo_3(): + pass + def test_foo_4(): + assert 0 + """ + ) + testdir.runpytest() + assert ( + self.get_cached_last_failed(testdir) + == ["test_bar.py::test_bar_2", "test_foo.py::test_foo_4"] + ) + + # 2. fix test_bar_2, run only test_bar.py + testdir.makepyfile( + test_bar=""" + def test_bar_1(): + pass + def test_bar_2(): + pass + """ + ) + result = testdir.runpytest(test_bar) + result.stdout.fnmatch_lines("*2 passed*") + # ensure cache does not forget that test_foo_4 failed once before + assert self.get_cached_last_failed(testdir) == ["test_foo.py::test_foo_4"] + + result = testdir.runpytest("--last-failed") + result.stdout.fnmatch_lines("*1 failed, 3 deselected*") + assert self.get_cached_last_failed(testdir) == ["test_foo.py::test_foo_4"] + + # 3. fix test_foo_4, run only test_foo.py + test_foo = testdir.makepyfile( + test_foo=""" + def test_foo_3(): + pass + def test_foo_4(): + pass + """ + ) + result = testdir.runpytest(test_foo, "--last-failed") + result.stdout.fnmatch_lines("*1 passed, 1 deselected*") + assert self.get_cached_last_failed(testdir) == [] + + result = testdir.runpytest("--last-failed") + result.stdout.fnmatch_lines("*4 passed*") + assert self.get_cached_last_failed(testdir) == [] + + def test_lastfailed_no_failures_behavior_all_passed(self, testdir): + testdir.makepyfile( + """ + def test_1(): + assert True + def test_2(): + assert True + """ + ) + result = testdir.runpytest() + result.stdout.fnmatch_lines(["*2 passed*"]) + result = testdir.runpytest("--lf") + result.stdout.fnmatch_lines(["*2 passed*"]) + result = testdir.runpytest("--lf", "--lfnf", "all") + result.stdout.fnmatch_lines(["*2 passed*"]) + result = testdir.runpytest("--lf", "--lfnf", "none") + result.stdout.fnmatch_lines(["*2 desel*"]) + + def test_lastfailed_no_failures_behavior_empty_cache(self, testdir): + testdir.makepyfile( + """ + def test_1(): + assert True + def test_2(): + assert False + """ + ) + result = testdir.runpytest("--lf", "--cache-clear") + result.stdout.fnmatch_lines(["*1 failed*1 passed*"]) + result = testdir.runpytest("--lf", "--cache-clear", "--lfnf", "all") + result.stdout.fnmatch_lines(["*1 failed*1 passed*"]) + result = testdir.runpytest("--lf", "--cache-clear", "--lfnf", "none") + result.stdout.fnmatch_lines(["*2 desel*"]) + + +class TestNewFirst(object): + + def test_newfirst_usecase(self, testdir): + testdir.makepyfile( + **{ + "test_1/test_1.py": """ + def test_1(): assert 1 + def test_2(): assert 1 + def test_3(): assert 1 + """, + "test_2/test_2.py": """ + def test_1(): assert 1 + def test_2(): assert 1 + def test_3(): assert 1 + """, + } + ) + + testdir.tmpdir.join("test_1/test_1.py").setmtime(1) + + result = testdir.runpytest("-v") + result.stdout.fnmatch_lines( + [ + "*test_1/test_1.py::test_1 PASSED*", + "*test_1/test_1.py::test_2 PASSED*", + "*test_1/test_1.py::test_3 PASSED*", + "*test_2/test_2.py::test_1 PASSED*", + "*test_2/test_2.py::test_2 PASSED*", + "*test_2/test_2.py::test_3 PASSED*", + ] + ) + + result = testdir.runpytest("-v", "--nf") + + result.stdout.fnmatch_lines( + [ + "*test_2/test_2.py::test_1 PASSED*", + "*test_2/test_2.py::test_2 PASSED*", + "*test_2/test_2.py::test_3 PASSED*", + "*test_1/test_1.py::test_1 PASSED*", + "*test_1/test_1.py::test_2 PASSED*", + "*test_1/test_1.py::test_3 PASSED*", + ] + ) + + testdir.tmpdir.join("test_1/test_1.py").write( + "def test_1(): assert 1\n" + "def test_2(): assert 1\n" + "def test_3(): assert 1\n" + "def test_4(): assert 1\n" + ) + testdir.tmpdir.join("test_1/test_1.py").setmtime(1) + + result = testdir.runpytest("-v", "--nf") + + result.stdout.fnmatch_lines( + [ + "*test_1/test_1.py::test_4 PASSED*", + "*test_2/test_2.py::test_1 PASSED*", + "*test_2/test_2.py::test_2 PASSED*", + "*test_2/test_2.py::test_3 PASSED*", + "*test_1/test_1.py::test_1 PASSED*", + "*test_1/test_1.py::test_2 PASSED*", + "*test_1/test_1.py::test_3 PASSED*", + ] + ) + + def test_newfirst_parametrize(self, testdir): + testdir.makepyfile( + **{ + "test_1/test_1.py": """ + import pytest + @pytest.mark.parametrize('num', [1, 2]) + def test_1(num): assert num + """, + "test_2/test_2.py": """ + import pytest + @pytest.mark.parametrize('num', [1, 2]) + def test_1(num): assert num + """, + } + ) + + testdir.tmpdir.join("test_1/test_1.py").setmtime(1) + + result = testdir.runpytest("-v") + result.stdout.fnmatch_lines( + [ + "*test_1/test_1.py::test_1[1*", + "*test_1/test_1.py::test_1[2*", + "*test_2/test_2.py::test_1[1*", + "*test_2/test_2.py::test_1[2*", + ] + ) + + result = testdir.runpytest("-v", "--nf") + + result.stdout.fnmatch_lines( + [ + "*test_2/test_2.py::test_1[1*", + "*test_2/test_2.py::test_1[2*", + "*test_1/test_1.py::test_1[1*", + "*test_1/test_1.py::test_1[2*", + ] + ) + + testdir.tmpdir.join("test_1/test_1.py").write( + "import pytest\n" + "@pytest.mark.parametrize('num', [1, 2, 3])\n" + "def test_1(num): assert num\n" + ) + testdir.tmpdir.join("test_1/test_1.py").setmtime(1) + + result = testdir.runpytest("-v", "--nf") + + result.stdout.fnmatch_lines( + [ + "*test_1/test_1.py::test_1[3*", + "*test_2/test_2.py::test_1[1*", + "*test_2/test_2.py::test_1[2*", + "*test_1/test_1.py::test_1[1*", + "*test_1/test_1.py::test_1[2*", + ] + ) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_capture.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_capture.py index f769a725dc4..e14b3af7851 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_capture.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_capture.py @@ -1,4 +1,5 @@ from __future__ import absolute_import, division, print_function + # note: py.io capture tests where copied from # pylib 1.4.20.dev2 (rev 13d9af95547e) from __future__ import with_statement @@ -11,7 +12,7 @@ import _pytest._code import py import pytest import contextlib - +from six import binary_type, text_type from _pytest import capture from _pytest.capture import CaptureManager from _pytest.main import EXIT_NOTESTSCOLLECTED @@ -19,30 +20,19 @@ from _pytest.main import EXIT_NOTESTSCOLLECTED needsosdup = pytest.mark.xfail("not hasattr(os, 'dup')") -if sys.version_info >= (3, 0): - def tobytes(obj): - if isinstance(obj, str): - obj = obj.encode('UTF-8') - assert isinstance(obj, bytes) - return obj - def totext(obj): - if isinstance(obj, bytes): - obj = str(obj, 'UTF-8') - assert isinstance(obj, str) - return obj -else: - def tobytes(obj): - if isinstance(obj, unicode): - obj = obj.encode('UTF-8') - assert isinstance(obj, str) - return obj +def tobytes(obj): + if isinstance(obj, text_type): + obj = obj.encode("UTF-8") + assert isinstance(obj, binary_type) + return obj - def totext(obj): - if isinstance(obj, str): - obj = unicode(obj, 'UTF-8') - assert isinstance(obj, unicode) - return obj + +def totext(obj): + if isinstance(obj, binary_type): + obj = text_type(obj, "UTF-8") + assert isinstance(obj, text_type) + return obj def oswritebytes(fd, obj): @@ -58,21 +48,24 @@ def StdCapture(out=True, err=True, in_=True): class TestCaptureManager(object): + def test_getmethod_default_no_fd(self, monkeypatch): from _pytest.capture import pytest_addoption - from _pytest.config import Parser + from _pytest.config.argparsing import Parser + parser = Parser() pytest_addoption(parser) default = parser._groups[0].options[0].default assert default == "fd" if hasattr(os, "dup") else "sys" parser = Parser() - monkeypatch.delattr(os, 'dup', raising=False) + monkeypatch.delattr(os, "dup", raising=False) pytest_addoption(parser) assert parser._groups[0].options[0].default == "sys" @needsosdup - @pytest.mark.parametrize("method", - ['no', 'sys', pytest.mark.skipif('not hasattr(os, "dup")', 'fd')]) + @pytest.mark.parametrize( + "method", ["no", "sys", pytest.mark.skipif('not hasattr(os, "dup")', "fd")] + ) def test_capturing_basic_api(self, method): capouter = StdCaptureFD() old = sys.stdout, sys.stderr, sys.stdin @@ -110,7 +103,7 @@ class TestCaptureManager(object): capouter.stop_capturing() -@pytest.mark.parametrize("method", ['fd', 'sys']) +@pytest.mark.parametrize("method", ["fd", "sys"]) def test_capturing_unicode(testdir, method): if hasattr(sys, "pypy_version_info") and sys.pypy_version_info < (2, 2): pytest.xfail("does not work on pypy < 2.2") @@ -118,47 +111,49 @@ def test_capturing_unicode(testdir, method): obj = "'b\u00f6y'" else: obj = "u'\u00f6y'" - testdir.makepyfile(""" + testdir.makepyfile( + """ # coding=utf8 # taken from issue 227 from nosetests def test_unicode(): import sys print (sys.stdout) print (%s) - """ % obj) + """ + % obj + ) result = testdir.runpytest("--capture=%s" % method) - result.stdout.fnmatch_lines([ - "*1 passed*" - ]) + result.stdout.fnmatch_lines(["*1 passed*"]) -@pytest.mark.parametrize("method", ['fd', 'sys']) +@pytest.mark.parametrize("method", ["fd", "sys"]) def test_capturing_bytes_in_utf8_encoding(testdir, method): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_unicode(): print ('b\\u00f6y') - """) + """ + ) result = testdir.runpytest("--capture=%s" % method) - result.stdout.fnmatch_lines([ - "*1 passed*" - ]) + result.stdout.fnmatch_lines(["*1 passed*"]) def test_collect_capturing(testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ print ("collect %s failure" % 13) import xyz42123 - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "*Captured stdout*", - "*collect 13 failure*", - ]) + result.stdout.fnmatch_lines(["*Captured stdout*", "*collect 13 failure*"]) class TestPerTestCapturing(object): + def test_capture_and_fixtures(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def setup_module(mod): print ("setup module") def setup_function(function): @@ -169,19 +164,23 @@ class TestPerTestCapturing(object): def test_func2(): print ("in func2") assert 0 - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "setup module*", - "setup test_func1*", - "in func1*", - "setup test_func2*", - "in func2*", - ]) + result.stdout.fnmatch_lines( + [ + "setup module*", + "setup test_func1*", + "in func1*", + "setup test_func2*", + "in func2*", + ] + ) @pytest.mark.xfail(reason="unimplemented feature") def test_capture_scope_cache(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import sys def setup_module(func): print ("module-setup") @@ -192,32 +191,38 @@ class TestPerTestCapturing(object): assert 0 def teardown_function(func): print ("in teardown") - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "*test_func():*", - "*Captured stdout during setup*", - "module-setup*", - "function-setup*", - "*Captured stdout*", - "in teardown*", - ]) + result.stdout.fnmatch_lines( + [ + "*test_func():*", + "*Captured stdout during setup*", + "module-setup*", + "function-setup*", + "*Captured stdout*", + "in teardown*", + ] + ) def test_no_carry_over(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_func1(): print ("in func1") def test_func2(): print ("in func2") assert 0 - """) + """ + ) result = testdir.runpytest(p) s = result.stdout.str() assert "in func1" not in s assert "in func2" in s def test_teardown_capturing(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def setup_function(function): print ("setup func1") def teardown_function(function): @@ -226,35 +231,43 @@ class TestPerTestCapturing(object): def test_func1(): print ("in func1") pass - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - '*teardown_function*', - '*Captured stdout*', - "setup func1*", - "in func1*", - "teardown func1*", - # "*1 fixture failure*" - ]) + result.stdout.fnmatch_lines( + [ + "*teardown_function*", + "*Captured stdout*", + "setup func1*", + "in func1*", + "teardown func1*", + # "*1 fixture failure*" + ] + ) def test_teardown_capturing_final(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def teardown_module(mod): print ("teardown module") assert 0 def test_func(): pass - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "*def teardown_module(mod):*", - "*Captured stdout*", - "*teardown module*", - "*1 error*", - ]) + result.stdout.fnmatch_lines( + [ + "*def teardown_module(mod):*", + "*Captured stdout*", + "*teardown module*", + "*1 error*", + ] + ) def test_capturing_outerr(self, testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ import sys def test_capturing(): print (42) @@ -263,35 +276,42 @@ class TestPerTestCapturing(object): print (1) sys.stderr.write(str(2)) raise ValueError - """) + """ + ) result = testdir.runpytest(p1) - result.stdout.fnmatch_lines([ - "*test_capturing_outerr.py .F*", - "====* FAILURES *====", - "____*____", - "*test_capturing_outerr.py:8: ValueError", - "*--- Captured stdout *call*", - "1", - "*--- Captured stderr *call*", - "2", - ]) + result.stdout.fnmatch_lines( + [ + "*test_capturing_outerr.py .F*", + "====* FAILURES *====", + "____*____", + "*test_capturing_outerr.py:8: ValueError", + "*--- Captured stdout *call*", + "1", + "*--- Captured stderr *call*", + "2", + ] + ) class TestLoggingInteraction(object): + def test_logging_stream_ownership(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_logging(): import logging import pytest stream = capture.CaptureIO() logging.basicConfig(stream=stream) stream.close() # to free memory/release resources - """) + """ + ) result = testdir.runpytest_subprocess(p) assert result.stderr.str().find("atexit") == -1 def test_logging_and_immediate_setupteardown(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import logging def setup_function(function): logging.warn("hello1") @@ -303,21 +323,21 @@ class TestLoggingInteraction(object): def teardown_function(function): logging.warn("hello3") assert 0 - """) - for optargs in (('--capture=sys',), ('--capture=fd',)): + """ + ) + for optargs in (("--capture=sys",), ("--capture=fd",)): print(optargs) result = testdir.runpytest_subprocess(p, *optargs) s = result.stdout.str() - result.stdout.fnmatch_lines([ - "*WARN*hello3", # errors show first! - "*WARN*hello1", - "*WARN*hello2", - ]) + result.stdout.fnmatch_lines( + ["*WARN*hello3", "*WARN*hello1", "*WARN*hello2"] # errors show first! + ) # verify proper termination assert "closed" not in s def test_logging_and_crossscope_fixtures(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import logging def setup_module(function): logging.warn("hello1") @@ -329,137 +349,156 @@ class TestLoggingInteraction(object): def teardown_module(function): logging.warn("hello3") assert 0 - """) - for optargs in (('--capture=sys',), ('--capture=fd',)): + """ + ) + for optargs in (("--capture=sys",), ("--capture=fd",)): print(optargs) result = testdir.runpytest_subprocess(p, *optargs) s = result.stdout.str() - result.stdout.fnmatch_lines([ - "*WARN*hello3", # errors come first - "*WARN*hello1", - "*WARN*hello2", - ]) + result.stdout.fnmatch_lines( + ["*WARN*hello3", "*WARN*hello1", "*WARN*hello2"] # errors come first + ) # verify proper termination assert "closed" not in s def test_conftestlogging_is_shown(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import logging logging.basicConfig() logging.warn("hello435") - """) + """ + ) # make sure that logging is still captured in tests result = testdir.runpytest_subprocess("-s", "-p", "no:capturelog") assert result.ret == EXIT_NOTESTSCOLLECTED - result.stderr.fnmatch_lines([ - "WARNING*hello435*", - ]) - assert 'operation on closed file' not in result.stderr.str() + result.stderr.fnmatch_lines(["WARNING*hello435*"]) + assert "operation on closed file" not in result.stderr.str() def test_conftestlogging_and_test_logging(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import logging logging.basicConfig() - """) + """ + ) # make sure that logging is still captured in tests - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_hello(): import logging logging.warn("hello433") assert 0 - """) + """ + ) result = testdir.runpytest_subprocess(p, "-p", "no:capturelog") assert result.ret != 0 - result.stdout.fnmatch_lines([ - "WARNING*hello433*", - ]) - assert 'something' not in result.stderr.str() - assert 'operation on closed file' not in result.stderr.str() + result.stdout.fnmatch_lines(["WARNING*hello433*"]) + assert "something" not in result.stderr.str() + assert "operation on closed file" not in result.stderr.str() class TestCaptureFixture(object): + @pytest.mark.parametrize("opt", [[], ["-s"]]) def test_std_functional(self, testdir, opt): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ def test_hello(capsys): print (42) out, err = capsys.readouterr() assert out.startswith("42") - """, *opt) + """, + *opt + ) reprec.assertoutcome(passed=1) def test_capsyscapfd(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_one(capsys, capfd): pass def test_two(capfd, capsys): pass - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "*ERROR*setup*test_one*", - "E*capfd*capsys*same*time*", - "*ERROR*setup*test_two*", - "E*capsys*capfd*same*time*", - "*2 error*"]) + result.stdout.fnmatch_lines( + [ + "*ERROR*setup*test_one*", + "E*capfd*capsys*same*time*", + "*ERROR*setup*test_two*", + "E*capsys*capfd*same*time*", + "*2 error*", + ] + ) def test_capturing_getfixturevalue(self, testdir): """Test that asking for "capfd" and "capsys" using request.getfixturevalue in the same test is an error. """ - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_one(capsys, request): request.getfixturevalue("capfd") def test_two(capfd, request): request.getfixturevalue("capsys") - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*test_one*", - "*capsys*capfd*same*time*", - "*test_two*", - "*capfd*capsys*same*time*", - "*2 failed in*", - ]) + result.stdout.fnmatch_lines( + [ + "*test_one*", + "*capsys*capfd*same*time*", + "*test_two*", + "*capfd*capsys*same*time*", + "*2 failed in*", + ] + ) def test_capsyscapfdbinary(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_one(capsys, capfdbinary): pass - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "*ERROR*setup*test_one*", - "E*capfdbinary*capsys*same*time*", - "*1 error*"]) + result.stdout.fnmatch_lines( + ["*ERROR*setup*test_one*", "E*capfdbinary*capsys*same*time*", "*1 error*"] + ) @pytest.mark.parametrize("method", ["sys", "fd"]) def test_capture_is_represented_on_failure_issue128(self, testdir, method): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_hello(cap%s): print ("xxx42xxx") assert 0 - """ % method) + """ + % method + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "xxx42xxx", - ]) + result.stdout.fnmatch_lines(["xxx42xxx"]) @needsosdup def test_stdfd_functional(self, testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ def test_hello(capfd): import os os.write(1, "42".encode('ascii')) out, err = capfd.readouterr() assert out.startswith("42") capfd.close() - """) + """ + ) reprec.assertoutcome(passed=1) @needsosdup def test_capfdbinary(self, testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ def test_hello(capfdbinary): import os # some likely un-decodable bytes @@ -467,15 +506,16 @@ class TestCaptureFixture(object): out, err = capfdbinary.readouterr() assert out == b'\\xfe\\x98\\x20' assert err == b'' - """) + """ + ) reprec.assertoutcome(passed=1) @pytest.mark.skipif( - sys.version_info < (3,), - reason='only have capsysbinary in python 3', + sys.version_info < (3,), reason="only have capsysbinary in python 3" ) def test_capsysbinary(self, testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ def test_hello(capsysbinary): import sys # some likely un-decodable bytes @@ -483,64 +523,70 @@ class TestCaptureFixture(object): out, err = capsysbinary.readouterr() assert out == b'\\xfe\\x98\\x20' assert err == b'' - """) + """ + ) reprec.assertoutcome(passed=1) @pytest.mark.skipif( - sys.version_info >= (3,), - reason='only have capsysbinary in python 3', + sys.version_info >= (3,), reason="only have capsysbinary in python 3" ) def test_capsysbinary_forbidden_in_python2(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_hello(capsysbinary): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*test_hello*", - "*capsysbinary is only supported on python 3*", - "*1 error in*", - ]) + result.stdout.fnmatch_lines( + [ + "*test_hello*", + "*capsysbinary is only supported on python 3*", + "*1 error in*", + ] + ) def test_partial_setup_failure(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_hello(capsys, missingarg): pass - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "*test_partial_setup_failure*", - "*1 error*", - ]) + result.stdout.fnmatch_lines(["*test_partial_setup_failure*", "*1 error*"]) @needsosdup def test_keyboardinterrupt_disables_capturing(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_hello(capfd): import os os.write(1, str(42).encode('ascii')) raise KeyboardInterrupt() - """) + """ + ) result = testdir.runpytest_subprocess(p) - result.stdout.fnmatch_lines([ - "*KeyboardInterrupt*" - ]) + result.stdout.fnmatch_lines(["*KeyboardInterrupt*"]) assert result.ret == 2 @pytest.mark.issue14 def test_capture_and_logging(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import logging def test_log(capsys): logging.error('x') - """) + """ + ) result = testdir.runpytest_subprocess(p) - assert 'closed' not in result.stderr.str() + assert "closed" not in result.stderr.str() - @pytest.mark.parametrize('fixture', ['capsys', 'capfd']) - @pytest.mark.parametrize('no_capture', [True, False]) + @pytest.mark.parametrize("fixture", ["capsys", "capfd"]) + @pytest.mark.parametrize("no_capture", [True, False]) def test_disabled_capture_fixture(self, testdir, fixture, no_capture): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_disabled({fixture}): print('captured before') with {fixture}.disabled(): @@ -550,25 +596,31 @@ class TestCaptureFixture(object): def test_normal(): print('test_normal executed') - """.format(fixture=fixture)) - args = ('-s',) if no_capture else () + """.format( + fixture=fixture + ) + ) + args = ("-s",) if no_capture else () result = testdir.runpytest_subprocess(*args) - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *while capture is disabled* - """) - assert 'captured before' not in result.stdout.str() - assert 'captured after' not in result.stdout.str() + """ + ) + assert "captured before" not in result.stdout.str() + assert "captured after" not in result.stdout.str() if no_capture: - assert 'test_normal executed' in result.stdout.str() + assert "test_normal executed" in result.stdout.str() else: - assert 'test_normal executed' not in result.stdout.str() + assert "test_normal executed" not in result.stdout.str() - @pytest.mark.parametrize('fixture', ['capsys', 'capfd']) + @pytest.mark.parametrize("fixture", ["capsys", "capfd"]) def test_fixture_use_by_other_fixtures(self, testdir, fixture): """ Ensure that capsys and capfd can be used by other fixtures during setup and teardown. """ - testdir.makepyfile(""" + testdir.makepyfile( + """ from __future__ import print_function import sys import pytest @@ -591,83 +643,96 @@ class TestCaptureFixture(object): out, err = captured_print assert out == 'stdout contents begin\\n' assert err == 'stderr contents begin\\n' - """.format(fixture=fixture)) + """.format( + fixture=fixture + ) + ) result = testdir.runpytest_subprocess() result.stdout.fnmatch_lines("*1 passed*") - assert 'stdout contents begin' not in result.stdout.str() - assert 'stderr contents begin' not in result.stdout.str() + assert "stdout contents begin" not in result.stdout.str() + assert "stderr contents begin" not in result.stdout.str() def test_setup_failure_does_not_kill_capturing(testdir): sub1 = testdir.mkpydir("sub1") - sub1.join("conftest.py").write(_pytest._code.Source(""" + sub1.join("conftest.py").write( + _pytest._code.Source( + """ def pytest_runtest_setup(item): raise ValueError(42) - """)) + """ + ) + ) sub1.join("test_mod.py").write("def test_func1(): pass") - result = testdir.runpytest(testdir.tmpdir, '--traceconfig') - result.stdout.fnmatch_lines([ - "*ValueError(42)*", - "*1 error*" - ]) + result = testdir.runpytest(testdir.tmpdir, "--traceconfig") + result.stdout.fnmatch_lines(["*ValueError(42)*", "*1 error*"]) def test_fdfuncarg_skips_on_no_osdup(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import os if hasattr(os, 'dup'): del os.dup def test_hello(capfd): pass - """) + """ + ) result = testdir.runpytest_subprocess("--capture=no") - result.stdout.fnmatch_lines([ - "*1 skipped*" - ]) + result.stdout.fnmatch_lines(["*1 skipped*"]) def test_capture_conftest_runtest_setup(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_runtest_setup(): print ("hello19") - """) + """ + ) testdir.makepyfile("def test_func(): pass") result = testdir.runpytest() assert result.ret == 0 - assert 'hello19' not in result.stdout.str() + assert "hello19" not in result.stdout.str() def test_capture_badoutput_issue412(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import os def test_func(): omg = bytearray([1,129,1]) os.write(1, omg) assert 0 - """) - result = testdir.runpytest('--cap=fd') - result.stdout.fnmatch_lines(''' + """ + ) + result = testdir.runpytest("--cap=fd") + result.stdout.fnmatch_lines( + """ *def test_func* *assert 0* *Captured* *1 failed* - ''') + """ + ) def test_capture_early_option_parsing(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_runtest_setup(): print ("hello19") - """) + """ + ) testdir.makepyfile("def test_func(): pass") result = testdir.runpytest("-vs") assert result.ret == 0 - assert 'hello19' in result.stdout.str() + assert "hello19" in result.stdout.str() def test_capture_binary_output(testdir): - testdir.makepyfile(r""" + testdir.makepyfile( + r""" import pytest def test_a(): @@ -680,31 +745,33 @@ def test_capture_binary_output(testdir): if __name__ == '__main__': test_foo() - """) - result = testdir.runpytest('--assert=plain') + """ + ) + result = testdir.runpytest("--assert=plain") result.assert_outcomes(passed=2) def test_error_during_readouterr(testdir): """Make sure we suspend capturing if errors occur during readouterr""" - testdir.makepyfile(pytest_xyz=""" + testdir.makepyfile( + pytest_xyz=""" from _pytest.capture import FDCapture def bad_snap(self): raise Exception('boom') assert FDCapture.snap FDCapture.snap = bad_snap - """) + """ + ) result = testdir.runpytest_subprocess( "-p", "pytest_xyz", "--version", syspathinsert=True ) - result.stderr.fnmatch_lines([ - "*in bad_snap", - " raise Exception('boom')", - "Exception: boom", - ]) + result.stderr.fnmatch_lines( + ["*in bad_snap", " raise Exception('boom')", "Exception: boom"] + ) class TestCaptureIO(object): + def test_text(self): f = capture.CaptureIO() f.write("hello") @@ -718,23 +785,20 @@ class TestCaptureIO(object): f.write("\u00f6") pytest.raises(TypeError, "f.write(bytes('hello', 'UTF-8'))") else: - f.write(unicode("\u00f6", 'UTF-8')) + f.write(text_type("\u00f6", "UTF-8")) f.write("hello") # bytes s = f.getvalue() f.close() - assert isinstance(s, unicode) + assert isinstance(s, text_type) - @pytest.mark.skipif( - sys.version_info[0] == 2, - reason='python 3 only behaviour', - ) + @pytest.mark.skipif(sys.version_info[0] == 2, reason="python 3 only behaviour") def test_write_bytes_to_buffer(self): """In python3, stdout / stderr are text io wrappers (exposing a buffer property of the underlying bytestream). See issue #1407 """ f = capture.CaptureIO() - f.buffer.write(b'foo\r\n') - assert f.getvalue() == 'foo\r\n' + f.buffer.write(b"foo\r\n") + assert f.getvalue() == "foo\r\n" def test_bytes_io(): @@ -747,31 +811,36 @@ def test_bytes_io(): def test_dontreadfrominput(): from _pytest.capture import DontReadFromInput + f = DontReadFromInput() assert not f.isatty() pytest.raises(IOError, f.read) pytest.raises(IOError, f.readlines) - pytest.raises(IOError, iter, f) + iter_f = iter(f) + pytest.raises(IOError, next, iter_f) pytest.raises(UnsupportedOperation, f.fileno) f.close() # just for completeness -@pytest.mark.skipif('sys.version_info < (3,)', reason='python2 has no buffer') +@pytest.mark.skipif("sys.version_info < (3,)", reason="python2 has no buffer") def test_dontreadfrominput_buffer_python3(): from _pytest.capture import DontReadFromInput + f = DontReadFromInput() fb = f.buffer assert not fb.isatty() pytest.raises(IOError, fb.read) pytest.raises(IOError, fb.readlines) - pytest.raises(IOError, iter, fb) + iter_f = iter(f) + pytest.raises(IOError, next, iter_f) pytest.raises(ValueError, fb.fileno) f.close() # just for completeness -@pytest.mark.skipif('sys.version_info >= (3,)', reason='python2 has no buffer') +@pytest.mark.skipif("sys.version_info >= (3,)", reason="python2 has no buffer") def test_dontreadfrominput_buffer_python2(): from _pytest.capture import DontReadFromInput + f = DontReadFromInput() with pytest.raises(AttributeError): f.buffer @@ -780,7 +849,7 @@ def test_dontreadfrominput_buffer_python2(): @pytest.yield_fixture def tmpfile(testdir): - f = testdir.makepyfile("").open('wb+') + f = testdir.makepyfile("").open("wb+") yield f if not f.closed: f.close() @@ -818,7 +887,7 @@ def test_dupfile_on_bytesio(): f = capture.safe_text_dupfile(io, "wb") f.write("hello") assert io.getvalue() == b"hello" - assert 'BytesIO object' in f.name + assert "BytesIO object" in f.name def test_dupfile_on_textio(): @@ -826,7 +895,7 @@ def test_dupfile_on_textio(): f = capture.safe_text_dupfile(io, "wb") f.write("hello") assert io.getvalue() == "hello" - assert not hasattr(f, 'name') + assert not hasattr(f, "name") @contextlib.contextmanager @@ -868,7 +937,7 @@ class TestFDCapture(object): def test_simple_many_check_open_files(self, testdir): with lsof_check(): - with testdir.makepyfile("").open('wb+') as tmpfile: + with testdir.makepyfile("").open("wb+") as tmpfile: self.test_simple_many(tmpfile) def test_simple_fail_second_start(self, tmpfile): @@ -890,7 +959,7 @@ class TestFDCapture(object): cap.start() x = os.read(0, 100).strip() cap.done() - assert x == tobytes('') + assert x == tobytes("") def test_writeorg(self, tmpfile): data1, data2 = tobytes("foo"), tobytes("bar") @@ -902,7 +971,7 @@ class TestFDCapture(object): scap = cap.snap() cap.done() assert scap == totext(data1) - with open(tmpfile.name, 'rb') as stmp_file: + with open(tmpfile.name, "rb") as stmp_file: stmp = stmp_file.read() assert stmp == data2 @@ -992,14 +1061,15 @@ class TestStdCapture(object): out, err = cap.readouterr() assert out == py.builtin._totext("hx\xc4\x85\xc4\x87\n", "utf8") - @pytest.mark.skipif('sys.version_info >= (3,)', - reason='text output different for bytes on python3') + @pytest.mark.skipif( + "sys.version_info >= (3,)", reason="text output different for bytes on python3" + ) def test_capturing_readouterr_decode_error_handling(self): with self.getcapture() as cap: - # triggered a internal error in pytest - print('\xa6') + # triggered an internal error in pytest + print("\xa6") out, err = cap.readouterr() - assert out == py.builtin._totext('\ufffd\n', 'unicode-escape') + assert out == py.builtin._totext("\ufffd\n", "unicode-escape") def test_reset_twice_error(self): with self.getcapture() as cap: @@ -1071,18 +1141,22 @@ class TestStdCaptureFD(TestStdCapture): captureclass = staticmethod(StdCaptureFD) def test_simple_only_fd(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import os def test_x(): os.write(1, "hello\\n".encode("ascii")) assert 0 - """) + """ + ) result = testdir.runpytest_subprocess() - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *test_x* *assert 0* *Captured stdout* - """) + """ + ) def test_intermingling(self): with self.getcapture() as cap: @@ -1109,7 +1183,8 @@ class TestStdCaptureFDinvalidFD(object): pytestmark = needsosdup def test_stdcapture_fd_invalid_fd(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import os from _pytest import capture def StdCaptureFD(out=True, err=True, in_=True): @@ -1127,10 +1202,11 @@ class TestStdCaptureFDinvalidFD(object): os.close(0) cap = StdCaptureFD(out=False, err=False, in_=True) cap.stop_capturing() - """) + """ + ) result = testdir.runpytest_subprocess("--capture=fd") assert result.ret == 0 - assert result.parseoutcomes()['passed'] == 3 + assert result.parseoutcomes()["passed"] == 3 def test_capture_not_started_but_reset(): @@ -1139,12 +1215,12 @@ def test_capture_not_started_but_reset(): def test_using_capsys_fixture_works_with_sys_stdout_encoding(capsys): - test_text = 'test text' + test_text = "test text" - print(test_text.encode(sys.stdout.encoding, 'replace')) + print(test_text.encode(sys.stdout.encoding, "replace")) (out, err) = capsys.readouterr() assert out - assert err == '' + assert err == "" def test_capsys_results_accessible_by_attribute(capsys): @@ -1156,7 +1232,7 @@ def test_capsys_results_accessible_by_attribute(capsys): @needsosdup -@pytest.mark.parametrize('use', [True, False]) +@pytest.mark.parametrize("use", [True, False]) def test_fdcapture_tmpfile_remains_the_same(tmpfile, use): if not use: tmpfile = True @@ -1173,29 +1249,34 @@ def test_fdcapture_tmpfile_remains_the_same(tmpfile, use): @needsosdup def test_close_and_capture_again(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import os def test_close(): os.close(1) def test_capture_again(): os.write(1, b"hello\\n") assert 0 - """) + """ + ) result = testdir.runpytest_subprocess() - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *test_capture_again* *assert 0* *stdout* *hello* - """) + """ + ) -@pytest.mark.parametrize('method', ['SysCapture', 'FDCapture']) +@pytest.mark.parametrize("method", ["SysCapture", "FDCapture"]) def test_capturing_and_logging_fundamentals(testdir, method): - if method == "StdCaptureFD" and not hasattr(os, 'dup'): + if method == "StdCaptureFD" and not hasattr(os, "dup"): pytest.skip("need os.dup") # here we check a fundamental feature - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import sys, os import py, logging from _pytest import capture @@ -1213,31 +1294,41 @@ def test_capturing_and_logging_fundamentals(testdir, method): outerr = cap.readouterr() print ("suspend2, captured %%s" %% (outerr,)) - """ % (method,)) + """ + % (method,) + ) result = testdir.runpython(p) - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ suspend, captured*hello1* suspend2, captured*WARNING:root:hello3* - """) - result.stderr.fnmatch_lines(""" + """ + ) + result.stderr.fnmatch_lines( + """ WARNING:root:hello2 - """) + """ + ) assert "atexit" not in result.stderr.str() def test_error_attribute_issue555(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import sys def test_capattr(): assert sys.stdout.errors == "strict" assert sys.stderr.errors == "strict" - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) -@pytest.mark.skipif(not sys.platform.startswith('win') and sys.version_info[:2] >= (3, 6), - reason='only py3.6+ on windows') +@pytest.mark.skipif( + not sys.platform.startswith("win") and sys.version_info[:2] >= (3, 6), + reason="only py3.6+ on windows", +) def test_py36_windowsconsoleio_workaround_non_standard_streams(): """ Ensure _py36_windowsconsoleio_workaround function works with objects that @@ -1245,7 +1336,8 @@ def test_py36_windowsconsoleio_workaround_non_standard_streams(): """ from _pytest.capture import _py36_windowsconsoleio_workaround - class DummyStream: + class DummyStream(object): + def write(self, s): pass @@ -1254,17 +1346,45 @@ def test_py36_windowsconsoleio_workaround_non_standard_streams(): def test_dontreadfrominput_has_encoding(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import sys def test_capattr(): # should not raise AttributeError assert sys.stdout.encoding assert sys.stderr.encoding - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) +def test_crash_on_closing_tmpfile_py27(testdir): + testdir.makepyfile( + """ + from __future__ import print_function + import time + import threading + import sys + + def spam(): + f = sys.stderr + while True: + print('.', end='', file=f) + + def test_silly(): + t = threading.Thread(target=spam) + t.daemon = True + t.start() + time.sleep(0.5) + + """ + ) + result = testdir.runpytest_subprocess() + assert result.ret == 0 + assert "IOError" not in result.stdout.str() + + def test_pickling_and_unpickling_encoded_file(): # See https://bitbucket.org/pytest-dev/pytest/pull-request/194 # pickle.loads() raises infinite recursion if diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_collection.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_collection.py index 563ed0439c0..657d64c74e2 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_collection.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_collection.py @@ -1,22 +1,27 @@ from __future__ import absolute_import, division, print_function +import pprint +import sys import pytest -import py import _pytest._code from _pytest.main import Session, EXIT_NOTESTSCOLLECTED, _in_venv class TestCollector(object): + def test_collect_versus_item(self): from pytest import Collector, Item + assert not issubclass(Collector, Item) assert not issubclass(Item, Collector) def test_compat_attributes(self, testdir, recwarn): - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ def test_pass(): pass def test_fail(): assert 0 - """) + """ + ) recwarn.clear() assert modcol.Module == pytest.Module assert modcol.Class == pytest.Class @@ -25,10 +30,12 @@ class TestCollector(object): assert modcol.Function == pytest.Function def test_check_equality(self, testdir): - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ def test_pass(): pass def test_fail(): assert 0 - """) + """ + ) fn1 = testdir.collect_by_name(modcol, "test_pass") assert isinstance(fn1, pytest.Function) fn2 = testdir.collect_by_name(modcol, "test_pass") @@ -36,8 +43,8 @@ class TestCollector(object): assert fn1 == fn2 assert fn1 != modcol - if py.std.sys.version_info < (3, 0): - assert cmp(fn1, fn2) == 0 + if sys.version_info < (3, 0): + assert cmp(fn1, fn2) == 0 # NOQA assert hash(fn1) == hash(fn2) fn3 = testdir.collect_by_name(modcol, "test_fail") @@ -53,14 +60,15 @@ class TestCollector(object): assert modcol != fn def test_getparent(self, testdir): - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ class TestClass(object): def test_foo(): pass - """) + """ + ) cls = testdir.collect_by_name(modcol, "TestClass") - fn = testdir.collect_by_name( - testdir.collect_by_name(cls, "()"), "test_foo") + fn = testdir.collect_by_name(testdir.collect_by_name(cls, "()"), "test_foo") parent = fn.getparent(pytest.Module) assert parent is modcol @@ -73,14 +81,16 @@ class TestCollector(object): def test_getcustomfile_roundtrip(self, testdir): hello = testdir.makefile(".xxx", hello="world") - testdir.makepyfile(conftest=""" + testdir.makepyfile( + conftest=""" import pytest class CustomFile(pytest.File): pass def pytest_collect_file(path, parent): if path.ext == ".xxx": return CustomFile(path, parent=parent) - """) + """ + ) node = testdir.getpathnode(hello) assert isinstance(node, pytest.File) assert node.name == "hello.xxx" @@ -90,32 +100,32 @@ class TestCollector(object): def test_can_skip_class_with_test_attr(self, testdir): """Assure test class is skipped when using `__test__=False` (See #2007).""" - testdir.makepyfile(""" + testdir.makepyfile( + """ class TestFoo(object): __test__ = False def __init__(self): pass def test_foo(): assert True - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - 'collected 0 items', - '*no tests ran in*', - ]) + result.stdout.fnmatch_lines(["collected 0 items", "*no tests ran in*"]) class TestCollectFS(object): + def test_ignored_certain_directories(self, testdir): tmpdir = testdir.tmpdir - tmpdir.ensure("build", 'test_notfound.py') - tmpdir.ensure("dist", 'test_notfound.py') - tmpdir.ensure("_darcs", 'test_notfound.py') - tmpdir.ensure("CVS", 'test_notfound.py') - tmpdir.ensure("{arch}", 'test_notfound.py') - tmpdir.ensure(".whatever", 'test_notfound.py') - tmpdir.ensure(".bzr", 'test_notfound.py') - tmpdir.ensure("normal", 'test_found.py') + tmpdir.ensure("build", "test_notfound.py") + tmpdir.ensure("dist", "test_notfound.py") + tmpdir.ensure("_darcs", "test_notfound.py") + tmpdir.ensure("CVS", "test_notfound.py") + tmpdir.ensure("{arch}", "test_notfound.py") + tmpdir.ensure(".whatever", "test_notfound.py") + tmpdir.ensure(".bzr", "test_notfound.py") + tmpdir.ensure("normal", "test_found.py") for x in tmpdir.visit("test_*.py"): x.write("def test_hello(): pass") @@ -124,11 +134,19 @@ class TestCollectFS(object): assert "test_notfound" not in s assert "test_found" in s - @pytest.mark.parametrize('fname', - ("activate", "activate.csh", "activate.fish", - "Activate", "Activate.bat", "Activate.ps1")) + @pytest.mark.parametrize( + "fname", + ( + "activate", + "activate.csh", + "activate.fish", + "Activate", + "Activate.bat", + "Activate.ps1", + ), + ) def test_ignored_virtualenvs(self, testdir, fname): - bindir = "Scripts" if py.std.sys.platform.startswith("win") else "bin" + bindir = "Scripts" if sys.platform.startswith("win") else "bin" testdir.tmpdir.ensure("virtual", bindir, fname) testfile = testdir.tmpdir.ensure("virtual", "test_invenv.py") testfile.write("def test_hello(): pass") @@ -143,11 +161,19 @@ class TestCollectFS(object): result = testdir.runpytest("virtual") assert "test_invenv" in result.stdout.str() - @pytest.mark.parametrize('fname', - ("activate", "activate.csh", "activate.fish", - "Activate", "Activate.bat", "Activate.ps1")) + @pytest.mark.parametrize( + "fname", + ( + "activate", + "activate.csh", + "activate.fish", + "Activate", + "Activate.bat", + "Activate.ps1", + ), + ) def test_ignored_virtualenvs_norecursedirs_precedence(self, testdir, fname): - bindir = "Scripts" if py.std.sys.platform.startswith("win") else "bin" + bindir = "Scripts" if sys.platform.startswith("win") else "bin" # norecursedirs takes priority testdir.tmpdir.ensure(".virtual", bindir, fname) testfile = testdir.tmpdir.ensure(".virtual", "test_invenv.py") @@ -158,24 +184,34 @@ class TestCollectFS(object): result = testdir.runpytest("--collect-in-virtualenv", ".virtual") assert "test_invenv" in result.stdout.str() - @pytest.mark.parametrize('fname', - ("activate", "activate.csh", "activate.fish", - "Activate", "Activate.bat", "Activate.ps1")) + @pytest.mark.parametrize( + "fname", + ( + "activate", + "activate.csh", + "activate.fish", + "Activate", + "Activate.bat", + "Activate.ps1", + ), + ) def test__in_venv(self, testdir, fname): """Directly test the virtual env detection function""" - bindir = "Scripts" if py.std.sys.platform.startswith("win") else "bin" + bindir = "Scripts" if sys.platform.startswith("win") else "bin" # no bin/activate, not a virtualenv - base_path = testdir.tmpdir.mkdir('venv') + base_path = testdir.tmpdir.mkdir("venv") assert _in_venv(base_path) is False # with bin/activate, totally a virtualenv base_path.ensure(bindir, fname) assert _in_venv(base_path) is True def test_custom_norecursedirs(self, testdir): - testdir.makeini(""" + testdir.makeini( + """ [pytest] norecursedirs = mydir xyz* - """) + """ + ) tmpdir = testdir.tmpdir tmpdir.ensure("mydir", "test_hello.py").write("def test_1(): pass") tmpdir.ensure("xyz123", "test_2.py").write("def test_2(): 0/0") @@ -186,10 +222,12 @@ class TestCollectFS(object): rec.assertoutcome(failed=1) def test_testpaths_ini(self, testdir, monkeypatch): - testdir.makeini(""" + testdir.makeini( + """ [pytest] testpaths = gui uts - """) + """ + ) tmpdir = testdir.tmpdir tmpdir.ensure("env", "test_1.py").write("def test_env(): pass") tmpdir.ensure("gui", "test_2.py").write("def test_gui(): pass") @@ -197,28 +235,30 @@ class TestCollectFS(object): # executing from rootdir only tests from `testpaths` directories # are collected - items, reprec = testdir.inline_genitems('-v') - assert [x.name for x in items] == ['test_gui', 'test_uts'] + items, reprec = testdir.inline_genitems("-v") + assert [x.name for x in items] == ["test_gui", "test_uts"] # check that explicitly passing directories in the command-line # collects the tests - for dirname in ('env', 'gui', 'uts'): + for dirname in ("env", "gui", "uts"): items, reprec = testdir.inline_genitems(tmpdir.join(dirname)) - assert [x.name for x in items] == ['test_%s' % dirname] + assert [x.name for x in items] == ["test_%s" % dirname] # changing cwd to each subdirectory and running pytest without # arguments collects the tests in that directory normally - for dirname in ('env', 'gui', 'uts'): + for dirname in ("env", "gui", "uts"): monkeypatch.chdir(testdir.tmpdir.join(dirname)) items, reprec = testdir.inline_genitems() - assert [x.name for x in items] == ['test_%s' % dirname] + assert [x.name for x in items] == ["test_%s" % dirname] class TestCollectPluginHookRelay(object): + def test_pytest_collect_file(self, testdir): wascalled = [] class Plugin(object): + def pytest_collect_file(self, path, parent): if not path.basename.startswith("."): # Ignore hidden files, e.g. .testmondata. @@ -227,12 +267,13 @@ class TestCollectPluginHookRelay(object): testdir.makefile(".abc", "xyz") pytest.main([testdir.tmpdir], plugins=[Plugin()]) assert len(wascalled) == 1 - assert wascalled[0].ext == '.abc' + assert wascalled[0].ext == ".abc" def test_pytest_collect_directory(self, testdir): wascalled = [] class Plugin(object): + def pytest_collect_directory(self, path, parent): wascalled.append(path.basename) @@ -246,10 +287,13 @@ class TestCollectPluginHookRelay(object): class TestPrunetraceback(object): def test_custom_repr_failure(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import not_exists - """) - testdir.makeconftest(""" + """ + ) + testdir.makeconftest( + """ import pytest def pytest_collect_file(path, parent): return MyFile(path, parent) @@ -262,20 +306,21 @@ class TestPrunetraceback(object): if excinfo.errisinstance(MyError): return "hello world" return pytest.File.repr_failure(self, excinfo) - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "*ERROR collecting*", - "*hello world*", - ]) + result.stdout.fnmatch_lines(["*ERROR collecting*", "*hello world*"]) @pytest.mark.xfail(reason="other mechanism for adding to reporting needed") def test_collect_report_postprocessing(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import not_exists - """) - testdir.makeconftest(""" + """ + ) + testdir.makeconftest( + """ import pytest @pytest.hookimpl(hookwrapper=True) def pytest_make_collect_report(): @@ -283,21 +328,22 @@ class TestPrunetraceback(object): rep = outcome.get_result() rep.headerlines += ["header1"] outcome.force_result(rep) - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "*ERROR collecting*", - "*header1*", - ]) + result.stdout.fnmatch_lines(["*ERROR collecting*", "*header1*"]) class TestCustomConftests(object): + def test_ignore_collect_path(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_ignore_collect(path, config): return path.basename.startswith("x") or \ path.basename == "test_one.py" - """) + """ + ) sub = testdir.mkdir("xy123") sub.ensure("test_hello.py").write("syntax error") sub.join("conftest.py").write("syntax error") @@ -308,10 +354,12 @@ class TestCustomConftests(object): result.stdout.fnmatch_lines(["*1 passed*"]) def test_ignore_collect_not_called_on_argument(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_ignore_collect(path, config): return True - """) + """ + ) p = testdir.makepyfile("def test_hello(): pass") result = testdir.runpytest(p) assert result.ret == 0 @@ -321,14 +369,16 @@ class TestCustomConftests(object): result.stdout.fnmatch_lines("*collected 0 items*") def test_collectignore_exclude_on_option(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ collect_ignore = ['hello', 'test_world.py'] def pytest_addoption(parser): parser.addoption("--XX", action="store_true", default=False) def pytest_configure(config): if config.getvalue("XX"): collect_ignore[:] = [] - """) + """ + ) testdir.mkdir("hello") testdir.makepyfile(test_world="def test_hello(): pass") result = testdir.runpytest() @@ -339,55 +389,55 @@ class TestCustomConftests(object): assert "passed" in result.stdout.str() def test_pytest_fs_collect_hooks_are_seen(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest class MyModule(pytest.Module): pass def pytest_collect_file(path, parent): if path.ext == ".py": return MyModule(path, parent) - """) + """ + ) testdir.mkdir("sub") testdir.makepyfile("def test_x(): pass") result = testdir.runpytest("--collect-only") - result.stdout.fnmatch_lines([ - "*MyModule*", - "*test_x*" - ]) + result.stdout.fnmatch_lines(["*MyModule*", "*test_x*"]) def test_pytest_collect_file_from_sister_dir(self, testdir): sub1 = testdir.mkpydir("sub1") sub2 = testdir.mkpydir("sub2") - conf1 = testdir.makeconftest(""" + conf1 = testdir.makeconftest( + """ import pytest class MyModule1(pytest.Module): pass def pytest_collect_file(path, parent): if path.ext == ".py": return MyModule1(path, parent) - """) + """ + ) conf1.move(sub1.join(conf1.basename)) - conf2 = testdir.makeconftest(""" + conf2 = testdir.makeconftest( + """ import pytest class MyModule2(pytest.Module): pass def pytest_collect_file(path, parent): if path.ext == ".py": return MyModule2(path, parent) - """) + """ + ) conf2.move(sub2.join(conf2.basename)) p = testdir.makepyfile("def test_x(): pass") p.copy(sub1.join(p.basename)) p.copy(sub2.join(p.basename)) result = testdir.runpytest("--collect-only") - result.stdout.fnmatch_lines([ - "*MyModule1*", - "*MyModule2*", - "*test_x*" - ]) + result.stdout.fnmatch_lines(["*MyModule1*", "*MyModule2*", "*test_x*"]) class TestSession(object): + def test_parsearg(self, testdir): p = testdir.makepyfile("def test_func(): pass") subdir = testdir.mkdir("sub") @@ -424,9 +474,13 @@ class TestSession(object): def get_reported_items(self, hookrec): """Return pytest.Item instances reported by the pytest_collectreport hook""" - calls = hookrec.getcalls('pytest_collectreport') - return [x for call in calls for x in call.report.result - if isinstance(x, pytest.Item)] + calls = hookrec.getcalls("pytest_collectreport") + return [ + x + for call in calls + for x in call.report.result + if isinstance(x, pytest.Item) + ] def test_collect_protocol_single_function(self, testdir): p = testdir.makepyfile("def test_func(): pass") @@ -436,42 +490,48 @@ class TestSession(object): assert item.name == "test_func" newid = item.nodeid assert newid == id - py.std.pprint.pprint(hookrec.calls) + pprint.pprint(hookrec.calls) topdir = testdir.tmpdir # noqa - hookrec.assert_contains([ - ("pytest_collectstart", "collector.fspath == topdir"), - ("pytest_make_collect_report", "collector.fspath == topdir"), - ("pytest_collectstart", "collector.fspath == p"), - ("pytest_make_collect_report", "collector.fspath == p"), - ("pytest_pycollect_makeitem", "name == 'test_func'"), - ("pytest_collectreport", "report.result[0].name == 'test_func'"), - ]) + hookrec.assert_contains( + [ + ("pytest_collectstart", "collector.fspath == topdir"), + ("pytest_make_collect_report", "collector.fspath == topdir"), + ("pytest_collectstart", "collector.fspath == p"), + ("pytest_make_collect_report", "collector.fspath == p"), + ("pytest_pycollect_makeitem", "name == 'test_func'"), + ("pytest_collectreport", "report.result[0].name == 'test_func'"), + ] + ) # ensure we are reporting the collection of the single test item (#2464) - assert [x.name for x in self.get_reported_items(hookrec)] == ['test_func'] + assert [x.name for x in self.get_reported_items(hookrec)] == ["test_func"] def test_collect_protocol_method(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ class TestClass(object): def test_method(self): pass - """) + """ + ) normid = p.basename + "::TestClass::()::test_method" - for id in [p.basename, - p.basename + "::TestClass", - p.basename + "::TestClass::()", - normid, - ]: + for id in [ + p.basename, + p.basename + "::TestClass", + p.basename + "::TestClass::()", + normid, + ]: items, hookrec = testdir.inline_genitems(id) assert len(items) == 1 assert items[0].name == "test_method" newid = items[0].nodeid assert newid == normid # ensure we are reporting the collection of the single test item (#2464) - assert [x.name for x in self.get_reported_items(hookrec)] == ['test_method'] + assert [x.name for x in self.get_reported_items(hookrec)] == ["test_method"] def test_collect_custom_nodes_multi_id(self, testdir): p = testdir.makepyfile("def test_func(): pass") - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest class SpecialItem(pytest.Item): def runtest(self): @@ -482,22 +542,26 @@ class TestSession(object): def pytest_collect_file(path, parent): if path.basename == %r: return SpecialFile(fspath=path, parent=parent) - """ % p.basename) + """ + % p.basename + ) id = p.basename items, hookrec = testdir.inline_genitems(id) - py.std.pprint.pprint(hookrec.calls) + pprint.pprint(hookrec.calls) assert len(items) == 2 - hookrec.assert_contains([ - ("pytest_collectstart", - "collector.fspath == collector.session.fspath"), - ("pytest_collectstart", - "collector.__class__.__name__ == 'SpecialFile'"), - ("pytest_collectstart", - "collector.__class__.__name__ == 'Module'"), - ("pytest_pycollect_makeitem", "name == 'test_func'"), - ("pytest_collectreport", "report.nodeid.startswith(p.basename)"), - ]) + hookrec.assert_contains( + [ + ("pytest_collectstart", "collector.fspath == collector.session.fspath"), + ( + "pytest_collectstart", + "collector.__class__.__name__ == 'SpecialFile'", + ), + ("pytest_collectstart", "collector.__class__.__name__ == 'Module'"), + ("pytest_pycollect_makeitem", "name == 'test_func'"), + ("pytest_collectreport", "report.nodeid.startswith(p.basename)"), + ] + ) assert len(self.get_reported_items(hookrec)) == 2 def test_collect_subdir_event_ordering(self, testdir): @@ -508,13 +572,14 @@ class TestSession(object): items, hookrec = testdir.inline_genitems() assert len(items) == 1 - py.std.pprint.pprint(hookrec.calls) - hookrec.assert_contains([ - ("pytest_collectstart", "collector.fspath == test_aaa"), - ("pytest_pycollect_makeitem", "name == 'test_func'"), - ("pytest_collectreport", - "report.nodeid.startswith('aaa/test_aaa.py')"), - ]) + pprint.pprint(hookrec.calls) + hookrec.assert_contains( + [ + ("pytest_collectstart", "collector.fspath == test_aaa"), + ("pytest_pycollect_makeitem", "name == 'test_func'"), + ("pytest_collectreport", "report.nodeid.startswith('aaa/test_aaa.py')"), + ] + ) def test_collect_two_commandline_args(self, testdir): p = testdir.makepyfile("def test_func(): pass") @@ -529,15 +594,17 @@ class TestSession(object): items, hookrec = testdir.inline_genitems(id) assert len(items) == 2 - py.std.pprint.pprint(hookrec.calls) - hookrec.assert_contains([ - ("pytest_collectstart", "collector.fspath == test_aaa"), - ("pytest_pycollect_makeitem", "name == 'test_func'"), - ("pytest_collectreport", "report.nodeid == 'aaa/test_aaa.py'"), - ("pytest_collectstart", "collector.fspath == test_bbb"), - ("pytest_pycollect_makeitem", "name == 'test_func'"), - ("pytest_collectreport", "report.nodeid == 'bbb/test_bbb.py'"), - ]) + pprint.pprint(hookrec.calls) + hookrec.assert_contains( + [ + ("pytest_collectstart", "collector.fspath == test_aaa"), + ("pytest_pycollect_makeitem", "name == 'test_func'"), + ("pytest_collectreport", "report.nodeid == 'aaa/test_aaa.py'"), + ("pytest_collectstart", "collector.fspath == test_bbb"), + ("pytest_pycollect_makeitem", "name == 'test_func'"), + ("pytest_collectreport", "report.nodeid == 'bbb/test_bbb.py'"), + ] + ) def test_serialization_byid(self, testdir): testdir.makepyfile("def test_func(): pass") @@ -550,28 +617,31 @@ class TestSession(object): assert item2.fspath == item.fspath def test_find_byid_without_instance_parents(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ class TestClass(object): def test_method(self): pass - """) + """ + ) arg = p.basename + "::TestClass::test_method" items, hookrec = testdir.inline_genitems(arg) assert len(items) == 1 item, = items assert item.nodeid.endswith("TestClass::()::test_method") # ensure we are reporting the collection of the single test item (#2464) - assert [x.name for x in self.get_reported_items(hookrec)] == ['test_method'] + assert [x.name for x in self.get_reported_items(hookrec)] == ["test_method"] class Test_getinitialnodes(object): + def test_global_file(self, testdir, tmpdir): x = tmpdir.ensure("x.py") with tmpdir.as_cwd(): config = testdir.parseconfigure(x) col = testdir.getnode(config, x) assert isinstance(col, pytest.Module) - assert col.name == 'x.py' + assert col.name == "x.py" assert col.parent.parent is None for col in col.listchain(): assert col.config is config @@ -585,21 +655,24 @@ class Test_getinitialnodes(object): config = testdir.parseconfigure(x) col = testdir.getnode(config, x) assert isinstance(col, pytest.Module) - assert col.name == 'x.py' + assert col.name == "x.py" assert col.parent.parent is None for col in col.listchain(): assert col.config is config class Test_genitems(object): + def test_check_collect_hashes(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_1(): pass def test_2(): pass - """) + """ + ) p.copy(p.dirpath(p.purebasename + "2" + ".py")) items, reprec = testdir.inline_genitems(p.dirpath()) assert len(items) == 4 @@ -610,7 +683,8 @@ class Test_genitems(object): assert i != j def test_example_items1(self, testdir): - p = testdir.makepyfile(''' + p = testdir.makepyfile( + """ def testone(): pass @@ -620,12 +694,13 @@ class Test_genitems(object): class TestY(TestX): pass - ''') + """ + ) items, reprec = testdir.inline_genitems(p) assert len(items) == 3 - assert items[0].name == 'testone' - assert items[1].name == 'testmethod_one' - assert items[2].name == 'testmethod_one' + assert items[0].name == "testone" + assert items[1].name == "testmethod_one" + assert items[2].name == "testmethod_one" # let's also test getmodpath here assert items[0].getmodpath() == "testone" @@ -641,12 +716,15 @@ class Test_genitems(object): tests that python_classes and python_functions config options work as prefixes and glob-like patterns (issue #600). """ - testdir.makeini(""" + testdir.makeini( + """ [pytest] python_classes = *Suite Test python_functions = *_test test - """) - p = testdir.makepyfile(''' + """ + ) + p = testdir.makepyfile( + """ class MyTestSuite(object): def x_test(self): pass @@ -654,14 +732,16 @@ class Test_genitems(object): class TestCase(object): def test_y(self): pass - ''') + """ + ) items, reprec = testdir.inline_genitems(p) ids = [x.getmodpath() for x in items] - assert ids == ['MyTestSuite.x_test', 'TestCase.test_y'] + assert ids == ["MyTestSuite.x_test", "TestCase.test_y"] def test_matchnodes_two_collections_same_file(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest def pytest_configure(config): config.pluginmanager.register(Plugin2()) @@ -685,25 +765,25 @@ def test_matchnodes_two_collections_same_file(testdir): class Item2(pytest.Item): def runtest(self): pass - """) + """ + ) p = testdir.makefile(".abc", "") result = testdir.runpytest() assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*2 passed*", - ]) + result.stdout.fnmatch_lines(["*2 passed*"]) res = testdir.runpytest("%s::hello" % p.basename) - res.stdout.fnmatch_lines([ - "*1 passed*", - ]) + res.stdout.fnmatch_lines(["*1 passed*"]) class TestNodekeywords(object): + def test_no_under(self, testdir): - modcol = testdir.getmodulecol(""" + modcol = testdir.getmodulecol( + """ def test_pass(): pass def test_fail(): assert 0 - """) + """ + ) values = list(modcol.keywords) assert modcol.name in values for x in values: @@ -711,13 +791,15 @@ class TestNodekeywords(object): assert modcol.name in repr(modcol.keywords) def test_issue345(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_should_not_be_selected(): assert False, 'I should not have been selected to run' def test___repr__(): pass - """) + """ + ) reprec = testdir.inline_run("-k repr") reprec.assertoutcome(passed=1, failed=0) @@ -751,13 +833,15 @@ def test_exit_on_collection_error(testdir): res = testdir.runpytest() assert res.ret == 2 - res.stdout.fnmatch_lines([ - "collected 2 items / 2 errors", - "*ERROR collecting test_02_import_error.py*", - "*No module named *asdfa*", - "*ERROR collecting test_03_import_error.py*", - "*No module named *asdfa*", - ]) + res.stdout.fnmatch_lines( + [ + "collected 2 items / 2 errors", + "*ERROR collecting test_02_import_error.py*", + "*No module named *asdfa*", + "*ERROR collecting test_03_import_error.py*", + "*No module named *asdfa*", + ] + ) def test_exit_on_collection_with_maxfail_smaller_than_n_errors(testdir): @@ -770,12 +854,11 @@ def test_exit_on_collection_with_maxfail_smaller_than_n_errors(testdir): res = testdir.runpytest("--maxfail=1") assert res.ret == 1 - res.stdout.fnmatch_lines([ - "*ERROR collecting test_02_import_error.py*", - "*No module named *asdfa*", - ]) + res.stdout.fnmatch_lines( + ["*ERROR collecting test_02_import_error.py*", "*No module named *asdfa*"] + ) - assert 'test_03' not in res.stdout.str() + assert "test_03" not in res.stdout.str() def test_exit_on_collection_with_maxfail_bigger_than_n_errors(testdir): @@ -788,13 +871,15 @@ def test_exit_on_collection_with_maxfail_bigger_than_n_errors(testdir): res = testdir.runpytest("--maxfail=4") assert res.ret == 2 - res.stdout.fnmatch_lines([ - "collected 2 items / 2 errors", - "*ERROR collecting test_02_import_error.py*", - "*No module named *asdfa*", - "*ERROR collecting test_03_import_error.py*", - "*No module named *asdfa*", - ]) + res.stdout.fnmatch_lines( + [ + "collected 2 items / 2 errors", + "*ERROR collecting test_02_import_error.py*", + "*No module named *asdfa*", + "*ERROR collecting test_03_import_error.py*", + "*No module named *asdfa*", + ] + ) def test_continue_on_collection_errors(testdir): @@ -807,10 +892,9 @@ def test_continue_on_collection_errors(testdir): res = testdir.runpytest("--continue-on-collection-errors") assert res.ret == 1 - res.stdout.fnmatch_lines([ - "collected 2 items / 2 errors", - "*1 failed, 1 passed, 2 error*", - ]) + res.stdout.fnmatch_lines( + ["collected 2 items / 2 errors", "*1 failed, 1 passed, 2 error*"] + ) def test_continue_on_collection_errors_maxfail(testdir): @@ -826,21 +910,22 @@ def test_continue_on_collection_errors_maxfail(testdir): res = testdir.runpytest("--continue-on-collection-errors", "--maxfail=3") assert res.ret == 1 - res.stdout.fnmatch_lines([ - "collected 2 items / 2 errors", - "*1 failed, 2 error*", - ]) + res.stdout.fnmatch_lines(["collected 2 items / 2 errors", "*1 failed, 2 error*"]) def test_fixture_scope_sibling_conftests(testdir): """Regression test case for https://github.com/pytest-dev/pytest/issues/2836""" foo_path = testdir.mkpydir("foo") - foo_path.join("conftest.py").write(_pytest._code.Source(""" + foo_path.join("conftest.py").write( + _pytest._code.Source( + """ import pytest @pytest.fixture def fix(): return 1 - """)) + """ + ) + ) foo_path.join("test_foo.py").write("def test_foo(fix): assert fix == 1") # Tests in `food/` should not see the conftest fixture from `foo/` @@ -850,8 +935,10 @@ def test_fixture_scope_sibling_conftests(testdir): res = testdir.runpytest() assert res.ret == 1 - res.stdout.fnmatch_lines([ - "*ERROR at setup of test_food*", - "E*fixture 'fix' not found", - "*1 passed, 1 error*", - ]) + res.stdout.fnmatch_lines( + [ + "*ERROR at setup of test_food*", + "E*fixture 'fix' not found", + "*1 passed, 1 error*", + ] + ) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_compat.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_compat.py index c74801c6c85..550a8f1b354 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_compat.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_compat.py @@ -7,6 +7,7 @@ from _pytest.outcomes import OutcomeException def test_is_generator(): + def zap(): yield @@ -20,6 +21,7 @@ def test_is_generator(): def test_real_func_loop_limit(): class Evil(object): + def __init__(self): self.left = 1000 @@ -28,7 +30,7 @@ def test_real_func_loop_limit(): def __getattr__(self, attr): if not self.left: - raise RuntimeError('its over') + raise RuntimeError("its over") self.left -= 1 return self @@ -39,10 +41,12 @@ def test_real_func_loop_limit(): print(res) -@pytest.mark.skipif(sys.version_info < (3, 4), - reason='asyncio available in Python 3.4+') +@pytest.mark.skipif( + sys.version_info < (3, 4), reason="asyncio available in Python 3.4+" +) def test_is_generator_asyncio(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ from _pytest.compat import is_generator import asyncio @asyncio.coroutine @@ -51,17 +55,20 @@ def test_is_generator_asyncio(testdir): def test_is_generator_asyncio(): assert not is_generator(baz) - """) + """ + ) # avoid importing asyncio into pytest's own process, # which in turn imports logging (#8) result = testdir.runpytest_subprocess() - result.stdout.fnmatch_lines(['*1 passed*']) + result.stdout.fnmatch_lines(["*1 passed*"]) -@pytest.mark.skipif(sys.version_info < (3, 5), - reason='async syntax available in Python 3.5+') +@pytest.mark.skipif( + sys.version_info < (3, 5), reason="async syntax available in Python 3.5+" +) def test_is_generator_async_syntax(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ from _pytest.compat import is_generator def test_is_generator_py35(): async def foo(): @@ -72,19 +79,21 @@ def test_is_generator_async_syntax(testdir): assert not is_generator(foo) assert not is_generator(bar) - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(['*1 passed*']) + result.stdout.fnmatch_lines(["*1 passed*"]) class ErrorsHelper(object): + @property def raise_exception(self): - raise Exception('exception should be catched') + raise Exception("exception should be catched") @property def raise_fail(self): - pytest.fail('fail should be catched') + pytest.fail("fail should be catched") def test_helper_failures(): @@ -97,5 +106,5 @@ def test_helper_failures(): def test_safe_getattr(): helper = ErrorsHelper() - assert safe_getattr(helper, 'raise_exception', 'default') == 'default' - assert safe_getattr(helper, 'raise_fail', 'default') == 'default' + assert safe_getattr(helper, "raise_exception", "default") == "default" + assert safe_getattr(helper, "raise_fail", "default") == "default" diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_config.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_config.py index 44b8c317a28..5fb048364f7 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_config.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_config.py @@ -1,79 +1,105 @@ from __future__ import absolute_import, division, print_function import sys -import py +import textwrap import pytest import _pytest._code -from _pytest.config import getcfg, get_common_ancestor, determine_setup, _iter_rewritable_modules +from _pytest.config.findpaths import getcfg, get_common_ancestor, determine_setup +from _pytest.config import _iter_rewritable_modules from _pytest.main import EXIT_NOTESTSCOLLECTED class TestParseIni(object): - @pytest.mark.parametrize('section, filename', - [('pytest', 'pytest.ini'), ('tool:pytest', 'setup.cfg')]) + @pytest.mark.parametrize( + "section, filename", [("pytest", "pytest.ini"), ("tool:pytest", "setup.cfg")] + ) def test_getcfg_and_config(self, testdir, tmpdir, section, filename): sub = tmpdir.mkdir("sub") sub.chdir() - tmpdir.join(filename).write(_pytest._code.Source(""" + tmpdir.join(filename).write( + _pytest._code.Source( + """ [{section}] name = value - """.format(section=section))) + """.format( + section=section + ) + ) + ) rootdir, inifile, cfg = getcfg([sub]) - assert cfg['name'] == "value" + assert cfg["name"] == "value" config = testdir.parseconfigure(sub) - assert config.inicfg['name'] == 'value' + assert config.inicfg["name"] == "value" def test_getcfg_empty_path(self): """correctly handle zero length arguments (a la pytest '')""" - getcfg(['']) + getcfg([""]) def test_append_parse_args(self, testdir, tmpdir, monkeypatch): - monkeypatch.setenv('PYTEST_ADDOPTS', '--color no -rs --tb="short"') - tmpdir.join("pytest.ini").write(_pytest._code.Source(""" + monkeypatch.setenv("PYTEST_ADDOPTS", '--color no -rs --tb="short"') + tmpdir.join("pytest.ini").write( + _pytest._code.Source( + """ [pytest] addopts = --verbose - """)) + """ + ) + ) config = testdir.parseconfig(tmpdir) - assert config.option.color == 'no' - assert config.option.reportchars == 's' - assert config.option.tbstyle == 'short' + assert config.option.color == "no" + assert config.option.reportchars == "s" + assert config.option.tbstyle == "short" assert config.option.verbose def test_tox_ini_wrong_version(self, testdir): - testdir.makefile('.ini', tox=""" + testdir.makefile( + ".ini", + tox=""" [pytest] minversion=9.0 - """) + """, + ) result = testdir.runpytest() assert result.ret != 0 - result.stderr.fnmatch_lines([ - "*tox.ini:2*requires*9.0*actual*" - ]) + result.stderr.fnmatch_lines(["*tox.ini:2*requires*9.0*actual*"]) - @pytest.mark.parametrize("section, name", [ - ('tool:pytest', 'setup.cfg'), - ('pytest', 'tox.ini'), - ('pytest', 'pytest.ini')], + @pytest.mark.parametrize( + "section, name", + [("tool:pytest", "setup.cfg"), ("pytest", "tox.ini"), ("pytest", "pytest.ini")], ) def test_ini_names(self, testdir, name, section): - testdir.tmpdir.join(name).write(py.std.textwrap.dedent(""" + testdir.tmpdir.join(name).write( + textwrap.dedent( + """ [{section}] minversion = 1.0 - """.format(section=section))) + """.format( + section=section + ) + ) + ) config = testdir.parseconfig() assert config.getini("minversion") == "1.0" def test_toxini_before_lower_pytestini(self, testdir): sub = testdir.tmpdir.mkdir("sub") - sub.join("tox.ini").write(py.std.textwrap.dedent(""" + sub.join("tox.ini").write( + textwrap.dedent( + """ [pytest] minversion = 2.0 - """)) - testdir.tmpdir.join("pytest.ini").write(py.std.textwrap.dedent(""" + """ + ) + ) + testdir.tmpdir.join("pytest.ini").write( + textwrap.dedent( + """ [pytest] minversion = 1.5 - """)) + """ + ) + ) config = testdir.parseconfigure(sub) assert config.getini("minversion") == "2.0" @@ -81,47 +107,72 @@ class TestParseIni(object): def test_confcutdir(self, testdir): sub = testdir.mkdir("sub") sub.chdir() - testdir.makeini(""" + testdir.makeini( + """ [pytest] addopts = --qwe - """) + """ + ) result = testdir.inline_run("--confcutdir=.") assert result.ret == 0 class TestConfigCmdlineParsing(object): + def test_parsing_again_fails(self, testdir): config = testdir.parseconfig() pytest.raises(AssertionError, lambda: config.parse([])) def test_explicitly_specified_config_file_is_loaded(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_addoption(parser): parser.addini("custom", "") - """) - testdir.makeini(""" + """ + ) + testdir.makeini( + """ [pytest] custom = 0 - """) - testdir.makefile(".cfg", custom=""" + """ + ) + testdir.makefile( + ".cfg", + custom=""" [pytest] custom = 1 - """) + """, + ) config = testdir.parseconfig("-c", "custom.cfg") assert config.getini("custom") == "1" + testdir.makefile( + ".cfg", + custom_tool_pytest_section=""" + [tool:pytest] + custom = 1 + """, + ) + config = testdir.parseconfig("-c", "custom_tool_pytest_section.cfg") + assert config.getini("custom") == "1" + def test_absolute_win32_path(self, testdir): - temp_cfg_file = testdir.makefile(".cfg", custom=""" + temp_cfg_file = testdir.makefile( + ".cfg", + custom=""" [pytest] addopts = --version - """) + """, + ) from os.path import normpath + temp_cfg_file = normpath(str(temp_cfg_file)) ret = pytest.main("-c " + temp_cfg_file) assert ret == _pytest.main.EXIT_OK class TestConfigAPI(object): + def test_config_trace(self, testdir): config = testdir.parseconfig() values = [] @@ -131,46 +182,51 @@ class TestConfigAPI(object): assert values[0] == "hello [config]\n" def test_config_getoption(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_addoption(parser): parser.addoption("--hello", "-X", dest="hello") - """) + """ + ) config = testdir.parseconfig("--hello=this") for x in ("hello", "--hello", "-X"): assert config.getoption(x) == "this" pytest.raises(ValueError, "config.getoption('qweqwe')") - @pytest.mark.skipif('sys.version_info[0] < 3') + @pytest.mark.skipif("sys.version_info[0] < 3") def test_config_getoption_unicode(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ from __future__ import unicode_literals def pytest_addoption(parser): parser.addoption('--hello', type=str) - """) - config = testdir.parseconfig('--hello=this') - assert config.getoption('hello') == 'this' + """ + ) + config = testdir.parseconfig("--hello=this") + assert config.getoption("hello") == "this" def test_config_getvalueorskip(self, testdir): config = testdir.parseconfig() - pytest.raises(pytest.skip.Exception, - "config.getvalueorskip('hello')") + pytest.raises(pytest.skip.Exception, "config.getvalueorskip('hello')") verbose = config.getvalueorskip("verbose") assert verbose == config.option.verbose def test_config_getvalueorskip_None(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_addoption(parser): parser.addoption("--hello") - """) + """ + ) config = testdir.parseconfig() with pytest.raises(pytest.skip.Exception): - config.getvalueorskip('hello') + config.getvalueorskip("hello") def test_getoption(self, testdir): config = testdir.parseconfig() with pytest.raises(ValueError): - config.getvalue('x') + config.getvalue("x") assert config.getoption("x", 1) == 1 def test_getconftest_pathlist(self, testdir, tmpdir): @@ -178,54 +234,66 @@ class TestConfigAPI(object): p = tmpdir.join("conftest.py") p.write("pathlist = ['.', %r]" % str(somepath)) config = testdir.parseconfigure(p) - assert config._getconftest_pathlist('notexist', path=tmpdir) is None - pl = config._getconftest_pathlist('pathlist', path=tmpdir) + assert config._getconftest_pathlist("notexist", path=tmpdir) is None + pl = config._getconftest_pathlist("pathlist", path=tmpdir) print(pl) assert len(pl) == 2 assert pl[0] == tmpdir assert pl[1] == somepath def test_addini(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_addoption(parser): parser.addini("myname", "my new ini value") - """) - testdir.makeini(""" + """ + ) + testdir.makeini( + """ [pytest] myname=hello - """) + """ + ) config = testdir.parseconfig() val = config.getini("myname") assert val == "hello" - pytest.raises(ValueError, config.getini, 'other') + pytest.raises(ValueError, config.getini, "other") def test_addini_pathlist(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_addoption(parser): parser.addini("paths", "my new ini value", type="pathlist") parser.addini("abc", "abc value") - """) - p = testdir.makeini(""" + """ + ) + p = testdir.makeini( + """ [pytest] paths=hello world/sub.py - """) + """ + ) config = testdir.parseconfig() values = config.getini("paths") assert len(values) == 2 - assert values[0] == p.dirpath('hello') - assert values[1] == p.dirpath('world/sub.py') - pytest.raises(ValueError, config.getini, 'other') + assert values[0] == p.dirpath("hello") + assert values[1] == p.dirpath("world/sub.py") + pytest.raises(ValueError, config.getini, "other") def test_addini_args(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_addoption(parser): parser.addini("args", "new args", type="args") parser.addini("a2", "", "args", default="1 2 3".split()) - """) - testdir.makeini(""" + """ + ) + testdir.makeini( + """ [pytest] args=123 "123 hello" "this" - """) + """ + ) config = testdir.parseconfig() values = config.getini("args") assert len(values) == 3 @@ -234,16 +302,20 @@ class TestConfigAPI(object): assert values == list("123") def test_addini_linelist(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_addoption(parser): parser.addini("xy", "", type="linelist") parser.addini("a2", "", "linelist") - """) - testdir.makeini(""" + """ + ) + testdir.makeini( + """ [pytest] xy= 123 345 second line - """) + """ + ) config = testdir.parseconfig() values = config.getini("xy") assert len(values) == 2 @@ -251,30 +323,40 @@ class TestConfigAPI(object): values = config.getini("a2") assert values == [] - @pytest.mark.parametrize('str_val, bool_val', - [('True', True), ('no', False), ('no-ini', True)]) + @pytest.mark.parametrize( + "str_val, bool_val", [("True", True), ("no", False), ("no-ini", True)] + ) def test_addini_bool(self, testdir, str_val, bool_val): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_addoption(parser): parser.addini("strip", "", type="bool", default=True) - """) - if str_val != 'no-ini': - testdir.makeini(""" + """ + ) + if str_val != "no-ini": + testdir.makeini( + """ [pytest] strip=%s - """ % str_val) + """ + % str_val + ) config = testdir.parseconfig() assert config.getini("strip") is bool_val def test_addinivalue_line_existing(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_addoption(parser): parser.addini("xy", "", type="linelist") - """) - testdir.makeini(""" + """ + ) + testdir.makeini( + """ [pytest] xy= 123 - """) + """ + ) config = testdir.parseconfig() values = config.getini("xy") assert len(values) == 1 @@ -285,10 +367,12 @@ class TestConfigAPI(object): assert values == ["123", "456"] def test_addinivalue_line_new(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_addoption(parser): parser.addini("xy", "", type="linelist") - """) + """ + ) config = testdir.parseconfig() assert not config.getini("xy") config.addinivalue_line("xy", "456") @@ -303,99 +387,124 @@ class TestConfigAPI(object): def test_confcutdir_check_isdir(self, testdir): """Give an error if --confcutdir is not a valid directory (#2078)""" with pytest.raises(pytest.UsageError): - testdir.parseconfig('--confcutdir', testdir.tmpdir.join('file').ensure(file=1)) + testdir.parseconfig( + "--confcutdir", testdir.tmpdir.join("file").ensure(file=1) + ) with pytest.raises(pytest.UsageError): - testdir.parseconfig('--confcutdir', testdir.tmpdir.join('inexistant')) - config = testdir.parseconfig('--confcutdir', testdir.tmpdir.join('dir').ensure(dir=1)) - assert config.getoption('confcutdir') == str(testdir.tmpdir.join('dir')) + testdir.parseconfig("--confcutdir", testdir.tmpdir.join("inexistant")) + config = testdir.parseconfig( + "--confcutdir", testdir.tmpdir.join("dir").ensure(dir=1) + ) + assert config.getoption("confcutdir") == str(testdir.tmpdir.join("dir")) - @pytest.mark.parametrize('names, expected', [ - (['bar.py'], ['bar']), - (['foo', 'bar.py'], []), - (['foo', 'bar.pyc'], []), - (['foo', '__init__.py'], ['foo']), - (['foo', 'bar', '__init__.py'], []), - ]) + @pytest.mark.parametrize( + "names, expected", + [ + (["bar.py"], ["bar"]), + (["foo", "bar.py"], []), + (["foo", "bar.pyc"], []), + (["foo", "__init__.py"], ["foo"]), + (["foo", "bar", "__init__.py"], []), + ], + ) def test_iter_rewritable_modules(self, names, expected): - assert list(_iter_rewritable_modules(['/'.join(names)])) == expected + assert list(_iter_rewritable_modules(["/".join(names)])) == expected class TestConfigFromdictargs(object): + def test_basic_behavior(self): from _pytest.config import Config - option_dict = { - 'verbose': 444, - 'foo': 'bar', - 'capture': 'no', - } - args = ['a', 'b'] + + option_dict = {"verbose": 444, "foo": "bar", "capture": "no"} + args = ["a", "b"] config = Config.fromdictargs(option_dict, args) with pytest.raises(AssertionError): - config.parse(['should refuse to parse again']) + config.parse(["should refuse to parse again"]) assert config.option.verbose == 444 - assert config.option.foo == 'bar' - assert config.option.capture == 'no' + assert config.option.foo == "bar" + assert config.option.capture == "no" assert config.args == args def test_origargs(self): """Show that fromdictargs can handle args in their "orig" format""" from _pytest.config import Config + option_dict = {} - args = ['-vvvv', '-s', 'a', 'b'] + args = ["-vvvv", "-s", "a", "b"] config = Config.fromdictargs(option_dict, args) - assert config.args == ['a', 'b'] + assert config.args == ["a", "b"] assert config._origargs == args assert config.option.verbose == 4 - assert config.option.capture == 'no' + assert config.option.capture == "no" def test_inifilename(self, tmpdir): - tmpdir.join("foo/bar.ini").ensure().write(_pytest._code.Source(""" + tmpdir.join("foo/bar.ini").ensure().write( + _pytest._code.Source( + """ [pytest] name = value - """)) + """ + ) + ) from _pytest.config import Config - inifile = '../../foo/bar.ini' - option_dict = { - 'inifilename': inifile, - 'capture': 'no', - } - cwd = tmpdir.join('a/b') - cwd.join('pytest.ini').ensure().write(_pytest._code.Source(""" + inifile = "../../foo/bar.ini" + option_dict = {"inifilename": inifile, "capture": "no"} + + cwd = tmpdir.join("a/b") + cwd.join("pytest.ini").ensure().write( + _pytest._code.Source( + """ [pytest] name = wrong-value should_not_be_set = true - """)) + """ + ) + ) with cwd.ensure(dir=True).as_cwd(): config = Config.fromdictargs(option_dict, ()) assert config.args == [str(cwd)] assert config.option.inifilename == inifile - assert config.option.capture == 'no' + assert config.option.capture == "no" # this indicates this is the file used for getting configuration values assert config.inifile == inifile - assert config.inicfg.get('name') == 'value' - assert config.inicfg.get('should_not_be_set') is None + assert config.inicfg.get("name") == "value" + assert config.inicfg.get("should_not_be_set") is None def test_options_on_small_file_do_not_blow_up(testdir): + def runfiletest(opts): reprec = testdir.inline_run(*opts) passed, skipped, failed = reprec.countoutcomes() assert failed == 2 assert skipped == passed == 0 - path = testdir.makepyfile(""" + + path = testdir.makepyfile( + """ def test_f1(): assert 0 def test_f2(): assert 0 - """) + """ + ) - for opts in ([], ['-l'], ['-s'], ['--tb=no'], ['--tb=short'], - ['--tb=long'], ['--fulltrace'], - ['--traceconfig'], ['-v'], ['-v', '-v']): + for opts in ( + [], + ["-l"], + ["-s"], + ["--tb=no"], + ["--tb=short"], + ["--tb=long"], + ["--fulltrace"], + ["--traceconfig"], + ["-v"], + ["-v", "-v"], + ): runfiletest(opts + [path]) @@ -406,27 +515,31 @@ def test_preparse_ordering_with_setuptools(testdir, monkeypatch): assert name == "pytest11" class Dist(object): - project_name = 'spam' - version = '1.0' + project_name = "spam" + version = "1.0" def _get_metadata(self, name): - return ['foo.txt,sha256=abc,123'] + return ["foo.txt,sha256=abc,123"] class EntryPoint(object): name = "mytestplugin" dist = Dist() def load(self): + class PseudoPlugin(object): x = 42 + return PseudoPlugin() return iter([EntryPoint()]) - monkeypatch.setattr(pkg_resources, 'iter_entry_points', my_iter) - testdir.makeconftest(""" + monkeypatch.setattr(pkg_resources, "iter_entry_points", my_iter) + testdir.makeconftest( + """ pytest_plugins = "mytestplugin", - """) + """ + ) monkeypatch.setenv("PYTEST_PLUGINS", "mytestplugin") config = testdir.parseconfig() plugin = config.pluginmanager.getplugin("mytestplugin") @@ -440,11 +553,11 @@ def test_setuptools_importerror_issue1479(testdir, monkeypatch): assert name == "pytest11" class Dist(object): - project_name = 'spam' - version = '1.0' + project_name = "spam" + version = "1.0" def _get_metadata(self, name): - return ['foo.txt,sha256=abc,123'] + return ["foo.txt,sha256=abc,123"] class EntryPoint(object): name = "mytestplugin" @@ -455,12 +568,12 @@ def test_setuptools_importerror_issue1479(testdir, monkeypatch): return iter([EntryPoint()]) - monkeypatch.setattr(pkg_resources, 'iter_entry_points', my_iter) + monkeypatch.setattr(pkg_resources, "iter_entry_points", my_iter) with pytest.raises(ImportError): testdir.parseconfig() -@pytest.mark.parametrize('block_it', [True, False]) +@pytest.mark.parametrize("block_it", [True, False]) def test_plugin_preparse_prevents_setuptools_loading(testdir, monkeypatch, block_it): pkg_resources = pytest.importorskip("pkg_resources") @@ -470,11 +583,11 @@ def test_plugin_preparse_prevents_setuptools_loading(testdir, monkeypatch, block assert name == "pytest11" class Dist(object): - project_name = 'spam' - version = '1.0' + project_name = "spam" + version = "1.0" def _get_metadata(self, name): - return ['foo.txt,sha256=abc,123'] + return ["foo.txt,sha256=abc,123"] class EntryPoint(object): name = "mytestplugin" @@ -485,67 +598,75 @@ def test_plugin_preparse_prevents_setuptools_loading(testdir, monkeypatch, block return iter([EntryPoint()]) - monkeypatch.setattr(pkg_resources, 'iter_entry_points', my_iter) + monkeypatch.setattr(pkg_resources, "iter_entry_points", my_iter) args = ("-p", "no:mytestplugin") if block_it else () config = testdir.parseconfig(*args) config.pluginmanager.import_plugin("mytestplugin") if block_it: assert "mytestplugin" not in sys.modules - assert config.pluginmanager.get_plugin('mytestplugin') is None + assert config.pluginmanager.get_plugin("mytestplugin") is None else: - assert config.pluginmanager.get_plugin('mytestplugin') is plugin_module_placeholder + assert config.pluginmanager.get_plugin( + "mytestplugin" + ) is plugin_module_placeholder def test_cmdline_processargs_simple(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_cmdline_preparse(args): args.append("-h") - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*pytest*", - "*-h*", - ]) + result.stdout.fnmatch_lines(["*pytest*", "*-h*"]) def test_invalid_options_show_extra_information(testdir): """display extra information when pytest exits due to unrecognized options in the command-line""" - testdir.makeini(""" + testdir.makeini( + """ [pytest] addopts = --invalid-option - """) + """ + ) result = testdir.runpytest() - result.stderr.fnmatch_lines([ - "*error: unrecognized arguments: --invalid-option*", - "* inifile: %s*" % testdir.tmpdir.join('tox.ini'), - "* rootdir: %s*" % testdir.tmpdir, - ]) + result.stderr.fnmatch_lines( + [ + "*error: unrecognized arguments: --invalid-option*", + "* inifile: %s*" % testdir.tmpdir.join("tox.ini"), + "* rootdir: %s*" % testdir.tmpdir, + ] + ) -@pytest.mark.parametrize('args', [ - ['dir1', 'dir2', '-v'], - ['dir1', '-v', 'dir2'], - ['dir2', '-v', 'dir1'], - ['-v', 'dir2', 'dir1'], -]) +@pytest.mark.parametrize( + "args", + [ + ["dir1", "dir2", "-v"], + ["dir1", "-v", "dir2"], + ["dir2", "-v", "dir1"], + ["-v", "dir2", "dir1"], + ], +) def test_consider_args_after_options_for_rootdir_and_inifile(testdir, args): """ Consider all arguments in the command-line for rootdir and inifile discovery, even if they happen to occur after an option. #949 """ # replace "dir1" and "dir2" from "args" into their real directory - root = testdir.tmpdir.mkdir('myroot') - d1 = root.mkdir('dir1') - d2 = root.mkdir('dir2') + root = testdir.tmpdir.mkdir("myroot") + d1 = root.mkdir("dir1") + d2 = root.mkdir("dir2") for i, arg in enumerate(args): - if arg == 'dir1': + if arg == "dir1": args[i] = d1 - elif arg == 'dir2': + elif arg == "dir2": args[i] = d2 with root.as_cwd(): result = testdir.runpytest(*args) - result.stdout.fnmatch_lines(['*rootdir: *myroot, inifile:']) + result.stdout.fnmatch_lines(["*rootdir: *myroot, inifile:"]) @pytest.mark.skipif("sys.platform == 'win32'") @@ -555,25 +676,28 @@ def test_toolongargs_issue224(testdir): def test_config_in_subdirectory_colon_command_line_issue2148(testdir): - conftest_source = ''' + conftest_source = """ def pytest_addoption(parser): parser.addini('foo', 'foo') - ''' + """ - testdir.makefile('.ini', **{ - 'pytest': '[pytest]\nfoo = root', - 'subdir/pytest': '[pytest]\nfoo = subdir', - }) + testdir.makefile( + ".ini", + **{"pytest": "[pytest]\nfoo = root", "subdir/pytest": "[pytest]\nfoo = subdir"} + ) - testdir.makepyfile(**{ - 'conftest': conftest_source, - 'subdir/conftest': conftest_source, - 'subdir/test_foo': ''' + testdir.makepyfile( + **{ + "conftest": conftest_source, + "subdir/conftest": conftest_source, + "subdir/test_foo": """ def test_foo(pytestconfig): assert pytestconfig.getini('foo') == 'subdir' - '''}) + """, + } + ) - result = testdir.runpytest('subdir/test_foo.py::test_foo') + result = testdir.runpytest("subdir/test_foo.py::test_foo") assert result.ret == 0 @@ -585,6 +709,7 @@ def test_notify_exception(testdir, capfd): assert "ValueError" in err class A(object): + def pytest_internalerror(self, excrepr): return True @@ -596,9 +721,11 @@ def test_notify_exception(testdir, capfd): def test_load_initial_conftest_last_ordering(testdir): from _pytest.config import get_config + pm = get_config().pluginmanager class My(object): + def pytest_load_initial_conftests(self): pass @@ -606,49 +733,52 @@ def test_load_initial_conftest_last_ordering(testdir): pm.register(m) hc = pm.hook.pytest_load_initial_conftests values = hc._nonwrappers + hc._wrappers - expected = [ - "_pytest.config", - 'test_config', - '_pytest.capture', - ] + expected = ["_pytest.config", "test_config", "_pytest.capture"] assert [x.function.__module__ for x in values] == expected def test_get_plugin_specs_as_list(): from _pytest.config import _get_plugin_specs_as_list + with pytest.raises(pytest.UsageError): - _get_plugin_specs_as_list(set(['foo'])) + _get_plugin_specs_as_list({"foo"}) with pytest.raises(pytest.UsageError): _get_plugin_specs_as_list(dict()) assert _get_plugin_specs_as_list(None) == [] - assert _get_plugin_specs_as_list('') == [] - assert _get_plugin_specs_as_list('foo') == ['foo'] - assert _get_plugin_specs_as_list('foo,bar') == ['foo', 'bar'] - assert _get_plugin_specs_as_list(['foo', 'bar']) == ['foo', 'bar'] - assert _get_plugin_specs_as_list(('foo', 'bar')) == ['foo', 'bar'] + assert _get_plugin_specs_as_list("") == [] + assert _get_plugin_specs_as_list("foo") == ["foo"] + assert _get_plugin_specs_as_list("foo,bar") == ["foo", "bar"] + assert _get_plugin_specs_as_list(["foo", "bar"]) == ["foo", "bar"] + assert _get_plugin_specs_as_list(("foo", "bar")) == ["foo", "bar"] class TestWarning(object): + def test_warn_config(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ values = [] def pytest_configure(config): config.warn("C1", "hello") def pytest_logwarning(code, message): if message == "hello" and code == "C1": values.append(1) - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ def test_proper(pytestconfig): import conftest assert conftest.values == [1] - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) def test_warn_on_test_item_from_request(self, testdir, request): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture @@ -657,20 +787,24 @@ class TestWarning(object): def test_hello(fix): pass - """) + """ + ) result = testdir.runpytest("--disable-pytest-warnings") assert result.parseoutcomes()["warnings"] > 0 assert "hello" not in result.stdout.str() result = testdir.runpytest() - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ ===*warnings summary*=== *test_warn_on_test_item_from_request.py::test_hello* *hello* - """) + """ + ) class TestRootdir(object): + def test_simple_noini(self, tmpdir): assert get_common_ancestor([tmpdir]) == tmpdir a = tmpdir.mkdir("a") @@ -678,9 +812,9 @@ class TestRootdir(object): assert get_common_ancestor([tmpdir, a]) == tmpdir with tmpdir.as_cwd(): assert get_common_ancestor([]) == tmpdir - no_path = tmpdir.join('does-not-exist') + no_path = tmpdir.join("does-not-exist") assert get_common_ancestor([no_path]) == tmpdir - assert get_common_ancestor([no_path.join('a')]) == tmpdir + assert get_common_ancestor([no_path.join("a")]) == tmpdir @pytest.mark.parametrize("name", "setup.cfg tox.ini pytest.ini".split()) def test_with_ini(self, tmpdir, name): @@ -729,96 +863,136 @@ class TestRootdir(object): class TestOverrideIniArgs(object): + @pytest.mark.parametrize("name", "setup.cfg tox.ini pytest.ini".split()) def test_override_ini_names(self, testdir, name): - testdir.tmpdir.join(name).write(py.std.textwrap.dedent(""" + testdir.tmpdir.join(name).write( + textwrap.dedent( + """ [pytest] - custom = 1.0""")) - testdir.makeconftest(""" + custom = 1.0""" + ) + ) + testdir.makeconftest( + """ def pytest_addoption(parser): - parser.addini("custom", "")""") - testdir.makepyfile(""" + parser.addini("custom", "")""" + ) + testdir.makepyfile( + """ def test_pass(pytestconfig): ini_val = pytestconfig.getini("custom") - print('\\ncustom_option:%s\\n' % ini_val)""") + print('\\ncustom_option:%s\\n' % ini_val)""" + ) result = testdir.runpytest("--override-ini", "custom=2.0", "-s") assert result.ret == 0 result.stdout.fnmatch_lines(["custom_option:2.0"]) - result = testdir.runpytest("--override-ini", "custom=2.0", - "--override-ini=custom=3.0", "-s") + result = testdir.runpytest( + "--override-ini", "custom=2.0", "--override-ini=custom=3.0", "-s" + ) assert result.ret == 0 result.stdout.fnmatch_lines(["custom_option:3.0"]) def test_override_ini_pathlist(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_addoption(parser): - parser.addini("paths", "my new ini value", type="pathlist")""") - testdir.makeini(""" + parser.addini("paths", "my new ini value", type="pathlist")""" + ) + testdir.makeini( + """ [pytest] - paths=blah.py""") - testdir.makepyfile(""" + paths=blah.py""" + ) + testdir.makepyfile( + """ import py.path def test_pathlist(pytestconfig): config_paths = pytestconfig.getini("paths") print(config_paths) for cpf in config_paths: - print('\\nuser_path:%s' % cpf.basename)""") - result = testdir.runpytest("--override-ini", - 'paths=foo/bar1.py foo/bar2.py', "-s") - result.stdout.fnmatch_lines(["user_path:bar1.py", - "user_path:bar2.py"]) + print('\\nuser_path:%s' % cpf.basename)""" + ) + result = testdir.runpytest( + "--override-ini", "paths=foo/bar1.py foo/bar2.py", "-s" + ) + result.stdout.fnmatch_lines(["user_path:bar1.py", "user_path:bar2.py"]) def test_override_multiple_and_default(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_addoption(parser): addini = parser.addini addini("custom_option_1", "", default="o1") addini("custom_option_2", "", default="o2") addini("custom_option_3", "", default=False, type="bool") - addini("custom_option_4", "", default=True, type="bool")""") - testdir.makeini(""" + addini("custom_option_4", "", default=True, type="bool")""" + ) + testdir.makeini( + """ [pytest] custom_option_1=custom_option_1 - custom_option_2=custom_option_2""") - testdir.makepyfile(""" + custom_option_2=custom_option_2 + """ + ) + testdir.makepyfile( + """ def test_multiple_options(pytestconfig): prefix = "custom_option" for x in range(1, 5): ini_value=pytestconfig.getini("%s_%d" % (prefix, x)) - print('\\nini%d:%s' % (x, ini_value))""") + print('\\nini%d:%s' % (x, ini_value)) + """ + ) result = testdir.runpytest( - "--override-ini", 'custom_option_1=fulldir=/tmp/user1', - 'custom_option_2=url=/tmp/user2?a=b&d=e', - "-o", 'custom_option_3=True', - "-o", 'custom_option_4=no', "-s") - result.stdout.fnmatch_lines(["ini1:fulldir=/tmp/user1", - "ini2:url=/tmp/user2?a=b&d=e", - "ini3:True", - "ini4:False"]) + "--override-ini", + "custom_option_1=fulldir=/tmp/user1", + "-o", + "custom_option_2=url=/tmp/user2?a=b&d=e", + "-o", + "custom_option_3=True", + "-o", + "custom_option_4=no", + "-s", + ) + result.stdout.fnmatch_lines( + [ + "ini1:fulldir=/tmp/user1", + "ini2:url=/tmp/user2?a=b&d=e", + "ini3:True", + "ini4:False", + ] + ) def test_override_ini_usage_error_bad_style(self, testdir): - testdir.makeini(""" + testdir.makeini( + """ [pytest] xdist_strict=False - """) - result = testdir.runpytest("--override-ini", 'xdist_strict True', "-s") + """ + ) + result = testdir.runpytest("--override-ini", "xdist_strict True", "-s") result.stderr.fnmatch_lines(["*ERROR* *expects option=value*"]) - @pytest.mark.parametrize('with_ini', [True, False]) + @pytest.mark.parametrize("with_ini", [True, False]) def test_override_ini_handled_asap(self, testdir, with_ini): """-o should be handled as soon as possible and always override what's in ini files (#2238)""" if with_ini: - testdir.makeini(""" + testdir.makeini( + """ [pytest] python_files=test_*.py - """) - testdir.makepyfile(unittest_ini_handle=""" + """ + ) + testdir.makepyfile( + unittest_ini_handle=""" def test(): pass - """) - result = testdir.runpytest("--override-ini", 'python_files=unittest_*.py') + """ + ) + result = testdir.runpytest("--override-ini", "python_files=unittest_*.py") result.stdout.fnmatch_lines(["*1 passed in*"]) def test_with_arg_outside_cwd_without_inifile(self, tmpdir, monkeypatch): @@ -837,8 +1011,7 @@ class TestOverrideIniArgs(object): assert rootdir == a assert inifile == parsed_inifile - @pytest.mark.parametrize('dirs', ([], ['does-not-exist'], - ['a/does-not-exist'])) + @pytest.mark.parametrize("dirs", ([], ["does-not-exist"], ["a/does-not-exist"])) def test_with_non_dir_arg(self, dirs, tmpdir): with tmpdir.ensure(dir=True).as_cwd(): rootdir, inifile, inicfg = determine_setup(None, dirs) @@ -849,14 +1022,47 @@ class TestOverrideIniArgs(object): a = tmpdir.mkdir("a") a.ensure("exist") with tmpdir.as_cwd(): - rootdir, inifile, inicfg = determine_setup(None, ['a/exist']) + rootdir, inifile, inicfg = determine_setup(None, ["a/exist"]) assert rootdir == tmpdir assert inifile is None - def test_addopts_before_initini(self, testdir, tmpdir, monkeypatch): - cache_dir = '.custom_cache' - monkeypatch.setenv('PYTEST_ADDOPTS', '-o cache_dir=%s' % cache_dir) + def test_addopts_before_initini(self, monkeypatch): + cache_dir = ".custom_cache" + monkeypatch.setenv("PYTEST_ADDOPTS", "-o cache_dir=%s" % cache_dir) from _pytest.config import get_config + config = get_config() config._preparse([], addopts=True) - assert config._override_ini == [['cache_dir=%s' % cache_dir]] + assert config._override_ini == ["cache_dir=%s" % cache_dir] + + def test_override_ini_does_not_contain_paths(self): + """Check that -o no longer swallows all options after it (#3103)""" + from _pytest.config import get_config + + config = get_config() + config._preparse(["-o", "cache_dir=/cache", "/some/test/path"]) + assert config._override_ini == ["cache_dir=/cache"] + + def test_multiple_override_ini_options(self, testdir, request): + """Ensure a file path following a '-o' option does not generate an error (#3103)""" + testdir.makepyfile( + **{ + "conftest.py": """ + def pytest_addoption(parser): + parser.addini('foo', default=None, help='some option') + parser.addini('bar', default=None, help='some option') + """, + "test_foo.py": """ + def test(pytestconfig): + assert pytestconfig.getini('foo') == '1' + assert pytestconfig.getini('bar') == '0' + """, + "test_bar.py": """ + def test(): + assert False + """, + } + ) + result = testdir.runpytest("-o", "foo=1", "-o", "bar=0", "test_foo.py") + assert "ERROR:" not in result.stderr.str() + result.stdout.fnmatch_lines(["collected 1 item", "*= 1 passed in *="]) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_conftest.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_conftest.py index c0411b72321..61b640976f1 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_conftest.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_conftest.py @@ -11,6 +11,7 @@ from _pytest.main import EXIT_NOTESTSCOLLECTED, EXIT_USAGEERROR @pytest.fixture(scope="module", params=["global", "inpackage"]) def basedir(request, tmpdir_factory): from _pytest.tmpdir import tmpdir + tmpdir = tmpdir(request, tmpdir_factory) tmpdir.ensure("adir/conftest.py").write("a=1 ; Directory = 3") tmpdir.ensure("adir/b/conftest.py").write("b=2 ; a = 1.5") @@ -27,15 +28,19 @@ def ConftestWithSetinitial(path): def conftest_setinitial(conftest, args, confcutdir=None): + class Namespace(object): + def __init__(self): self.file_or_dir = args self.confcutdir = str(confcutdir) self.noconftest = False + conftest._set_initial_conftests(Namespace()) class TestConftestValueAccessGlobal(object): + def test_basic_init(self, basedir): conftest = PytestPluginManager() p = basedir.join("adir") @@ -47,15 +52,15 @@ class TestConftestValueAccessGlobal(object): conftest._getconftestmodules(basedir) snap1 = len(conftest._path2confmods) # assert len(conftest._path2confmods) == snap1 + 1 - conftest._getconftestmodules(basedir.join('adir')) + conftest._getconftestmodules(basedir.join("adir")) assert len(conftest._path2confmods) == snap1 + 1 - conftest._getconftestmodules(basedir.join('b')) + conftest._getconftestmodules(basedir.join("b")) assert len(conftest._path2confmods) == snap1 + 2 def test_value_access_not_existing(self, basedir): conftest = ConftestWithSetinitial(basedir) with pytest.raises(KeyError): - conftest._rget_with_confmod('a', basedir) + conftest._rget_with_confmod("a", basedir) def test_value_access_by_path(self, basedir): conftest = ConftestWithSetinitial(basedir) @@ -84,7 +89,7 @@ def test_conftest_in_nonpkg_with_init(tmpdir): def test_doubledash_considered(testdir): conf = testdir.mkdir("--option") - conf.join("conftest.py").ensure() + conf.ensure("conftest.py") conftest = PytestPluginManager() conftest_setinitial(conftest, [conf.basename, conf.basename]) values = conftest._getconftestmodules(conf) @@ -105,7 +110,8 @@ def test_issue151_load_all_conftests(testdir): def test_conftest_global_import(testdir): testdir.makeconftest("x=3") - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import py, pytest from _pytest.config import PytestPluginManager conf = PytestPluginManager() @@ -120,7 +126,8 @@ def test_conftest_global_import(testdir): assert mod2.y == 4 import conftest assert conftest is mod2, (conftest, mod) - """) + """ + ) res = testdir.runpython(p) assert res.ret == 0 @@ -154,13 +161,13 @@ def test_conftestcutdir_inplace_considered(testdir): assert values[0].__file__.startswith(str(conf)) -@pytest.mark.parametrize("name", 'test tests whatever .dotdir'.split()) +@pytest.mark.parametrize("name", "test tests whatever .dotdir".split()) def test_setinitial_conftest_subdirs(testdir, name): sub = testdir.mkdir(name) subconftest = sub.ensure("conftest.py") conftest = PytestPluginManager() conftest_setinitial(conftest, [sub.dirpath()], confcutdir=testdir.tmpdir) - if name not in ('whatever', '.dotdir'): + if name not in ("whatever", ".dotdir"): assert subconftest in conftest._conftestpath2mod assert len(conftest._conftestpath2mod) == 1 else: @@ -171,13 +178,17 @@ def test_setinitial_conftest_subdirs(testdir, name): def test_conftest_confcutdir(testdir): testdir.makeconftest("assert 0") x = testdir.mkdir("x") - x.join("conftest.py").write(_pytest._code.Source(""" + x.join("conftest.py").write( + _pytest._code.Source( + """ def pytest_addoption(parser): parser.addoption("--xyz", action="store_true") - """)) + """ + ) + ) result = testdir.runpytest("-h", "--confcutdir=%s" % x, x) result.stdout.fnmatch_lines(["*--xyz*"]) - assert 'warning: could not load initial' not in result.stdout.str() + assert "warning: could not load initial" not in result.stdout.str() def test_no_conftest(testdir): @@ -191,10 +202,14 @@ def test_no_conftest(testdir): def test_conftest_existing_resultlog(testdir): x = testdir.mkdir("tests") - x.join("conftest.py").write(_pytest._code.Source(""" + x.join("conftest.py").write( + _pytest._code.Source( + """ def pytest_addoption(parser): parser.addoption("--xyz", action="store_true") - """)) + """ + ) + ) testdir.makefile(ext=".log", result="") # Writes result.log result = testdir.runpytest("-h", "--resultlog", "result.log") result.stdout.fnmatch_lines(["*--xyz*"]) @@ -202,10 +217,14 @@ def test_conftest_existing_resultlog(testdir): def test_conftest_existing_junitxml(testdir): x = testdir.mkdir("tests") - x.join("conftest.py").write(_pytest._code.Source(""" + x.join("conftest.py").write( + _pytest._code.Source( + """ def pytest_addoption(parser): parser.addoption("--xyz", action="store_true") - """)) + """ + ) + ) testdir.makefile(ext=".xml", junit="") # Writes junit.xml result = testdir.runpytest("-h", "--junitxml", "junit.xml") result.stdout.fnmatch_lines(["*--xyz*"]) @@ -222,7 +241,7 @@ def test_conftest_import_order(testdir, monkeypatch): conftest = PytestPluginManager() conftest._confcutdir = testdir.tmpdir - monkeypatch.setattr(conftest, '_importconftest', impct) + monkeypatch.setattr(conftest, "_importconftest", impct) assert conftest._getconftestmodules(sub) == [ct1, ct2] @@ -232,7 +251,9 @@ def test_fixture_dependency(testdir, monkeypatch): ct1.write("") sub = testdir.mkdir("sub") sub.join("__init__.py").write("") - sub.join("conftest.py").write(py.std.textwrap.dedent(""" + sub.join("conftest.py").write( + dedent( + """ import pytest @pytest.fixture @@ -246,10 +267,14 @@ def test_fixture_dependency(testdir, monkeypatch): @pytest.fixture def bar(foo): return 'bar' - """)) + """ + ) + ) subsub = sub.mkdir("subsub") subsub.join("__init__.py").write("") - subsub.join("test_bar.py").write(py.std.textwrap.dedent(""" + subsub.join("test_bar.py").write( + dedent( + """ import pytest @pytest.fixture @@ -258,112 +283,133 @@ def test_fixture_dependency(testdir, monkeypatch): def test_event_fixture(bar): assert bar == 'sub bar' - """)) + """ + ) + ) result = testdir.runpytest("sub") result.stdout.fnmatch_lines(["*1 passed*"]) def test_conftest_found_with_double_dash(testdir): sub = testdir.mkdir("sub") - sub.join("conftest.py").write(py.std.textwrap.dedent(""" + sub.join("conftest.py").write( + dedent( + """ def pytest_addoption(parser): parser.addoption("--hello-world", action="store_true") - """)) + """ + ) + ) p = sub.join("test_hello.py") - p.write(py.std.textwrap.dedent(""" - import pytest - def test_hello(found): - assert found == 1 - """)) + p.write("def test_hello(): pass") result = testdir.runpytest(str(p) + "::test_hello", "-h") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *--hello-world* - """) + """ + ) class TestConftestVisibility(object): + def _setup_tree(self, testdir): # for issue616 # example mostly taken from: # https://mail.python.org/pipermail/pytest-dev/2014-September/002617.html runner = testdir.mkdir("empty") package = testdir.mkdir("package") - package.join("conftest.py").write(dedent("""\ + package.join("conftest.py").write( + dedent( + """\ import pytest @pytest.fixture def fxtr(): return "from-package" - """)) - package.join("test_pkgroot.py").write(dedent("""\ + """ + ) + ) + package.join("test_pkgroot.py").write( + dedent( + """\ def test_pkgroot(fxtr): assert fxtr == "from-package" - """)) + """ + ) + ) swc = package.mkdir("swc") swc.join("__init__.py").ensure() - swc.join("conftest.py").write(dedent("""\ + swc.join("conftest.py").write( + dedent( + """\ import pytest @pytest.fixture def fxtr(): return "from-swc" - """)) - swc.join("test_with_conftest.py").write(dedent("""\ + """ + ) + ) + swc.join("test_with_conftest.py").write( + dedent( + """\ def test_with_conftest(fxtr): assert fxtr == "from-swc" - """)) + """ + ) + ) snc = package.mkdir("snc") snc.join("__init__.py").ensure() - snc.join("test_no_conftest.py").write(dedent("""\ + snc.join("test_no_conftest.py").write( + dedent( + """\ def test_no_conftest(fxtr): assert fxtr == "from-package" # No local conftest.py, so should # use value from parent dir's - """)) + """ + ) + ) print("created directory structure:") for x in testdir.tmpdir.visit(): print(" " + x.relto(testdir.tmpdir)) - return { - "runner": runner, - "package": package, - "swc": swc, - "snc": snc} + return {"runner": runner, "package": package, "swc": swc, "snc": snc} # N.B.: "swc" stands for "subdir with conftest.py" # "snc" stands for "subdir no [i.e. without] conftest.py" - @pytest.mark.parametrize("chdir,testarg,expect_ntests_passed", [ - # Effective target: package/.. - ("runner", "..", 3), - ("package", "..", 3), - ("swc", "../..", 3), - ("snc", "../..", 3), - - # Effective target: package - ("runner", "../package", 3), - ("package", ".", 3), - ("swc", "..", 3), - ("snc", "..", 3), - - # Effective target: package/swc - ("runner", "../package/swc", 1), - ("package", "./swc", 1), - ("swc", ".", 1), - ("snc", "../swc", 1), - - # Effective target: package/snc - ("runner", "../package/snc", 1), - ("package", "./snc", 1), - ("swc", "../snc", 1), - ("snc", ".", 1), - ]) + @pytest.mark.parametrize( + "chdir,testarg,expect_ntests_passed", + [ + # Effective target: package/.. + ("runner", "..", 3), + ("package", "..", 3), + ("swc", "../..", 3), + ("snc", "../..", 3), + # Effective target: package + ("runner", "../package", 3), + ("package", ".", 3), + ("swc", "..", 3), + ("snc", "..", 3), + # Effective target: package/swc + ("runner", "../package/swc", 1), + ("package", "./swc", 1), + ("swc", ".", 1), + ("snc", "../swc", 1), + # Effective target: package/snc + ("runner", "../package/snc", 1), + ("package", "./snc", 1), + ("swc", "../snc", 1), + ("snc", ".", 1), + ], + ) @pytest.mark.issue616 def test_parsefactories_relative_node_ids( - self, testdir, chdir, testarg, expect_ntests_passed): + self, testdir, chdir, testarg, expect_ntests_passed + ): dirs = self._setup_tree(testdir) - print("pytest run in cwd: %s" % ( - dirs[chdir].relto(testdir.tmpdir))) + print("pytest run in cwd: %s" % (dirs[chdir].relto(testdir.tmpdir))) print("pytestarg : %s" % (testarg)) print("expected pass : %s" % (expect_ntests_passed)) with dirs[chdir].as_cwd(): @@ -371,108 +417,127 @@ class TestConftestVisibility(object): reprec.assertoutcome(passed=expect_ntests_passed) -@pytest.mark.parametrize('confcutdir,passed,error', [ - ('.', 2, 0), - ('src', 1, 1), - (None, 1, 1), -]) +@pytest.mark.parametrize( + "confcutdir,passed,error", [(".", 2, 0), ("src", 1, 1), (None, 1, 1)] +) def test_search_conftest_up_to_inifile(testdir, confcutdir, passed, error): - """Test that conftest files are detected only up to a ini file, unless + """Test that conftest files are detected only up to an ini file, unless an explicit --confcutdir option is given. """ root = testdir.tmpdir - src = root.join('src').ensure(dir=1) - src.join('pytest.ini').write('[pytest]') - src.join('conftest.py').write(_pytest._code.Source(""" + src = root.join("src").ensure(dir=1) + src.join("pytest.ini").write("[pytest]") + src.join("conftest.py").write( + _pytest._code.Source( + """ import pytest @pytest.fixture def fix1(): pass - """)) - src.join('test_foo.py').write(_pytest._code.Source(""" + """ + ) + ) + src.join("test_foo.py").write( + _pytest._code.Source( + """ def test_1(fix1): pass def test_2(out_of_reach): pass - """)) - root.join('conftest.py').write(_pytest._code.Source(""" + """ + ) + ) + root.join("conftest.py").write( + _pytest._code.Source( + """ import pytest @pytest.fixture def out_of_reach(): pass - """)) + """ + ) + ) args = [str(src)] if confcutdir: - args = ['--confcutdir=%s' % root.join(confcutdir)] + args = ["--confcutdir=%s" % root.join(confcutdir)] result = testdir.runpytest(*args) - match = '' + match = "" if passed: - match += '*%d passed*' % passed + match += "*%d passed*" % passed if error: - match += '*%d error*' % error + match += "*%d error*" % error result.stdout.fnmatch_lines(match) def test_issue1073_conftest_special_objects(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ class DontTouchMe(object): def __getattr__(self, x): raise Exception('cant touch me') x = DontTouchMe() - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ def test_some(): pass - """) + """ + ) res = testdir.runpytest() assert res.ret == 0 def test_conftest_exception_handling(testdir): - testdir.makeconftest(''' + testdir.makeconftest( + """ raise ValueError() - ''') - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ def test_some(): pass - """) + """ + ) res = testdir.runpytest() assert res.ret == 4 - assert 'raise ValueError()' in [line.strip() for line in res.errlines] + assert "raise ValueError()" in [line.strip() for line in res.errlines] def test_hook_proxy(testdir): """Session's gethookproxy() would cache conftests incorrectly (#2016). It was decided to remove the cache altogether. """ - testdir.makepyfile(**{ - 'root/demo-0/test_foo1.py': "def test1(): pass", - - 'root/demo-a/test_foo2.py': "def test1(): pass", - 'root/demo-a/conftest.py': """ + testdir.makepyfile( + **{ + "root/demo-0/test_foo1.py": "def test1(): pass", + "root/demo-a/test_foo2.py": "def test1(): pass", + "root/demo-a/conftest.py": """ def pytest_ignore_collect(path, config): return True """, - - 'root/demo-b/test_foo3.py': "def test1(): pass", - 'root/demo-c/test_foo4.py': "def test1(): pass", - }) + "root/demo-b/test_foo3.py": "def test1(): pass", + "root/demo-c/test_foo4.py": "def test1(): pass", + } + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - '*test_foo1.py*', - '*test_foo3.py*', - '*test_foo4.py*', - '*3 passed*', - ]) + result.stdout.fnmatch_lines( + ["*test_foo1.py*", "*test_foo3.py*", "*test_foo4.py*", "*3 passed*"] + ) def test_required_option_help(testdir): testdir.makeconftest("assert 0") x = testdir.mkdir("x") - x.join("conftest.py").write(_pytest._code.Source(""" + x.join("conftest.py").write( + _pytest._code.Source( + """ def pytest_addoption(parser): parser.addoption("--xyz", action="store_true", required=True) - """)) + """ + ) + ) result = testdir.runpytest("-h", x) - assert 'argument --xyz is required' not in result.stdout.str() - assert 'general:' in result.stdout.str() + assert "argument --xyz is required" not in result.stdout.str() + assert "general:" in result.stdout.str() diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_doctest.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_doctest.py index b15067f15e9..7f3aff3b0e1 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_doctest.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_doctest.py @@ -11,12 +11,14 @@ class TestDoctests(object): def test_collect_testtextfile(self, testdir): w = testdir.maketxtfile(whatever="") - checkfile = testdir.maketxtfile(test_something=""" + checkfile = testdir.maketxtfile( + test_something=""" alskdjalsdk >>> i = 5 >>> i-1 4 - """) + """ + ) for x in (testdir.tmpdir, checkfile): # print "checking that %s returns custom items" % (x,) @@ -31,28 +33,27 @@ class TestDoctests(object): def test_collect_module_empty(self, testdir): path = testdir.makepyfile(whatever="#") for p in (path, testdir.tmpdir): - items, reprec = testdir.inline_genitems(p, - '--doctest-modules') + items, reprec = testdir.inline_genitems(p, "--doctest-modules") assert len(items) == 0 def test_collect_module_single_modulelevel_doctest(self, testdir): path = testdir.makepyfile(whatever='""">>> pass"""') for p in (path, testdir.tmpdir): - items, reprec = testdir.inline_genitems(p, - '--doctest-modules') + items, reprec = testdir.inline_genitems(p, "--doctest-modules") assert len(items) == 1 assert isinstance(items[0], DoctestItem) assert isinstance(items[0].parent, DoctestModule) def test_collect_module_two_doctest_one_modulelevel(self, testdir): - path = testdir.makepyfile(whatever=""" + path = testdir.makepyfile( + whatever=""" '>>> x = None' def my_func(): ">>> magic = 42 " - """) + """ + ) for p in (path, testdir.tmpdir): - items, reprec = testdir.inline_genitems(p, - '--doctest-modules') + items, reprec = testdir.inline_genitems(p, "--doctest-modules") assert len(items) == 2 assert isinstance(items[0], DoctestItem) assert isinstance(items[1], DoctestItem) @@ -60,7 +61,8 @@ class TestDoctests(object): assert items[0].parent is items[1].parent def test_collect_module_two_doctest_no_modulelevel(self, testdir): - path = testdir.makepyfile(whatever=""" + path = testdir.makepyfile( + whatever=""" '# Empty' def my_func(): ">>> magic = 42 " @@ -74,10 +76,10 @@ class TestDoctests(object): # This is another function >>> import os # this one does have a doctest ''' - """) + """ + ) for p in (path, testdir.tmpdir): - items, reprec = testdir.inline_genitems(p, - '--doctest-modules') + items, reprec = testdir.inline_genitems(p, "--doctest-modules") assert len(items) == 2 assert isinstance(items[0], DoctestItem) assert isinstance(items[1], DoctestItem) @@ -85,99 +87,108 @@ class TestDoctests(object): assert items[0].parent is items[1].parent def test_simple_doctestfile(self, testdir): - p = testdir.maketxtfile(test_doc=""" + p = testdir.maketxtfile( + test_doc=""" >>> x = 1 >>> x == 1 False - """) - reprec = testdir.inline_run(p, ) + """ + ) + reprec = testdir.inline_run(p) reprec.assertoutcome(failed=1) def test_new_pattern(self, testdir): - p = testdir.maketxtfile(xdoc=""" + p = testdir.maketxtfile( + xdoc=""" >>> x = 1 >>> x == 1 False - """) + """ + ) reprec = testdir.inline_run(p, "--doctest-glob=x*.txt") reprec.assertoutcome(failed=1) def test_multiple_patterns(self, testdir): """Test support for multiple --doctest-glob arguments (#1255). """ - testdir.maketxtfile(xdoc=""" + testdir.maketxtfile( + xdoc=""" >>> 1 1 - """) - testdir.makefile('.foo', test=""" + """ + ) + testdir.makefile( + ".foo", + test=""" >>> 1 1 - """) - testdir.maketxtfile(test_normal=""" + """, + ) + testdir.maketxtfile( + test_normal=""" >>> 1 1 - """) - expected = set(['xdoc.txt', 'test.foo', 'test_normal.txt']) - assert set(x.basename for x in testdir.tmpdir.listdir()) == expected + """ + ) + expected = {"xdoc.txt", "test.foo", "test_normal.txt"} + assert {x.basename for x in testdir.tmpdir.listdir()} == expected args = ["--doctest-glob=xdoc*.txt", "--doctest-glob=*.foo"] result = testdir.runpytest(*args) - result.stdout.fnmatch_lines([ - '*test.foo *', - '*xdoc.txt *', - '*2 passed*', - ]) + result.stdout.fnmatch_lines(["*test.foo *", "*xdoc.txt *", "*2 passed*"]) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - '*test_normal.txt *', - '*1 passed*', - ]) + result.stdout.fnmatch_lines(["*test_normal.txt *", "*1 passed*"]) @pytest.mark.parametrize( - ' test_string, encoding', - [ - (u'foo', 'ascii'), - (u'öäü', 'latin1'), - (u'öäü', 'utf-8') - ] + " test_string, encoding", + [(u"foo", "ascii"), (u"öäü", "latin1"), (u"öäü", "utf-8")], ) def test_encoding(self, testdir, test_string, encoding): """Test support for doctest_encoding ini option. """ - testdir.makeini(""" + testdir.makeini( + """ [pytest] - doctest_encoding={0} - """.format(encoding)) + doctest_encoding={} + """.format( + encoding + ) + ) doctest = u""" - >>> u"{0}" - {1} - """.format(test_string, repr(test_string)) + >>> u"{}" + {} + """.format( + test_string, repr(test_string) + ) testdir._makefile(".txt", [doctest], {}, encoding=encoding) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - '*1 passed*', - ]) + result.stdout.fnmatch_lines(["*1 passed*"]) def test_doctest_unexpected_exception(self, testdir): - testdir.maketxtfile(""" + testdir.maketxtfile( + """ >>> i = 0 >>> 0 / i 2 - """) + """ + ) result = testdir.runpytest("--doctest-modules") - result.stdout.fnmatch_lines([ - "*unexpected_exception*", - "*>>> i = 0*", - "*>>> 0 / i*", - "*UNEXPECTED*ZeroDivision*", - ]) + result.stdout.fnmatch_lines( + [ + "*unexpected_exception*", + "*>>> i = 0*", + "*>>> 0 / i*", + "*UNEXPECTED*ZeroDivision*", + ] + ) def test_docstring_partial_context_around_error(self, testdir): """Test that we show some context before the actual line of a failing doctest. """ - testdir.makepyfile(''' + testdir.makepyfile( + ''' def foo(): """ text-line-1 @@ -196,28 +207,32 @@ class TestDoctests(object): text-line-after """ - ''') - result = testdir.runpytest('--doctest-modules') - result.stdout.fnmatch_lines([ - '*docstring_partial_context_around_error*', - '005*text-line-3', - '006*text-line-4', - '013*text-line-11', - '014*>>> 1 + 1', - 'Expected:', - ' 3', - 'Got:', - ' 2', - ]) + ''' + ) + result = testdir.runpytest("--doctest-modules") + result.stdout.fnmatch_lines( + [ + "*docstring_partial_context_around_error*", + "005*text-line-3", + "006*text-line-4", + "013*text-line-11", + "014*>>> 1 + 1", + "Expected:", + " 3", + "Got:", + " 2", + ] + ) # lines below should be trimmed out - assert 'text-line-2' not in result.stdout.str() - assert 'text-line-after' not in result.stdout.str() + assert "text-line-2" not in result.stdout.str() + assert "text-line-after" not in result.stdout.str() def test_docstring_full_context_around_error(self, testdir): """Test that we show the whole context before the actual line of a failing doctest, provided that the context is up to 10 lines long. """ - testdir.makepyfile(''' + testdir.makepyfile( + ''' def foo(): """ text-line-1 @@ -226,21 +241,26 @@ class TestDoctests(object): >>> 1 + 1 3 """ - ''') - result = testdir.runpytest('--doctest-modules') - result.stdout.fnmatch_lines([ - '*docstring_full_context_around_error*', - '003*text-line-1', - '004*text-line-2', - '006*>>> 1 + 1', - 'Expected:', - ' 3', - 'Got:', - ' 2', - ]) + ''' + ) + result = testdir.runpytest("--doctest-modules") + result.stdout.fnmatch_lines( + [ + "*docstring_full_context_around_error*", + "003*text-line-1", + "004*text-line-2", + "006*>>> 1 + 1", + "Expected:", + " 3", + "Got:", + " 2", + ] + ) def test_doctest_linedata_missing(self, testdir): - testdir.tmpdir.join('hello.py').write(_pytest._code.Source(""" + testdir.tmpdir.join("hello.py").write( + _pytest._code.Source( + """ class Fun(object): @property def test(self): @@ -248,137 +268,176 @@ class TestDoctests(object): >>> a = 1 >>> 1/0 ''' - """)) + """ + ) + ) result = testdir.runpytest("--doctest-modules") - result.stdout.fnmatch_lines([ - "*hello*", - "*EXAMPLE LOCATION UNKNOWN, not showing all tests of that example*", - "*1/0*", - "*UNEXPECTED*ZeroDivision*", - "*1 failed*", - ]) + result.stdout.fnmatch_lines( + [ + "*hello*", + "*EXAMPLE LOCATION UNKNOWN, not showing all tests of that example*", + "*1/0*", + "*UNEXPECTED*ZeroDivision*", + "*1 failed*", + ] + ) def test_doctest_unex_importerror_only_txt(self, testdir): - testdir.maketxtfile(""" + testdir.maketxtfile( + """ >>> import asdalsdkjaslkdjasd >>> - """) + """ + ) result = testdir.runpytest() # doctest is never executed because of error during hello.py collection - result.stdout.fnmatch_lines([ - "*>>> import asdals*", - "*UNEXPECTED*{e}*".format(e=MODULE_NOT_FOUND_ERROR), - "{e}: No module named *asdal*".format(e=MODULE_NOT_FOUND_ERROR), - ]) + result.stdout.fnmatch_lines( + [ + "*>>> import asdals*", + "*UNEXPECTED*{e}*".format(e=MODULE_NOT_FOUND_ERROR), + "{e}: No module named *asdal*".format(e=MODULE_NOT_FOUND_ERROR), + ] + ) def test_doctest_unex_importerror_with_module(self, testdir): - testdir.tmpdir.join("hello.py").write(_pytest._code.Source(""" + testdir.tmpdir.join("hello.py").write( + _pytest._code.Source( + """ import asdalsdkjaslkdjasd - """)) - testdir.maketxtfile(""" + """ + ) + ) + testdir.maketxtfile( + """ >>> import hello >>> - """) + """ + ) result = testdir.runpytest("--doctest-modules") # doctest is never executed because of error during hello.py collection - result.stdout.fnmatch_lines([ - "*ERROR collecting hello.py*", - "*{e}: No module named *asdals*".format(e=MODULE_NOT_FOUND_ERROR), - "*Interrupted: 1 errors during collection*", - ]) + result.stdout.fnmatch_lines( + [ + "*ERROR collecting hello.py*", + "*{e}: No module named *asdals*".format(e=MODULE_NOT_FOUND_ERROR), + "*Interrupted: 1 errors during collection*", + ] + ) def test_doctestmodule(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ ''' >>> x = 1 >>> x == 1 False ''' - """) + """ + ) reprec = testdir.inline_run(p, "--doctest-modules") reprec.assertoutcome(failed=1) def test_doctestmodule_external_and_issue116(self, testdir): p = testdir.mkpydir("hello") - p.join("__init__.py").write(_pytest._code.Source(""" + p.join("__init__.py").write( + _pytest._code.Source( + """ def somefunc(): ''' >>> i = 0 >>> i + 1 2 ''' - """)) + """ + ) + ) result = testdir.runpytest(p, "--doctest-modules") - result.stdout.fnmatch_lines([ - '004 *>>> i = 0', - '005 *>>> i + 1', - '*Expected:', - "* 2", - "*Got:", - "* 1", - "*:5: DocTestFailure" - ]) + result.stdout.fnmatch_lines( + [ + "004 *>>> i = 0", + "005 *>>> i + 1", + "*Expected:", + "* 2", + "*Got:", + "* 1", + "*:5: DocTestFailure", + ] + ) def test_txtfile_failing(self, testdir): - p = testdir.maketxtfile(""" + p = testdir.maketxtfile( + """ >>> i = 0 >>> i + 1 2 - """) + """ + ) result = testdir.runpytest(p, "-s") - result.stdout.fnmatch_lines([ - '001 >>> i = 0', - '002 >>> i + 1', - 'Expected:', - " 2", - "Got:", - " 1", - "*test_txtfile_failing.txt:2: DocTestFailure" - ]) + result.stdout.fnmatch_lines( + [ + "001 >>> i = 0", + "002 >>> i + 1", + "Expected:", + " 2", + "Got:", + " 1", + "*test_txtfile_failing.txt:2: DocTestFailure", + ] + ) def test_txtfile_with_fixtures(self, testdir): - p = testdir.maketxtfile(""" + p = testdir.maketxtfile( + """ >>> dir = getfixture('tmpdir') >>> type(dir).__name__ 'LocalPath' - """) - reprec = testdir.inline_run(p, ) + """ + ) + reprec = testdir.inline_run(p) reprec.assertoutcome(passed=1) def test_txtfile_with_usefixtures_in_ini(self, testdir): - testdir.makeini(""" + testdir.makeini( + """ [pytest] usefixtures = myfixture - """) - testdir.makeconftest(""" + """ + ) + testdir.makeconftest( + """ import pytest @pytest.fixture def myfixture(monkeypatch): monkeypatch.setenv("HELLO", "WORLD") - """) + """ + ) - p = testdir.maketxtfile(""" + p = testdir.maketxtfile( + """ >>> import os >>> os.environ["HELLO"] 'WORLD' - """) - reprec = testdir.inline_run(p, ) + """ + ) + reprec = testdir.inline_run(p) reprec.assertoutcome(passed=1) def test_doctestmodule_with_fixtures(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ ''' >>> dir = getfixture('tmpdir') >>> type(dir).__name__ 'LocalPath' ''' - """) + """ + ) reprec = testdir.inline_run(p, "--doctest-modules") reprec.assertoutcome(passed=1) def test_doctestmodule_three_tests(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ ''' >>> dir = getfixture('tmpdir') >>> type(dir).__name__ @@ -398,12 +457,14 @@ class TestDoctests(object): >>> os is os True ''' - """) + """ + ) reprec = testdir.inline_run(p, "--doctest-modules") reprec.assertoutcome(passed=3) def test_doctestmodule_two_tests_one_fail(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ class MyClass(object): def bad_meth(self): ''' @@ -417,16 +478,20 @@ class TestDoctests(object): >>> magic - 42 0 ''' - """) + """ + ) reprec = testdir.inline_run(p, "--doctest-modules") reprec.assertoutcome(failed=1, passed=1) def test_ignored_whitespace(self, testdir): - testdir.makeini(""" + testdir.makeini( + """ [pytest] doctest_optionflags = ELLIPSIS NORMALIZE_WHITESPACE - """) - p = testdir.makepyfile(""" + """ + ) + p = testdir.makepyfile( + """ class MyClass(object): ''' >>> a = "foo " @@ -434,16 +499,20 @@ class TestDoctests(object): foo ''' pass - """) + """ + ) reprec = testdir.inline_run(p, "--doctest-modules") reprec.assertoutcome(passed=1) def test_non_ignored_whitespace(self, testdir): - testdir.makeini(""" + testdir.makeini( + """ [pytest] doctest_optionflags = ELLIPSIS - """) - p = testdir.makepyfile(""" + """ + ) + p = testdir.makepyfile( + """ class MyClass(object): ''' >>> a = "foo " @@ -451,55 +520,64 @@ class TestDoctests(object): foo ''' pass - """) + """ + ) reprec = testdir.inline_run(p, "--doctest-modules") reprec.assertoutcome(failed=1, passed=0) def test_ignored_whitespace_glob(self, testdir): - testdir.makeini(""" + testdir.makeini( + """ [pytest] doctest_optionflags = ELLIPSIS NORMALIZE_WHITESPACE - """) - p = testdir.maketxtfile(xdoc=""" + """ + ) + p = testdir.maketxtfile( + xdoc=""" >>> a = "foo " >>> print(a) foo - """) + """ + ) reprec = testdir.inline_run(p, "--doctest-glob=x*.txt") reprec.assertoutcome(passed=1) def test_non_ignored_whitespace_glob(self, testdir): - testdir.makeini(""" + testdir.makeini( + """ [pytest] doctest_optionflags = ELLIPSIS - """) - p = testdir.maketxtfile(xdoc=""" + """ + ) + p = testdir.maketxtfile( + xdoc=""" >>> a = "foo " >>> print(a) foo - """) + """ + ) reprec = testdir.inline_run(p, "--doctest-glob=x*.txt") reprec.assertoutcome(failed=1, passed=0) def test_contains_unicode(self, testdir): """Fix internal error with docstrings containing non-ascii characters. """ - testdir.makepyfile(u''' + testdir.makepyfile( + u''' # encoding: utf-8 def foo(): """ >>> name = 'с' # not letter 'c' but instead Cyrillic 's'. 'anything' """ - ''') - result = testdir.runpytest('--doctest-modules') - result.stdout.fnmatch_lines([ - 'Got nothing', - '* 1 failed in*', - ]) + ''' + ) + result = testdir.runpytest("--doctest-modules") + result.stdout.fnmatch_lines(["Got nothing", "* 1 failed in*"]) def test_ignore_import_errors_on_doctest(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import asdf def add_one(x): @@ -508,26 +586,29 @@ class TestDoctests(object): 2 ''' return x + 1 - """) + """ + ) - reprec = testdir.inline_run(p, "--doctest-modules", - "--doctest-ignore-import-errors") + reprec = testdir.inline_run( + p, "--doctest-modules", "--doctest-ignore-import-errors" + ) reprec.assertoutcome(skipped=1, failed=1, passed=0) def test_junit_report_for_doctest(self, testdir): """ #713: Fix --junit-xml option when used with --doctest-modules. """ - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def foo(): ''' >>> 1 + 1 3 ''' pass - """) - reprec = testdir.inline_run(p, "--doctest-modules", - "--junit-xml=junit.xml") + """ + ) + reprec = testdir.inline_run(p, "--doctest-modules", "--junit-xml=junit.xml") reprec.assertoutcome(failed=1) def test_unicode_doctest(self, testdir): @@ -535,7 +616,8 @@ class TestDoctests(object): Test case for issue 2434: DecodeError on Python 2 when doctest contains non-ascii characters. """ - p = testdir.maketxtfile(test_unicode_doctest=""" + p = testdir.maketxtfile( + test_unicode_doctest=""" .. doctest:: >>> print( @@ -545,19 +627,20 @@ class TestDoctests(object): Byé >>> 1/0 # Byé 1 - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - '*UNEXPECTED EXCEPTION: ZeroDivisionError*', - '*1 failed*', - ]) + result.stdout.fnmatch_lines( + ["*UNEXPECTED EXCEPTION: ZeroDivisionError*", "*1 failed*"] + ) def test_unicode_doctest_module(self, testdir): """ Test case for issue 2434: DecodeError on Python 2 when doctest docstring contains non-ascii characters. """ - p = testdir.makepyfile(test_unicode_doctest_module=""" + p = testdir.makepyfile( + test_unicode_doctest_module=""" # -*- encoding: utf-8 -*- from __future__ import unicode_literals @@ -567,112 +650,155 @@ class TestDoctests(object): único ''' return "único" - """) - result = testdir.runpytest(p, '--doctest-modules') - result.stdout.fnmatch_lines(['* 1 passed *']) + """ + ) + result = testdir.runpytest(p, "--doctest-modules") + result.stdout.fnmatch_lines(["* 1 passed *"]) + + def test_print_unicode_value(self, testdir): + """ + Test case for issue 3583: Printing Unicode in doctest under Python 2.7 + doesn't work + """ + p = testdir.maketxtfile( + test_print_unicode_value=r""" + Here is a doctest:: + + >>> print(u'\xE5\xE9\xEE\xF8\xFC') + åéîøü + """ + ) + result = testdir.runpytest(p) + result.stdout.fnmatch_lines(["* 1 passed *"]) def test_reportinfo(self, testdir): - ''' + """ Test case to make sure that DoctestItem.reportinfo() returns lineno. - ''' - p = testdir.makepyfile(test_reportinfo=""" + """ + p = testdir.makepyfile( + test_reportinfo=""" def foo(x): ''' >>> foo('a') 'b' ''' return 'c' - """) - items, reprec = testdir.inline_genitems(p, '--doctest-modules') + """ + ) + items, reprec = testdir.inline_genitems(p, "--doctest-modules") reportinfo = items[0].reportinfo() assert reportinfo[1] == 1 def test_valid_setup_py(self, testdir): - ''' + """ Test to make sure that pytest ignores valid setup.py files when ran with --doctest-modules - ''' - p = testdir.makepyfile(setup=""" + """ + p = testdir.makepyfile( + setup=""" from setuptools import setup, find_packages setup(name='sample', version='0.0', description='description', packages=find_packages() ) - """) - result = testdir.runpytest(p, '--doctest-modules') - result.stdout.fnmatch_lines(['*collected 0 items*']) + """ + ) + result = testdir.runpytest(p, "--doctest-modules") + result.stdout.fnmatch_lines(["*collected 0 items*"]) def test_invalid_setup_py(self, testdir): - ''' + """ Test to make sure that pytest reads setup.py files that are not used for python packages when ran with --doctest-modules - ''' - p = testdir.makepyfile(setup=""" + """ + p = testdir.makepyfile( + setup=""" def test_foo(): return 'bar' - """) - result = testdir.runpytest(p, '--doctest-modules') - result.stdout.fnmatch_lines(['*collected 1 item*']) + """ + ) + result = testdir.runpytest(p, "--doctest-modules") + result.stdout.fnmatch_lines(["*collected 1 item*"]) class TestLiterals(object): - @pytest.mark.parametrize('config_mode', ['ini', 'comment']) + @pytest.mark.parametrize("config_mode", ["ini", "comment"]) def test_allow_unicode(self, testdir, config_mode): """Test that doctests which output unicode work in all python versions tested by pytest when the ALLOW_UNICODE option is used (either in the ini file or by an inline comment). """ - if config_mode == 'ini': - testdir.makeini(''' + if config_mode == "ini": + testdir.makeini( + """ [pytest] doctest_optionflags = ALLOW_UNICODE - ''') - comment = '' + """ + ) + comment = "" else: - comment = '#doctest: +ALLOW_UNICODE' + comment = "#doctest: +ALLOW_UNICODE" - testdir.maketxtfile(test_doc=""" + testdir.maketxtfile( + test_doc=""" >>> b'12'.decode('ascii') {comment} '12' - """.format(comment=comment)) - testdir.makepyfile(foo=""" + """.format( + comment=comment + ) + ) + testdir.makepyfile( + foo=""" def foo(): ''' >>> b'12'.decode('ascii') {comment} '12' ''' - """.format(comment=comment)) + """.format( + comment=comment + ) + ) reprec = testdir.inline_run("--doctest-modules") reprec.assertoutcome(passed=2) - @pytest.mark.parametrize('config_mode', ['ini', 'comment']) + @pytest.mark.parametrize("config_mode", ["ini", "comment"]) def test_allow_bytes(self, testdir, config_mode): """Test that doctests which output bytes work in all python versions tested by pytest when the ALLOW_BYTES option is used (either in the ini file or by an inline comment)(#1287). """ - if config_mode == 'ini': - testdir.makeini(''' + if config_mode == "ini": + testdir.makeini( + """ [pytest] doctest_optionflags = ALLOW_BYTES - ''') - comment = '' + """ + ) + comment = "" else: - comment = '#doctest: +ALLOW_BYTES' + comment = "#doctest: +ALLOW_BYTES" - testdir.maketxtfile(test_doc=""" + testdir.maketxtfile( + test_doc=""" >>> b'foo' {comment} 'foo' - """.format(comment=comment)) - testdir.makepyfile(foo=""" + """.format( + comment=comment + ) + ) + testdir.makepyfile( + foo=""" def foo(): ''' >>> b'foo' {comment} 'foo' ''' - """.format(comment=comment)) + """.format( + comment=comment + ) + ) reprec = testdir.inline_run("--doctest-modules") reprec.assertoutcome(passed=2) @@ -681,10 +807,12 @@ class TestLiterals(object): the ALLOW_UNICODE option is not used. The same test should pass in Python 3. """ - testdir.maketxtfile(test_doc=""" + testdir.maketxtfile( + test_doc=""" >>> b'12'.decode('ascii') '12' - """) + """ + ) reprec = testdir.inline_run() passed = int(sys.version_info[0] >= 3) reprec.assertoutcome(passed=passed, failed=int(not passed)) @@ -694,10 +822,12 @@ class TestLiterals(object): the ALLOW_BYTES option is not used. The same test should pass in Python 2 (#1287). """ - testdir.maketxtfile(test_doc=""" + testdir.maketxtfile( + test_doc=""" >>> b'foo' 'foo' - """) + """ + ) reprec = testdir.inline_run() passed = int(sys.version_info[0] == 2) reprec.assertoutcome(passed=passed, failed=int(not passed)) @@ -709,64 +839,93 @@ class TestDoctestSkips(object): the tests should be SKIPPED rather than PASSED. (#957) """ - @pytest.fixture(params=['text', 'module']) + @pytest.fixture(params=["text", "module"]) def makedoctest(self, testdir, request): + def makeit(doctest): mode = request.param - if mode == 'text': + if mode == "text": testdir.maketxtfile(doctest) else: - assert mode == 'module' + assert mode == "module" testdir.makepyfile('"""\n%s"""' % doctest) return makeit def test_one_skipped(self, testdir, makedoctest): - makedoctest(""" + makedoctest( + """ >>> 1 + 1 # doctest: +SKIP 2 >>> 2 + 2 4 - """) + """ + ) reprec = testdir.inline_run("--doctest-modules") reprec.assertoutcome(passed=1) def test_one_skipped_failed(self, testdir, makedoctest): - makedoctest(""" + makedoctest( + """ >>> 1 + 1 # doctest: +SKIP 2 >>> 2 + 2 200 - """) + """ + ) reprec = testdir.inline_run("--doctest-modules") reprec.assertoutcome(failed=1) def test_all_skipped(self, testdir, makedoctest): - makedoctest(""" + makedoctest( + """ >>> 1 + 1 # doctest: +SKIP 2 >>> 2 + 2 # doctest: +SKIP 200 - """) + """ + ) reprec = testdir.inline_run("--doctest-modules") reprec.assertoutcome(skipped=1) def test_vacuous_all_skipped(self, testdir, makedoctest): - makedoctest('') + makedoctest("") reprec = testdir.inline_run("--doctest-modules") reprec.assertoutcome(passed=0, skipped=0) + def test_continue_on_failure(self, testdir): + testdir.maketxtfile( + test_something=""" + >>> i = 5 + >>> def foo(): + ... raise ValueError('error1') + >>> foo() + >>> i + >>> i + 2 + 7 + >>> i + 1 + """ + ) + result = testdir.runpytest("--doctest-modules", "--doctest-continue-on-failure") + result.assert_outcomes(passed=0, failed=1) + # The lines that contains the failure are 4, 5, and 8. The first one + # is a stack trace and the other two are mismatches. + result.stdout.fnmatch_lines( + ["*4: UnexpectedException*", "*5: DocTestFailure*", "*8: DocTestFailure*"] + ) + class TestDoctestAutoUseFixtures(object): - SCOPES = ['module', 'session', 'class', 'function'] + SCOPES = ["module", "session", "class", "function"] def test_doctest_module_session_fixture(self, testdir): """Test that session fixtures are initialized for doctest modules (#768) """ # session fixture which changes some global data, which will # be accessed by doctests in a module - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest import sys @@ -776,8 +935,10 @@ class TestDoctestAutoUseFixtures(object): sys.pytest_session_data = 1 yield del sys.pytest_session_data - """) - testdir.makepyfile(foo=""" + """ + ) + testdir.makepyfile( + foo=""" import sys def foo(): @@ -789,24 +950,30 @@ class TestDoctestAutoUseFixtures(object): ''' >>> assert sys.pytest_session_data == 1 ''' - """) + """ + ) result = testdir.runpytest("--doctest-modules") - result.stdout.fnmatch_lines('*2 passed*') + result.stdout.fnmatch_lines("*2 passed*") - @pytest.mark.parametrize('scope', SCOPES) - @pytest.mark.parametrize('enable_doctest', [True, False]) + @pytest.mark.parametrize("scope", SCOPES) + @pytest.mark.parametrize("enable_doctest", [True, False]) def test_fixture_scopes(self, testdir, scope, enable_doctest): """Test that auto-use fixtures work properly with doctest modules. See #1057 and #1100. """ - testdir.makeconftest(''' + testdir.makeconftest( + """ import pytest @pytest.fixture(autouse=True, scope="{scope}") def auto(request): return 99 - '''.format(scope=scope)) - testdir.makepyfile(test_1=''' + """.format( + scope=scope + ) + ) + testdir.makepyfile( + test_1=''' def test_foo(): """ >>> getfixture('auto') + 1 @@ -814,47 +981,58 @@ class TestDoctestAutoUseFixtures(object): """ def test_bar(): assert 1 - ''') - params = ('--doctest-modules',) if enable_doctest else () + ''' + ) + params = ("--doctest-modules",) if enable_doctest else () passes = 3 if enable_doctest else 2 result = testdir.runpytest(*params) - result.stdout.fnmatch_lines(['*=== %d passed in *' % passes]) + result.stdout.fnmatch_lines(["*=== %d passed in *" % passes]) - @pytest.mark.parametrize('scope', SCOPES) - @pytest.mark.parametrize('autouse', [True, False]) - @pytest.mark.parametrize('use_fixture_in_doctest', [True, False]) - def test_fixture_module_doctest_scopes(self, testdir, scope, autouse, - use_fixture_in_doctest): + @pytest.mark.parametrize("scope", SCOPES) + @pytest.mark.parametrize("autouse", [True, False]) + @pytest.mark.parametrize("use_fixture_in_doctest", [True, False]) + def test_fixture_module_doctest_scopes( + self, testdir, scope, autouse, use_fixture_in_doctest + ): """Test that auto-use fixtures work properly with doctest files. See #1057 and #1100. """ - testdir.makeconftest(''' + testdir.makeconftest( + """ import pytest @pytest.fixture(autouse={autouse}, scope="{scope}") def auto(request): return 99 - '''.format(scope=scope, autouse=autouse)) + """.format( + scope=scope, autouse=autouse + ) + ) if use_fixture_in_doctest: - testdir.maketxtfile(test_doc=""" + testdir.maketxtfile( + test_doc=""" >>> getfixture('auto') 99 - """) + """ + ) else: - testdir.maketxtfile(test_doc=""" + testdir.maketxtfile( + test_doc=""" >>> 1 + 1 2 - """) - result = testdir.runpytest('--doctest-modules') - assert 'FAILURES' not in str(result.stdout.str()) - result.stdout.fnmatch_lines(['*=== 1 passed in *']) + """ + ) + result = testdir.runpytest("--doctest-modules") + assert "FAILURES" not in str(result.stdout.str()) + result.stdout.fnmatch_lines(["*=== 1 passed in *"]) - @pytest.mark.parametrize('scope', SCOPES) + @pytest.mark.parametrize("scope", SCOPES) def test_auto_use_request_attributes(self, testdir, scope): """Check that all attributes of a request in an autouse fixture behave as expected when requested for a doctest item. """ - testdir.makeconftest(''' + testdir.makeconftest( + """ import pytest @pytest.fixture(autouse=True, scope="{scope}") @@ -866,69 +1044,88 @@ class TestDoctestAutoUseFixtures(object): if "{scope}" == 'function': assert request.function is None return 99 - '''.format(scope=scope)) - testdir.maketxtfile(test_doc=""" + """.format( + scope=scope + ) + ) + testdir.maketxtfile( + test_doc=""" >>> 1 + 1 2 - """) - result = testdir.runpytest('--doctest-modules') - assert 'FAILURES' not in str(result.stdout.str()) - result.stdout.fnmatch_lines(['*=== 1 passed in *']) + """ + ) + result = testdir.runpytest("--doctest-modules") + assert "FAILURES" not in str(result.stdout.str()) + result.stdout.fnmatch_lines(["*=== 1 passed in *"]) class TestDoctestNamespaceFixture(object): - SCOPES = ['module', 'session', 'class', 'function'] + SCOPES = ["module", "session", "class", "function"] - @pytest.mark.parametrize('scope', SCOPES) + @pytest.mark.parametrize("scope", SCOPES) def test_namespace_doctestfile(self, testdir, scope): """ Check that inserting something into the namespace works in a simple text file doctest """ - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest import contextlib @pytest.fixture(autouse=True, scope="{scope}") def add_contextlib(doctest_namespace): doctest_namespace['cl'] = contextlib - """.format(scope=scope)) - p = testdir.maketxtfile(""" + """.format( + scope=scope + ) + ) + p = testdir.maketxtfile( + """ >>> print(cl.__name__) contextlib - """) + """ + ) reprec = testdir.inline_run(p) reprec.assertoutcome(passed=1) - @pytest.mark.parametrize('scope', SCOPES) + @pytest.mark.parametrize("scope", SCOPES) def test_namespace_pyfile(self, testdir, scope): """ Check that inserting something into the namespace works in a simple Python file docstring doctest """ - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest import contextlib @pytest.fixture(autouse=True, scope="{scope}") def add_contextlib(doctest_namespace): doctest_namespace['cl'] = contextlib - """.format(scope=scope)) - p = testdir.makepyfile(""" + """.format( + scope=scope + ) + ) + p = testdir.makepyfile( + """ def foo(): ''' >>> print(cl.__name__) contextlib ''' - """) + """ + ) reprec = testdir.inline_run(p, "--doctest-modules") reprec.assertoutcome(passed=1) class TestDoctestReportingOption(object): + def _run_doctest_report(self, testdir, format): - testdir.makepyfile(""" + testdir.makepyfile( + """ def foo(): ''' >>> foo() @@ -941,63 +1138,69 @@ class TestDoctestReportingOption(object): '0 1 4\\n' '1 2 5\\n' '2 3 6') - """) + """ + ) return testdir.runpytest("--doctest-modules", "--doctest-report", format) - @pytest.mark.parametrize('format', ['udiff', 'UDIFF', 'uDiFf']) + @pytest.mark.parametrize("format", ["udiff", "UDIFF", "uDiFf"]) def test_doctest_report_udiff(self, testdir, format): result = self._run_doctest_report(testdir, format) - result.stdout.fnmatch_lines([ - ' 0 1 4', - ' -1 2 4', - ' +1 2 5', - ' 2 3 6', - ]) + result.stdout.fnmatch_lines( + [" 0 1 4", " -1 2 4", " +1 2 5", " 2 3 6"] + ) def test_doctest_report_cdiff(self, testdir): - result = self._run_doctest_report(testdir, 'cdiff') - result.stdout.fnmatch_lines([ - ' a b', - ' 0 1 4', - ' ! 1 2 4', - ' 2 3 6', - ' --- 1,4 ----', - ' a b', - ' 0 1 4', - ' ! 1 2 5', - ' 2 3 6', - ]) + result = self._run_doctest_report(testdir, "cdiff") + result.stdout.fnmatch_lines( + [ + " a b", + " 0 1 4", + " ! 1 2 4", + " 2 3 6", + " --- 1,4 ----", + " a b", + " 0 1 4", + " ! 1 2 5", + " 2 3 6", + ] + ) def test_doctest_report_ndiff(self, testdir): - result = self._run_doctest_report(testdir, 'ndiff') - result.stdout.fnmatch_lines([ - ' a b', - ' 0 1 4', - ' - 1 2 4', - ' ? ^', - ' + 1 2 5', - ' ? ^', - ' 2 3 6', - ]) + result = self._run_doctest_report(testdir, "ndiff") + result.stdout.fnmatch_lines( + [ + " a b", + " 0 1 4", + " - 1 2 4", + " ? ^", + " + 1 2 5", + " ? ^", + " 2 3 6", + ] + ) - @pytest.mark.parametrize('format', ['none', 'only_first_failure']) + @pytest.mark.parametrize("format", ["none", "only_first_failure"]) def test_doctest_report_none_or_only_first_failure(self, testdir, format): result = self._run_doctest_report(testdir, format) - result.stdout.fnmatch_lines([ - 'Expected:', - ' a b', - ' 0 1 4', - ' 1 2 4', - ' 2 3 6', - 'Got:', - ' a b', - ' 0 1 4', - ' 1 2 5', - ' 2 3 6', - ]) + result.stdout.fnmatch_lines( + [ + "Expected:", + " a b", + " 0 1 4", + " 1 2 4", + " 2 3 6", + "Got:", + " a b", + " 0 1 4", + " 1 2 5", + " 2 3 6", + ] + ) def test_doctest_report_invalid(self, testdir): - result = self._run_doctest_report(testdir, 'obviously_invalid_format') - result.stderr.fnmatch_lines([ - "*error: argument --doctest-report: invalid choice: 'obviously_invalid_format' (choose from*" - ]) + result = self._run_doctest_report(testdir, "obviously_invalid_format") + result.stderr.fnmatch_lines( + [ + "*error: argument --doctest-report: invalid choice: 'obviously_invalid_format' (choose from*" + ] + ) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_entry_points.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_entry_points.py index 6ca68b481fa..8f734778faa 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_entry_points.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_entry_points.py @@ -4,11 +4,11 @@ import pkg_resources import pytest -@pytest.mark.parametrize("entrypoint", ['py.test', 'pytest']) +@pytest.mark.parametrize("entrypoint", ["py.test", "pytest"]) def test_entry_point_exist(entrypoint): - assert entrypoint in pkg_resources.get_entry_map('pytest')['console_scripts'] + assert entrypoint in pkg_resources.get_entry_map("pytest")["console_scripts"] def test_pytest_entry_points_are_identical(): - entryMap = pkg_resources.get_entry_map('pytest')['console_scripts'] - assert entryMap['pytest'].module_name == entryMap['py.test'].module_name + entryMap = pkg_resources.get_entry_map("pytest")["console_scripts"] + assert entryMap["pytest"].module_name == entryMap["py.test"].module_name diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_helpconfig.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_helpconfig.py index 845005a0575..b5424235b16 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_helpconfig.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_helpconfig.py @@ -7,57 +7,53 @@ def test_version(testdir, pytestconfig): result = testdir.runpytest("--version") assert result.ret == 0 # p = py.path.local(py.__file__).dirpath() - result.stderr.fnmatch_lines([ - '*pytest*%s*imported from*' % (pytest.__version__, ) - ]) + result.stderr.fnmatch_lines(["*pytest*%s*imported from*" % (pytest.__version__,)]) if pytestconfig.pluginmanager.list_plugin_distinfo(): - result.stderr.fnmatch_lines([ - "*setuptools registered plugins:", - "*at*", - ]) + result.stderr.fnmatch_lines(["*setuptools registered plugins:", "*at*"]) def test_help(testdir): result = testdir.runpytest("--help") assert result.ret == 0 - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *-v*verbose* *setup.cfg* *minversion* *to see*markers*pytest --markers* *to see*fixtures*pytest --fixtures* - """) + """ + ) def test_hookvalidation_unknown(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_hello(xyz): pass - """) + """ + ) result = testdir.runpytest() assert result.ret != 0 - result.stdout.fnmatch_lines([ - '*unknown hook*pytest_hello*' - ]) + result.stdout.fnmatch_lines(["*unknown hook*pytest_hello*"]) def test_hookvalidation_optional(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.hookimpl(optionalhook=True) def pytest_hello(xyz): pass - """) + """ + ) result = testdir.runpytest() assert result.ret == EXIT_NOTESTSCOLLECTED def test_traceconfig(testdir): result = testdir.runpytest("--traceconfig") - result.stdout.fnmatch_lines([ - "*using*pytest*py*", - "*active plugins*", - ]) + result.stdout.fnmatch_lines(["*using*pytest*py*", "*active plugins*"]) def test_debug(testdir, monkeypatch): @@ -71,7 +67,6 @@ def test_PYTEST_DEBUG(testdir, monkeypatch): monkeypatch.setenv("PYTEST_DEBUG", "1") result = testdir.runpytest_subprocess() assert result.ret == EXIT_NOTESTSCOLLECTED - result.stderr.fnmatch_lines([ - "*pytest_plugin_registered*", - "*manager*PluginManager*" - ]) + result.stderr.fnmatch_lines( + ["*pytest_plugin_registered*", "*manager*PluginManager*"] + ) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_junitxml.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_junitxml.py index b604c02a3de..d0be5f26759 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_junitxml.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_junitxml.py @@ -23,12 +23,13 @@ def assert_attr(node, **kwargs): if anode is not None: return anode.value - expected = dict((name, str(value)) for name, value in kwargs.items()) - on_node = dict((name, nodeval(node, name)) for name in expected) + expected = {name: str(value) for name, value in kwargs.items()} + on_node = {name: nodeval(node, name) for name in expected} assert on_node == expected class DomNode(object): + def __init__(self, dom): self.__node = dom @@ -80,8 +81,10 @@ class DomNode(object): class TestPython(object): + def test_summing_simple(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def test_pass(): pass @@ -95,14 +98,16 @@ class TestPython(object): @pytest.mark.xfail def test_xpass(): assert 1 - """) + """ + ) result, dom = runandparse(testdir) assert result.ret node = dom.find_first_by_tag("testsuite") node.assert_attr(name="pytest", errors=0, failures=1, skips=2, tests=5) def test_summing_simple_with_errors(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture def fixture(): @@ -119,14 +124,16 @@ class TestPython(object): @pytest.mark.xfail(strict=True) def test_xpass(): assert True - """) + """ + ) result, dom = runandparse(testdir) assert result.ret node = dom.find_first_by_tag("testsuite") node.assert_attr(name="pytest", errors=1, failures=2, skips=1, tests=5) def test_timing_function(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import time, pytest def setup_module(): time.sleep(0.01) @@ -134,7 +141,8 @@ class TestPython(object): time.sleep(0.01) def test_sleep(): time.sleep(0.01) - """) + """ + ) result, dom = runandparse(testdir) node = dom.find_first_by_tag("testsuite") tnode = node.find_first_by_tag("testcase") @@ -142,7 +150,8 @@ class TestPython(object): assert round(float(val), 2) >= 0.03 def test_setup_error(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture @@ -150,7 +159,8 @@ class TestPython(object): raise ValueError() def test_function(arg): pass - """) + """ + ) result, dom = runandparse(testdir) assert result.ret node = dom.find_first_by_tag("testsuite") @@ -160,13 +170,15 @@ class TestPython(object): file="test_setup_error.py", line="5", classname="test_setup_error", - name="test_function") + name="test_function", + ) fnode = tnode.find_first_by_tag("error") fnode.assert_attr(message="test setup failure") assert "ValueError" in fnode.toxml() def test_teardown_error(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture @@ -175,7 +187,8 @@ class TestPython(object): raise ValueError() def test_function(arg): pass - """) + """ + ) result, dom = runandparse(testdir) assert result.ret node = dom.find_first_by_tag("testsuite") @@ -184,13 +197,15 @@ class TestPython(object): file="test_teardown_error.py", line="6", classname="test_teardown_error", - name="test_function") + name="test_function", + ) fnode = tnode.find_first_by_tag("error") fnode.assert_attr(message="test teardown failure") assert "ValueError" in fnode.toxml() def test_call_failure_teardown_error(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture @@ -199,7 +214,8 @@ class TestPython(object): raise Exception("Teardown Exception") def test_function(arg): raise Exception("Call Exception") - """) + """ + ) result, dom = runandparse(testdir) assert result.ret node = dom.find_first_by_tag("testsuite") @@ -213,11 +229,13 @@ class TestPython(object): snode.assert_attr(message="test teardown failure") def test_skip_contains_name_reason(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def test_skip(): pytest.skip("hello23") - """) + """ + ) result, dom = runandparse(testdir) assert result.ret == 0 node = dom.find_first_by_tag("testsuite") @@ -227,17 +245,20 @@ class TestPython(object): file="test_skip_contains_name_reason.py", line="1", classname="test_skip_contains_name_reason", - name="test_skip") + name="test_skip", + ) snode = tnode.find_first_by_tag("skipped") - snode.assert_attr(type="pytest.skip", message="hello23", ) + snode.assert_attr(type="pytest.skip", message="hello23") def test_mark_skip_contains_name_reason(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.skip(reason="hello24") def test_skip(): assert True - """) + """ + ) result, dom = runandparse(testdir) assert result.ret == 0 node = dom.find_first_by_tag("testsuite") @@ -247,18 +268,21 @@ class TestPython(object): file="test_mark_skip_contains_name_reason.py", line="1", classname="test_mark_skip_contains_name_reason", - name="test_skip") + name="test_skip", + ) snode = tnode.find_first_by_tag("skipped") - snode.assert_attr(type="pytest.skip", message="hello24", ) + snode.assert_attr(type="pytest.skip", message="hello24") def test_mark_skipif_contains_name_reason(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest GLOBAL_CONDITION = True @pytest.mark.skipif(GLOBAL_CONDITION, reason="hello25") def test_skip(): assert True - """) + """ + ) result, dom = runandparse(testdir) assert result.ret == 0 node = dom.find_first_by_tag("testsuite") @@ -268,28 +292,33 @@ class TestPython(object): file="test_mark_skipif_contains_name_reason.py", line="2", classname="test_mark_skipif_contains_name_reason", - name="test_skip") + name="test_skip", + ) snode = tnode.find_first_by_tag("skipped") - snode.assert_attr(type="pytest.skip", message="hello25", ) + snode.assert_attr(type="pytest.skip", message="hello25") def test_mark_skip_doesnt_capture_output(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.skip(reason="foo") def test_skip(): print("bar!") - """) + """ + ) result, dom = runandparse(testdir) assert result.ret == 0 node_xml = dom.find_first_by_tag("testsuite").toxml() assert "bar!" not in node_xml def test_classname_instance(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ class TestClass(object): def test_method(self): assert 0 - """) + """ + ) result, dom = runandparse(testdir) assert result.ret node = dom.find_first_by_tag("testsuite") @@ -299,7 +328,8 @@ class TestPython(object): file="test_classname_instance.py", line="1", classname="test_classname_instance.TestClass", - name="test_method") + name="test_method", + ) def test_classname_nested_dir(self, testdir): p = testdir.tmpdir.ensure("sub", "test_hello.py") @@ -313,7 +343,8 @@ class TestPython(object): file=os.path.join("sub", "test_hello.py"), line="0", classname="sub.test_hello", - name="test_func") + name="test_func", + ) def test_internal_error(self, testdir): testdir.makeconftest("def pytest_runtest_protocol(): 0 / 0") @@ -328,41 +359,63 @@ class TestPython(object): fnode.assert_attr(message="internal error") assert "Division" in fnode.toxml() - def test_failure_function(self, testdir): - testdir.makepyfile(""" + @pytest.mark.parametrize("junit_logging", ["no", "system-out", "system-err"]) + def test_failure_function(self, testdir, junit_logging): + testdir.makepyfile( + """ + import logging import sys + def test_fail(): print ("hello-stdout") sys.stderr.write("hello-stderr\\n") + logging.info('info msg') + logging.warning('warning msg') raise ValueError(42) - """) + """ + ) - result, dom = runandparse(testdir) + result, dom = runandparse(testdir, "-o", "junit_logging=%s" % junit_logging) assert result.ret node = dom.find_first_by_tag("testsuite") node.assert_attr(failures=1, tests=1) tnode = node.find_first_by_tag("testcase") tnode.assert_attr( file="test_failure_function.py", - line="1", + line="3", classname="test_failure_function", - name="test_fail") + name="test_fail", + ) fnode = tnode.find_first_by_tag("failure") fnode.assert_attr(message="ValueError: 42") assert "ValueError" in fnode.toxml() systemout = fnode.next_siebling assert systemout.tag == "system-out" assert "hello-stdout" in systemout.toxml() + assert "info msg" not in systemout.toxml() systemerr = systemout.next_siebling assert systemerr.tag == "system-err" assert "hello-stderr" in systemerr.toxml() + assert "info msg" not in systemerr.toxml() + + if junit_logging == "system-out": + assert "warning msg" in systemout.toxml() + assert "warning msg" not in systemerr.toxml() + elif junit_logging == "system-err": + assert "warning msg" not in systemout.toxml() + assert "warning msg" in systemerr.toxml() + elif junit_logging == "no": + assert "warning msg" not in systemout.toxml() + assert "warning msg" not in systemerr.toxml() def test_failure_verbose_message(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import sys def test_fail(): assert 0, "An error" - """) + """ + ) result, dom = runandparse(testdir) node = dom.find_first_by_tag("testsuite") @@ -371,13 +424,15 @@ class TestPython(object): fnode.assert_attr(message="AssertionError: An error assert 0") def test_failure_escape(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.parametrize('arg1', "<&'", ids="<&'") def test_func(arg1): print(arg1) assert 0 - """) + """ + ) result, dom = runandparse(testdir) assert result.ret node = dom.find_first_by_tag("testsuite") @@ -390,19 +445,22 @@ class TestPython(object): file="test_failure_escape.py", line="1", classname="test_failure_escape", - name="test_func[%s]" % char) - sysout = tnode.find_first_by_tag('system-out') + name="test_func[%s]" % char, + ) + sysout = tnode.find_first_by_tag("system-out") text = sysout.text - assert text == '%s\n' % char + assert text == "%s\n" % char def test_junit_prefixing(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_func(): assert 0 class TestHello(object): def test_hello(self): pass - """) + """ + ) result, dom = runandparse(testdir, "--junitprefix=xyz") assert result.ret node = dom.find_first_by_tag("testsuite") @@ -412,21 +470,24 @@ class TestPython(object): file="test_junit_prefixing.py", line="0", classname="xyz.test_junit_prefixing", - name="test_func") + name="test_func", + ) tnode = node.find_nth_by_tag("testcase", 1) tnode.assert_attr( file="test_junit_prefixing.py", line="3", - classname="xyz.test_junit_prefixing." - "TestHello", - name="test_hello") + classname="xyz.test_junit_prefixing." "TestHello", + name="test_hello", + ) def test_xfailure_function(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def test_xfail(): pytest.xfail("42") - """) + """ + ) result, dom = runandparse(testdir) assert not result.ret node = dom.find_first_by_tag("testsuite") @@ -436,18 +497,40 @@ class TestPython(object): file="test_xfailure_function.py", line="1", classname="test_xfailure_function", - name="test_xfail") + name="test_xfail", + ) fnode = tnode.find_first_by_tag("skipped") fnode.assert_attr(message="expected test failure") # assert "ValueError" in fnode.toxml() + def test_xfail_captures_output_once(self, testdir): + testdir.makepyfile( + """ + import sys + import pytest + + @pytest.mark.xfail() + def test_fail(): + sys.stdout.write('XFAIL This is stdout') + sys.stderr.write('XFAIL This is stderr') + assert 0 + """ + ) + result, dom = runandparse(testdir) + node = dom.find_first_by_tag("testsuite") + tnode = node.find_first_by_tag("testcase") + assert len(tnode.find_by_tag("system-err")) == 1 + assert len(tnode.find_by_tag("system-out")) == 1 + def test_xfailure_xpass(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.xfail def test_xpass(): pass - """) + """ + ) result, dom = runandparse(testdir) # assert result.ret node = dom.find_first_by_tag("testsuite") @@ -457,15 +540,18 @@ class TestPython(object): file="test_xfailure_xpass.py", line="1", classname="test_xfailure_xpass", - name="test_xpass") + name="test_xpass", + ) def test_xfailure_xpass_strict(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.xfail(strict=True, reason="This needs to fail!") def test_xpass(): pass - """) + """ + ) result, dom = runandparse(testdir) # assert result.ret node = dom.find_first_by_tag("testsuite") @@ -475,7 +561,8 @@ class TestPython(object): file="test_xfailure_xpass_strict.py", line="1", classname="test_xfailure_xpass_strict", - name="test_xpass") + name="test_xpass", + ) fnode = tnode.find_first_by_tag("failure") fnode.assert_attr(message="[XPASS(strict)] This needs to fail!") @@ -486,22 +573,23 @@ class TestPython(object): node = dom.find_first_by_tag("testsuite") node.assert_attr(errors=1, tests=1) tnode = node.find_first_by_tag("testcase") - tnode.assert_attr( - file="test_collect_error.py", - name="test_collect_error") + tnode.assert_attr(file="test_collect_error.py", name="test_collect_error") assert tnode["line"] is None fnode = tnode.find_first_by_tag("error") fnode.assert_attr(message="collection failure") assert "SyntaxError" in fnode.toxml() def test_unicode(self, testdir): - value = 'hx\xc4\x85\xc4\x87\n' - testdir.makepyfile(""" + value = "hx\xc4\x85\xc4\x87\n" + testdir.makepyfile( + """ # coding: latin1 def test_hello(): print (%r) assert 0 - """ % value) + """ + % value + ) result, dom = runandparse(testdir) assert result.ret == 1 tnode = dom.find_first_by_tag("testcase") @@ -511,22 +599,26 @@ class TestPython(object): def test_assertion_binchars(self, testdir): """this test did fail when the escaping wasnt strict""" - testdir.makepyfile(""" + testdir.makepyfile( + """ M1 = '\x01\x02\x03\x04' M2 = '\x01\x02\x03\x05' def test_str_compare(): assert M1 == M2 - """) + """ + ) result, dom = runandparse(testdir) print(dom.toxml()) def test_pass_captures_stdout(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_pass(): print('hello-stdout') - """) + """ + ) result, dom = runandparse(testdir) node = dom.find_first_by_tag("testsuite") pnode = node.find_first_by_tag("testcase") @@ -534,11 +626,13 @@ class TestPython(object): assert "hello-stdout" in systemout.toxml() def test_pass_captures_stderr(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import sys def test_pass(): sys.stderr.write('hello-stderr') - """) + """ + ) result, dom = runandparse(testdir) node = dom.find_first_by_tag("testsuite") pnode = node.find_first_by_tag("testcase") @@ -546,7 +640,8 @@ class TestPython(object): assert "hello-stderr" in systemout.toxml() def test_setup_error_captures_stdout(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture @@ -555,7 +650,8 @@ class TestPython(object): raise ValueError() def test_function(arg): pass - """) + """ + ) result, dom = runandparse(testdir) node = dom.find_first_by_tag("testsuite") pnode = node.find_first_by_tag("testcase") @@ -563,7 +659,8 @@ class TestPython(object): assert "hello-stdout" in systemout.toxml() def test_setup_error_captures_stderr(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import sys import pytest @@ -573,7 +670,8 @@ class TestPython(object): raise ValueError() def test_function(arg): pass - """) + """ + ) result, dom = runandparse(testdir) node = dom.find_first_by_tag("testsuite") pnode = node.find_first_by_tag("testcase") @@ -581,7 +679,8 @@ class TestPython(object): assert "hello-stderr" in systemout.toxml() def test_avoid_double_stdout(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import sys import pytest @@ -592,7 +691,8 @@ class TestPython(object): raise ValueError() def test_function(arg): sys.stdout.write('hello-stdout call') - """) + """ + ) result, dom = runandparse(testdir) node = dom.find_first_by_tag("testsuite") pnode = node.find_first_by_tag("testcase") @@ -603,8 +703,8 @@ class TestPython(object): def test_mangle_test_address(): from _pytest.junitxml import mangle_test_address - address = '::'.join( - ["a/my.py.thing.py", "Class", "()", "method", "[a-1-::]"]) + + address = "::".join(["a/my.py.thing.py", "Class", "()", "method", "[a-1-::]"]) newnames = mangle_test_address(address) assert newnames == ["a.my.py.thing", "Class", "method", "[a-1-::]"] @@ -613,6 +713,7 @@ def test_dont_configure_on_slaves(tmpdir): gotten = [] class FakeConfig(object): + def __init__(self): self.pluginmanager = self self.option = self @@ -622,11 +723,12 @@ def test_dont_configure_on_slaves(tmpdir): junitprefix = None # XXX: shouldnt need tmpdir ? - xmlpath = str(tmpdir.join('junix.xml')) + xmlpath = str(tmpdir.join("junix.xml")) register = gotten.append fake_config = FakeConfig() from _pytest import junitxml + junitxml.pytest_configure(fake_config) assert len(gotten) == 1 FakeConfig.slaveinput = None @@ -635,8 +737,10 @@ def test_dont_configure_on_slaves(tmpdir): class TestNonPython(object): + def test_summing_simple(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest def pytest_collect_file(path, parent): if path.ext == ".xyz": @@ -649,7 +753,8 @@ class TestNonPython(object): raise ValueError(42) def repr_failure(self, excinfo): return "custom item runtest failed" - """) + """ + ) testdir.tmpdir.join("myfile.xyz").write("hello") result, dom = runandparse(testdir) assert result.ret @@ -664,33 +769,37 @@ class TestNonPython(object): def test_nullbyte(testdir): # A null byte can not occur in XML (see section 2.2 of the spec) - testdir.makepyfile(""" + testdir.makepyfile( + """ import sys def test_print_nullbyte(): sys.stdout.write('Here the null -->' + chr(0) + '<--') sys.stdout.write('In repr form -->' + repr(chr(0)) + '<--') assert False - """) - xmlf = testdir.tmpdir.join('junit.xml') - testdir.runpytest('--junitxml=%s' % xmlf) + """ + ) + xmlf = testdir.tmpdir.join("junit.xml") + testdir.runpytest("--junitxml=%s" % xmlf) text = xmlf.read() - assert '\x00' not in text - assert '#x00' in text + assert "\x00" not in text + assert "#x00" in text def test_nullbyte_replace(testdir): # Check if the null byte gets replaced - testdir.makepyfile(""" + testdir.makepyfile( + """ import sys def test_print_nullbyte(): sys.stdout.write('Here the null -->' + chr(0) + '<--') sys.stdout.write('In repr form -->' + repr(chr(0)) + '<--') assert False - """) - xmlf = testdir.tmpdir.join('junit.xml') - testdir.runpytest('--junitxml=%s' % xmlf) + """ + ) + xmlf = testdir.tmpdir.join("junit.xml") + testdir.runpytest("--junitxml=%s" % xmlf) text = xmlf.read() - assert '#x0' in text + assert "#x0" in text def test_invalid_xml_escape(): @@ -707,9 +816,20 @@ def test_invalid_xml_escape(): unichr(65) except NameError: unichr = chr - invalid = (0x00, 0x1, 0xB, 0xC, 0xE, 0x19, 27, # issue #126 - 0xD800, 0xDFFF, 0xFFFE, 0x0FFFF) # , 0x110000) - valid = (0x9, 0xA, 0x20, ) + invalid = ( + 0x00, + 0x1, + 0xB, + 0xC, + 0xE, + 0x19, + 27, # issue #126 + 0xD800, + 0xDFFF, + 0xFFFE, + 0x0FFFF, + ) # , 0x110000) + valid = (0x9, 0xA, 0x20) # 0xD, 0xD7FF, 0xE000, 0xFFFD, 0x10000, 0x10FFFF) from _pytest.junitxml import bin_xml_escape @@ -717,34 +837,36 @@ def test_invalid_xml_escape(): for i in invalid: got = bin_xml_escape(unichr(i)).uniobj if i <= 0xFF: - expected = '#x%02X' % i + expected = "#x%02X" % i else: - expected = '#x%04X' % i + expected = "#x%04X" % i assert got == expected for i in valid: assert chr(i) == bin_xml_escape(unichr(i)).uniobj def test_logxml_path_expansion(tmpdir, monkeypatch): - home_tilde = py.path.local(os.path.expanduser('~')).join('test.xml') + home_tilde = py.path.local(os.path.expanduser("~")).join("test.xml") - xml_tilde = LogXML('~%stest.xml' % tmpdir.sep, None) + xml_tilde = LogXML("~%stest.xml" % tmpdir.sep, None) assert xml_tilde.logfile == home_tilde # this is here for when $HOME is not set correct monkeypatch.setenv("HOME", tmpdir) - home_var = os.path.normpath(os.path.expandvars('$HOME/test.xml')) + home_var = os.path.normpath(os.path.expandvars("$HOME/test.xml")) - xml_var = LogXML('$HOME%stest.xml' % tmpdir.sep, None) + xml_var = LogXML("$HOME%stest.xml" % tmpdir.sep, None) assert xml_var.logfile == home_var def test_logxml_changingdir(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_func(): import os os.chdir("a") - """) + """ + ) testdir.tmpdir.mkdir("a") result = testdir.runpytest("--junitxml=a/x.xml") assert result.ret == 0 @@ -753,10 +875,12 @@ def test_logxml_changingdir(testdir): def test_logxml_makedir(testdir): """--junitxml should automatically create directories for the xml file""" - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_pass(): pass - """) + """ + ) result = testdir.runpytest("--junitxml=path/to/results.xml") assert result.ret == 0 assert testdir.tmpdir.join("path/to/results.xml").check() @@ -769,12 +893,14 @@ def test_logxml_check_isdir(testdir): def test_escaped_parametrized_names_xml(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.parametrize('char', [u"\\x00"]) def test_func(char): assert char - """) + """ + ) result, dom = runandparse(testdir) assert result.ret == 0 node = dom.find_first_by_tag("testcase") @@ -782,33 +908,36 @@ def test_escaped_parametrized_names_xml(testdir): def test_double_colon_split_function_issue469(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.parametrize('param', ["double::colon"]) def test_func(param): pass - """) + """ + ) result, dom = runandparse(testdir) assert result.ret == 0 node = dom.find_first_by_tag("testcase") node.assert_attr(classname="test_double_colon_split_function_issue469") - node.assert_attr(name='test_func[double::colon]') + node.assert_attr(name="test_func[double::colon]") def test_double_colon_split_method_issue469(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest class TestClass(object): @pytest.mark.parametrize('param', ["double::colon"]) def test_func(self, param): pass - """) + """ + ) result, dom = runandparse(testdir) assert result.ret == 0 node = dom.find_first_by_tag("testcase") - node.assert_attr( - classname="test_double_colon_split_method_issue469.TestClass") - node.assert_attr(name='test_func[double::colon]') + node.assert_attr(classname="test_double_colon_split_method_issue469.TestClass") + node.assert_attr(name="test_func[double::colon]") def test_unicode_issue368(testdir): @@ -821,7 +950,7 @@ def test_unicode_issue368(testdir): longrepr = ustr sections = [] nodeid = "something" - location = 'tests/filename.py', 42, 'TestClass.method' + location = "tests/filename.py", 42, "TestClass.method" test_report = Report() @@ -842,96 +971,123 @@ def test_unicode_issue368(testdir): def test_record_property(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture - def other(record_xml_property): - record_xml_property("bar", 1) - def test_record(record_xml_property, other): - record_xml_property("foo", "<1"); - """) - result, dom = runandparse(testdir, '-rw') + def other(record_property): + record_property("bar", 1) + def test_record(record_property, other): + record_property("foo", "<1"); + """ + ) + result, dom = runandparse(testdir, "-rwv") node = dom.find_first_by_tag("testsuite") tnode = node.find_first_by_tag("testcase") - psnode = tnode.find_first_by_tag('properties') - pnodes = psnode.find_by_tag('property') + psnode = tnode.find_first_by_tag("properties") + pnodes = psnode.find_by_tag("property") pnodes[0].assert_attr(name="bar", value="1") pnodes[1].assert_attr(name="foo", value="<1") - result.stdout.fnmatch_lines([ - 'test_record_property.py::test_record', - '*record_xml_property*experimental*', - ]) def test_record_property_same_name(testdir): - testdir.makepyfile(""" - def test_record_with_same_name(record_xml_property): - record_xml_property("foo", "bar") - record_xml_property("foo", "baz") - """) - result, dom = runandparse(testdir, '-rw') + testdir.makepyfile( + """ + def test_record_with_same_name(record_property): + record_property("foo", "bar") + record_property("foo", "baz") + """ + ) + result, dom = runandparse(testdir, "-rw") node = dom.find_first_by_tag("testsuite") tnode = node.find_first_by_tag("testcase") - psnode = tnode.find_first_by_tag('properties') - pnodes = psnode.find_by_tag('property') + psnode = tnode.find_first_by_tag("properties") + pnodes = psnode.find_by_tag("property") pnodes[0].assert_attr(name="foo", value="bar") pnodes[1].assert_attr(name="foo", value="baz") +def test_record_attribute(testdir): + testdir.makepyfile( + """ + import pytest + + @pytest.fixture + def other(record_xml_attribute): + record_xml_attribute("bar", 1) + def test_record(record_xml_attribute, other): + record_xml_attribute("foo", "<1"); + """ + ) + result, dom = runandparse(testdir, "-rw") + node = dom.find_first_by_tag("testsuite") + tnode = node.find_first_by_tag("testcase") + tnode.assert_attr(bar="1") + tnode.assert_attr(foo="<1") + result.stdout.fnmatch_lines( + ["test_record_attribute.py::test_record", "*record_xml_attribute*experimental*"] + ) + + def test_random_report_log_xdist(testdir): """xdist calls pytest_runtest_logreport as they are executed by the slaves, with nodes from several nodes overlapping, so junitxml must cope with that to produce correct reports. #1064 """ - pytest.importorskip('xdist') - testdir.makepyfile(""" + pytest.importorskip("xdist") + testdir.makepyfile( + """ import pytest, time @pytest.mark.parametrize('i', list(range(30))) def test_x(i): assert i != 22 - """) - _, dom = runandparse(testdir, '-n2') + """ + ) + _, dom = runandparse(testdir, "-n2") suite_node = dom.find_first_by_tag("testsuite") failed = [] for case_node in suite_node.find_by_tag("testcase"): - if case_node.find_first_by_tag('failure'): - failed.append(case_node['name']) + if case_node.find_first_by_tag("failure"): + failed.append(case_node["name"]) - assert failed == ['test_x[22]'] + assert failed == ["test_x[22]"] def test_runs_twice(testdir): - f = testdir.makepyfile(''' + f = testdir.makepyfile( + """ def test_pass(): pass - ''') + """ + ) result, dom = runandparse(testdir, f, f) - assert 'INTERNALERROR' not in result.stdout.str() - first, second = [x['classname'] for x in dom.find_by_tag("testcase")] + assert "INTERNALERROR" not in result.stdout.str() + first, second = [x["classname"] for x in dom.find_by_tag("testcase")] assert first == second -@pytest.mark.xfail(reason='hangs', run=False) +@pytest.mark.xfail(reason="hangs", run=False) def test_runs_twice_xdist(testdir): - pytest.importorskip('xdist') - f = testdir.makepyfile(''' + pytest.importorskip("xdist") + f = testdir.makepyfile( + """ def test_pass(): pass - ''') + """ + ) - result, dom = runandparse( - testdir, f, - '--dist', 'each', '--tx', '2*popen',) - assert 'INTERNALERROR' not in result.stdout.str() - first, second = [x['classname'] for x in dom.find_by_tag("testcase")] + result, dom = runandparse(testdir, f, "--dist", "each", "--tx", "2*popen") + assert "INTERNALERROR" not in result.stdout.str() + first, second = [x["classname"] for x in dom.find_by_tag("testcase")] assert first == second def test_fancy_items_regression(testdir): # issue 1259 - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest class FunItem(pytest.Item): def runtest(self): @@ -951,33 +1107,38 @@ def test_fancy_items_regression(testdir): def pytest_collect_file(path, parent): if path.check(ext='.py'): return FunCollector(path, parent) - """) + """ + ) - testdir.makepyfile(''' + testdir.makepyfile( + """ def test_pass(): pass - ''') + """ + ) result, dom = runandparse(testdir) - assert 'INTERNALERROR' not in result.stdout.str() + assert "INTERNALERROR" not in result.stdout.str() items = sorted( - '%(classname)s %(name)s %(file)s' % x - - for x in dom.find_by_tag("testcase")) + "%(classname)s %(name)s %(file)s" % x for x in dom.find_by_tag("testcase") + ) import pprint + pprint.pprint(items) - assert items == [ - u'conftest a conftest.py', - u'conftest a conftest.py', - u'conftest b conftest.py', - u'test_fancy_items_regression a test_fancy_items_regression.py', - u'test_fancy_items_regression a test_fancy_items_regression.py', - u'test_fancy_items_regression b test_fancy_items_regression.py', - u'test_fancy_items_regression test_pass' - u' test_fancy_items_regression.py', - ] + assert ( + items + == [ + u"conftest a conftest.py", + u"conftest a conftest.py", + u"conftest b conftest.py", + u"test_fancy_items_regression a test_fancy_items_regression.py", + u"test_fancy_items_regression a test_fancy_items_regression.py", + u"test_fancy_items_regression b test_fancy_items_regression.py", + u"test_fancy_items_regression test_pass" u" test_fancy_items_regression.py", + ] + ) def test_global_properties(testdir): @@ -990,26 +1151,26 @@ def test_global_properties(testdir): nodeid = "test_node_id" log.pytest_sessionstart() - log.add_global_property('foo', 1) - log.add_global_property('bar', 2) + log.add_global_property("foo", 1) + log.add_global_property("bar", 2) log.pytest_sessionfinish() dom = minidom.parse(str(path)) - properties = dom.getElementsByTagName('properties') + properties = dom.getElementsByTagName("properties") - assert (properties.length == 1), "There must be one node" + assert properties.length == 1, "There must be one node" - property_list = dom.getElementsByTagName('property') + property_list = dom.getElementsByTagName("property") - assert (property_list.length == 2), "There most be only 2 property nodes" + assert property_list.length == 2, "There most be only 2 property nodes" - expected = {'foo': '1', 'bar': '2'} + expected = {"foo": "1", "bar": "2"} actual = {} for p in property_list: - k = str(p.getAttribute('name')) - v = str(p.getAttribute('value')) + k = str(p.getAttribute("name")) + v = str(p.getAttribute("value")) actual[k] = v assert actual == expected @@ -1025,7 +1186,7 @@ def test_url_property(testdir): longrepr = "FooBarBaz" sections = [] nodeid = "something" - location = 'tests/filename.py', 42, 'TestClass.method' + location = "tests/filename.py", 42, "TestClass.method" url = test_url test_report = Report() @@ -1035,27 +1196,35 @@ def test_url_property(testdir): node_reporter.append_failure(test_report) log.pytest_sessionfinish() - test_case = minidom.parse(str(path)).getElementsByTagName('testcase')[0] + test_case = minidom.parse(str(path)).getElementsByTagName("testcase")[0] - assert (test_case.getAttribute('url') == test_url), "The URL did not get written to the xml" + assert ( + test_case.getAttribute("url") == test_url + ), "The URL did not get written to the xml" -@pytest.mark.parametrize('suite_name', ['my_suite', '']) +@pytest.mark.parametrize("suite_name", ["my_suite", ""]) def test_set_suite_name(testdir, suite_name): if suite_name: - testdir.makeini(""" + testdir.makeini( + """ [pytest] - junit_suite_name={0} - """.format(suite_name)) + junit_suite_name={} + """.format( + suite_name + ) + ) expected = suite_name else: - expected = 'pytest' - testdir.makepyfile(""" + expected = "pytest" + testdir.makepyfile( + """ import pytest def test_func(): pass - """) + """ + ) result, dom = runandparse(testdir) assert result.ret == 0 node = dom.find_first_by_tag("testsuite") diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_mark.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_mark.py index 46bf0b0e778..e2e7369dc79 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_mark.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_mark.py @@ -1,19 +1,31 @@ from __future__ import absolute_import, division, print_function import os import sys - +import mock import pytest -from _pytest.mark import MarkGenerator as Mark, ParameterSet, transfer_markers +from _pytest.mark import ( + MarkGenerator as Mark, + ParameterSet, + transfer_markers, + EMPTY_PARAMETERSET_OPTION, +) +from _pytest.nodes import Node + +ignore_markinfo = pytest.mark.filterwarnings( + "ignore:MarkInfo objects:_pytest.deprecated.RemovedInPytest4Warning" +) class TestMark(object): + def test_markinfo_repr(self): from _pytest.mark import MarkInfo, Mark - m = MarkInfo(Mark("hello", (1, 2), {})) + + m = MarkInfo.for_mark(Mark("hello", (1, 2), {})) repr(m) - @pytest.mark.parametrize('attr', ['mark', 'param']) - @pytest.mark.parametrize('modulename', ['py.test', 'pytest']) + @pytest.mark.parametrize("attr", ["mark", "param"]) + @pytest.mark.parametrize("modulename", ["py.test", "pytest"]) def test_pytest_exists_in_namespace_all(self, attr, modulename): module = sys.modules[modulename] assert attr in module.__all__ @@ -23,6 +35,7 @@ class TestMark(object): pytest.raises((AttributeError, TypeError), mark) def test_mark_with_param(self): + def some_function(abc): pass @@ -37,7 +50,7 @@ class TestMark(object): def test_pytest_mark_name_starts_with_underscore(self): mark = Mark() - pytest.raises(AttributeError, getattr, mark, '_some_name') + pytest.raises(AttributeError, getattr, mark, "_some_name") def test_pytest_mark_bare(self): mark = Mark() @@ -48,6 +61,7 @@ class TestMark(object): mark.hello(f) assert f.hello + @ignore_markinfo def test_pytest_mark_keywords(self): mark = Mark() @@ -56,9 +70,10 @@ class TestMark(object): mark.world(x=3, y=4)(f) assert f.world - assert f.world.kwargs['x'] == 3 - assert f.world.kwargs['y'] == 4 + assert f.world.kwargs["x"] == 3 + assert f.world.kwargs["y"] == 4 + @ignore_markinfo def test_apply_multiple_and_merge(self): mark = Mark() @@ -67,14 +82,15 @@ class TestMark(object): mark.world mark.world(x=3)(f) - assert f.world.kwargs['x'] == 3 + assert f.world.kwargs["x"] == 3 mark.world(y=4)(f) - assert f.world.kwargs['x'] == 3 - assert f.world.kwargs['y'] == 4 + assert f.world.kwargs["x"] == 3 + assert f.world.kwargs["y"] == 4 mark.world(y=1)(f) - assert f.world.kwargs['y'] == 1 + assert f.world.kwargs["y"] == 1 assert len(f.world.args) == 0 + @ignore_markinfo def test_pytest_mark_positional(self): mark = Mark() @@ -85,6 +101,7 @@ class TestMark(object): assert f.world.args[0] == "hello" mark.world("world")(f) + @ignore_markinfo def test_pytest_mark_positional_func_and_keyword(self): mark = Mark() @@ -100,6 +117,7 @@ class TestMark(object): assert g.world.args[0] is f assert g.world.kwargs["omega"] == "hello" + @ignore_markinfo def test_pytest_mark_reuse(self): mark = Mark() @@ -109,94 +127,109 @@ class TestMark(object): w = mark.some w("hello", reason="123")(f) assert f.some.args[0] == "hello" - assert f.some.kwargs['reason'] == "123" + assert f.some.kwargs["reason"] == "123" def g(): pass w("world", reason2="456")(g) assert g.some.args[0] == "world" - assert 'reason' not in g.some.kwargs - assert g.some.kwargs['reason2'] == "456" + assert "reason" not in g.some.kwargs + assert g.some.kwargs["reason2"] == "456" def test_marked_class_run_twice(testdir, request): """Test fails file is run twice that contains marked class. See issue#683. """ - py_file = testdir.makepyfile(""" + py_file = testdir.makepyfile( + """ import pytest @pytest.mark.parametrize('abc', [1, 2, 3]) class Test1(object): def test_1(self, abc): assert abc in [1, 2, 3] - """) + """ + ) file_name = os.path.basename(py_file.strpath) rec = testdir.inline_run(file_name, file_name) rec.assertoutcome(passed=6) def test_ini_markers(testdir): - testdir.makeini(""" + testdir.makeini( + """ [pytest] markers = a1: this is a webtest marker a2: this is a smoke marker - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ def test_markers(pytestconfig): markers = pytestconfig.getini("markers") print (markers) assert len(markers) >= 2 assert markers[0].startswith("a1:") assert markers[1].startswith("a2:") - """) + """ + ) rec = testdir.inline_run() rec.assertoutcome(passed=1) def test_markers_option(testdir): - testdir.makeini(""" + testdir.makeini( + """ [pytest] markers = a1: this is a webtest marker a1some: another marker nodescription - """) - result = testdir.runpytest("--markers", ) - result.stdout.fnmatch_lines([ - "*a1*this is a webtest*", - "*a1some*another marker", - "*nodescription*", - ]) + """ + ) + result = testdir.runpytest("--markers") + result.stdout.fnmatch_lines( + ["*a1*this is a webtest*", "*a1some*another marker", "*nodescription*"] + ) def test_ini_markers_whitespace(testdir): - testdir.makeini(""" + testdir.makeini( + """ [pytest] markers = a1 : this is a whitespace marker - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ import pytest @pytest.mark.a1 def test_markers(): assert True - """) + """ + ) rec = testdir.inline_run("--strict", "-m", "a1") rec.assertoutcome(passed=1) def test_marker_without_description(testdir): - testdir.makefile(".cfg", setup=""" + testdir.makefile( + ".cfg", + setup=""" [tool:pytest] markers=slow - """) - testdir.makeconftest(""" + """, + ) + testdir.makeconftest( + """ import pytest pytest.mark.xfail('FAIL') - """) + """ + ) ftdir = testdir.mkdir("ft1_dummy") testdir.tmpdir.join("conftest.py").move(ftdir.join("conftest.py")) rec = testdir.runpytest_subprocess("--strict") @@ -205,7 +238,8 @@ def test_marker_without_description(testdir): def test_markers_option_with_plugin_in_current_dir(testdir): testdir.makeconftest('pytest_plugins = "flip_flop"') - testdir.makepyfile(flip_flop="""\ + testdir.makepyfile( + flip_flop="""\ def pytest_configure(config): config.addinivalue_line("markers", "flip:flop") @@ -214,51 +248,60 @@ def test_markers_option_with_plugin_in_current_dir(testdir): mark = metafunc.function.flipper except AttributeError: return - metafunc.parametrize("x", (10, 20))""") - testdir.makepyfile("""\ + metafunc.parametrize("x", (10, 20))""" + ) + testdir.makepyfile( + """\ import pytest @pytest.mark.flipper def test_example(x): - assert x""") + assert x""" + ) result = testdir.runpytest("--markers") result.stdout.fnmatch_lines(["*flip*flop*"]) def test_mark_on_pseudo_function(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.r(lambda x: 0/0) def test_hello(): pass - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) def test_strict_prohibits_unregistered_markers(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.unregisteredmark def test_hello(): pass - """) + """ + ) result = testdir.runpytest("--strict") assert result.ret != 0 - result.stdout.fnmatch_lines([ - "*unregisteredmark*not*registered*", - ]) + result.stdout.fnmatch_lines(["*unregisteredmark*not*registered*"]) -@pytest.mark.parametrize("spec", [ - ("xyz", ("test_one",)), - ("xyz and xyz2", ()), - ("xyz2", ("test_two",)), - ("xyz or xyz2", ("test_one", "test_two"),) -]) +@pytest.mark.parametrize( + "spec", + [ + ("xyz", ("test_one",)), + ("xyz and xyz2", ()), + ("xyz2", ("test_two",)), + ("xyz or xyz2", ("test_one", "test_two")), + ], +) def test_mark_option(spec, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.xyz def test_one(): @@ -266,7 +309,8 @@ def test_mark_option(spec, testdir): @pytest.mark.xyz2 def test_two(): pass - """) + """ + ) opt, passed_result = spec rec = testdir.inline_run("-m", opt) passed, skipped, fail = rec.listoutcomes() @@ -275,24 +319,27 @@ def test_mark_option(spec, testdir): assert list(passed) == list(passed_result) -@pytest.mark.parametrize("spec", [ - ("interface", ("test_interface",)), - ("not interface", ("test_nointer",)), -]) +@pytest.mark.parametrize( + "spec", [("interface", ("test_interface",)), ("not interface", ("test_nointer",))] +) def test_mark_option_custom(spec, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest def pytest_collection_modifyitems(items): for item in items: if "interface" in item.nodeid: - item.keywords["interface"] = pytest.mark.interface - """) - testdir.makepyfile(""" + item.add_marker(pytest.mark.interface) + """ + ) + testdir.makepyfile( + """ def test_interface(): pass def test_nointer(): pass - """) + """ + ) opt, passed_result = spec rec = testdir.inline_run("-m", opt) passed, skipped, fail = rec.listoutcomes() @@ -301,21 +348,26 @@ def test_mark_option_custom(spec, testdir): assert list(passed) == list(passed_result) -@pytest.mark.parametrize("spec", [ - ("interface", ("test_interface",)), - ("not interface", ("test_nointer", "test_pass")), - ("pass", ("test_pass",)), - ("not pass", ("test_interface", "test_nointer")), -]) +@pytest.mark.parametrize( + "spec", + [ + ("interface", ("test_interface",)), + ("not interface", ("test_nointer", "test_pass")), + ("pass", ("test_pass",)), + ("not pass", ("test_interface", "test_nointer")), + ], +) def test_keyword_option_custom(spec, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_interface(): pass def test_nointer(): pass def test_pass(): pass - """) + """ + ) opt, passed_result = spec rec = testdir.inline_run("-k", opt) passed, skipped, fail = rec.listoutcomes() @@ -324,18 +376,23 @@ def test_keyword_option_custom(spec, testdir): assert list(passed) == list(passed_result) -@pytest.mark.parametrize("spec", [ - ("None", ("test_func[None]",)), - ("1.3", ("test_func[1.3]",)), - ("2-3", ("test_func[2-3]",)) -]) +@pytest.mark.parametrize( + "spec", + [ + ("None", ("test_func[None]",)), + ("1.3", ("test_func[1.3]",)), + ("2-3", ("test_func[2-3]",)), + ], +) def test_keyword_option_parametrize(spec, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.parametrize("arg", [None, 1.3, "2-3"]) def test_func(arg): pass - """) + """ + ) opt, passed_result = spec rec = testdir.inline_run("-k", opt) passed, skipped, fail = rec.listoutcomes() @@ -344,16 +401,41 @@ def test_keyword_option_parametrize(spec, testdir): assert list(passed) == list(passed_result) +@pytest.mark.parametrize( + "spec", + [ + ( + "foo or import", + "ERROR: Python keyword 'import' not accepted in expressions passed to '-k'", + ), + ("foo or", "ERROR: Wrong expression passed to '-k': foo or"), + ], +) +def test_keyword_option_wrong_arguments(spec, testdir, capsys): + testdir.makepyfile( + """ + def test_func(arg): + pass + """ + ) + opt, expected_result = spec + testdir.inline_run("-k", opt) + out = capsys.readouterr().err + assert expected_result in out + + def test_parametrized_collected_from_command_line(testdir): """Parametrized test not collected if test named specified in command line issue#649. """ - py_file = testdir.makepyfile(""" + py_file = testdir.makepyfile( + """ import pytest @pytest.mark.parametrize("arg", [None, 1.3, "2-3"]) def test_func(arg): pass - """) + """ + ) file_name = os.path.basename(py_file.strpath) rec = testdir.inline_run(file_name + "::" + "test_func") rec.assertoutcome(passed=3) @@ -361,24 +443,29 @@ def test_parametrized_collected_from_command_line(testdir): def test_parametrized_collect_with_wrong_args(testdir): """Test collect parametrized func with wrong number of args.""" - py_file = testdir.makepyfile(""" + py_file = testdir.makepyfile( + """ import pytest @pytest.mark.parametrize('foo, bar', [(1, 2, 3)]) def test_func(foo, bar): pass - """) + """ + ) result = testdir.runpytest(py_file) - result.stdout.fnmatch_lines([ - 'E ValueError: In "parametrize" the number of values ((1, 2, 3)) ' - 'must be equal to the number of names ([\'foo\', \'bar\'])' - ]) + result.stdout.fnmatch_lines( + [ + 'E ValueError: In "parametrize" the number of values ((1, 2, 3)) ' + "must be equal to the number of names (['foo', 'bar'])" + ] + ) def test_parametrized_with_kwargs(testdir): """Test collect parametrized func with wrong number of args.""" - py_file = testdir.makepyfile(""" + py_file = testdir.makepyfile( + """ import pytest @pytest.fixture(params=[1,2]) @@ -388,72 +475,84 @@ def test_parametrized_with_kwargs(testdir): @pytest.mark.parametrize(argnames='b', argvalues=[1, 2]) def test_func(a, b): pass - """) + """ + ) result = testdir.runpytest(py_file) - assert(result.ret == 0) + assert result.ret == 0 class TestFunctional(object): def test_mark_per_function(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest @pytest.mark.hello def test_hello(): assert hasattr(test_hello, 'hello') - """) + """ + ) result = testdir.runpytest(p) result.stdout.fnmatch_lines(["*1 passed*"]) def test_mark_per_module(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest pytestmark = pytest.mark.hello def test_func(): pass - """) + """ + ) keywords = item.keywords - assert 'hello' in keywords + assert "hello" in keywords def test_marklist_per_class(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest class TestClass(object): pytestmark = [pytest.mark.hello, pytest.mark.world] def test_func(self): assert TestClass.test_func.hello assert TestClass.test_func.world - """) + """ + ) keywords = item.keywords - assert 'hello' in keywords + assert "hello" in keywords def test_marklist_per_module(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest pytestmark = [pytest.mark.hello, pytest.mark.world] class TestClass(object): def test_func(self): assert TestClass.test_func.hello assert TestClass.test_func.world - """) + """ + ) keywords = item.keywords - assert 'hello' in keywords - assert 'world' in keywords + assert "hello" in keywords + assert "world" in keywords def test_mark_per_class_decorator(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest @pytest.mark.hello class TestClass(object): def test_func(self): assert TestClass.test_func.hello - """) + """ + ) keywords = item.keywords - assert 'hello' in keywords + assert "hello" in keywords def test_mark_per_class_decorator_plus_existing_dec(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest @pytest.mark.hello class TestClass(object): @@ -461,13 +560,16 @@ class TestFunctional(object): def test_func(self): assert TestClass.test_func.hello assert TestClass.test_func.world - """) + """ + ) keywords = item.keywords - assert 'hello' in keywords - assert 'world' in keywords + assert "hello" in keywords + assert "world" in keywords + @ignore_markinfo def test_merging_markers(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest pytestmark = pytest.mark.hello("pos1", x=1, y=2) class TestClass(object): @@ -476,25 +578,26 @@ class TestFunctional(object): @pytest.mark.hello("pos0", z=4) def test_func(self): pass - """) + """ + ) items, rec = testdir.inline_genitems(p) item, = items keywords = item.keywords - marker = keywords['hello'] + marker = keywords["hello"] assert marker.args == ("pos0", "pos1") - assert marker.kwargs == {'x': 1, 'y': 2, 'z': 4} + assert marker.kwargs == {"x": 1, "y": 2, "z": 4} # test the new __iter__ interface values = list(marker) assert len(values) == 3 assert values[0].args == ("pos0",) assert values[1].args == () - assert values[2].args == ("pos1", ) + assert values[2].args == ("pos1",) - @pytest.mark.xfail(reason='unfixed') def test_merging_markers_deep(self, testdir): # issue 199 - propagate markers into nested classes - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest class TestA(object): pytestmark = pytest.mark.a @@ -504,14 +607,16 @@ class TestFunctional(object): # this one didnt get marked def test_d(self): assert True - """) + """ + ) items, rec = testdir.inline_genitems(p) for item in items: print(item, item.keywords) - assert 'a' in item.keywords + assert [x for x in item.iter_markers() if x.name == "a"] def test_mark_decorator_subclass_does_not_propagate_to_base(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest @pytest.mark.a @@ -523,14 +628,15 @@ class TestFunctional(object): class Test2(Base): def test_bar(self): pass - """) + """ + ) items, rec = testdir.inline_genitems(p) - self.assert_markers(items, test_foo=('a', 'b'), test_bar=('a',)) + self.assert_markers(items, test_foo=("a", "b"), test_bar=("a",)) @pytest.mark.issue568 - @pytest.mark.xfail(reason="markers smear on methods of base classes") def test_mark_should_not_pass_to_siebling_class(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest class TestBase(object): @@ -545,14 +651,24 @@ class TestFunctional(object): class TestOtherSub(TestBase): pass - """) + """ + ) items, rec = testdir.inline_genitems(p) base_item, sub_item, sub_item_other = items - assert not hasattr(base_item.obj, 'b') - assert not hasattr(sub_item_other.obj, 'b') + print(items, [x.nodeid for x in items]) + # legacy api smears + assert hasattr(base_item.obj, "b") + assert hasattr(sub_item_other.obj, "b") + assert hasattr(sub_item.obj, "b") + + # new api seregates + assert not list(base_item.iter_markers(name="b")) + assert not list(sub_item_other.iter_markers(name="b")) + assert list(sub_item.iter_markers(name="b")) def test_mark_decorator_baseclasses_merged(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest @pytest.mark.a @@ -568,25 +684,50 @@ class TestFunctional(object): class Test2(Base2): @pytest.mark.d def test_bar(self): pass - """) + """ + ) items, rec = testdir.inline_genitems(p) - self.assert_markers(items, test_foo=('a', 'b', 'c'), - test_bar=('a', 'b', 'd')) + self.assert_markers(items, test_foo=("a", "b", "c"), test_bar=("a", "b", "d")) + + def test_mark_closest(self, testdir): + p = testdir.makepyfile( + """ + import pytest + + @pytest.mark.c(location="class") + class Test: + @pytest.mark.c(location="function") + def test_has_own(): + pass + + def test_has_inherited(): + pass + + """ + ) + items, rec = testdir.inline_genitems(p) + has_own, has_inherited = items + assert has_own.get_closest_marker("c").kwargs == {"location": "function"} + assert has_inherited.get_closest_marker("c").kwargs == {"location": "class"} + assert has_own.get_closest_marker("missing") is None def test_mark_with_wrong_marker(self, testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ import pytest class pytestmark(object): pass def test_func(): pass - """) + """ + ) values = reprec.getfailedcollections() assert len(values) == 1 assert "TypeError" in str(values[0].longrepr) def test_mark_dynamically_in_funcarg(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.fixture def arg(request): @@ -594,35 +735,40 @@ class TestFunctional(object): def pytest_terminal_summary(terminalreporter): values = terminalreporter.stats['passed'] terminalreporter._tw.line("keyword: %s" % values[0].keywords) - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ def test_func(arg): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "keyword: *hello*" - ]) + result.stdout.fnmatch_lines(["keyword: *hello*"]) + @ignore_markinfo def test_merging_markers_two_functions(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest @pytest.mark.hello("pos1", z=4) @pytest.mark.hello("pos0", z=3) def test_func(): pass - """) + """ + ) items, rec = testdir.inline_genitems(p) item, = items keywords = item.keywords - marker = keywords['hello'] + marker = keywords["hello"] values = list(marker) assert len(values) == 2 assert values[0].args == ("pos0",) assert values[1].args == ("pos1",) def test_no_marker_match_on_unmarked_names(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest @pytest.mark.shouldmatch def test_marked(): @@ -630,7 +776,8 @@ class TestFunctional(object): def test_unmarked(): assert 1 - """) + """ + ) reprec = testdir.inline_run("-m", "test_unmarked", p) passed, skipped, failed = reprec.listoutcomes() assert len(passed) + len(skipped) + len(failed) == 0 @@ -639,7 +786,8 @@ class TestFunctional(object): assert len(deselected_tests) == 2 def test_keywords_at_node_level(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope="session", autouse=True) def some(request): @@ -654,12 +802,15 @@ class TestFunctional(object): @pytest.mark.world def test_function(): pass - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) + @ignore_markinfo def test_keyword_added_for_session(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest def pytest_collection_modifyitems(session): session.add_marker("mark1") @@ -667,8 +818,10 @@ class TestFunctional(object): session.add_marker(pytest.mark.mark3) pytest.raises(ValueError, lambda: session.add_marker(10)) - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ def test_some(request): assert "mark1" in request.keywords assert "mark2" in request.keywords @@ -678,7 +831,8 @@ class TestFunctional(object): assert marker.name == "mark1" assert marker.args == () assert marker.kwargs == {} - """) + """ + ) reprec = testdir.inline_run("-m", "mark1") reprec.assertoutcome(passed=1) @@ -690,17 +844,20 @@ class TestFunctional(object): to other modules. """ from _pytest.mark import MarkInfo - items = dict((x.name, x) for x in items) + + items = {x.name: x for x in items} for name, expected_markers in expected.items(): markers = items[name].keywords._markers - marker_names = set([name for (name, v) in markers.items() - if isinstance(v, MarkInfo)]) + marker_names = { + name for (name, v) in markers.items() if isinstance(v, MarkInfo) + } assert marker_names == set(expected_markers) - @pytest.mark.xfail(reason='callspec2.setmulti misuses keywords') @pytest.mark.issue1540 + @pytest.mark.filterwarnings("ignore") def test_mark_from_parameters(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest pytestmark = pytest.mark.skipif(True, reason='skip all') @@ -716,7 +873,8 @@ class TestFunctional(object): def test_1(parameter): assert True - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(skipped=1) @@ -724,37 +882,50 @@ class TestFunctional(object): class TestKeywordSelection(object): def test_select_simple(self, testdir): - file_test = testdir.makepyfile(""" + file_test = testdir.makepyfile( + """ def test_one(): assert 0 class TestClass(object): def test_method_one(self): assert 42 == 43 - """) + """ + ) def check(keyword, name): reprec = testdir.inline_run("-s", "-k", keyword, file_test) passed, skipped, failed = reprec.listoutcomes() assert len(failed) == 1 assert failed[0].nodeid.split("::")[-1] == name - assert len(reprec.getcalls('pytest_deselected')) == 1 + assert len(reprec.getcalls("pytest_deselected")) == 1 - for keyword in ['test_one', 'est_on']: - check(keyword, 'test_one') - check('TestClass and test', 'test_method_one') + for keyword in ["test_one", "est_on"]: + check(keyword, "test_one") + check("TestClass and test", "test_method_one") - @pytest.mark.parametrize("keyword", [ - 'xxx', 'xxx and test_2', 'TestClass', 'xxx and not test_1', - 'TestClass and test_2', 'xxx and TestClass and test_2']) + @pytest.mark.parametrize( + "keyword", + [ + "xxx", + "xxx and test_2", + "TestClass", + "xxx and not test_1", + "TestClass and test_2", + "xxx and TestClass and test_2", + ], + ) def test_select_extra_keywords(self, testdir, keyword): - p = testdir.makepyfile(test_select=""" + p = testdir.makepyfile( + test_select=""" def test_1(): pass class TestClass(object): def test_2(self): pass - """) - testdir.makepyfile(conftest=""" + """ + ) + testdir.makepyfile( + conftest=""" import pytest @pytest.hookimpl(hookwrapper=True) def pytest_pycollect_makeitem(name): @@ -762,22 +933,25 @@ class TestKeywordSelection(object): if name == "TestClass": item = outcome.get_result() item.extra_keyword_matches.add("xxx") - """) - reprec = testdir.inline_run(p.dirpath(), '-s', '-k', keyword) + """ + ) + reprec = testdir.inline_run(p.dirpath(), "-s", "-k", keyword) print("keyword", repr(keyword)) passed, skipped, failed = reprec.listoutcomes() assert len(passed) == 1 assert passed[0].nodeid.endswith("test_2") dlist = reprec.getcalls("pytest_deselected") assert len(dlist) == 1 - assert dlist[0].items[0].name == 'test_1' + assert dlist[0].items[0].name == "test_1" def test_select_starton(self, testdir): - threepass = testdir.makepyfile(test_threepass=""" + threepass = testdir.makepyfile( + test_threepass=""" def test_one(): assert 1 def test_two(): assert 1 def test_three(): assert 1 - """) + """ + ) reprec = testdir.inline_run("-k", "test_two:", threepass) passed, skipped, failed = reprec.listoutcomes() assert len(passed) == 2 @@ -788,22 +962,26 @@ class TestKeywordSelection(object): assert item.name == "test_one" def test_keyword_extra(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_one(): assert 0 test_one.mykeyword = True - """) + """ + ) reprec = testdir.inline_run("-k", "mykeyword", p) passed, skipped, failed = reprec.countoutcomes() assert failed == 1 @pytest.mark.xfail def test_keyword_extra_dash(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_one(): assert 0 test_one.mykeyword = True - """) + """ + ) # with argparse the argument to an option cannot # start with '-' reprec = testdir.inline_run("-k", "-mykeyword", p) @@ -815,9 +993,11 @@ class TestKeywordSelection(object): no double underscored values, like '__dict__', and no instance values, like '()'. """ - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_one(): assert 1 - """) + """ + ) def assert_test_is_not_selected(keyword): reprec = testdir.inline_run("-k", keyword, p) @@ -831,15 +1011,22 @@ class TestKeywordSelection(object): assert_test_is_not_selected("()") -@pytest.mark.parametrize('argval, expected', [ - (pytest.mark.skip()((1, 2)), - ParameterSet(values=(1, 2), marks=[pytest.mark.skip], id=None)), - (pytest.mark.xfail(pytest.mark.skip()((1, 2))), - ParameterSet(values=(1, 2), - marks=[pytest.mark.xfail, pytest.mark.skip], id=None)), - -]) -@pytest.mark.filterwarnings('ignore') +@pytest.mark.parametrize( + "argval, expected", + [ + ( + pytest.mark.skip()((1, 2)), + ParameterSet(values=(1, 2), marks=[pytest.mark.skip], id=None), + ), + ( + pytest.mark.xfail(pytest.mark.skip()((1, 2))), + ParameterSet( + values=(1, 2), marks=[pytest.mark.xfail, pytest.mark.skip], id=None + ), + ), + ], +) +@pytest.mark.filterwarnings("ignore") def test_parameterset_extractfrom(argval, expected): extracted = ParameterSet.extract_from(argval) assert extracted == expected @@ -868,11 +1055,80 @@ def test_legacy_transfer(): class TestMarkDecorator(object): - @pytest.mark.parametrize('lhs, rhs, expected', [ - (pytest.mark.foo(), pytest.mark.foo(), True), - (pytest.mark.foo(), pytest.mark.bar(), False), - (pytest.mark.foo(), 'bar', False), - ('foo', pytest.mark.bar(), False) - ]) + @pytest.mark.parametrize( + "lhs, rhs, expected", + [ + (pytest.mark.foo(), pytest.mark.foo(), True), + (pytest.mark.foo(), pytest.mark.bar(), False), + (pytest.mark.foo(), "bar", False), + ("foo", pytest.mark.bar(), False), + ], + ) def test__eq__(self, lhs, rhs, expected): assert (lhs == rhs) == expected + + +@pytest.mark.parametrize("mark", [None, "", "skip", "xfail"]) +def test_parameterset_for_parametrize_marks(testdir, mark): + if mark is not None: + testdir.makeini("[pytest]\n{}={}".format(EMPTY_PARAMETERSET_OPTION, mark)) + + config = testdir.parseconfig() + from _pytest.mark import pytest_configure, get_empty_parameterset_mark + + pytest_configure(config) + result_mark = get_empty_parameterset_mark(config, ["a"], all) + if mark in (None, ""): + # normalize to the requested name + mark = "skip" + assert result_mark.name == mark + assert result_mark.kwargs["reason"].startswith("got empty parameter set ") + if mark == "xfail": + assert result_mark.kwargs.get("run") is False + + +def test_parameterset_for_parametrize_bad_markname(testdir): + with pytest.raises(pytest.UsageError): + test_parameterset_for_parametrize_marks(testdir, "bad") + + +def test_mark_expressions_no_smear(testdir): + testdir.makepyfile( + """ + import pytest + + class BaseTests(object): + def test_something(self): + pass + + @pytest.mark.FOO + class TestFooClass(BaseTests): + pass + + @pytest.mark.BAR + class TestBarClass(BaseTests): + pass + """ + ) + + reprec = testdir.inline_run("-m", "FOO") + passed, skipped, failed = reprec.countoutcomes() + dlist = reprec.getcalls("pytest_deselected") + assert passed == 1 + assert skipped == failed == 0 + deselected_tests = dlist[0].items + assert len(deselected_tests) == 1 + + # keywords smear - expected behaviour + reprec_keywords = testdir.inline_run("-k", "FOO") + passed_k, skipped_k, failed_k = reprec_keywords.countoutcomes() + assert passed_k == 2 + assert skipped_k == failed_k == 0 + + +def test_addmarker_getmarker(): + node = Node("Test", config=mock.Mock(), session=mock.Mock(), nodeid="Test") + node.add_marker(pytest.mark.a(1)) + node.add_marker("b") + node.get_marker("a").combined + node.get_marker("b").combined diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_modimport.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_modimport.py index 2ab86bf7af1..f7b92a0b6f6 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_modimport.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_modimport.py @@ -5,21 +5,25 @@ import pytest import _pytest MODSET = [ - x for x in py.path.local(_pytest.__file__).dirpath().visit('*.py') - if x.purebasename != '__init__' + x + for x in py.path.local(_pytest.__file__).dirpath().visit("*.py") + if x.purebasename != "__init__" ] -@pytest.mark.parametrize('modfile', MODSET, ids=lambda x: x.purebasename) +@pytest.mark.parametrize("modfile", MODSET, ids=lambda x: x.purebasename) def test_fileimport(modfile): # this test ensures all internal packages can import # without needing the pytest namespace being set # this is critical for the initialization of xdist - res = subprocess.call([ - sys.executable, - '-c', 'import sys, py; py.path.local(sys.argv[1]).pyimport()', - modfile.strpath, - ]) + res = subprocess.call( + [ + sys.executable, + "-c", + "import sys, py; py.path.local(sys.argv[1]).pyimport()", + modfile.strpath, + ] + ) if res: pytest.fail("command result %s" % res) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_monkeypatch.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_monkeypatch.py index 4427908ab3b..c298ce0d929 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_monkeypatch.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_monkeypatch.py @@ -17,20 +17,21 @@ def mp(): def test_setattr(): + class A(object): x = 1 monkeypatch = MonkeyPatch() pytest.raises(AttributeError, "monkeypatch.setattr(A, 'notexists', 2)") - monkeypatch.setattr(A, 'y', 2, raising=False) + monkeypatch.setattr(A, "y", 2, raising=False) assert A.y == 2 monkeypatch.undo() - assert not hasattr(A, 'y') + assert not hasattr(A, "y") monkeypatch = MonkeyPatch() - monkeypatch.setattr(A, 'x', 2) + monkeypatch.setattr(A, "x", 2) assert A.x == 2 - monkeypatch.setattr(A, 'x', 3) + monkeypatch.setattr(A, "x", 3) assert A.x == 3 monkeypatch.undo() assert A.x == 1 @@ -41,6 +42,7 @@ def test_setattr(): class TestSetattrWithImportPath(object): + def test_string_expression(self, monkeypatch): monkeypatch.setattr("os.path.abspath", lambda x: "hello2") assert os.path.abspath("123") == "hello2" @@ -48,11 +50,13 @@ class TestSetattrWithImportPath(object): def test_string_expression_class(self, monkeypatch): monkeypatch.setattr("_pytest.config.Config", 42) import _pytest + assert _pytest.config.Config == 42 def test_unicode_string(self, monkeypatch): monkeypatch.setattr("_pytest.config.Config", 42) import _pytest + assert _pytest.config.Config == 42 monkeypatch.delattr("_pytest.config.Config") @@ -60,16 +64,16 @@ class TestSetattrWithImportPath(object): pytest.raises(TypeError, lambda: monkeypatch.setattr(None, None)) def test_unknown_import(self, monkeypatch): - pytest.raises(ImportError, - lambda: monkeypatch.setattr("unkn123.classx", None)) + pytest.raises(ImportError, lambda: monkeypatch.setattr("unkn123.classx", None)) def test_unknown_attr(self, monkeypatch): - pytest.raises(AttributeError, - lambda: monkeypatch.setattr("os.path.qweqwe", None)) + pytest.raises( + AttributeError, lambda: monkeypatch.setattr("os.path.qweqwe", None) + ) def test_unknown_attr_non_raising(self, monkeypatch): # https://github.com/pytest-dev/pytest/issues/746 - monkeypatch.setattr('os.path.qweqwe', 42, raising=False) + monkeypatch.setattr("os.path.qweqwe", 42, raising=False) assert os.path.qweqwe == 42 def test_delattr(self, monkeypatch): @@ -80,48 +84,49 @@ class TestSetattrWithImportPath(object): def test_delattr(): + class A(object): x = 1 monkeypatch = MonkeyPatch() - monkeypatch.delattr(A, 'x') - assert not hasattr(A, 'x') + monkeypatch.delattr(A, "x") + assert not hasattr(A, "x") monkeypatch.undo() assert A.x == 1 monkeypatch = MonkeyPatch() - monkeypatch.delattr(A, 'x') + monkeypatch.delattr(A, "x") pytest.raises(AttributeError, "monkeypatch.delattr(A, 'y')") - monkeypatch.delattr(A, 'y', raising=False) - monkeypatch.setattr(A, 'x', 5, raising=False) + monkeypatch.delattr(A, "y", raising=False) + monkeypatch.setattr(A, "x", 5, raising=False) assert A.x == 5 monkeypatch.undo() assert A.x == 1 def test_setitem(): - d = {'x': 1} + d = {"x": 1} monkeypatch = MonkeyPatch() - monkeypatch.setitem(d, 'x', 2) - monkeypatch.setitem(d, 'y', 1700) - monkeypatch.setitem(d, 'y', 1700) - assert d['x'] == 2 - assert d['y'] == 1700 - monkeypatch.setitem(d, 'x', 3) - assert d['x'] == 3 + monkeypatch.setitem(d, "x", 2) + monkeypatch.setitem(d, "y", 1700) + monkeypatch.setitem(d, "y", 1700) + assert d["x"] == 2 + assert d["y"] == 1700 + monkeypatch.setitem(d, "x", 3) + assert d["x"] == 3 monkeypatch.undo() - assert d['x'] == 1 - assert 'y' not in d - d['x'] = 5 + assert d["x"] == 1 + assert "y" not in d + d["x"] = 5 monkeypatch.undo() - assert d['x'] == 5 + assert d["x"] == 5 def test_setitem_deleted_meanwhile(): d = {} monkeypatch = MonkeyPatch() - monkeypatch.setitem(d, 'x', 2) - del d['x'] + monkeypatch.setitem(d, "x", 2) + del d["x"] monkeypatch.undo() assert not d @@ -132,7 +137,7 @@ def test_setenv_deleted_meanwhile(before): if before: os.environ[key] = "world" monkeypatch = MonkeyPatch() - monkeypatch.setenv(key, 'hello') + monkeypatch.setenv(key, "hello") del os.environ[key] monkeypatch.undo() if before: @@ -143,33 +148,34 @@ def test_setenv_deleted_meanwhile(before): def test_delitem(): - d = {'x': 1} + d = {"x": 1} monkeypatch = MonkeyPatch() - monkeypatch.delitem(d, 'x') - assert 'x' not in d - monkeypatch.delitem(d, 'y', raising=False) + monkeypatch.delitem(d, "x") + assert "x" not in d + monkeypatch.delitem(d, "y", raising=False) pytest.raises(KeyError, "monkeypatch.delitem(d, 'y')") assert not d - monkeypatch.setitem(d, 'y', 1700) - assert d['y'] == 1700 - d['hello'] = 'world' - monkeypatch.setitem(d, 'x', 1500) - assert d['x'] == 1500 + monkeypatch.setitem(d, "y", 1700) + assert d["y"] == 1700 + d["hello"] = "world" + monkeypatch.setitem(d, "x", 1500) + assert d["x"] == 1500 monkeypatch.undo() - assert d == {'hello': 'world', 'x': 1} + assert d == {"hello": "world", "x": 1} def test_setenv(): monkeypatch = MonkeyPatch() - monkeypatch.setenv('XYZ123', 2) + monkeypatch.setenv("XYZ123", 2) import os - assert os.environ['XYZ123'] == "2" + + assert os.environ["XYZ123"] == "2" monkeypatch.undo() - assert 'XYZ123' not in os.environ + assert "XYZ123" not in os.environ def test_delenv(): - name = 'xyz1234' + name = "xyz1234" assert name not in os.environ monkeypatch = MonkeyPatch() pytest.raises(KeyError, "monkeypatch.delenv(%r, raising=True)" % name) @@ -191,28 +197,31 @@ def test_delenv(): def test_setenv_prepend(): import os + monkeypatch = MonkeyPatch() - monkeypatch.setenv('XYZ123', 2, prepend="-") - assert os.environ['XYZ123'] == "2" - monkeypatch.setenv('XYZ123', 3, prepend="-") - assert os.environ['XYZ123'] == "3-2" + monkeypatch.setenv("XYZ123", 2, prepend="-") + assert os.environ["XYZ123"] == "2" + monkeypatch.setenv("XYZ123", 3, prepend="-") + assert os.environ["XYZ123"] == "3-2" monkeypatch.undo() - assert 'XYZ123' not in os.environ + assert "XYZ123" not in os.environ def test_monkeypatch_plugin(testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ def test_method(monkeypatch): assert monkeypatch.__class__.__name__ == "MonkeyPatch" - """) + """ + ) res = reprec.countoutcomes() assert tuple(res) == (1, 0, 0), res def test_syspath_prepend(mp): old = list(sys.path) - mp.syspath_prepend('world') - mp.syspath_prepend('hello') + mp.syspath_prepend("world") + mp.syspath_prepend("hello") assert sys.path[0] == "hello" assert sys.path[1] == "world" mp.undo() @@ -222,11 +231,11 @@ def test_syspath_prepend(mp): def test_syspath_prepend_double_undo(mp): - mp.syspath_prepend('hello world') + mp.syspath_prepend("hello world") mp.undo() - sys.path.append('more hello world') + sys.path.append("more hello world") mp.undo() - assert sys.path[-1] == 'more hello world' + assert sys.path[-1] == "more hello world" def test_chdir_with_path_local(mp, tmpdir): @@ -255,37 +264,54 @@ def test_chdir_double_undo(mp, tmpdir): def test_issue185_time_breaks(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import time def test_m(monkeypatch): def f(): raise Exception monkeypatch.setattr(time, "time", f) - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *1 passed* - """) + """ + ) def test_importerror(testdir): p = testdir.mkpydir("package") - p.join("a.py").write(textwrap.dedent("""\ + p.join("a.py").write( + textwrap.dedent( + """\ import doesnotexist x = 1 - """)) - testdir.tmpdir.join("test_importerror.py").write(textwrap.dedent("""\ + """ + ) + ) + testdir.tmpdir.join("test_importerror.py").write( + textwrap.dedent( + """\ def test_importerror(monkeypatch): monkeypatch.setattr('package.a.x', 2) - """)) + """ + ) + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *import error in package.a: No module named {0}doesnotexist{0}* - """.format("'" if sys.version_info > (3, 0) else "")) + """.format( + "'" if sys.version_info > (3, 0) else "" + ) + ) class SampleNew(object): + @staticmethod def hello(): return True @@ -306,14 +332,15 @@ class SampleOldInherit(SampleOld): pass -@pytest.mark.parametrize('Sample', [ - SampleNew, SampleNewInherit, - SampleOld, SampleOldInherit, -], ids=['new', 'new-inherit', 'old', 'old-inherit']) +@pytest.mark.parametrize( + "Sample", + [SampleNew, SampleNewInherit, SampleOld, SampleOldInherit], + ids=["new", "new-inherit", "old", "old-inherit"], +) def test_issue156_undo_staticmethod(Sample): monkeypatch = MonkeyPatch() - monkeypatch.setattr(Sample, 'hello', None) + monkeypatch.setattr(Sample, "hello", None) assert Sample.hello is None monkeypatch.undo() @@ -321,9 +348,21 @@ def test_issue156_undo_staticmethod(Sample): def test_issue1338_name_resolving(): - pytest.importorskip('requests') + pytest.importorskip("requests") monkeypatch = MonkeyPatch() try: - monkeypatch.delattr('requests.sessions.Session.request') + monkeypatch.delattr("requests.sessions.Session.request") finally: monkeypatch.undo() + + +def test_context(): + monkeypatch = MonkeyPatch() + + import functools + import inspect + + with monkeypatch.context() as m: + m.setattr(functools, "partial", 3) + assert not inspect.isclass(functools.partial) + assert inspect.isclass(functools.partial) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_nodes.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_nodes.py index 6f4540f99b9..eee3ac8e9e4 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_nodes.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_nodes.py @@ -3,16 +3,19 @@ import pytest from _pytest import nodes -@pytest.mark.parametrize("baseid, nodeid, expected", ( - ('', '', True), - ('', 'foo', True), - ('', 'foo/bar', True), - ('', 'foo/bar::TestBaz::()', True), - ('foo', 'food', False), - ('foo/bar::TestBaz::()', 'foo/bar', False), - ('foo/bar::TestBaz::()', 'foo/bar::TestBop::()', False), - ('foo/bar', 'foo/bar::TestBop::()', True), -)) +@pytest.mark.parametrize( + "baseid, nodeid, expected", + ( + ("", "", True), + ("", "foo", True), + ("", "foo/bar", True), + ("", "foo/bar::TestBaz::()", True), + ("foo", "food", False), + ("foo/bar::TestBaz::()", "foo/bar", False), + ("foo/bar::TestBaz::()", "foo/bar::TestBop::()", False), + ("foo/bar", "foo/bar::TestBop::()", True), + ), +) def test_ischildnode(baseid, nodeid, expected): result = nodes.ischildnode(baseid, nodeid) assert result is expected diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_nose.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_nose.py index df3e1a94b05..abe7323754e 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_nose.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_nose.py @@ -7,7 +7,8 @@ def setup_module(mod): def test_nose_setup(testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ values = [] from nose.tools import with_setup @@ -20,16 +21,19 @@ def test_nose_setup(testdir): test_hello.setup = lambda: values.append(1) test_hello.teardown = lambda: values.append(2) - """) - result = testdir.runpytest(p, '-p', 'nose') + """ + ) + result = testdir.runpytest(p, "-p", "nose") result.assert_outcomes(passed=2) def test_setup_func_with_setup_decorator(): from _pytest.nose import call_optional + values = [] class A(object): + @pytest.fixture(autouse=True) def f(self): values.append(1) @@ -48,7 +52,8 @@ def test_setup_func_not_callable(): def test_nose_setup_func(testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ from nose.tools import with_setup values = [] @@ -70,13 +75,15 @@ def test_nose_setup_func(testdir): print (values) assert values == [1,2] - """) - result = testdir.runpytest(p, '-p', 'nose') + """ + ) + result = testdir.runpytest(p, "-p", "nose") result.assert_outcomes(passed=2) def test_nose_setup_func_failure(testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ from nose.tools import with_setup values = [] @@ -92,15 +99,15 @@ def test_nose_setup_func_failure(testdir): print (values) assert values == [1,2] - """) - result = testdir.runpytest(p, '-p', 'nose') - result.stdout.fnmatch_lines([ - "*TypeError: ()*" - ]) + """ + ) + result = testdir.runpytest(p, "-p", "nose") + result.stdout.fnmatch_lines(["*TypeError: ()*"]) def test_nose_setup_func_failure_2(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ values = [] my_setup = 1 @@ -111,14 +118,16 @@ def test_nose_setup_func_failure_2(testdir): test_hello.setup = my_setup test_hello.teardown = my_teardown - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) def test_nose_setup_partial(testdir): pytest.importorskip("functools") - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ from functools import partial values = [] @@ -144,15 +153,15 @@ def test_nose_setup_partial(testdir): test_hello.setup = my_setup_partial test_hello.teardown = my_teardown_partial - """) - result = testdir.runpytest(p, '-p', 'nose') - result.stdout.fnmatch_lines([ - "*2 passed*" - ]) + """ + ) + result = testdir.runpytest(p, "-p", "nose") + result.stdout.fnmatch_lines(["*2 passed*"]) def test_nose_test_generator_fixtures(testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ # taken from nose-0.11.1 unit_tests/test_generator_fixtures.py from nose.tools import eq_ called = [] @@ -211,15 +220,15 @@ def test_nose_test_generator_fixtures(testdir): # expect.append('teardown') #expect.append('setup') eq_(self.called, expect) - """) - result = testdir.runpytest(p, '-p', 'nose') - result.stdout.fnmatch_lines([ - "*10 passed*" - ]) + """ + ) + result = testdir.runpytest(p, "-p", "nose") + result.stdout.fnmatch_lines(["*10 passed*"]) def test_module_level_setup(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ from nose.tools import with_setup items = {} @@ -242,15 +251,15 @@ def test_module_level_setup(testdir): def test_local_setup(): assert items[2] == 2 assert 1 not in items - """) - result = testdir.runpytest('-p', 'nose') - result.stdout.fnmatch_lines([ - "*2 passed*", - ]) + """ + ) + result = testdir.runpytest("-p", "nose") + result.stdout.fnmatch_lines(["*2 passed*"]) def test_nose_style_setup_teardown(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ values = [] def setup_module(): @@ -264,15 +273,15 @@ def test_nose_style_setup_teardown(testdir): def test_world(): assert values == [1] - """) - result = testdir.runpytest('-p', 'nose') - result.stdout.fnmatch_lines([ - "*2 passed*", - ]) + """ + ) + result = testdir.runpytest("-p", "nose") + result.stdout.fnmatch_lines(["*2 passed*"]) def test_nose_setup_ordering(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def setup_module(mod): mod.visited = True @@ -281,17 +290,17 @@ def test_nose_setup_ordering(testdir): assert visited def test_first(self): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*1 passed*", - ]) + result.stdout.fnmatch_lines(["*1 passed*"]) def test_apiwrapper_problem_issue260(testdir): - # this would end up trying a call a optional teardown on the class + # this would end up trying a call an optional teardown on the class # for plain unittests we dont want nose behaviour - testdir.makepyfile(""" + testdir.makepyfile( + """ import unittest class TestCase(unittest.TestCase): def setup(self): @@ -306,7 +315,8 @@ def test_apiwrapper_problem_issue260(testdir): print('teardown') def test_fun(self): pass - """) + """ + ) result = testdir.runpytest() result.assert_outcomes(passed=1) @@ -314,7 +324,8 @@ def test_apiwrapper_problem_issue260(testdir): def test_setup_teardown_linking_issue265(testdir): # we accidentally didnt integrate nose setupstate with normal setupstate # this test ensures that won't happen again - testdir.makepyfile(''' + testdir.makepyfile( + ''' import pytest class TestGeneric(object): @@ -332,51 +343,60 @@ def test_setup_teardown_linking_issue265(testdir): def teardown(self): """Undoes the setup.""" raise Exception("should not call teardown for skipped tests") - ''') + ''' + ) reprec = testdir.runpytest() reprec.assert_outcomes(passed=1, skipped=1) def test_SkipTest_during_collection(testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import nose raise nose.SkipTest("during collection") def test_failing(): assert False - """) + """ + ) result = testdir.runpytest(p) result.assert_outcomes(skipped=1) def test_SkipTest_in_test(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import nose def test_skipping(): raise nose.SkipTest("in test") - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(skipped=1) def test_istest_function_decorator(testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import nose.tools @nose.tools.istest def not_test_prefix(): pass - """) + """ + ) result = testdir.runpytest(p) result.assert_outcomes(passed=1) def test_nottest_function_decorator(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import nose.tools @nose.tools.nottest def test_prefix(): pass - """) + """ + ) reprec = testdir.inline_run() assert not reprec.getfailedcollections() calls = reprec.getreports("pytest_runtest_logreport") @@ -384,25 +404,29 @@ def test_nottest_function_decorator(testdir): def test_istest_class_decorator(testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import nose.tools @nose.tools.istest class NotTestPrefix(object): def test_method(self): pass - """) + """ + ) result = testdir.runpytest(p) result.assert_outcomes(passed=1) def test_nottest_class_decorator(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import nose.tools @nose.tools.nottest class TestPrefix(object): def test_method(self): pass - """) + """ + ) reprec = testdir.inline_run() assert not reprec.getfailedcollections() calls = reprec.getreports("pytest_runtest_logreport") diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_parseopt.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_parseopt.py index 92159257019..79076cafd81 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_parseopt.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_parseopt.py @@ -1,9 +1,10 @@ from __future__ import absolute_import, division, print_function +import argparse import sys import os import py import pytest -from _pytest import config as parseopt +from _pytest.config import argparsing as parseopt @pytest.fixture @@ -12,6 +13,7 @@ def parser(): class TestParser(object): + def test_no_help_by_default(self, capsys): parser = parseopt.Parser(usage="xyz") pytest.raises(SystemExit, lambda: parser.parse(["-h"])) @@ -22,41 +24,43 @@ class TestParser(object): with pytest.raises(parseopt.ArgumentError): # need a short or long option argument = parseopt.Argument() - argument = parseopt.Argument('-t') - assert argument._short_opts == ['-t'] + argument = parseopt.Argument("-t") + assert argument._short_opts == ["-t"] assert argument._long_opts == [] - assert argument.dest == 't' - argument = parseopt.Argument('-t', '--test') - assert argument._short_opts == ['-t'] - assert argument._long_opts == ['--test'] - assert argument.dest == 'test' - argument = parseopt.Argument('-t', '--test', dest='abc') - assert argument.dest == 'abc' - assert str(argument) == ( - "Argument(_short_opts: ['-t'], _long_opts: ['--test'], dest: 'abc')" + assert argument.dest == "t" + argument = parseopt.Argument("-t", "--test") + assert argument._short_opts == ["-t"] + assert argument._long_opts == ["--test"] + assert argument.dest == "test" + argument = parseopt.Argument("-t", "--test", dest="abc") + assert argument.dest == "abc" + assert ( + str(argument) + == ("Argument(_short_opts: ['-t'], _long_opts: ['--test'], dest: 'abc')") ) def test_argument_type(self): - argument = parseopt.Argument('-t', dest='abc', type=int) + argument = parseopt.Argument("-t", dest="abc", type=int) assert argument.type is int - argument = parseopt.Argument('-t', dest='abc', type=str) + argument = parseopt.Argument("-t", dest="abc", type=str) assert argument.type is str - argument = parseopt.Argument('-t', dest='abc', type=float) + argument = parseopt.Argument("-t", dest="abc", type=float) assert argument.type is float with pytest.warns(DeprecationWarning): with pytest.raises(KeyError): - argument = parseopt.Argument('-t', dest='abc', type='choice') - argument = parseopt.Argument('-t', dest='abc', type=str, - choices=['red', 'blue']) + argument = parseopt.Argument("-t", dest="abc", type="choice") + argument = parseopt.Argument( + "-t", dest="abc", type=str, choices=["red", "blue"] + ) assert argument.type is str def test_argument_processopt(self): - argument = parseopt.Argument('-t', type=int) + argument = parseopt.Argument("-t", type=int) argument.default = 42 - argument.dest = 'abc' + argument.dest = "abc" res = argument.attrs() - assert res['default'] == 42 - assert res['dest'] == 'abc' + assert res["default"] == 42 + assert res["dest"] == "abc" def test_group_add_and_get(self, parser): group = parser.getgroup("hello", description="desc") @@ -89,13 +93,16 @@ class TestParser(object): group.addoption("--option1", "--option-1", action="store_true") with pytest.raises(ValueError) as err: group.addoption("--option1", "--option-one", action="store_true") - assert str(set(["--option1"])) in str(err.value) + assert str({"--option1"}) in str(err.value) def test_group_shortopt_lowercase(self, parser): group = parser.getgroup("hello") - pytest.raises(ValueError, """ + pytest.raises( + ValueError, + """ group.addoption("-x", action="store_true") - """) + """, + ) assert len(group.options) == 0 group._addoption("-x", action="store_true") assert len(group.options) == 1 @@ -108,7 +115,7 @@ class TestParser(object): def test_parse(self, parser): parser.addoption("--hello", dest="hello", action="store") - args = parser.parse(['--hello', 'world']) + args = parser.parse(["--hello", "world"]) assert args.hello == "world" assert not getattr(args, parseopt.FILE_OR_DIR) @@ -121,15 +128,16 @@ class TestParser(object): parser.addoption("--hello", action="store_true") ns = parser.parse_known_args(["x", "--y", "--hello", "this"]) assert ns.hello - assert ns.file_or_dir == ['x'] + assert ns.file_or_dir == ["x"] def test_parse_known_and_unknown_args(self, parser): parser.addoption("--hello", action="store_true") - ns, unknown = parser.parse_known_and_unknown_args(["x", "--y", - "--hello", "this"]) + ns, unknown = parser.parse_known_and_unknown_args( + ["x", "--y", "--hello", "this"] + ) assert ns.hello - assert ns.file_or_dir == ['x'] - assert unknown == ['--y', 'this'] + assert ns.file_or_dir == ["x"] + assert unknown == ["--y", "this"] def test_parse_will_set_default(self, parser): parser.addoption("--hello", dest="hello", default="x", action="store") @@ -147,38 +155,40 @@ class TestParser(object): pass option = A() - args = parser.parse_setoption(['--hello', 'world'], option) + args = parser.parse_setoption(["--hello", "world"], option) assert option.hello == "world" assert option.world == 42 assert not args def test_parse_special_destination(self, parser): parser.addoption("--ultimate-answer", type=int) - args = parser.parse(['--ultimate-answer', '42']) + args = parser.parse(["--ultimate-answer", "42"]) assert args.ultimate_answer == 42 def test_parse_split_positional_arguments(self, parser): - parser.addoption("-R", action='store_true') - parser.addoption("-S", action='store_false') - args = parser.parse(['-R', '4', '2', '-S']) - assert getattr(args, parseopt.FILE_OR_DIR) == ['4', '2'] - args = parser.parse(['-R', '-S', '4', '2', '-R']) - assert getattr(args, parseopt.FILE_OR_DIR) == ['4', '2'] + parser.addoption("-R", action="store_true") + parser.addoption("-S", action="store_false") + args = parser.parse(["-R", "4", "2", "-S"]) + assert getattr(args, parseopt.FILE_OR_DIR) == ["4", "2"] + args = parser.parse(["-R", "-S", "4", "2", "-R"]) + assert getattr(args, parseopt.FILE_OR_DIR) == ["4", "2"] assert args.R is True assert args.S is False - args = parser.parse(['-R', '4', '-S', '2']) - assert getattr(args, parseopt.FILE_OR_DIR) == ['4', '2'] + args = parser.parse(["-R", "4", "-S", "2"]) + assert getattr(args, parseopt.FILE_OR_DIR) == ["4", "2"] assert args.R is True assert args.S is False def test_parse_defaultgetter(self): + def defaultget(option): - if not hasattr(option, 'type'): + if not hasattr(option, "type"): return if option.type is int: option.default = 42 elif option.type is str: option.default = "world" + parser = parseopt.Parser(processopt=defaultget) parser.addoption("--this", dest="this", type=int, action="store") parser.addoption("--hello", dest="hello", type=str, action="store") @@ -189,73 +199,88 @@ class TestParser(object): assert option.no is False def test_drop_short_helper(self): - parser = py.std.argparse.ArgumentParser(formatter_class=parseopt.DropShorterLongHelpFormatter) - parser.add_argument('-t', '--twoword', '--duo', '--two-word', '--two', - help='foo').map_long_option = {'two': 'two-word'} + parser = argparse.ArgumentParser( + formatter_class=parseopt.DropShorterLongHelpFormatter + ) + parser.add_argument( + "-t", "--twoword", "--duo", "--two-word", "--two", help="foo" + ).map_long_option = { + "two": "two-word" + } # throws error on --deux only! - parser.add_argument('-d', '--deuxmots', '--deux-mots', - action='store_true', help='foo').map_long_option = {'deux': 'deux-mots'} - parser.add_argument('-s', action='store_true', help='single short') - parser.add_argument('--abc', '-a', - action='store_true', help='bar') - parser.add_argument('--klm', '-k', '--kl-m', - action='store_true', help='bar') - parser.add_argument('-P', '--pq-r', '-p', '--pqr', - action='store_true', help='bar') - parser.add_argument('--zwei-wort', '--zweiwort', '--zweiwort', - action='store_true', help='bar') - parser.add_argument('-x', '--exit-on-first', '--exitfirst', - action='store_true', help='spam').map_long_option = {'exitfirst': 'exit-on-first'} - parser.add_argument('files_and_dirs', nargs='*') - args = parser.parse_args(['-k', '--duo', 'hallo', '--exitfirst']) - assert args.twoword == 'hallo' + parser.add_argument( + "-d", "--deuxmots", "--deux-mots", action="store_true", help="foo" + ).map_long_option = { + "deux": "deux-mots" + } + parser.add_argument("-s", action="store_true", help="single short") + parser.add_argument("--abc", "-a", action="store_true", help="bar") + parser.add_argument("--klm", "-k", "--kl-m", action="store_true", help="bar") + parser.add_argument( + "-P", "--pq-r", "-p", "--pqr", action="store_true", help="bar" + ) + parser.add_argument( + "--zwei-wort", "--zweiwort", "--zweiwort", action="store_true", help="bar" + ) + parser.add_argument( + "-x", "--exit-on-first", "--exitfirst", action="store_true", help="spam" + ).map_long_option = { + "exitfirst": "exit-on-first" + } + parser.add_argument("files_and_dirs", nargs="*") + args = parser.parse_args(["-k", "--duo", "hallo", "--exitfirst"]) + assert args.twoword == "hallo" assert args.klm is True assert args.zwei_wort is False assert args.exit_on_first is True assert args.s is False - args = parser.parse_args(['--deux-mots']) + args = parser.parse_args(["--deux-mots"]) with pytest.raises(AttributeError): assert args.deux_mots is True assert args.deuxmots is True - args = parser.parse_args(['file', 'dir']) - assert '|'.join(args.files_and_dirs) == 'file|dir' + args = parser.parse_args(["file", "dir"]) + assert "|".join(args.files_and_dirs) == "file|dir" def test_drop_short_0(self, parser): - parser.addoption('--funcarg', '--func-arg', action='store_true') - parser.addoption('--abc-def', '--abc-def', action='store_true') - parser.addoption('--klm-hij', action='store_true') - args = parser.parse(['--funcarg', '--k']) + parser.addoption("--funcarg", "--func-arg", action="store_true") + parser.addoption("--abc-def", "--abc-def", action="store_true") + parser.addoption("--klm-hij", action="store_true") + args = parser.parse(["--funcarg", "--k"]) assert args.funcarg is True assert args.abc_def is False assert args.klm_hij is True def test_drop_short_2(self, parser): - parser.addoption('--func-arg', '--doit', action='store_true') - args = parser.parse(['--doit']) + parser.addoption("--func-arg", "--doit", action="store_true") + args = parser.parse(["--doit"]) assert args.func_arg is True def test_drop_short_3(self, parser): - parser.addoption('--func-arg', '--funcarg', '--doit', action='store_true') - args = parser.parse(['abcd']) + parser.addoption("--func-arg", "--funcarg", "--doit", action="store_true") + args = parser.parse(["abcd"]) assert args.func_arg is False - assert args.file_or_dir == ['abcd'] + assert args.file_or_dir == ["abcd"] def test_drop_short_help0(self, parser, capsys): - parser.addoption('--func-args', '--doit', help='foo', - action='store_true') + parser.addoption("--func-args", "--doit", help="foo", action="store_true") parser.parse([]) help = parser.optparser.format_help() - assert '--func-args, --doit foo' in help + assert "--func-args, --doit foo" in help # testing would be more helpful with all help generated def test_drop_short_help1(self, parser, capsys): group = parser.getgroup("general") - group.addoption('--doit', '--func-args', action='store_true', help='foo') - group._addoption("-h", "--help", action="store_true", dest="help", - help="show help message and configuration info") - parser.parse(['-h']) + group.addoption("--doit", "--func-args", action="store_true", help="foo") + group._addoption( + "-h", + "--help", + action="store_true", + dest="help", + help="show help message and configuration info", + ) + parser.parse(["-h"]) help = parser.optparser.format_help() - assert '-doit, --func-args foo' in help + assert "-doit, --func-args foo" in help def test_multiple_metavar_help(self, parser): """ @@ -263,22 +288,24 @@ class TestParser(object): in the form "--preferences=value1 value2 value3" (#2004). """ group = parser.getgroup("general") - group.addoption('--preferences', metavar=('value1', 'value2', 'value3'), nargs=3) + group.addoption( + "--preferences", metavar=("value1", "value2", "value3"), nargs=3 + ) group._addoption("-h", "--help", action="store_true", dest="help") - parser.parse(['-h']) + parser.parse(["-h"]) help = parser.optparser.format_help() - assert '--preferences=value1 value2 value3' in help + assert "--preferences=value1 value2 value3" in help def test_argcomplete(testdir, monkeypatch): - if not py.path.local.sysfind('bash'): + if not py.path.local.sysfind("bash"): pytest.skip("bash not available") script = str(testdir.tmpdir.join("test_argcomplete")) pytest_bin = sys.argv[0] if "pytest" not in os.path.basename(pytest_bin): pytest.skip("need to be run with pytest executable, not %s" % (pytest_bin,)) - with open(str(script), 'w') as fp: + with open(str(script), "w") as fp: # redirect output from argcomplete to stdin and stderr is not trivial # http://stackoverflow.com/q/12589419/1307905 # so we use bash @@ -286,14 +313,14 @@ def test_argcomplete(testdir, monkeypatch): # alternative would be exteneded Testdir.{run(),_run(),popen()} to be able # to handle a keyword argument env that replaces os.environ in popen or # extends the copy, advantage: could not forget to restore - monkeypatch.setenv('_ARGCOMPLETE', "1") - monkeypatch.setenv('_ARGCOMPLETE_IFS', "\x0b") - monkeypatch.setenv('COMP_WORDBREAKS', ' \\t\\n"\\\'><=;|&(:') + monkeypatch.setenv("_ARGCOMPLETE", "1") + monkeypatch.setenv("_ARGCOMPLETE_IFS", "\x0b") + monkeypatch.setenv("COMP_WORDBREAKS", " \\t\\n\"\\'><=;|&(:") - arg = '--fu' - monkeypatch.setenv('COMP_LINE', "pytest " + arg) - monkeypatch.setenv('COMP_POINT', str(len("pytest " + arg))) - result = testdir.run('bash', str(script), arg) + arg = "--fu" + monkeypatch.setenv("COMP_LINE", "pytest " + arg) + monkeypatch.setenv("COMP_POINT", str(len("pytest " + arg))) + result = testdir.run("bash", str(script), arg) if result.ret == 255: # argcomplete not found pytest.skip("argcomplete not available") @@ -301,9 +328,9 @@ def test_argcomplete(testdir, monkeypatch): pytest.skip("bash provided no output, argcomplete not available?") else: result.stdout.fnmatch_lines(["--funcargs", "--fulltrace"]) - os.mkdir('test_argcomplete.d') - arg = 'test_argc' - monkeypatch.setenv('COMP_LINE', "pytest " + arg) - monkeypatch.setenv('COMP_POINT', str(len('pytest ' + arg))) - result = testdir.run('bash', str(script), arg) + os.mkdir("test_argcomplete.d") + arg = "test_argc" + monkeypatch.setenv("COMP_LINE", "pytest " + arg) + monkeypatch.setenv("COMP_POINT", str(len("pytest " + arg))) + result = testdir.run("bash", str(script), arg) result.stdout.fnmatch_lines(["test_argcomplete", "test_argcomplete.d/"]) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_pastebin.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_pastebin.py index 6b1742d1415..ad7c4d0c1c0 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_pastebin.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_pastebin.py @@ -9,12 +9,13 @@ class TestPasteCapture(object): @pytest.fixture def pastebinlist(self, monkeypatch, request): pastebinlist = [] - plugin = request.config.pluginmanager.getplugin('pastebin') - monkeypatch.setattr(plugin, 'create_new_paste', pastebinlist.append) + plugin = request.config.pluginmanager.getplugin("pastebin") + monkeypatch.setattr(plugin, "create_new_paste", pastebinlist.append) return pastebinlist def test_failed(self, testdir, pastebinlist): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ import pytest def test_pass(): pass @@ -22,7 +23,8 @@ class TestPasteCapture(object): assert 0 def test_skip(): pytest.skip("") - """) + """ + ) reprec = testdir.inline_run(testpath, "--paste=failed") assert len(pastebinlist) == 1 s = pastebinlist[0] @@ -31,7 +33,9 @@ class TestPasteCapture(object): def test_all(self, testdir, pastebinlist): from _pytest.pytester import LineMatcher - testpath = testdir.makepyfile(""" + + testpath = testdir.makepyfile( + """ import pytest def test_pass(): pass @@ -39,45 +43,52 @@ class TestPasteCapture(object): assert 0 def test_skip(): pytest.skip("") - """) - reprec = testdir.inline_run(testpath, "--pastebin=all", '-v') + """ + ) + reprec = testdir.inline_run(testpath, "--pastebin=all", "-v") assert reprec.countoutcomes() == [1, 1, 1] assert len(pastebinlist) == 1 - contents = pastebinlist[0].decode('utf-8') + contents = pastebinlist[0].decode("utf-8") matcher = LineMatcher(contents.splitlines()) - matcher.fnmatch_lines([ - '*test_pass PASSED*', - '*test_fail FAILED*', - '*test_skip SKIPPED*', - '*== 1 failed, 1 passed, 1 skipped in *' - ]) + matcher.fnmatch_lines( + [ + "*test_pass PASSED*", + "*test_fail FAILED*", + "*test_skip SKIPPED*", + "*== 1 failed, 1 passed, 1 skipped in *", + ] + ) def test_non_ascii_paste_text(self, testdir): """Make sure that text which contains non-ascii characters is pasted correctly. See #1219. """ - testdir.makepyfile(test_unicode=""" + testdir.makepyfile( + test_unicode=""" # encoding: utf-8 def test(): assert '☺' == 1 - """) - result = testdir.runpytest('--pastebin=all') + """ + ) + result = testdir.runpytest("--pastebin=all") if sys.version_info[0] == 3: expected_msg = "*assert '☺' == 1*" else: expected_msg = "*assert '\\xe2\\x98\\xba' == 1*" - result.stdout.fnmatch_lines([ - expected_msg, - "*== 1 failed in *", - '*Sending information to Paste Service*', - ]) + result.stdout.fnmatch_lines( + [ + expected_msg, + "*== 1 failed in *", + "*Sending information to Paste Service*", + ] + ) class TestPaste(object): @pytest.fixture def pastebin(self, request): - return request.config.pluginmanager.getplugin('pastebin') + return request.config.pluginmanager.getplugin("pastebin") @pytest.fixture def mocked_urlopen(self, monkeypatch): @@ -91,27 +102,31 @@ class TestPaste(object): calls.append((url, data)) class DummyFile(object): + def read(self): # part of html of a normal response return b'View raw.' + return DummyFile() if sys.version_info < (3, 0): import urllib - monkeypatch.setattr(urllib, 'urlopen', mocked) + + monkeypatch.setattr(urllib, "urlopen", mocked) else: import urllib.request - monkeypatch.setattr(urllib.request, 'urlopen', mocked) + + monkeypatch.setattr(urllib.request, "urlopen", mocked) return calls def test_create_new_paste(self, pastebin, mocked_urlopen): - result = pastebin.create_new_paste(b'full-paste-contents') - assert result == 'https://bpaste.net/show/3c0c6750bd' + result = pastebin.create_new_paste(b"full-paste-contents") + assert result == "https://bpaste.net/show/3c0c6750bd" assert len(mocked_urlopen) == 1 url, data = mocked_urlopen[0] assert type(data) is bytes - lexer = 'python3' if sys.version_info[0] == 3 else 'python' - assert url == 'https://bpaste.net' - assert 'lexer=%s' % lexer in data.decode() - assert 'code=full-paste-contents' in data.decode() - assert 'expiry=1week' in data.decode() + lexer = "python3" if sys.version_info[0] == 3 else "python" + assert url == "https://bpaste.net" + assert "lexer=%s" % lexer in data.decode() + assert "code=full-paste-contents" in data.decode() + assert "expiry=1week" in data.decode() diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_pdb.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_pdb.py index 70a5c3c5bdb..615d52e8345 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_pdb.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_pdb.py @@ -1,11 +1,16 @@ from __future__ import absolute_import, division, print_function import sys import platform +import os import _pytest._code +from _pytest.debugging import SUPPORTS_BREAKPOINT_BUILTIN import pytest +_ENVIRON_PYTHONBREAKPOINT = os.environ.get("PYTHONBREAKPOINT", "") + + def runpdb_and_get_report(testdir, source): p = testdir.makepyfile(source) result = testdir.runpytest_inprocess("--pdb", p) @@ -20,6 +25,7 @@ def custom_pdb_calls(): # install dummy debugger class and track which methods were called on it class _CustomPdb(object): + def __init__(self, *args, **kwargs): called.append("init") @@ -33,6 +39,31 @@ def custom_pdb_calls(): return called +@pytest.fixture +def custom_debugger_hook(): + called = [] + + # install dummy debugger class and track which methods were called on it + class _CustomDebugger(object): + + def __init__(self, *args, **kwargs): + called.append("init") + + def reset(self): + called.append("reset") + + def interaction(self, *args): + called.append("interaction") + + def set_trace(self, frame): + print("**CustomDebugger**") + called.append("set_trace") + + _pytest._CustomDebugger = _CustomDebugger + yield called + del _pytest._CustomDebugger + + class TestPDB(object): @pytest.fixture @@ -43,54 +74,79 @@ class TestPDB(object): def mypdb(*args): pdblist.append(args) - plugin = request.config.pluginmanager.getplugin('debugging') - monkeypatch.setattr(plugin, 'post_mortem', mypdb) + plugin = request.config.pluginmanager.getplugin("debugging") + monkeypatch.setattr(plugin, "post_mortem", mypdb) return pdblist def test_pdb_on_fail(self, testdir, pdblist): - rep = runpdb_and_get_report(testdir, """ + rep = runpdb_and_get_report( + testdir, + """ def test_func(): assert 0 - """) + """, + ) assert rep.failed assert len(pdblist) == 1 tb = _pytest._code.Traceback(pdblist[0][0]) assert tb[-1].name == "test_func" def test_pdb_on_xfail(self, testdir, pdblist): - rep = runpdb_and_get_report(testdir, """ + rep = runpdb_and_get_report( + testdir, + """ import pytest @pytest.mark.xfail def test_func(): assert 0 - """) + """, + ) assert "xfail" in rep.keywords assert not pdblist def test_pdb_on_skip(self, testdir, pdblist): - rep = runpdb_and_get_report(testdir, """ + rep = runpdb_and_get_report( + testdir, + """ import pytest def test_func(): pytest.skip("hello") - """) + """, + ) assert rep.skipped assert len(pdblist) == 0 def test_pdb_on_BdbQuit(self, testdir, pdblist): - rep = runpdb_and_get_report(testdir, """ + rep = runpdb_and_get_report( + testdir, + """ import bdb def test_func(): raise bdb.BdbQuit - """) + """, + ) assert rep.failed assert len(pdblist) == 0 + def test_pdb_on_KeyboardInterrupt(self, testdir, pdblist): + rep = runpdb_and_get_report( + testdir, + """ + def test_func(): + raise KeyboardInterrupt + """, + ) + assert rep.failed + assert len(pdblist) == 1 + def test_pdb_interaction(self, testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ def test_1(): i = 0 assert i == 1 - """) + """ + ) child = testdir.spawn_pytest("--pdb %s" % p1) child.expect(".*def test_1") child.expect(".*i = 0") @@ -103,13 +159,14 @@ class TestPDB(object): @staticmethod def flush(child): - if platform.system() == 'Darwin': + if platform.system() == "Darwin": return if child.isalive(): child.wait() def test_pdb_unittest_postmortem(self, testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ import unittest class Blub(unittest.TestCase): def tearDown(self): @@ -117,53 +174,136 @@ class TestPDB(object): def test_false(self): self.filename = 'debug' + '.me' assert 0 - """) + """ + ) child = testdir.spawn_pytest("--pdb %s" % p1) - child.expect('(Pdb)') - child.sendline('p self.filename') + child.expect("(Pdb)") + child.sendline("p self.filename") child.sendeof() rest = child.read().decode("utf8") - assert 'debug.me' in rest + assert "debug.me" in rest self.flush(child) def test_pdb_unittest_skip(self, testdir): """Test for issue #2137""" - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ import unittest @unittest.skipIf(True, 'Skipping also with pdb active') class MyTestCase(unittest.TestCase): def test_one(self): assert 0 - """) + """ + ) child = testdir.spawn_pytest("-rs --pdb %s" % p1) - child.expect('Skipping also with pdb active') - child.expect('1 skipped in') + child.expect("Skipping also with pdb active") + child.expect("1 skipped in") child.sendeof() self.flush(child) - def test_pdb_interaction_capture(self, testdir): - p1 = testdir.makepyfile(""" + def test_pdb_print_captured_stdout(self, testdir): + p1 = testdir.makepyfile( + """ def test_1(): - print("getrekt") + print("get\\x20rekt") assert False - """) + """ + ) child = testdir.spawn_pytest("--pdb %s" % p1) - child.expect("getrekt") + child.expect("captured stdout") + child.expect("get rekt") + child.expect("(Pdb)") + child.sendeof() + rest = child.read().decode("utf8") + assert "1 failed" in rest + assert "get rekt" not in rest + self.flush(child) + + def test_pdb_print_captured_stderr(self, testdir): + p1 = testdir.makepyfile( + """ + def test_1(): + import sys + sys.stderr.write("get\\x20rekt") + assert False + """ + ) + child = testdir.spawn_pytest("--pdb %s" % p1) + child.expect("captured stderr") + child.expect("get rekt") + child.expect("(Pdb)") + child.sendeof() + rest = child.read().decode("utf8") + assert "1 failed" in rest + assert "get rekt" not in rest + self.flush(child) + + def test_pdb_dont_print_empty_captured_stdout_and_stderr(self, testdir): + p1 = testdir.makepyfile( + """ + def test_1(): + assert False + """ + ) + child = testdir.spawn_pytest("--pdb %s" % p1) + child.expect("(Pdb)") + output = child.before.decode("utf8") + child.sendeof() + assert "captured stdout" not in output + assert "captured stderr" not in output + self.flush(child) + + @pytest.mark.parametrize("showcapture", ["all", "no", "log"]) + def test_pdb_print_captured_logs(self, testdir, showcapture): + p1 = testdir.makepyfile( + """ + def test_1(): + import logging + logging.warn("get " + "rekt") + assert False + """ + ) + child = testdir.spawn_pytest("--show-capture=%s --pdb %s" % (showcapture, p1)) + if showcapture in ("all", "log"): + child.expect("captured log") + child.expect("get rekt") + child.expect("(Pdb)") + child.sendeof() + rest = child.read().decode("utf8") + assert "1 failed" in rest + self.flush(child) + + def test_pdb_print_captured_logs_nologging(self, testdir): + p1 = testdir.makepyfile( + """ + def test_1(): + import logging + logging.warn("get " + "rekt") + assert False + """ + ) + child = testdir.spawn_pytest( + "--show-capture=all --pdb " "-p no:logging %s" % p1 + ) + child.expect("get rekt") + output = child.before.decode("utf8") + assert "captured log" not in output child.expect("(Pdb)") child.sendeof() rest = child.read().decode("utf8") assert "1 failed" in rest - assert "getrekt" not in rest self.flush(child) def test_pdb_interaction_exception(self, testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ import pytest def globalfunc(): pass def test_1(): pytest.raises(ValueError, globalfunc) - """) + """ + ) child = testdir.spawn_pytest("--pdb %s" % p1) child.expect(".*def test_1") child.expect(".*pytest.raises.*globalfunc") @@ -175,10 +315,12 @@ class TestPDB(object): self.flush(child) def test_pdb_interaction_on_collection_issue181(self, testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ import pytest xxx - """) + """ + ) child = testdir.spawn_pytest("--pdb %s" % p1) # child.expect(".*import pytest.*") child.expect("(Pdb)") @@ -187,10 +329,12 @@ class TestPDB(object): self.flush(child) def test_pdb_interaction_on_internal_error(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_runtest_protocol(): 0/0 - """) + """ + ) p1 = testdir.makepyfile("def test_func(): pass") child = testdir.spawn_pytest("--pdb %s" % p1) # child.expect(".*import pytest.*") @@ -199,14 +343,16 @@ class TestPDB(object): self.flush(child) def test_pdb_interaction_capturing_simple(self, testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ import pytest def test_1(): i = 0 print ("hello17") pytest.set_trace() x = 3 - """) + """ + ) child = testdir.spawn_pytest(str(p1)) child.expect("test_1") child.expect("x = 3") @@ -219,11 +365,13 @@ class TestPDB(object): self.flush(child) def test_pdb_set_trace_interception(self, testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ import pdb def test_1(): pdb.set_trace() - """) + """ + ) child = testdir.spawn_pytest(str(p1)) child.expect("test_1") child.expect("(Pdb)") @@ -234,12 +382,14 @@ class TestPDB(object): self.flush(child) def test_pdb_and_capsys(self, testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ import pytest def test_1(capsys): print ("hello1") pytest.set_trace() - """) + """ + ) child = testdir.spawn_pytest(str(p1)) child.expect("test_1") child.send("capsys.readouterr()\n") @@ -249,14 +399,16 @@ class TestPDB(object): self.flush(child) def test_set_trace_capturing_afterwards(self, testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ import pdb def test_1(): pdb.set_trace() def test_2(): print ("hello") assert 0 - """) + """ + ) child = testdir.spawn_pytest(str(p1)) child.expect("test_1") child.send("c\n") @@ -268,17 +420,19 @@ class TestPDB(object): self.flush(child) def test_pdb_interaction_doctest(self, testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ import pytest def function_1(): ''' >>> i = 0 >>> assert i == 1 ''' - """) + """ + ) child = testdir.spawn_pytest("--doctest-modules --pdb %s" % p1) child.expect("(Pdb)") - child.sendline('i') + child.sendline("i") child.expect("0") child.expect("(Pdb)") child.sendeof() @@ -287,7 +441,8 @@ class TestPDB(object): self.flush(child) def test_pdb_interaction_capturing_twice(self, testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ import pytest def test_1(): i = 0 @@ -297,12 +452,13 @@ class TestPDB(object): print ("hello18") pytest.set_trace() x = 4 - """) + """ + ) child = testdir.spawn_pytest(str(p1)) child.expect("test_1") child.expect("x = 3") child.expect("(Pdb)") - child.sendline('c') + child.sendline("c") child.expect("x = 4") child.sendeof() rest = child.read().decode("utf8") @@ -313,94 +469,234 @@ class TestPDB(object): self.flush(child) def test_pdb_used_outside_test(self, testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ import pytest pytest.set_trace() x = 5 - """) + """ + ) child = testdir.spawn("%s %s" % (sys.executable, p1)) child.expect("x = 5") child.sendeof() self.flush(child) def test_pdb_used_in_generate_tests(self, testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ import pytest def pytest_generate_tests(metafunc): pytest.set_trace() x = 5 def test_foo(a): pass - """) + """ + ) child = testdir.spawn_pytest(str(p1)) child.expect("x = 5") child.sendeof() self.flush(child) def test_pdb_collection_failure_is_shown(self, testdir): - p1 = testdir.makepyfile("""xxx """) + p1 = testdir.makepyfile("xxx") result = testdir.runpytest_subprocess("--pdb", p1) - result.stdout.fnmatch_lines([ - "*NameError*xxx*", - "*1 error*", - ]) + result.stdout.fnmatch_lines(["*NameError*xxx*", "*1 error*"]) def test_enter_pdb_hook_is_called(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_enter_pdb(config): assert config.testing_verification == 'configured' print 'enter_pdb_hook' def pytest_configure(config): config.testing_verification = 'configured' - """) - p1 = testdir.makepyfile(""" + """ + ) + p1 = testdir.makepyfile( + """ import pytest def test_foo(): pytest.set_trace() - """) + """ + ) child = testdir.spawn_pytest(str(p1)) child.expect("enter_pdb_hook") - child.send('c\n') + child.send("c\n") child.sendeof() self.flush(child) def test_pdb_custom_cls(self, testdir, custom_pdb_calls): p1 = testdir.makepyfile("""xxx """) - result = testdir.runpytest_inprocess( - "--pdb", "--pdbcls=_pytest:_CustomPdb", p1) - result.stdout.fnmatch_lines([ - "*NameError*xxx*", - "*1 error*", - ]) + result = testdir.runpytest_inprocess("--pdb", "--pdbcls=_pytest:_CustomPdb", p1) + result.stdout.fnmatch_lines(["*NameError*xxx*", "*1 error*"]) assert custom_pdb_calls == ["init", "reset", "interaction"] def test_pdb_custom_cls_without_pdb(self, testdir, custom_pdb_calls): p1 = testdir.makepyfile("""xxx """) - result = testdir.runpytest_inprocess( - "--pdbcls=_pytest:_CustomPdb", p1) - result.stdout.fnmatch_lines([ - "*NameError*xxx*", - "*1 error*", - ]) + result = testdir.runpytest_inprocess("--pdbcls=_pytest:_CustomPdb", p1) + result.stdout.fnmatch_lines(["*NameError*xxx*", "*1 error*"]) assert custom_pdb_calls == [] def test_pdb_custom_cls_with_settrace(self, testdir, monkeypatch): - testdir.makepyfile(custom_pdb=""" + testdir.makepyfile( + custom_pdb=""" class CustomPdb(object): def set_trace(*args, **kwargs): print 'custom set_trace>' - """) - p1 = testdir.makepyfile(""" + """ + ) + p1 = testdir.makepyfile( + """ import pytest def test_foo(): pytest.set_trace() - """) - monkeypatch.setenv('PYTHONPATH', str(testdir.tmpdir)) + """ + ) + monkeypatch.setenv("PYTHONPATH", str(testdir.tmpdir)) child = testdir.spawn_pytest("--pdbcls=custom_pdb:CustomPdb %s" % str(p1)) - child.expect('custom set_trace>') - if child.isalive(): - child.wait() + child.expect("custom set_trace>") + self.flush(child) + + +class TestDebuggingBreakpoints(object): + + def test_supports_breakpoint_module_global(self): + """ + Test that supports breakpoint global marks on Python 3.7+ and not on + CPython 3.5, 2.7 + """ + if sys.version_info.major == 3 and sys.version_info.minor >= 7: + assert SUPPORTS_BREAKPOINT_BUILTIN is True + if sys.version_info.major == 3 and sys.version_info.minor == 5: + assert SUPPORTS_BREAKPOINT_BUILTIN is False + if sys.version_info.major == 2 and sys.version_info.minor == 7: + assert SUPPORTS_BREAKPOINT_BUILTIN is False + + @pytest.mark.skipif( + not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin" + ) + @pytest.mark.parametrize("arg", ["--pdb", ""]) + def test_sys_breakpointhook_configure_and_unconfigure(self, testdir, arg): + """ + Test that sys.breakpointhook is set to the custom Pdb class once configured, test that + hook is reset to system value once pytest has been unconfigured + """ + testdir.makeconftest( + """ + import sys + from pytest import hookimpl + from _pytest.debugging import pytestPDB + + def pytest_configure(config): + config._cleanup.append(check_restored) + + def check_restored(): + assert sys.breakpointhook == sys.__breakpointhook__ + + def test_check(): + assert sys.breakpointhook == pytestPDB.set_trace + """ + ) + testdir.makepyfile( + """ + def test_nothing(): pass + """ + ) + args = (arg,) if arg else () + result = testdir.runpytest_subprocess(*args) + result.stdout.fnmatch_lines(["*1 passed in *"]) + + @pytest.mark.skipif( + not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin" + ) + def test_pdb_custom_cls(self, testdir, custom_debugger_hook): + p1 = testdir.makepyfile( + """ + def test_nothing(): + breakpoint() + """ + ) + result = testdir.runpytest_inprocess( + "--pdb", "--pdbcls=_pytest:_CustomDebugger", p1 + ) + result.stdout.fnmatch_lines(["*CustomDebugger*", "*1 passed*"]) + assert custom_debugger_hook == ["init", "set_trace"] + + @pytest.mark.parametrize("arg", ["--pdb", ""]) + @pytest.mark.skipif( + not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin" + ) + def test_environ_custom_class(self, testdir, custom_debugger_hook, arg): + testdir.makeconftest( + """ + import os + import sys + + os.environ['PYTHONBREAKPOINT'] = '_pytest._CustomDebugger.set_trace' + + def pytest_configure(config): + config._cleanup.append(check_restored) + + def check_restored(): + assert sys.breakpointhook == sys.__breakpointhook__ + + def test_check(): + import _pytest + assert sys.breakpointhook is _pytest._CustomDebugger.set_trace + """ + ) + testdir.makepyfile( + """ + def test_nothing(): pass + """ + ) + args = (arg,) if arg else () + result = testdir.runpytest_subprocess(*args) + result.stdout.fnmatch_lines(["*1 passed in *"]) + + @pytest.mark.skipif( + not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin" + ) + @pytest.mark.skipif( + not _ENVIRON_PYTHONBREAKPOINT == "", + reason="Requires breakpoint() default value", + ) + def test_sys_breakpoint_interception(self, testdir): + p1 = testdir.makepyfile( + """ + def test_1(): + breakpoint() + """ + ) + child = testdir.spawn_pytest(str(p1)) + child.expect("test_1") + child.expect("(Pdb)") + child.sendeof() + rest = child.read().decode("utf8") + assert "1 failed" in rest + assert "reading from stdin while output" not in rest + TestPDB.flush(child) + + @pytest.mark.skipif( + not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin" + ) + def test_pdb_not_altered(self, testdir): + p1 = testdir.makepyfile( + """ + import pdb + def test_1(): + pdb.set_trace() + """ + ) + child = testdir.spawn_pytest(str(p1)) + child.expect("test_1") + child.expect("(Pdb)") + child.sendeof() + rest = child.read().decode("utf8") + assert "1 failed" in rest + assert "reading from stdin while output" not in rest + TestPDB.flush(child) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_pluginmanager.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_pluginmanager.py index 6192176e8a8..22cea4207c6 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_pluginmanager.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_pluginmanager.py @@ -1,8 +1,10 @@ # encoding: UTF-8 from __future__ import absolute_import, division, print_function import pytest -import py import os +import re +import sys +import types from _pytest.config import get_config, PytestPluginManager from _pytest.main import EXIT_NOTESTSCOLLECTED, Session @@ -14,72 +16,86 @@ def pytestpm(): class TestPytestPluginInteractions(object): + def test_addhooks_conftestplugin(self, testdir): - testdir.makepyfile(newhooks=""" + testdir.makepyfile( + newhooks=""" def pytest_myhook(xyz): "new hook" - """) - conf = testdir.makeconftest(""" + """ + ) + conf = testdir.makeconftest( + """ import sys ; sys.path.insert(0, '.') import newhooks def pytest_addhooks(pluginmanager): pluginmanager.addhooks(newhooks) def pytest_myhook(xyz): return xyz + 1 - """) + """ + ) config = get_config() pm = config.pluginmanager pm.hook.pytest_addhooks.call_historic( - kwargs=dict(pluginmanager=config.pluginmanager)) + kwargs=dict(pluginmanager=config.pluginmanager) + ) config.pluginmanager._importconftest(conf) # print(config.pluginmanager.get_plugins()) res = config.hook.pytest_myhook(xyz=10) assert res == [11] def test_addhooks_nohooks(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import sys def pytest_addhooks(pluginmanager): pluginmanager.addhooks(sys) - """) + """ + ) res = testdir.runpytest() assert res.ret != 0 - res.stderr.fnmatch_lines([ - "*did not find*sys*" - ]) + res.stderr.fnmatch_lines(["*did not find*sys*"]) def test_namespace_early_from_import(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ from pytest import Item from pytest import Item as Item2 assert Item is Item2 - """) + """ + ) result = testdir.runpython(p) assert result.ret == 0 def test_do_ext_namespace(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_namespace(): return {'hello': 'world'} - """) - p = testdir.makepyfile(""" + """ + ) + p = testdir.makepyfile( + """ from pytest import hello import pytest def test_hello(): assert hello == "world" assert 'hello' in pytest.__all__ - """) + """ + ) reprec = testdir.inline_run(p) reprec.assertoutcome(passed=1) def test_do_option_postinitialize(self, testdir): config = testdir.parseconfigure() - assert not hasattr(config.option, 'test123') - p = testdir.makepyfile(""" + assert not hasattr(config.option, "test123") + p = testdir.makepyfile( + """ def pytest_addoption(parser): parser.addoption('--test123', action="store_true", default=True) - """) + """ + ) config.pluginmanager._importconftest(p) assert config.option.test123 @@ -88,6 +104,7 @@ class TestPytestPluginInteractions(object): values = [] class A(object): + def pytest_configure(self, config): values.append(self) @@ -108,10 +125,12 @@ class TestPytestPluginInteractions(object): saveindent = [] class api1(object): + def pytest_plugin_registered(self): saveindent.append(pytestpm.trace.root.indent) class api2(object): + def pytest_plugin_registered(self): saveindent.append(pytestpm.trace.root.indent) raise ValueError() @@ -125,8 +144,8 @@ class TestPytestPluginInteractions(object): pytestpm.register(p) assert pytestpm.trace.root.indent == indent assert len(values) >= 2 - assert 'pytest_plugin_registered' in values[0] - assert 'finish' in values[1] + assert "pytest_plugin_registered" in values[0] + assert "finish" in values[1] values[:] = [] with pytest.raises(ValueError): @@ -140,29 +159,28 @@ class TestPytestPluginInteractions(object): """Test the gethookproxy function(#2016)""" config = testdir.parseconfig() session = Session(config) - testdir.makepyfile(**{ - 'tests/conftest.py': '', - 'tests/subdir/conftest.py': '', - }) + testdir.makepyfile(**{"tests/conftest.py": "", "tests/subdir/conftest.py": ""}) - conftest1 = testdir.tmpdir.join('tests/conftest.py') - conftest2 = testdir.tmpdir.join('tests/subdir/conftest.py') + conftest1 = testdir.tmpdir.join("tests/conftest.py") + conftest2 = testdir.tmpdir.join("tests/subdir/conftest.py") config.pluginmanager._importconftest(conftest1) - ihook_a = session.gethookproxy(testdir.tmpdir.join('tests')) + ihook_a = session.gethookproxy(testdir.tmpdir.join("tests")) assert ihook_a is not None config.pluginmanager._importconftest(conftest2) - ihook_b = session.gethookproxy(testdir.tmpdir.join('tests')) + ihook_b = session.gethookproxy(testdir.tmpdir.join("tests")) assert ihook_a is not ihook_b def test_warn_on_deprecated_addhooks(self, pytestpm): warnings = [] class get_warnings(object): + def pytest_logwarning(self, code, fslocation, message, nodeid): warnings.append(message) class Plugin(object): + def pytest_testhook(): pass @@ -174,20 +192,19 @@ class TestPytestPluginInteractions(object): def test_namespace_has_default_and_env_plugins(testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest pytest.mark - """) + """ + ) result = testdir.runpython(p) assert result.ret == 0 def test_default_markers(testdir): result = testdir.runpytest("--markers") - result.stdout.fnmatch_lines([ - "*tryfirst*first*", - "*trylast*last*", - ]) + result.stdout.fnmatch_lines(["*tryfirst*first*", "*trylast*last*"]) def test_importplugin_error_message(testdir, pytestpm): @@ -197,25 +214,28 @@ def test_importplugin_error_message(testdir, pytestpm): See #375 and #1998. """ testdir.syspathinsert(testdir.tmpdir) - testdir.makepyfile(qwe=""" + testdir.makepyfile( + qwe=""" # encoding: UTF-8 def test_traceback(): raise ImportError(u'Not possible to import: ☺') test_traceback() - """) + """ + ) with pytest.raises(ImportError) as excinfo: pytestpm.import_plugin("qwe") expected_message = '.*Error importing plugin "qwe": Not possible to import: .' expected_traceback = ".*in test_traceback" - assert py.std.re.match(expected_message, str(excinfo.value)) - assert py.std.re.match(expected_traceback, str(excinfo.traceback[-1])) + assert re.match(expected_message, str(excinfo.value)) + assert re.match(expected_traceback, str(excinfo.traceback[-1])) class TestPytestPluginManager(object): + def test_register_imported_modules(self): pm = PytestPluginManager() - mod = py.std.types.ModuleType("x.y.pytest_hello") + mod = types.ModuleType("x.y.pytest_hello") pm.register(mod) assert pm.is_registered(mod) values = pm.get_plugins() @@ -226,18 +246,18 @@ class TestPytestPluginManager(object): assert pm.get_plugins() == values def test_canonical_import(self, monkeypatch): - mod = py.std.types.ModuleType("pytest_xyz") - monkeypatch.setitem(py.std.sys.modules, 'pytest_xyz', mod) + mod = types.ModuleType("pytest_xyz") + monkeypatch.setitem(sys.modules, "pytest_xyz", mod) pm = PytestPluginManager() - pm.import_plugin('pytest_xyz') - assert pm.get_plugin('pytest_xyz') == mod + pm.import_plugin("pytest_xyz") + assert pm.get_plugin("pytest_xyz") == mod assert pm.is_registered(mod) def test_consider_module(self, testdir, pytestpm): testdir.syspathinsert() testdir.makepyfile(pytest_p1="#") testdir.makepyfile(pytest_p2="#") - mod = py.std.types.ModuleType("temp") + mod = types.ModuleType("temp") mod.pytest_plugins = ["pytest_p1", "pytest_p2"] pytestpm.consider_module(mod) assert pytestpm.get_plugin("pytest_p1").__name__ == "pytest_p1" @@ -245,12 +265,12 @@ class TestPytestPluginManager(object): def test_consider_module_import_module(self, testdir): pytestpm = get_config().pluginmanager - mod = py.std.types.ModuleType("x") + mod = types.ModuleType("x") mod.pytest_plugins = "pytest_a" aplugin = testdir.makepyfile(pytest_a="#") reprec = testdir.make_hook_recorder(pytestpm) # syspath.prepend(aplugin.dirpath()) - py.std.sys.path.insert(0, str(aplugin.dirpath())) + sys.path.insert(0, str(aplugin.dirpath())) pytestpm.consider_module(mod) call = reprec.getcall(pytestpm.hook.pytest_plugin_registered.name) assert call.plugin.__name__ == "pytest_a" @@ -261,46 +281,49 @@ class TestPytestPluginManager(object): assert len(values) == 1 def test_consider_env_fails_to_import(self, monkeypatch, pytestpm): - monkeypatch.setenv('PYTEST_PLUGINS', 'nonexisting', prepend=",") + monkeypatch.setenv("PYTEST_PLUGINS", "nonexisting", prepend=",") with pytest.raises(ImportError): pytestpm.consider_env() def test_plugin_skip(self, testdir, monkeypatch): - p = testdir.makepyfile(skipping1=""" + p = testdir.makepyfile( + skipping1=""" import pytest pytest.skip("hello") - """) + """ + ) p.copy(p.dirpath("skipping2.py")) monkeypatch.setenv("PYTEST_PLUGINS", "skipping2") result = testdir.runpytest("-rw", "-p", "skipping1", syspathinsert=True) assert result.ret == EXIT_NOTESTSCOLLECTED - result.stdout.fnmatch_lines([ - "*skipped plugin*skipping1*hello*", - "*skipped plugin*skipping2*hello*", - ]) + result.stdout.fnmatch_lines( + ["*skipped plugin*skipping1*hello*", "*skipped plugin*skipping2*hello*"] + ) def test_consider_env_plugin_instantiation(self, testdir, monkeypatch, pytestpm): testdir.syspathinsert() testdir.makepyfile(xy123="#") - monkeypatch.setitem(os.environ, 'PYTEST_PLUGINS', 'xy123') + monkeypatch.setitem(os.environ, "PYTEST_PLUGINS", "xy123") l1 = len(pytestpm.get_plugins()) pytestpm.consider_env() l2 = len(pytestpm.get_plugins()) assert l2 == l1 + 1 - assert pytestpm.get_plugin('xy123') + assert pytestpm.get_plugin("xy123") pytestpm.consider_env() l3 = len(pytestpm.get_plugins()) assert l2 == l3 def test_pluginmanager_ENV_startup(self, testdir, monkeypatch): testdir.makepyfile(pytest_x500="#") - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest def test_hello(pytestconfig): plugin = pytestconfig.pluginmanager.get_plugin('pytest_x500') assert plugin is not None - """) - monkeypatch.setenv('PYTEST_PLUGINS', 'pytest_x500', prepend=",") + """ + ) + monkeypatch.setenv("PYTEST_PLUGINS", "pytest_x500", prepend=",") result = testdir.runpytest(p, syspathinsert=True) assert result.ret == 0 result.stdout.fnmatch_lines(["*1 passed*"]) @@ -318,7 +341,7 @@ class TestPytestPluginManager(object): len2 = len(pytestpm.get_plugins()) assert len1 == len2 plugin1 = pytestpm.get_plugin("pytest_hello") - assert plugin1.__name__.endswith('pytest_hello') + assert plugin1.__name__.endswith("pytest_hello") plugin2 = pytestpm.get_plugin("pytest_hello") assert plugin2 is plugin1 @@ -340,9 +363,11 @@ class TestPytestPluginManager(object): class TestPytestPluginManagerBootstrapming(object): + def test_preparse_args(self, pytestpm): - pytest.raises(ImportError, lambda: - pytestpm.consider_preparse(["xyz", "-p", "hello123"])) + pytest.raises( + ImportError, lambda: pytestpm.consider_preparse(["xyz", "-p", "hello123"]) + ) def test_plugin_prevent_register(self, pytestpm): pytestpm.consider_preparse(["xyz", "-p", "no:abc"]) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_pytester.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_pytester.py index 9508c2954e8..b74c0b7f70c 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_pytester.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_pytester.py @@ -1,8 +1,12 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function -import pytest import os +import py.path +import pytest +import sys +import _pytest.pytester as pytester from _pytest.pytester import HookRecorder +from _pytest.pytester import CwdSnapshot, SysModulesSnapshot, SysPathsSnapshot from _pytest.config import PytestPluginManager from _pytest.main import EXIT_OK, EXIT_TESTSFAILED @@ -33,6 +37,7 @@ def test_make_hook_recorder(testdir): failed = False skipped = True when = "call" + rep.passed = False rep.skipped = True recorder.hook.pytest_runtest_logreport(report=rep) @@ -67,24 +72,28 @@ def test_parseconfig(testdir): def test_testdir_runs_with_plugin(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ pytest_plugins = "pytester" def test_hello(testdir): assert 1 - """) + """ + ) result = testdir.runpytest() result.assert_outcomes(passed=1) def make_holder(): + class apiclass(object): + def pytest_xyz(self, arg): "x" def pytest_xyz_noarg(self): "x" - apimod = type(os)('api') + apimod = type(os)("api") def pytest_xyz(arg): "x" @@ -126,24 +135,267 @@ def test_makepyfile_utf8(testdir): utf8_contents = u""" def setup_function(function): mixed_encoding = u'São Paulo' - """.encode('utf-8') + """.encode( + "utf-8" + ) p = testdir.makepyfile(utf8_contents) - assert u"mixed_encoding = u'São Paulo'".encode('utf-8') in p.read('rb') + assert u"mixed_encoding = u'São Paulo'".encode("utf-8") in p.read("rb") -def test_inline_run_clean_modules(testdir): - test_mod = testdir.makepyfile("def test_foo(): assert True") - result = testdir.inline_run(str(test_mod)) - assert result.ret == EXIT_OK - # rewrite module, now test should fail if module was re-imported - test_mod.write("def test_foo(): assert False") - result2 = testdir.inline_run(str(test_mod)) - assert result2.ret == EXIT_TESTSFAILED +class TestInlineRunModulesCleanup(object): + + def test_inline_run_test_module_not_cleaned_up(self, testdir): + test_mod = testdir.makepyfile("def test_foo(): assert True") + result = testdir.inline_run(str(test_mod)) + assert result.ret == EXIT_OK + # rewrite module, now test should fail if module was re-imported + test_mod.write("def test_foo(): assert False") + result2 = testdir.inline_run(str(test_mod)) + assert result2.ret == EXIT_TESTSFAILED + + def spy_factory(self): + + class SysModulesSnapshotSpy(object): + instances = [] + + def __init__(self, preserve=None): + SysModulesSnapshotSpy.instances.append(self) + self._spy_restore_count = 0 + self._spy_preserve = preserve + self.__snapshot = SysModulesSnapshot(preserve=preserve) + + def restore(self): + self._spy_restore_count += 1 + return self.__snapshot.restore() + + return SysModulesSnapshotSpy + + def test_inline_run_taking_and_restoring_a_sys_modules_snapshot( + self, testdir, monkeypatch + ): + spy_factory = self.spy_factory() + monkeypatch.setattr(pytester, "SysModulesSnapshot", spy_factory) + original = dict(sys.modules) + testdir.syspathinsert() + testdir.makepyfile(import1="# you son of a silly person") + testdir.makepyfile(import2="# my hovercraft is full of eels") + test_mod = testdir.makepyfile( + """ + import import1 + def test_foo(): import import2""" + ) + testdir.inline_run(str(test_mod)) + assert len(spy_factory.instances) == 1 + spy = spy_factory.instances[0] + assert spy._spy_restore_count == 1 + assert sys.modules == original + assert all(sys.modules[x] is original[x] for x in sys.modules) + + def test_inline_run_sys_modules_snapshot_restore_preserving_modules( + self, testdir, monkeypatch + ): + spy_factory = self.spy_factory() + monkeypatch.setattr(pytester, "SysModulesSnapshot", spy_factory) + test_mod = testdir.makepyfile("def test_foo(): pass") + testdir.inline_run(str(test_mod)) + spy = spy_factory.instances[0] + assert not spy._spy_preserve("black_knight") + assert spy._spy_preserve("zope") + assert spy._spy_preserve("zope.interface") + assert spy._spy_preserve("zopelicious") + + def test_external_test_module_imports_not_cleaned_up(self, testdir): + testdir.syspathinsert() + testdir.makepyfile(imported="data = 'you son of a silly person'") + import imported + + test_mod = testdir.makepyfile( + """ + def test_foo(): + import imported + imported.data = 42""" + ) + testdir.inline_run(str(test_mod)) + assert imported.data == 42 -def test_assert_outcomes_after_pytest_erro(testdir): +def test_inline_run_clean_sys_paths(testdir): + + def test_sys_path_change_cleanup(self, testdir): + test_path1 = testdir.tmpdir.join("boink1").strpath + test_path2 = testdir.tmpdir.join("boink2").strpath + test_path3 = testdir.tmpdir.join("boink3").strpath + sys.path.append(test_path1) + sys.meta_path.append(test_path1) + original_path = list(sys.path) + original_meta_path = list(sys.meta_path) + test_mod = testdir.makepyfile( + """ + import sys + sys.path.append({:test_path2}) + sys.meta_path.append({:test_path2}) + def test_foo(): + sys.path.append({:test_path3}) + sys.meta_path.append({:test_path3})""".format( + locals() + ) + ) + testdir.inline_run(str(test_mod)) + assert sys.path == original_path + assert sys.meta_path == original_meta_path + + def spy_factory(self): + + class SysPathsSnapshotSpy(object): + instances = [] + + def __init__(self): + SysPathsSnapshotSpy.instances.append(self) + self._spy_restore_count = 0 + self.__snapshot = SysPathsSnapshot() + + def restore(self): + self._spy_restore_count += 1 + return self.__snapshot.restore() + + return SysPathsSnapshotSpy + + def test_inline_run_taking_and_restoring_a_sys_paths_snapshot( + self, testdir, monkeypatch + ): + spy_factory = self.spy_factory() + monkeypatch.setattr(pytester, "SysPathsSnapshot", spy_factory) + test_mod = testdir.makepyfile("def test_foo(): pass") + testdir.inline_run(str(test_mod)) + assert len(spy_factory.instances) == 1 + spy = spy_factory.instances[0] + assert spy._spy_restore_count == 1 + + +def test_assert_outcomes_after_pytest_error(testdir): testdir.makepyfile("def test_foo(): assert True") - result = testdir.runpytest('--unexpected-argument') + result = testdir.runpytest("--unexpected-argument") with pytest.raises(ValueError, message="Pytest terminal report not found"): result.assert_outcomes(passed=0) + + +def test_cwd_snapshot(tmpdir): + foo = tmpdir.ensure("foo", dir=1) + bar = tmpdir.ensure("bar", dir=1) + foo.chdir() + snapshot = CwdSnapshot() + bar.chdir() + assert py.path.local() == bar + snapshot.restore() + assert py.path.local() == foo + + +class TestSysModulesSnapshot(object): + key = "my-test-module" + + def test_remove_added(self): + original = dict(sys.modules) + assert self.key not in sys.modules + snapshot = SysModulesSnapshot() + sys.modules[self.key] = "something" + assert self.key in sys.modules + snapshot.restore() + assert sys.modules == original + + def test_add_removed(self, monkeypatch): + assert self.key not in sys.modules + monkeypatch.setitem(sys.modules, self.key, "something") + assert self.key in sys.modules + original = dict(sys.modules) + snapshot = SysModulesSnapshot() + del sys.modules[self.key] + assert self.key not in sys.modules + snapshot.restore() + assert sys.modules == original + + def test_restore_reloaded(self, monkeypatch): + assert self.key not in sys.modules + monkeypatch.setitem(sys.modules, self.key, "something") + assert self.key in sys.modules + original = dict(sys.modules) + snapshot = SysModulesSnapshot() + sys.modules[self.key] = "something else" + snapshot.restore() + assert sys.modules == original + + def test_preserve_modules(self, monkeypatch): + key = [self.key + str(i) for i in range(3)] + assert not any(k in sys.modules for k in key) + for i, k in enumerate(key): + monkeypatch.setitem(sys.modules, k, "something" + str(i)) + original = dict(sys.modules) + + def preserve(name): + return name in (key[0], key[1], "some-other-key") + + snapshot = SysModulesSnapshot(preserve=preserve) + sys.modules[key[0]] = original[key[0]] = "something else0" + sys.modules[key[1]] = original[key[1]] = "something else1" + sys.modules[key[2]] = "something else2" + snapshot.restore() + assert sys.modules == original + + def test_preserve_container(self, monkeypatch): + original = dict(sys.modules) + assert self.key not in original + replacement = dict(sys.modules) + replacement[self.key] = "life of brian" + snapshot = SysModulesSnapshot() + monkeypatch.setattr(sys, "modules", replacement) + snapshot.restore() + assert sys.modules is replacement + assert sys.modules == original + + +@pytest.mark.parametrize("path_type", ("path", "meta_path")) +class TestSysPathsSnapshot(object): + other_path = {"path": "meta_path", "meta_path": "path"} + + @staticmethod + def path(n): + return "my-dirty-little-secret-" + str(n) + + def test_restore(self, monkeypatch, path_type): + other_path_type = self.other_path[path_type] + for i in range(10): + assert self.path(i) not in getattr(sys, path_type) + sys_path = [self.path(i) for i in range(6)] + monkeypatch.setattr(sys, path_type, sys_path) + original = list(sys_path) + original_other = list(getattr(sys, other_path_type)) + snapshot = SysPathsSnapshot() + transformation = { + "source": (0, 1, 2, 3, 4, 5), "target": (6, 2, 9, 7, 5, 8) + } # noqa: E201 + assert sys_path == [self.path(x) for x in transformation["source"]] + sys_path[1] = self.path(6) + sys_path[3] = self.path(7) + sys_path.append(self.path(8)) + del sys_path[4] + sys_path[3:3] = [self.path(9)] + del sys_path[0] + assert sys_path == [self.path(x) for x in transformation["target"]] + snapshot.restore() + assert getattr(sys, path_type) is sys_path + assert getattr(sys, path_type) == original + assert getattr(sys, other_path_type) == original_other + + def test_preserve_container(self, monkeypatch, path_type): + other_path_type = self.other_path[path_type] + original_data = list(getattr(sys, path_type)) + original_other = getattr(sys, other_path_type) + original_other_data = list(original_other) + new = [] + snapshot = SysPathsSnapshot() + monkeypatch.setattr(sys, path_type, new) + snapshot.restore() + assert getattr(sys, path_type) is new + assert getattr(sys, path_type) == original_data + assert getattr(sys, other_path_type) is original_other + assert getattr(sys, other_path_type) == original_other_data diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_recwarn.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_recwarn.py index 31e70460fe4..a8e2fb80378 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_recwarn.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_recwarn.py @@ -1,32 +1,34 @@ from __future__ import absolute_import, division, print_function import warnings import re -import py import pytest from _pytest.recwarn import WarningsRecorder def test_recwarn_functional(testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ import warnings def test_method(recwarn): warnings.warn("hello") warn = recwarn.pop() assert isinstance(warn.message, UserWarning) - """) + """ + ) res = reprec.countoutcomes() assert tuple(res) == (1, 0, 0), res class TestWarningsRecorderChecker(object): + def test_recording(self): rec = WarningsRecorder() with rec: assert not rec.list - py.std.warnings.warn_explicit("hello", UserWarning, "xyz", 13) + warnings.warn_explicit("hello", UserWarning, "xyz", 13) assert len(rec.list) == 1 - py.std.warnings.warn(DeprecationWarning("hello")) + warnings.warn(DeprecationWarning("hello")) assert len(rec.list) == 2 warn = rec.pop() assert str(warn.message) == "hello" @@ -38,10 +40,11 @@ class TestWarningsRecorderChecker(object): def test_typechecking(self): from _pytest.recwarn import WarningsChecker + with pytest.raises(TypeError): WarningsChecker(5) with pytest.raises(TypeError): - WarningsChecker(('hi', RuntimeWarning)) + WarningsChecker(("hi", RuntimeWarning)) with pytest.raises(TypeError): WarningsChecker([DeprecationWarning, RuntimeWarning]) @@ -64,19 +67,19 @@ class TestDeprecatedCall(object): def dep(self, i, j=None): if i == 0: - py.std.warnings.warn("is deprecated", DeprecationWarning, - stacklevel=1) + warnings.warn("is deprecated", DeprecationWarning, stacklevel=1) return 42 def dep_explicit(self, i): if i == 0: - py.std.warnings.warn_explicit("dep_explicit", category=DeprecationWarning, - filename="hello", lineno=3) + warnings.warn_explicit( + "dep_explicit", category=DeprecationWarning, filename="hello", lineno=3 + ) def test_deprecated_call_raises(self): with pytest.raises(AssertionError) as excinfo: pytest.deprecated_call(self.dep, 3, 5) - assert 'Did not produce' in str(excinfo) + assert "Did not produce" in str(excinfo) def test_deprecated_call(self): pytest.deprecated_call(self.dep, 0, 5) @@ -86,16 +89,16 @@ class TestDeprecatedCall(object): assert ret == 42 def test_deprecated_call_preserves(self): - onceregistry = py.std.warnings.onceregistry.copy() - filters = py.std.warnings.filters[:] - warn = py.std.warnings.warn - warn_explicit = py.std.warnings.warn_explicit + onceregistry = warnings.onceregistry.copy() + filters = warnings.filters[:] + warn = warnings.warn + warn_explicit = warnings.warn_explicit self.test_deprecated_call_raises() self.test_deprecated_call() - assert onceregistry == py.std.warnings.onceregistry - assert filters == py.std.warnings.filters - assert warn is py.std.warnings.warn - assert warn_explicit is py.std.warnings.warn_explicit + assert onceregistry == warnings.onceregistry + assert filters == warnings.filters + assert warn is warnings.warn + assert warn_explicit is warnings.warn_explicit def test_deprecated_explicit_call_raises(self): with pytest.raises(AssertionError): @@ -105,30 +108,34 @@ class TestDeprecatedCall(object): pytest.deprecated_call(self.dep_explicit, 0) pytest.deprecated_call(self.dep_explicit, 0) - @pytest.mark.parametrize('mode', ['context_manager', 'call']) + @pytest.mark.parametrize("mode", ["context_manager", "call"]) def test_deprecated_call_no_warning(self, mode): """Ensure deprecated_call() raises the expected failure when its block/function does not raise a deprecation warning. """ + def f(): pass - msg = 'Did not produce DeprecationWarning or PendingDeprecationWarning' - with pytest.raises(AssertionError, matches=msg): - if mode == 'call': + msg = "Did not produce DeprecationWarning or PendingDeprecationWarning" + with pytest.raises(AssertionError, match=msg): + if mode == "call": pytest.deprecated_call(f) else: with pytest.deprecated_call(): f() - @pytest.mark.parametrize('warning_type', [PendingDeprecationWarning, DeprecationWarning]) - @pytest.mark.parametrize('mode', ['context_manager', 'call']) - @pytest.mark.parametrize('call_f_first', [True, False]) - @pytest.mark.filterwarnings('ignore') + @pytest.mark.parametrize( + "warning_type", [PendingDeprecationWarning, DeprecationWarning] + ) + @pytest.mark.parametrize("mode", ["context_manager", "call"]) + @pytest.mark.parametrize("call_f_first", [True, False]) + @pytest.mark.filterwarnings("ignore") def test_deprecated_call_modes(self, warning_type, mode, call_f_first): """Ensure deprecated_call() captures a deprecation warning as expected inside its block/function. """ + def f(): warnings.warn(warning_type("hi")) return 10 @@ -136,31 +143,40 @@ class TestDeprecatedCall(object): # ensure deprecated_call() can capture the warning even if it has already been triggered if call_f_first: assert f() == 10 - if mode == 'call': + if mode == "call": assert pytest.deprecated_call(f) == 10 else: with pytest.deprecated_call(): assert f() == 10 - @pytest.mark.parametrize('mode', ['context_manager', 'call']) + @pytest.mark.parametrize("mode", ["context_manager", "call"]) def test_deprecated_call_exception_is_raised(self, mode): """If the block of the code being tested by deprecated_call() raises an exception, it must raise the exception undisturbed. """ - def f(): - raise ValueError('some exception') - with pytest.raises(ValueError, match='some exception'): - if mode == 'call': + def f(): + raise ValueError("some exception") + + with pytest.raises(ValueError, match="some exception"): + if mode == "call": pytest.deprecated_call(f) else: with pytest.deprecated_call(): f() def test_deprecated_call_specificity(self): - other_warnings = [Warning, UserWarning, SyntaxWarning, RuntimeWarning, - FutureWarning, ImportWarning, UnicodeWarning] + other_warnings = [ + Warning, + UserWarning, + SyntaxWarning, + RuntimeWarning, + FutureWarning, + ImportWarning, + UnicodeWarning, + ] for warning in other_warnings: + def f(): warnings.warn(warning("hi")) @@ -172,29 +188,35 @@ class TestDeprecatedCall(object): class TestWarns(object): + def test_strings(self): # different messages, b/c Python suppresses multiple identical warnings source1 = "warnings.warn('w1', RuntimeWarning)" source2 = "warnings.warn('w2', RuntimeWarning)" source3 = "warnings.warn('w3', RuntimeWarning)" pytest.warns(RuntimeWarning, source1) - pytest.raises(pytest.fail.Exception, - lambda: pytest.warns(UserWarning, source2)) + pytest.raises(pytest.fail.Exception, lambda: pytest.warns(UserWarning, source2)) pytest.warns(RuntimeWarning, source3) def test_function(self): - pytest.warns(SyntaxWarning, - lambda msg: warnings.warn(msg, SyntaxWarning), "syntax") + pytest.warns( + SyntaxWarning, lambda msg: warnings.warn(msg, SyntaxWarning), "syntax" + ) def test_warning_tuple(self): - pytest.warns((RuntimeWarning, SyntaxWarning), - lambda: warnings.warn('w1', RuntimeWarning)) - pytest.warns((RuntimeWarning, SyntaxWarning), - lambda: warnings.warn('w2', SyntaxWarning)) - pytest.raises(pytest.fail.Exception, - lambda: pytest.warns( - (RuntimeWarning, SyntaxWarning), - lambda: warnings.warn('w3', UserWarning))) + pytest.warns( + (RuntimeWarning, SyntaxWarning), lambda: warnings.warn("w1", RuntimeWarning) + ) + pytest.warns( + (RuntimeWarning, SyntaxWarning), lambda: warnings.warn("w2", SyntaxWarning) + ) + pytest.raises( + pytest.fail.Exception, + lambda: pytest.warns( + (RuntimeWarning, SyntaxWarning), + lambda: warnings.warn("w3", UserWarning), + ), + ) def test_as_contextmanager(self): with pytest.warns(RuntimeWarning): @@ -206,20 +228,26 @@ class TestWarns(object): with pytest.raises(pytest.fail.Exception) as excinfo: with pytest.warns(RuntimeWarning): warnings.warn("user", UserWarning) - excinfo.match(r"DID NOT WARN. No warnings of type \(.+RuntimeWarning.+,\) was emitted. " - r"The list of emitted warnings is: \[UserWarning\('user',\)\].") + excinfo.match( + r"DID NOT WARN. No warnings of type \(.+RuntimeWarning.+,\) was emitted. " + r"The list of emitted warnings is: \[UserWarning\('user',?\)\]." + ) with pytest.raises(pytest.fail.Exception) as excinfo: with pytest.warns(UserWarning): warnings.warn("runtime", RuntimeWarning) - excinfo.match(r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) was emitted. " - r"The list of emitted warnings is: \[RuntimeWarning\('runtime',\)\].") + excinfo.match( + r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) was emitted. " + r"The list of emitted warnings is: \[RuntimeWarning\('runtime',?\)\]." + ) with pytest.raises(pytest.fail.Exception) as excinfo: with pytest.warns(UserWarning): pass - excinfo.match(r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) was emitted. " - r"The list of emitted warnings is: \[\].") + excinfo.match( + r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) was emitted. " + r"The list of emitted warnings is: \[\]." + ) warning_classes = (UserWarning, FutureWarning) with pytest.raises(pytest.fail.Exception) as excinfo: @@ -227,10 +255,17 @@ class TestWarns(object): warnings.warn("runtime", RuntimeWarning) warnings.warn("import", ImportWarning) - message_template = ("DID NOT WARN. No warnings of type {0} was emitted. " - "The list of emitted warnings is: {1}.") - excinfo.match(re.escape(message_template.format(warning_classes, - [each.message for each in warninfo]))) + message_template = ( + "DID NOT WARN. No warnings of type {0} was emitted. " + "The list of emitted warnings is: {1}." + ) + excinfo.match( + re.escape( + message_template.format( + warning_classes, [each.message for each in warninfo] + ) + ) + ) def test_record(self): with pytest.warns(UserWarning) as record: @@ -273,7 +308,8 @@ class TestWarns(object): def test_double_test(self, testdir): """If a test is run again, the warning should still be raised""" - testdir.makepyfile(''' + testdir.makepyfile( + """ import pytest import warnings @@ -281,30 +317,31 @@ class TestWarns(object): def test(run): with pytest.warns(RuntimeWarning): warnings.warn("runtime", RuntimeWarning) - ''') + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(['*2 passed in*']) + result.stdout.fnmatch_lines(["*2 passed in*"]) def test_match_regex(self): - with pytest.warns(UserWarning, match=r'must be \d+$'): + with pytest.warns(UserWarning, match=r"must be \d+$"): warnings.warn("value must be 42", UserWarning) with pytest.raises(pytest.fail.Exception): - with pytest.warns(UserWarning, match=r'must be \d+$'): + with pytest.warns(UserWarning, match=r"must be \d+$"): warnings.warn("this is not here", UserWarning) with pytest.raises(pytest.fail.Exception): - with pytest.warns(FutureWarning, match=r'must be \d+$'): + with pytest.warns(FutureWarning, match=r"must be \d+$"): warnings.warn("value must be 42", UserWarning) def test_one_from_multiple_warns(self): - with pytest.warns(UserWarning, match=r'aaa'): + with pytest.warns(UserWarning, match=r"aaa"): warnings.warn("cccccccccc", UserWarning) warnings.warn("bbbbbbbbbb", UserWarning) warnings.warn("aaaaaaaaaa", UserWarning) def test_none_of_multiple_warns(self): with pytest.raises(pytest.fail.Exception): - with pytest.warns(UserWarning, match=r'aaa'): + with pytest.warns(UserWarning, match=r"aaa"): warnings.warn("bbbbbbbbbb", UserWarning) warnings.warn("cccccccccc", UserWarning) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_resultlog.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_resultlog.py index b7dd2687cdf..173384ffb30 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_resultlog.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_resultlog.py @@ -4,72 +4,77 @@ import os import _pytest._code import py import pytest -from _pytest.main import Node, Item, FSCollector -from _pytest.resultlog import generic_path, ResultLog, \ - pytest_configure, pytest_unconfigure +from _pytest.nodes import Node, Item, FSCollector +from _pytest.resultlog import ( + generic_path, + ResultLog, + pytest_configure, + pytest_unconfigure, +) def test_generic_path(testdir): from _pytest.main import Session + config = testdir.parseconfig() session = Session(config) - p1 = Node('a', config=config, session=session) + p1 = Node("a", config=config, session=session, nodeid="a") # assert p1.fspath is None - p2 = Node('B', parent=p1) - p3 = Node('()', parent=p2) - item = Item('c', parent=p3) + p2 = Node("B", parent=p1) + p3 = Node("()", parent=p2) + item = Item("c", parent=p3) res = generic_path(item) - assert res == 'a.B().c' + assert res == "a.B().c" - p0 = FSCollector('proj/test', config=config, session=session) - p1 = FSCollector('proj/test/a', parent=p0) - p2 = Node('B', parent=p1) - p3 = Node('()', parent=p2) - p4 = Node('c', parent=p3) - item = Item('[1]', parent=p4) + p0 = FSCollector("proj/test", config=config, session=session) + p1 = FSCollector("proj/test/a", parent=p0) + p2 = Node("B", parent=p1) + p3 = Node("()", parent=p2) + p4 = Node("c", parent=p3) + item = Item("[1]", parent=p4) res = generic_path(item) - assert res == 'test/a:B().c[1]' + assert res == "test/a:B().c[1]" def test_write_log_entry(): reslog = ResultLog(None, None) reslog.logfile = py.io.TextIO() - reslog.write_log_entry('name', '.', '') + reslog.write_log_entry("name", ".", "") entry = reslog.logfile.getvalue() - assert entry[-1] == '\n' + assert entry[-1] == "\n" entry_lines = entry.splitlines() assert len(entry_lines) == 1 - assert entry_lines[0] == '. name' + assert entry_lines[0] == ". name" reslog.logfile = py.io.TextIO() - reslog.write_log_entry('name', 's', 'Skipped') + reslog.write_log_entry("name", "s", "Skipped") entry = reslog.logfile.getvalue() - assert entry[-1] == '\n' + assert entry[-1] == "\n" entry_lines = entry.splitlines() assert len(entry_lines) == 2 - assert entry_lines[0] == 's name' - assert entry_lines[1] == ' Skipped' + assert entry_lines[0] == "s name" + assert entry_lines[1] == " Skipped" reslog.logfile = py.io.TextIO() - reslog.write_log_entry('name', 's', 'Skipped\n') + reslog.write_log_entry("name", "s", "Skipped\n") entry = reslog.logfile.getvalue() - assert entry[-1] == '\n' + assert entry[-1] == "\n" entry_lines = entry.splitlines() assert len(entry_lines) == 2 - assert entry_lines[0] == 's name' - assert entry_lines[1] == ' Skipped' + assert entry_lines[0] == "s name" + assert entry_lines[1] == " Skipped" reslog.logfile = py.io.TextIO() - longrepr = ' tb1\n tb 2\nE tb3\nSome Error' - reslog.write_log_entry('name', 'F', longrepr) + longrepr = " tb1\n tb 2\nE tb3\nSome Error" + reslog.write_log_entry("name", "F", longrepr) entry = reslog.logfile.getvalue() - assert entry[-1] == '\n' + assert entry[-1] == "\n" entry_lines = entry.splitlines() assert len(entry_lines) == 5 - assert entry_lines[0] == 'F name' - assert entry_lines[1:] == [' ' + line for line in longrepr.splitlines()] + assert entry_lines[0] == "F name" + assert entry_lines[1:] == [" " + line for line in longrepr.splitlines()] class TestWithFunctionIntegration(object): @@ -98,7 +103,8 @@ class TestWithFunctionIntegration(object): assert "XXX" in "".join(lines[1:]) def test_log_test_outcomes(self, testdir): - mod = testdir.makepyfile(test_mod=""" + mod = testdir.makepyfile( + test_mod=""" import pytest def test_pass(): pass def test_skip(): pytest.skip("hello") @@ -109,7 +115,8 @@ class TestWithFunctionIntegration(object): @pytest.mark.xfail def test_xpass(): pass - """) + """ + ) lines = self.getresultlog(testdir, mod) assert len(lines) >= 3 assert lines[0].startswith(". ") @@ -123,11 +130,11 @@ class TestWithFunctionIntegration(object): tb = "".join(lines[4:8]) assert tb.find('raise ValueError("FAIL")') != -1 - assert lines[8].startswith('x ') + assert lines[8].startswith("x ") tb = "".join(lines[8:14]) assert tb.find('raise ValueError("XFAIL")') != -1 - assert lines[14].startswith('X ') + assert lines[14].startswith("X ") assert len(lines) == 15 @pytest.mark.parametrize("style", ("native", "long", "short")) @@ -143,16 +150,17 @@ class TestWithFunctionIntegration(object): entry = reslog.logfile.getvalue() entry_lines = entry.splitlines() - assert entry_lines[0].startswith('! ') + assert entry_lines[0].startswith("! ") if style != "native": assert os.path.basename(__file__)[:-9] in entry_lines[0] # .pyc/class - assert entry_lines[-1][0] == ' ' - assert 'ValueError' in entry + assert entry_lines[-1][0] == " " + assert "ValueError" in entry def test_generic(testdir, LineMatcher): testdir.plugins.append("resultlog") - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def test_pass(): pass @@ -166,51 +174,55 @@ def test_generic(testdir, LineMatcher): @pytest.mark.xfail(run=False) def test_xfail_norun(): assert 0 - """) + """ + ) testdir.runpytest("--resultlog=result.log") lines = testdir.tmpdir.join("result.log").readlines(cr=0) - LineMatcher(lines).fnmatch_lines([ - ". *:test_pass", - "F *:test_fail", - "s *:test_skip", - "x *:test_xfail", - "x *:test_xfail_norun", - ]) + LineMatcher(lines).fnmatch_lines( + [ + ". *:test_pass", + "F *:test_fail", + "s *:test_skip", + "x *:test_xfail", + "x *:test_xfail_norun", + ] + ) def test_makedir_for_resultlog(testdir, LineMatcher): """--resultlog should automatically create directories for the log file""" testdir.plugins.append("resultlog") - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def test_pass(): pass - """) + """ + ) testdir.runpytest("--resultlog=path/to/result.log") lines = testdir.tmpdir.join("path/to/result.log").readlines(cr=0) - LineMatcher(lines).fnmatch_lines([ - ". *:test_pass", - ]) + LineMatcher(lines).fnmatch_lines([". *:test_pass"]) def test_no_resultlog_on_slaves(testdir): config = testdir.parseconfig("-p", "resultlog", "--resultlog=resultlog") - assert not hasattr(config, '_resultlog') + assert not hasattr(config, "_resultlog") pytest_configure(config) - assert hasattr(config, '_resultlog') + assert hasattr(config, "_resultlog") pytest_unconfigure(config) - assert not hasattr(config, '_resultlog') + assert not hasattr(config, "_resultlog") config.slaveinput = {} pytest_configure(config) - assert not hasattr(config, '_resultlog') + assert not hasattr(config, "_resultlog") pytest_unconfigure(config) - assert not hasattr(config, '_resultlog') + assert not hasattr(config, "_resultlog") def test_failure_issue380(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest class MyCollector(pytest.File): def collect(self): @@ -219,10 +231,13 @@ def test_failure_issue380(testdir): return "somestring" def pytest_collect_file(path, parent): return MyCollector(parent=parent, fspath=path) - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ def test_func(): pass - """) + """ + ) result = testdir.runpytest("--resultlog=log") assert result.ret == 2 diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_runner.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_runner.py index c8e2a6463a0..f5430a90da5 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_runner.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_runner.py @@ -2,14 +2,17 @@ from __future__ import absolute_import, division, print_function import _pytest._code +import inspect import os import py import pytest import sys +import types from _pytest import runner, main, outcomes class TestSetupState(object): + def test_setup(self, testdir): ss = runner.SetupState() item = testdir.getitem("def test_func(): pass") @@ -28,11 +31,13 @@ class TestSetupState(object): ss.teardown_exact(item, None) def test_setup_fails_and_failure_is_cached(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ def setup_module(mod): raise ValueError(42) def test_func(): pass - """) # noqa + """ + ) ss = runner.SetupState() pytest.raises(ValueError, lambda: ss.prepare(item)) pytest.raises(ValueError, lambda: ss.prepare(item)) @@ -41,13 +46,13 @@ class TestSetupState(object): r = [] def fin1(): - r.append('fin1') + r.append("fin1") def fin2(): - raise Exception('oops') + raise Exception("oops") def fin3(): - r.append('fin3') + r.append("fin3") item = testdir.getitem("def test_func(): pass") ss = runner.SetupState() @@ -56,17 +61,17 @@ class TestSetupState(object): ss.addfinalizer(fin3, item) with pytest.raises(Exception) as err: ss._callfinalizers(item) - assert err.value.args == ('oops',) - assert r == ['fin3', 'fin1'] + assert err.value.args == ("oops",) + assert r == ["fin3", "fin1"] def test_teardown_multiple_fail(self, testdir): # Ensure the first exception is the one which is re-raised. # Ideally both would be reported however. def fin1(): - raise Exception('oops1') + raise Exception("oops1") def fin2(): - raise Exception('oops2') + raise Exception("oops2") item = testdir.getitem("def test_func(): pass") ss = runner.SetupState() @@ -74,15 +79,36 @@ class TestSetupState(object): ss.addfinalizer(fin2, item) with pytest.raises(Exception) as err: ss._callfinalizers(item) - assert err.value.args == ('oops2',) + assert err.value.args == ("oops2",) + + def test_teardown_multiple_scopes_one_fails(self, testdir): + module_teardown = [] + + def fin_func(): + raise Exception("oops1") + + def fin_module(): + module_teardown.append("fin_module") + + item = testdir.getitem("def test_func(): pass") + ss = runner.SetupState() + ss.addfinalizer(fin_module, item.listchain()[-2]) + ss.addfinalizer(fin_func, item) + ss.prepare(item) + with pytest.raises(Exception, match="oops1"): + ss.teardown_exact(item, None) + assert module_teardown class BaseFunctionalTests(object): + def test_passfunction(self, testdir): - reports = testdir.runitem(""" + reports = testdir.runitem( + """ def test_func(): pass - """) + """ + ) rep = reports[1] assert rep.passed assert not rep.failed @@ -90,10 +116,12 @@ class BaseFunctionalTests(object): assert not rep.longrepr def test_failfunction(self, testdir): - reports = testdir.runitem(""" + reports = testdir.runitem( + """ def test_func(): assert 0 - """) + """ + ) rep = reports[1] assert not rep.passed assert not rep.skipped @@ -103,11 +131,13 @@ class BaseFunctionalTests(object): # assert isinstance(rep.longrepr, ReprExceptionInfo) def test_skipfunction(self, testdir): - reports = testdir.runitem(""" + reports = testdir.runitem( + """ import pytest def test_func(): pytest.skip("hello") - """) + """ + ) rep = reports[1] assert not rep.failed assert not rep.passed @@ -121,13 +151,15 @@ class BaseFunctionalTests(object): # assert not rep.skipped.failurerepr def test_skip_in_setup_function(self, testdir): - reports = testdir.runitem(""" + reports = testdir.runitem( + """ import pytest def setup_function(func): pytest.skip("hello") def test_func(): pass - """) + """ + ) print(reports) rep = reports[0] assert not rep.failed @@ -140,13 +172,15 @@ class BaseFunctionalTests(object): assert reports[1].passed # teardown def test_failure_in_setup_function(self, testdir): - reports = testdir.runitem(""" + reports = testdir.runitem( + """ import pytest def setup_function(func): raise ValueError(42) def test_func(): pass - """) + """ + ) rep = reports[0] assert not rep.skipped assert not rep.passed @@ -155,13 +189,15 @@ class BaseFunctionalTests(object): assert len(reports) == 2 def test_failure_in_teardown_function(self, testdir): - reports = testdir.runitem(""" + reports = testdir.runitem( + """ import pytest def teardown_function(func): raise ValueError(42) def test_func(): pass - """) + """ + ) print(reports) assert len(reports) == 3 rep = reports[2] @@ -173,17 +209,21 @@ class BaseFunctionalTests(object): # assert rep.longrepr.reprtraceback.reprentries def test_custom_failure_repr(self, testdir): - testdir.makepyfile(conftest=""" + testdir.makepyfile( + conftest=""" import pytest class Function(pytest.Function): def repr_failure(self, excinfo): return "hello" - """) - reports = testdir.runitem(""" + """ + ) + reports = testdir.runitem( + """ import pytest def test_func(): assert 0 - """) + """ + ) rep = reports[1] assert not rep.skipped assert not rep.passed @@ -194,16 +234,36 @@ class BaseFunctionalTests(object): # assert rep.failed.failurerepr == "hello" def test_teardown_final_returncode(self, testdir): - rec = testdir.inline_runsource(""" + rec = testdir.inline_runsource( + """ def test_func(): pass def teardown_function(func): raise ValueError(42) - """) + """ + ) assert rec.ret == 1 + def test_logstart_logfinish_hooks(self, testdir): + rec = testdir.inline_runsource( + """ + import pytest + def test_func(): + pass + """ + ) + reps = rec.getcalls("pytest_runtest_logstart pytest_runtest_logfinish") + assert ( + [x._name for x in reps] + == ["pytest_runtest_logstart", "pytest_runtest_logfinish"] + ) + for rep in reps: + assert rep.nodeid == "test_logstart_logfinish_hooks.py::test_func" + assert rep.location == ("test_logstart_logfinish_hooks.py", 1, "test_func") + def test_exact_teardown_issue90(self, testdir): - rec = testdir.inline_runsource(""" + rec = testdir.inline_runsource( + """ import pytest class TestClass(object): @@ -224,7 +284,8 @@ class BaseFunctionalTests(object): traceback.format_exception(*excinfo) def teardown_function(func): raise ValueError(42) - """) + """ + ) reps = rec.getreports("pytest_runtest_logreport") print(reps) for i in range(2): @@ -242,7 +303,8 @@ class BaseFunctionalTests(object): def test_exact_teardown_issue1206(self, testdir): """issue shadowing error with wrong number of arguments on teardown_method.""" - rec = testdir.inline_runsource(""" + rec = testdir.inline_runsource( + """ import pytest class TestClass(object): @@ -251,18 +313,19 @@ class BaseFunctionalTests(object): def test_method(self): assert True - """) + """ + ) reps = rec.getreports("pytest_runtest_logreport") print(reps) assert len(reps) == 3 # assert reps[0].nodeid.endswith("test_method") assert reps[0].passed - assert reps[0].when == 'setup' + assert reps[0].when == "setup" # assert reps[1].nodeid.endswith("test_method") assert reps[1].passed - assert reps[1].when == 'call' + assert reps[1].when == "call" # assert reps[2].nodeid.endswith("test_method") assert reps[2].failed @@ -271,22 +334,26 @@ class BaseFunctionalTests(object): # python3 error "TypeError: teardown_method() missing 2 required positional arguments: 'y' and 'z'", # python2 error - 'TypeError: teardown_method() takes exactly 4 arguments (2 given)' + "TypeError: teardown_method() takes exactly 4 arguments (2 given)", ) def test_failure_in_setup_function_ignores_custom_repr(self, testdir): - testdir.makepyfile(conftest=""" + testdir.makepyfile( + conftest=""" import pytest class Function(pytest.Function): def repr_failure(self, excinfo): assert 0 - """) - reports = testdir.runitem(""" + """ + ) + reports = testdir.runitem( + """ def setup_function(func): raise ValueError(42) def test_func(): pass - """) + """ + ) assert len(reports) == 2 rep = reports[0] print(rep) @@ -300,10 +367,12 @@ class BaseFunctionalTests(object): def test_systemexit_does_not_bail_out(self, testdir): try: - reports = testdir.runitem(""" + reports = testdir.runitem( + """ def test_func(): raise SystemExit(42) - """) + """ + ) except SystemExit: pytest.fail("runner did not catch SystemExit") rep = reports[1] @@ -312,11 +381,13 @@ class BaseFunctionalTests(object): def test_exit_propagates(self, testdir): try: - testdir.runitem(""" + testdir.runitem( + """ import pytest def test_func(): raise pytest.exit.Exception() - """) + """ + ) except pytest.exit.Exception: pass else: @@ -324,17 +395,22 @@ class BaseFunctionalTests(object): class TestExecutionNonForked(BaseFunctionalTests): + def getrunner(self): + def f(item): return runner.runtestprotocol(item, log=False) + return f def test_keyboardinterrupt_propagates(self, testdir): try: - testdir.runitem(""" + testdir.runitem( + """ def test_func(): raise KeyboardInterrupt("fake") - """) + """ + ) except KeyboardInterrupt: pass else: @@ -350,24 +426,29 @@ class TestExecutionForked(BaseFunctionalTests): return boxed.forked_run_report def test_suicide(self, testdir): - reports = testdir.runitem(""" + reports = testdir.runitem( + """ def test_func(): import os os.kill(os.getpid(), 15) - """) + """ + ) rep = reports[0] assert rep.failed assert rep.when == "???" class TestSessionReports(object): + def test_collect_result(self, testdir): - col = testdir.getmodulecol(""" + col = testdir.getmodulecol( + """ def test_func1(): pass class TestClass(object): pass - """) + """ + ) rep = runner.collect_one_node(col) assert not rep.failed assert not rep.skipped @@ -390,35 +471,39 @@ reporttypes = [ ] -@pytest.mark.parametrize('reporttype', reporttypes, ids=[x.__name__ for x in reporttypes]) +@pytest.mark.parametrize( + "reporttype", reporttypes, ids=[x.__name__ for x in reporttypes] +) def test_report_extra_parameters(reporttype): - if hasattr(py.std.inspect, 'signature'): - args = list(py.std.inspect.signature(reporttype.__init__).parameters.keys())[1:] + if hasattr(inspect, "signature"): + args = list(inspect.signature(reporttype.__init__).parameters.keys())[1:] else: - args = py.std.inspect.getargspec(reporttype.__init__)[0][1:] + args = inspect.getargspec(reporttype.__init__)[0][1:] basekw = dict.fromkeys(args, []) report = reporttype(newthing=1, **basekw) assert report.newthing == 1 def test_callinfo(): - ci = runner.CallInfo(lambda: 0, '123') + ci = runner.CallInfo(lambda: 0, "123") assert ci.when == "123" assert ci.result == 0 assert "result" in repr(ci) - ci = runner.CallInfo(lambda: 0 / 0, '123') + ci = runner.CallInfo(lambda: 0 / 0, "123") assert ci.when == "123" - assert not hasattr(ci, 'result') + assert not hasattr(ci, "result") assert ci.excinfo assert "exc" in repr(ci) + # design question: do we want general hooks in python files? # then something like the following functional tests makes sense @pytest.mark.xfail def test_runtest_in_module_ordering(testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ import pytest def pytest_runtest_setup(item): # runs after class-level! item.function.mylist.append("module") @@ -441,22 +526,21 @@ def test_runtest_in_module_ordering(testdir): assert mylist == ['class', 'module'], mylist def pytest_runtest_teardown(item): del item.function.mylist - """) + """ + ) result = testdir.runpytest(p1) - result.stdout.fnmatch_lines([ - "*2 passed*" - ]) + result.stdout.fnmatch_lines(["*2 passed*"]) def test_outcomeexception_exceptionattributes(): - outcome = outcomes.OutcomeException('test') + outcome = outcomes.OutcomeException("test") assert outcome.args[0] == outcome.msg def test_outcomeexception_passes_except_Exception(): with pytest.raises(outcomes.OutcomeException): try: - raise outcomes.OutcomeException('test') + raise outcomes.OutcomeException("test") except Exception: pass @@ -479,72 +563,76 @@ def test_pytest_fail(): def test_pytest_exit_msg(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest def pytest_configure(config): pytest.exit('oh noes') - """) + """ + ) result = testdir.runpytest() - result.stderr.fnmatch_lines([ - "Exit: oh noes", - ]) + result.stderr.fnmatch_lines(["Exit: oh noes"]) def test_pytest_fail_notrace(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def test_hello(): pytest.fail("hello", pytrace=False) def teardown_function(function): pytest.fail("world", pytrace=False) - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "world", - "hello", - ]) - assert 'def teardown_function' not in result.stdout.str() + result.stdout.fnmatch_lines(["world", "hello"]) + assert "def teardown_function" not in result.stdout.str() -@pytest.mark.parametrize('str_prefix', ['u', '']) +@pytest.mark.parametrize("str_prefix", ["u", ""]) def test_pytest_fail_notrace_non_ascii(testdir, str_prefix): """Fix pytest.fail with pytrace=False with non-ascii characters (#1178). This tests with native and unicode strings containing non-ascii chars. """ - testdir.makepyfile(u""" + testdir.makepyfile( + u""" # coding: utf-8 import pytest def test_hello(): pytest.fail(%s'oh oh: ☺', pytrace=False) - """ % str_prefix) + """ + % str_prefix + ) result = testdir.runpytest() if sys.version_info[0] >= 3: - result.stdout.fnmatch_lines(['*test_hello*', "oh oh: ☺"]) + result.stdout.fnmatch_lines(["*test_hello*", "oh oh: ☺"]) else: - result.stdout.fnmatch_lines(['*test_hello*', "oh oh: *"]) - assert 'def test_hello' not in result.stdout.str() + result.stdout.fnmatch_lines(["*test_hello*", "oh oh: *"]) + assert "def test_hello" not in result.stdout.str() def test_pytest_no_tests_collected_exit_status(testdir): result = testdir.runpytest() - result.stdout.fnmatch_lines('*collected 0 items*') + result.stdout.fnmatch_lines("*collected 0 items*") assert result.ret == main.EXIT_NOTESTSCOLLECTED - testdir.makepyfile(test_foo=""" + testdir.makepyfile( + test_foo=""" def test_foo(): assert 1 - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines('*collected 1 item*') - result.stdout.fnmatch_lines('*1 passed*') + result.stdout.fnmatch_lines("*collected 1 item*") + result.stdout.fnmatch_lines("*1 passed*") assert result.ret == main.EXIT_OK - result = testdir.runpytest('-k nonmatch') - result.stdout.fnmatch_lines('*collected 1 item*') - result.stdout.fnmatch_lines('*1 deselected*') + result = testdir.runpytest("-k nonmatch") + result.stdout.fnmatch_lines("*collected 1 item*") + result.stdout.fnmatch_lines("*1 deselected*") assert result.ret == main.EXIT_NOTESTSCOLLECTED @@ -564,10 +652,10 @@ def test_importorskip(monkeypatch): importorskip("asdlkj") try: - sys = importorskip("sys") # noqa - assert sys == py.std.sys + sysmod = importorskip("sys") + assert sysmod is sys # path = pytest.importorskip("os.path") - # assert path == py.std.os.path + # assert path == os.path excinfo = pytest.raises(pytest.skip.Exception, f) path = py.path.local(excinfo.getrepr().reprcrash.path) # check that importorskip reports the actual call @@ -575,12 +663,15 @@ def test_importorskip(monkeypatch): assert path.purebasename == "test_runner" pytest.raises(SyntaxError, "pytest.importorskip('x y z')") pytest.raises(SyntaxError, "pytest.importorskip('x=y')") - mod = py.std.types.ModuleType("hello123") + mod = types.ModuleType("hello123") mod.__version__ = "1.3" monkeypatch.setitem(sys.modules, "hello123", mod) - pytest.raises(pytest.skip.Exception, """ + pytest.raises( + pytest.skip.Exception, + """ pytest.importorskip("hello123", minversion="1.3.1") - """) + """, + ) mod2 = pytest.importorskip("hello123", minversion="1.3") assert mod2 == mod except pytest.skip.Exception: @@ -595,13 +686,16 @@ def test_importorskip_imports_last_module_part(): def test_importorskip_dev_module(monkeypatch): try: - mod = py.std.types.ModuleType("mockmodule") - mod.__version__ = '0.13.0.dev-43290' - monkeypatch.setitem(sys.modules, 'mockmodule', mod) - mod2 = pytest.importorskip('mockmodule', minversion='0.12.0') + mod = types.ModuleType("mockmodule") + mod.__version__ = "0.13.0.dev-43290" + monkeypatch.setitem(sys.modules, "mockmodule", mod) + mod2 = pytest.importorskip("mockmodule", minversion="0.12.0") assert mod2 == mod - pytest.raises(pytest.skip.Exception, """ - pytest.importorskip('mockmodule1', minversion='0.14.0')""") + pytest.raises( + pytest.skip.Exception, + """ + pytest.importorskip('mockmodule1', minversion='0.14.0')""", + ) except pytest.skip.Exception: print(_pytest._code.ExceptionInfo()) pytest.fail("spurious skip") @@ -609,26 +703,31 @@ def test_importorskip_dev_module(monkeypatch): def test_importorskip_module_level(testdir): """importorskip must be able to skip entire modules when used at module level""" - testdir.makepyfile(''' + testdir.makepyfile( + """ import pytest foobarbaz = pytest.importorskip("foobarbaz") def test_foo(): pass - ''') + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(['*collected 0 items / 1 skipped*']) + result.stdout.fnmatch_lines(["*collected 0 items / 1 skipped*"]) def test_pytest_cmdline_main(testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest def test_hello(): assert 1 if __name__ == '__main__': pytest.cmdline.main([__file__]) - """) + """ + ) import subprocess + popen = subprocess.Popen([sys.executable, str(p)], stdout=subprocess.PIPE) popen.communicate() ret = popen.wait() @@ -636,7 +735,8 @@ def test_pytest_cmdline_main(testdir): def test_unicode_in_longrepr(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ # -*- coding: utf-8 -*- import pytest @pytest.hookimpl(hookwrapper=True) @@ -645,52 +745,61 @@ def test_unicode_in_longrepr(testdir): rep = outcome.get_result() if rep.when == "call": rep.longrepr = u'ä' - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ def test_out(): assert 0 - """) + """ + ) result = testdir.runpytest() assert result.ret == 1 assert "UnicodeEncodeError" not in result.stderr.str() def test_failure_in_setup(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def setup_module(): 0/0 def test_func(): pass - """) + """ + ) result = testdir.runpytest("--tb=line") assert "def setup_module" not in result.stdout.str() def test_makereport_getsource(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_foo(): if False: pass else: assert False - """) + """ + ) result = testdir.runpytest() - assert 'INTERNALERROR' not in result.stdout.str() - result.stdout.fnmatch_lines(['*else: assert False*']) + assert "INTERNALERROR" not in result.stdout.str() + result.stdout.fnmatch_lines(["*else: assert False*"]) def test_makereport_getsource_dynamic_code(testdir, monkeypatch): """Test that exception in dynamically generated code doesn't break getting the source line.""" import inspect + original_findsource = inspect.findsource def findsource(obj, *args, **kwargs): # Can be triggered by dynamically created functions - if obj.__name__ == 'foo': + if obj.__name__ == "foo": raise IndexError() return original_findsource(obj, *args, **kwargs) - monkeypatch.setattr(inspect, 'findsource', findsource) + monkeypatch.setattr(inspect, "findsource", findsource) - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture @@ -699,36 +808,50 @@ def test_makereport_getsource_dynamic_code(testdir, monkeypatch): def test_fix(foo): assert False - """) - result = testdir.runpytest('-vv') - assert 'INTERNALERROR' not in result.stdout.str() + """ + ) + result = testdir.runpytest("-vv") + assert "INTERNALERROR" not in result.stdout.str() result.stdout.fnmatch_lines(["*test_fix*", "*fixture*'missing'*not found*"]) -def test_store_except_info_on_eror(): +def test_store_except_info_on_error(): """ Test that upon test failure, the exception info is stored on sys.last_traceback and friends. """ - # Simulate item that raises a specific exception - class ItemThatRaises(object): - nodeid = 'item_that_raises' + # Simulate item that might raise a specific exception, depending on `raise_error` class var + class ItemMightRaise(object): + nodeid = "item_that_raises" + raise_error = True def runtest(self): - raise IndexError('TEST') + if self.raise_error: + raise IndexError("TEST") + try: - runner.pytest_runtest_call(ItemThatRaises()) + runner.pytest_runtest_call(ItemMightRaise()) except IndexError: pass # Check that exception info is stored on sys assert sys.last_type is IndexError - assert sys.last_value.args[0] == 'TEST' + assert sys.last_value.args[0] == "TEST" assert sys.last_traceback + # The next run should clear the exception info stored by the previous run + ItemMightRaise.raise_error = False + runner.pytest_runtest_call(ItemMightRaise()) + assert sys.last_type is None + assert sys.last_value is None + assert sys.last_traceback is None + def test_current_test_env_var(testdir, monkeypatch): pytest_current_test_vars = [] - monkeypatch.setattr(sys, 'pytest_current_test_vars', pytest_current_test_vars, raising=False) - testdir.makepyfile(''' + monkeypatch.setattr( + sys, "pytest_current_test_vars", pytest_current_test_vars, raising=False + ) + testdir.makepyfile( + """ import pytest import sys import os @@ -741,13 +864,20 @@ def test_current_test_env_var(testdir, monkeypatch): def test(fix): sys.pytest_current_test_vars.append(('call', os.environ['PYTEST_CURRENT_TEST'])) - ''') + """ + ) result = testdir.runpytest_inprocess() assert result.ret == 0 - test_id = 'test_current_test_env_var.py::test' - assert pytest_current_test_vars == [ - ('setup', test_id + ' (setup)'), ('call', test_id + ' (call)'), ('teardown', test_id + ' (teardown)')] - assert 'PYTEST_CURRENT_TEST' not in os.environ + test_id = "test_current_test_env_var.py::test" + assert ( + pytest_current_test_vars + == [ + ("setup", test_id + " (setup)"), + ("call", test_id + " (call)"), + ("teardown", test_id + " (teardown)"), + ] + ) + assert "PYTEST_CURRENT_TEST" not in os.environ class TestReportContents(object): @@ -759,24 +889,29 @@ class TestReportContents(object): return lambda item: runner.runtestprotocol(item, log=False) def test_longreprtext_pass(self, testdir): - reports = testdir.runitem(""" + reports = testdir.runitem( + """ def test_func(): pass - """) + """ + ) rep = reports[1] - assert rep.longreprtext == '' + assert rep.longreprtext == "" def test_longreprtext_failure(self, testdir): - reports = testdir.runitem(""" + reports = testdir.runitem( + """ def test_func(): x = 1 assert x == 4 - """) + """ + ) rep = reports[1] - assert 'assert 1 == 4' in rep.longreprtext + assert "assert 1 == 4" in rep.longreprtext def test_captured_text(self, testdir): - reports = testdir.runitem(""" + reports = testdir.runitem( + """ import pytest import sys @@ -793,21 +928,24 @@ class TestReportContents(object): sys.stdout.write('call: stdout\\n') sys.stderr.write('call: stderr\\n') assert 0 - """) + """ + ) setup, call, teardown = reports - assert setup.capstdout == 'setup: stdout\n' - assert call.capstdout == 'setup: stdout\ncall: stdout\n' - assert teardown.capstdout == 'setup: stdout\ncall: stdout\nteardown: stdout\n' + assert setup.capstdout == "setup: stdout\n" + assert call.capstdout == "setup: stdout\ncall: stdout\n" + assert teardown.capstdout == "setup: stdout\ncall: stdout\nteardown: stdout\n" - assert setup.capstderr == 'setup: stderr\n' - assert call.capstderr == 'setup: stderr\ncall: stderr\n' - assert teardown.capstderr == 'setup: stderr\ncall: stderr\nteardown: stderr\n' + assert setup.capstderr == "setup: stderr\n" + assert call.capstderr == "setup: stderr\ncall: stderr\n" + assert teardown.capstderr == "setup: stderr\ncall: stderr\nteardown: stderr\n" def test_no_captured_text(self, testdir): - reports = testdir.runitem(""" + reports = testdir.runitem( + """ def test_func(): pass - """) + """ + ) rep = reports[1] - assert rep.capstdout == '' - assert rep.capstderr == '' + assert rep.capstdout == "" + assert rep.capstderr == "" diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_runner_xunit.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_runner_xunit.py index fc931f86720..8316aafbf56 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_runner_xunit.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_runner_xunit.py @@ -7,7 +7,8 @@ import pytest def test_module_and_function_setup(testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ modlevel = [] def setup_module(module): assert not modlevel @@ -30,7 +31,8 @@ def test_module_and_function_setup(testdir): def test_module(self): assert modlevel[0] == 42 assert not hasattr(test_modlevel, 'answer') - """) + """ + ) rep = reprec.matchreport("test_modlevel") assert rep.passed rep = reprec.matchreport("test_module") @@ -38,7 +40,8 @@ def test_module_and_function_setup(testdir): def test_module_setup_failure_no_teardown(testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ values = [] def setup_module(module): values.append(1) @@ -49,14 +52,16 @@ def test_module_setup_failure_no_teardown(testdir): def teardown_module(module): values.append(2) - """) + """ + ) reprec.assertoutcome(failed=1) calls = reprec.getcalls("pytest_runtest_setup") assert calls[0].item.module.values == [1] def test_setup_function_failure_no_teardown(testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ modlevel = [] def setup_function(function): modlevel.append(1) @@ -67,13 +72,15 @@ def test_setup_function_failure_no_teardown(testdir): def test_func(): pass - """) + """ + ) calls = reprec.getcalls("pytest_runtest_setup") assert calls[0].item.module.modlevel == [1] def test_class_setup(testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ class TestSimpleClassSetup(object): clslevel = [] def setup_class(cls): @@ -92,12 +99,14 @@ def test_class_setup(testdir): def test_cleanup(): assert not TestSimpleClassSetup.clslevel assert not TestInheritedClassSetupStillWorks.clslevel - """) + """ + ) reprec.assertoutcome(passed=1 + 2 + 1) def test_class_setup_failure_no_teardown(testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ class TestSimpleClassSetup(object): clslevel = [] def setup_class(cls): @@ -111,12 +120,14 @@ def test_class_setup_failure_no_teardown(testdir): def test_cleanup(): assert not TestSimpleClassSetup.clslevel - """) + """ + ) reprec.assertoutcome(failed=1, passed=1) def test_method_setup(testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ class TestSetupMethod(object): def setup_method(self, meth): self.methsetup = meth @@ -128,12 +139,14 @@ def test_method_setup(testdir): def test_other(self): assert self.methsetup == self.test_other - """) + """ + ) reprec.assertoutcome(passed=2) def test_method_setup_failure_no_teardown(testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ class TestMethodSetup(object): clslevel = [] def setup_method(self, method): @@ -148,12 +161,14 @@ def test_method_setup_failure_no_teardown(testdir): def test_cleanup(): assert TestMethodSetup.clslevel == [1] - """) + """ + ) reprec.assertoutcome(failed=1, passed=1) def test_method_generator_setup(testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ class TestSetupTeardownOnInstance(object): def setup_class(cls): cls.classsetup = True @@ -171,12 +186,14 @@ def test_method_generator_setup(testdir): assert self.classsetup assert self.methsetup == self.test_generate assert value == 5 - """) + """ + ) reprec.assertoutcome(passed=1, failed=1) def test_func_generator_setup(testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ import sys def setup_module(mod): @@ -199,13 +216,15 @@ def test_func_generator_setup(testdir): assert x == [1] yield check assert x == [1] - """) + """ + ) rep = reprec.matchreport("test_one", names="pytest_runtest_logreport") assert rep.passed def test_method_setup_uses_fresh_instances(testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ class TestSelfState1(object): memory = [] def test_hello(self): @@ -213,12 +232,14 @@ def test_method_setup_uses_fresh_instances(testdir): def test_afterhello(self): assert self != self.memory[0] - """) + """ + ) reprec.assertoutcome(passed=2, failed=0) def test_setup_that_skips_calledagain(testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest def setup_module(mod): pytest.skip("x") @@ -226,13 +247,15 @@ def test_setup_that_skips_calledagain(testdir): pass def test_function2(): pass - """) + """ + ) reprec = testdir.inline_run(p) reprec.assertoutcome(skipped=2) def test_setup_fails_again_on_all_tests(testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest def setup_module(mod): raise ValueError(42) @@ -240,13 +263,15 @@ def test_setup_fails_again_on_all_tests(testdir): pass def test_function2(): pass - """) + """ + ) reprec = testdir.inline_run(p) reprec.assertoutcome(failed=2) def test_setup_funcarg_setup_when_outer_scope_fails(testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest def setup_module(mod): raise ValueError(42) @@ -257,25 +282,34 @@ def test_setup_funcarg_setup_when_outer_scope_fails(testdir): pass def test_function2(hello): pass - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "*function1*", - "*ValueError*42*", - "*function2*", - "*ValueError*42*", - "*2 error*" - ]) + result.stdout.fnmatch_lines( + [ + "*function1*", + "*ValueError*42*", + "*function2*", + "*ValueError*42*", + "*2 error*", + ] + ) assert "xyz43" not in result.stdout.str() -@pytest.mark.parametrize('arg', ['', 'arg']) -def test_setup_teardown_function_level_with_optional_argument(testdir, monkeypatch, arg): +@pytest.mark.parametrize("arg", ["", "arg"]) +def test_setup_teardown_function_level_with_optional_argument( + testdir, monkeypatch, arg +): """parameter to setup/teardown xunit-style functions parameter is now optional (#1728).""" import sys + trace_setups_teardowns = [] - monkeypatch.setattr(sys, 'trace_setups_teardowns', trace_setups_teardowns, raising=False) - p = testdir.makepyfile(""" + monkeypatch.setattr( + sys, "trace_setups_teardowns", trace_setups_teardowns, raising=False + ) + p = testdir.makepyfile( + """ import pytest import sys @@ -296,24 +330,23 @@ def test_setup_teardown_function_level_with_optional_argument(testdir, monkeypat def test_method_1(self): pass def test_method_2(self): pass - """.format(arg=arg)) + """.format( + arg=arg + ) + ) result = testdir.inline_run(p) result.assertoutcome(passed=4) expected = [ - 'setup_module', - - 'setup_function', - 'teardown_function', - 'setup_function', - 'teardown_function', - - 'setup_method', - 'teardown_method', - - 'setup_method', - 'teardown_method', - - 'teardown_module', + "setup_module", + "setup_function", + "teardown_function", + "setup_function", + "teardown_function", + "setup_method", + "teardown_method", + "setup_method", + "teardown_method", + "teardown_module", ] assert trace_setups_teardowns == expected diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_session.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_session.py index 9ec13f523e6..4a594009bab 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_session.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_session.py @@ -1,12 +1,15 @@ from __future__ import absolute_import, division, print_function + import pytest from _pytest.main import EXIT_NOTESTSCOLLECTED class SessionTests(object): + def test_basic_testitem_events(self, testdir): - tfile = testdir.makepyfile(""" + tfile = testdir.makepyfile( + """ def test_one(): pass def test_one_one(): @@ -16,7 +19,8 @@ class SessionTests(object): class TestClass(object): def test_two(self, someargs): pass - """) + """ + ) reprec = testdir.inline_run(tfile) passed, skipped, failed = reprec.listoutcomes() assert len(skipped) == 0 @@ -36,26 +40,31 @@ class SessionTests(object): # assert colreports[1].report.failed def test_nested_import_error(self, testdir): - tfile = testdir.makepyfile(""" + tfile = testdir.makepyfile( + """ import import_fails def test_this(): assert import_fails.a == 1 - """, import_fails=""" + """, + import_fails=""" import does_not_work a = 1 - """) + """, + ) reprec = testdir.inline_run(tfile) values = reprec.getfailedcollections() assert len(values) == 1 out = str(values[0].longrepr) - assert out.find('does_not_work') != -1 + assert out.find("does_not_work") != -1 def test_raises_output(self, testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ import pytest def test_raises_doesnt(): pytest.raises(ValueError, int, "3") - """) + """ + ) passed, skipped, failed = reprec.listoutcomes() assert len(failed) == 1 out = failed[0].longrepr.reprcrash.message @@ -64,13 +73,15 @@ class SessionTests(object): pytest.fail("incorrect raises() output") def test_generator_yields_None(self, testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ def test_1(): yield None - """) + """ + ) failures = reprec.getfailedcollections() out = failures[0].longrepr.reprcrash.message - i = out.find('TypeError') + i = out.find("TypeError") assert i != -1 def test_syntax_error_module(self, testdir): @@ -78,29 +89,36 @@ class SessionTests(object): values = reprec.getfailedcollections() assert len(values) == 1 out = str(values[0].longrepr) - assert out.find(str('not python')) != -1 + assert out.find(str("not python")) != -1 def test_exit_first_problem(self, testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ def test_one(): assert 0 def test_two(): assert 0 - """, '--exitfirst') + """, + "--exitfirst", + ) passed, skipped, failed = reprec.countoutcomes() assert failed == 1 assert passed == skipped == 0 def test_maxfail(self, testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ def test_one(): assert 0 def test_two(): assert 0 def test_three(): assert 0 - """, '--maxfail=2') + """, + "--maxfail=2", + ) passed, skipped, failed = reprec.countoutcomes() assert failed == 2 assert passed == skipped == 0 def test_broken_repr(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest class BrokenRepr1(object): foo=0 @@ -116,21 +134,30 @@ class SessionTests(object): t = BrokenRepr1() assert t.foo == 1 - """) + """ + ) reprec = testdir.inline_run(p) passed, skipped, failed = reprec.listoutcomes() assert len(failed) == 1 out = failed[0].longrepr.reprcrash.message - assert out.find("""[Exception("Ha Ha fooled you, I'm a broken repr().") raised in repr()]""") != -1 # ' + assert ( + out.find( + """[Exception("Ha Ha fooled you, I'm a broken repr().") raised in repr()]""" + ) + != -1 + ) # ' def test_skip_file_by_conftest(self, testdir): - testdir.makepyfile(conftest=""" + testdir.makepyfile( + conftest=""" import pytest def pytest_collect_file(): pytest.skip("intentional") - """, test_file=""" + """, + test_file=""" def test_one(): pass - """) + """, + ) try: reprec = testdir.inline_run(testdir.tmpdir) except pytest.skip.Exception: @@ -143,7 +170,8 @@ class SessionTests(object): class TestNewSession(SessionTests): def test_order_of_execution(self, testdir): - reprec = testdir.inline_runsource(""" + reprec = testdir.inline_runsource( + """ values = [] def test_1(): values.append(1) @@ -161,7 +189,8 @@ class TestNewSession(SessionTests): self.reslist.append(3) def test_4(self): assert self.reslist == [1,2,1,2,3] - """) + """ + ) passed, skipped, failed = reprec.countoutcomes() assert failed == skipped == 0 assert passed == 7 @@ -181,9 +210,9 @@ class TestNewSession(SessionTests): pass """, test_three="xxxdsadsadsadsa", - __init__="" + __init__="", ) - reprec = testdir.inline_run('--collect-only', p.dirpath()) + reprec = testdir.inline_run("--collect-only", p.dirpath()) itemstarted = reprec.getcalls("pytest_itemcollected") assert len(itemstarted) == 3 @@ -213,9 +242,12 @@ class TestNewSession(SessionTests): def test_plugin_specify(testdir): - pytest.raises(ImportError, """ + pytest.raises( + ImportError, + """ testdir.parseconfig("-p", "nqweotexistent") - """) + """, + ) # pytest.raises(ImportError, # "config.do_configure(config)" # ) @@ -223,7 +255,7 @@ def test_plugin_specify(testdir): def test_plugin_already_exists(testdir): config = testdir.parseconfig("-p", "terminal") - assert config.option.plugins == ['terminal'] + assert config.option.plugins == ["terminal"] config._do_configure() config._ensure_unconfigure() @@ -239,8 +271,27 @@ def test_exclude(testdir): result.stdout.fnmatch_lines(["*1 passed*"]) +def test_deselect(testdir): + testdir.makepyfile( + test_a=""" + import pytest + def test_a1(): pass + @pytest.mark.parametrize('b', range(3)) + def test_a2(b): pass + """ + ) + result = testdir.runpytest( + "-v", "--deselect=test_a.py::test_a2[1]", "--deselect=test_a.py::test_a2[2]" + ) + assert result.ret == 0 + result.stdout.fnmatch_lines(["*2 passed, 2 deselected*"]) + for line in result.stdout.lines: + assert not line.startswith(("test_a.py::test_a2[1]", "test_a.py::test_a2[2]")) + + def test_sessionfinish_with_start(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import os values = [] def pytest_sessionstart(): @@ -250,6 +301,43 @@ def test_sessionfinish_with_start(testdir): def pytest_sessionfinish(): assert values[0] == os.getcwd() - """) + """ + ) res = testdir.runpytest("--collect-only") assert res.ret == EXIT_NOTESTSCOLLECTED + + +@pytest.mark.parametrize("path", ["root", "{relative}/root", "{environment}/root"]) +def test_rootdir_option_arg(testdir, monkeypatch, path): + monkeypatch.setenv("PY_ROOTDIR_PATH", str(testdir.tmpdir)) + path = path.format(relative=str(testdir.tmpdir), environment="$PY_ROOTDIR_PATH") + + rootdir = testdir.mkdir("root") + rootdir.mkdir("tests") + testdir.makepyfile( + """ + import os + def test_one(): + assert 1 + """ + ) + + result = testdir.runpytest("--rootdir={}".format(path)) + result.stdout.fnmatch_lines( + ["*rootdir: {}/root, inifile:*".format(testdir.tmpdir), "*1 passed*"] + ) + + +def test_rootdir_wrong_option_arg(testdir): + testdir.makepyfile( + """ + import os + def test_one(): + assert 1 + """ + ) + + result = testdir.runpytest("--rootdir=wrong_dir") + result.stderr.fnmatch_lines( + ["*Directory *wrong_dir* not found. Check your '--rootdir' option.*"] + ) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_skipping.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_skipping.py index 978944876f3..5d970e2fea0 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_skipping.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_skipping.py @@ -7,20 +7,23 @@ from _pytest.runner import runtestprotocol class TestEvaluator(object): + def test_no_marker(self, testdir): item = testdir.getitem("def test_func(): pass") - evalskipif = MarkEvaluator(item, 'skipif') + evalskipif = MarkEvaluator(item, "skipif") assert not evalskipif assert not evalskipif.istrue() def test_marked_no_args(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest @pytest.mark.xyz def test_func(): pass - """) - ev = MarkEvaluator(item, 'xyz') + """ + ) + ev = MarkEvaluator(item, "xyz") assert ev assert ev.istrue() expl = ev.getexplanation() @@ -28,40 +31,46 @@ class TestEvaluator(object): assert not ev.get("run", False) def test_marked_one_arg(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest @pytest.mark.xyz("hasattr(os, 'sep')") def test_func(): pass - """) - ev = MarkEvaluator(item, 'xyz') + """ + ) + ev = MarkEvaluator(item, "xyz") assert ev assert ev.istrue() expl = ev.getexplanation() assert expl == "condition: hasattr(os, 'sep')" - @pytest.mark.skipif('sys.version_info[0] >= 3') + @pytest.mark.skipif("sys.version_info[0] >= 3") def test_marked_one_arg_unicode(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest @pytest.mark.xyz(u"hasattr(os, 'sep')") def test_func(): pass - """) - ev = MarkEvaluator(item, 'xyz') + """ + ) + ev = MarkEvaluator(item, "xyz") assert ev assert ev.istrue() expl = ev.getexplanation() assert expl == "condition: hasattr(os, 'sep')" def test_marked_one_arg_with_reason(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest @pytest.mark.xyz("hasattr(os, 'sep')", attr=2, reason="hello world") def test_func(): pass - """) - ev = MarkEvaluator(item, 'xyz') + """ + ) + ev = MarkEvaluator(item, "xyz") assert ev assert ev.istrue() expl = ev.getexplanation() @@ -70,58 +79,67 @@ class TestEvaluator(object): def test_marked_one_arg_twice(self, testdir): lines = [ - '''@pytest.mark.skipif("not hasattr(os, 'murks')")''', - '''@pytest.mark.skipif("hasattr(os, 'murks')")''' + """@pytest.mark.skipif("not hasattr(os, 'murks')")""", + """@pytest.mark.skipif("hasattr(os, 'murks')")""", ] for i in range(0, 2): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest %s %s def test_func(): pass - """ % (lines[i], lines[(i + 1) % 2])) - ev = MarkEvaluator(item, 'skipif') + """ + % (lines[i], lines[(i + 1) % 2]) + ) + ev = MarkEvaluator(item, "skipif") assert ev assert ev.istrue() expl = ev.getexplanation() assert expl == "condition: not hasattr(os, 'murks')" def test_marked_one_arg_twice2(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest @pytest.mark.skipif("hasattr(os, 'murks')") @pytest.mark.skipif("not hasattr(os, 'murks')") def test_func(): pass - """) - ev = MarkEvaluator(item, 'skipif') + """ + ) + ev = MarkEvaluator(item, "skipif") assert ev assert ev.istrue() expl = ev.getexplanation() assert expl == "condition: not hasattr(os, 'murks')" def test_marked_skip_with_not_string(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest @pytest.mark.skipif(False) def test_func(): pass - """) - ev = MarkEvaluator(item, 'skipif') + """ + ) + ev = MarkEvaluator(item, "skipif") exc = pytest.raises(pytest.fail.Exception, ev.istrue) assert """Failed: you need to specify reason=STRING when using booleans as conditions.""" in exc.value.msg def test_skipif_class(self, testdir): - item, = testdir.getitems(""" + item, = testdir.getitems( + """ import pytest class TestClass(object): pytestmark = pytest.mark.skipif("config._hackxyz") def test_func(self): pass - """) + """ + ) item.config._hackxyz = 3 - ev = MarkEvaluator(item, 'skipif') + ev = MarkEvaluator(item, "skipif") assert ev.istrue() expl = ev.getexplanation() assert expl == "condition: config._hackxyz" @@ -129,14 +147,17 @@ class TestEvaluator(object): class TestXFail(object): - @pytest.mark.parametrize('strict', [True, False]) + @pytest.mark.parametrize("strict", [True, False]) def test_xfail_simple(self, testdir, strict): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest @pytest.mark.xfail(strict=%s) def test_func(): assert 0 - """ % strict) + """ + % strict + ) reports = runtestprotocol(item, log=False) assert len(reports) == 3 callreport = reports[1] @@ -144,25 +165,46 @@ class TestXFail(object): assert callreport.wasxfail == "" def test_xfail_xpassed(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest @pytest.mark.xfail(reason="this is an xfail") def test_func(): assert 1 - """) + """ + ) reports = runtestprotocol(item, log=False) assert len(reports) == 3 callreport = reports[1] assert callreport.passed assert callreport.wasxfail == "this is an xfail" + def test_xfail_using_platform(self, testdir): + """ + Verify that platform can be used with xfail statements. + """ + item = testdir.getitem( + """ + import pytest + @pytest.mark.xfail("platform.platform() == platform.platform()") + def test_func(): + assert 0 + """ + ) + reports = runtestprotocol(item, log=False) + assert len(reports) == 3 + callreport = reports[1] + assert callreport.wasxfail + def test_xfail_xpassed_strict(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest @pytest.mark.xfail(strict=True, reason="nope") def test_func(): assert 1 - """) + """ + ) reports = runtestprotocol(item, log=False) assert len(reports) == 3 callreport = reports[1] @@ -171,48 +213,53 @@ class TestXFail(object): assert not hasattr(callreport, "wasxfail") def test_xfail_run_anyway(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.xfail def test_func(): assert 0 def test_func2(): pytest.xfail("hello") - """) + """ + ) result = testdir.runpytest("--runxfail") - result.stdout.fnmatch_lines([ - "*def test_func():*", - "*assert 0*", - "*1 failed*1 pass*", - ]) + result.stdout.fnmatch_lines( + ["*def test_func():*", "*assert 0*", "*1 failed*1 pass*"] + ) def test_xfail_evalfalse_but_fails(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest @pytest.mark.xfail('False') def test_func(): assert 0 - """) + """ + ) reports = runtestprotocol(item, log=False) callreport = reports[1] assert callreport.failed assert not hasattr(callreport, "wasxfail") - assert 'xfail' in callreport.keywords + assert "xfail" in callreport.keywords def test_xfail_not_report_default(self, testdir): - p = testdir.makepyfile(test_one=""" + p = testdir.makepyfile( + test_one=""" import pytest @pytest.mark.xfail def test_this(): assert 0 - """) - testdir.runpytest(p, '-v') + """ + ) + testdir.runpytest(p, "-v") # result.stdout.fnmatch_lines([ # "*HINT*use*-r*" # ]) def test_xfail_not_run_xfail_reporting(self, testdir): - p = testdir.makepyfile(test_one=""" + p = testdir.makepyfile( + test_one=""" import pytest @pytest.mark.xfail(run=False, reason="noway") def test_this(): @@ -223,90 +270,89 @@ class TestXFail(object): @pytest.mark.xfail("False", run=False, reason="huh") def test_this_false(): assert 1 - """) - result = testdir.runpytest(p, '-rx', ) - result.stdout.fnmatch_lines([ - "*test_one*test_this*", - "*NOTRUN*noway", - "*test_one*test_this_true*", - "*NOTRUN*condition:*True*", - "*1 passed*", - ]) + """ + ) + result = testdir.runpytest(p, "-rx") + result.stdout.fnmatch_lines( + [ + "*test_one*test_this*", + "*NOTRUN*noway", + "*test_one*test_this_true*", + "*NOTRUN*condition:*True*", + "*1 passed*", + ] + ) def test_xfail_not_run_no_setup_run(self, testdir): - p = testdir.makepyfile(test_one=""" + p = testdir.makepyfile( + test_one=""" import pytest @pytest.mark.xfail(run=False, reason="hello") def test_this(): assert 0 def setup_module(mod): raise ValueError(42) - """) - result = testdir.runpytest(p, '-rx', ) - result.stdout.fnmatch_lines([ - "*test_one*test_this*", - "*NOTRUN*hello", - "*1 xfailed*", - ]) + """ + ) + result = testdir.runpytest(p, "-rx") + result.stdout.fnmatch_lines( + ["*test_one*test_this*", "*NOTRUN*hello", "*1 xfailed*"] + ) def test_xfail_xpass(self, testdir): - p = testdir.makepyfile(test_one=""" + p = testdir.makepyfile( + test_one=""" import pytest @pytest.mark.xfail def test_that(): assert 1 - """) - result = testdir.runpytest(p, '-rX') - result.stdout.fnmatch_lines([ - "*XPASS*test_that*", - "*1 xpassed*" - ]) + """ + ) + result = testdir.runpytest(p, "-rX") + result.stdout.fnmatch_lines(["*XPASS*test_that*", "*1 xpassed*"]) assert result.ret == 0 def test_xfail_imperative(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest def test_this(): pytest.xfail("hello") - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "*1 xfailed*", - ]) + result.stdout.fnmatch_lines(["*1 xfailed*"]) result = testdir.runpytest(p, "-rx") - result.stdout.fnmatch_lines([ - "*XFAIL*test_this*", - "*reason:*hello*", - ]) + result.stdout.fnmatch_lines(["*XFAIL*test_this*", "*reason:*hello*"]) result = testdir.runpytest(p, "--runxfail") result.stdout.fnmatch_lines("*1 pass*") def test_xfail_imperative_in_setup_function(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest def setup_function(function): pytest.xfail("hello") def test_this(): assert 0 - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "*1 xfailed*", - ]) + result.stdout.fnmatch_lines(["*1 xfailed*"]) result = testdir.runpytest(p, "-rx") - result.stdout.fnmatch_lines([ - "*XFAIL*test_this*", - "*reason:*hello*", - ]) + result.stdout.fnmatch_lines(["*XFAIL*test_this*", "*reason:*hello*"]) result = testdir.runpytest(p, "--runxfail") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *def test_this* *1 fail* - """) + """ + ) def xtest_dynamic_xfail_set_during_setup(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest def setup_function(function): pytest.mark.xfail(function) @@ -314,147 +360,164 @@ class TestXFail(object): assert 0 def test_that(): assert 1 - """) - result = testdir.runpytest(p, '-rxX') - result.stdout.fnmatch_lines([ - "*XFAIL*test_this*", - "*XPASS*test_that*", - ]) + """ + ) + result = testdir.runpytest(p, "-rxX") + result.stdout.fnmatch_lines(["*XFAIL*test_this*", "*XPASS*test_that*"]) def test_dynamic_xfail_no_run(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest @pytest.fixture def arg(request): request.applymarker(pytest.mark.xfail(run=False)) def test_this(arg): assert 0 - """) - result = testdir.runpytest(p, '-rxX') - result.stdout.fnmatch_lines([ - "*XFAIL*test_this*", - "*NOTRUN*", - ]) + """ + ) + result = testdir.runpytest(p, "-rxX") + result.stdout.fnmatch_lines(["*XFAIL*test_this*", "*NOTRUN*"]) def test_dynamic_xfail_set_during_funcarg_setup(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest @pytest.fixture def arg(request): request.applymarker(pytest.mark.xfail) def test_this2(arg): assert 0 - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "*1 xfailed*", - ]) + result.stdout.fnmatch_lines(["*1 xfailed*"]) - @pytest.mark.parametrize('expected, actual, matchline', - [('TypeError', 'TypeError', "*1 xfailed*"), - ('(AttributeError, TypeError)', 'TypeError', "*1 xfailed*"), - ('TypeError', 'IndexError', "*1 failed*"), - ('(AttributeError, TypeError)', 'IndexError', "*1 failed*"), - ]) + @pytest.mark.parametrize( + "expected, actual, matchline", + [ + ("TypeError", "TypeError", "*1 xfailed*"), + ("(AttributeError, TypeError)", "TypeError", "*1 xfailed*"), + ("TypeError", "IndexError", "*1 failed*"), + ("(AttributeError, TypeError)", "IndexError", "*1 failed*"), + ], + ) def test_xfail_raises(self, expected, actual, matchline, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest @pytest.mark.xfail(raises=%s) def test_raises(): raise %s() - """ % (expected, actual)) + """ + % (expected, actual) + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - matchline, - ]) + result.stdout.fnmatch_lines([matchline]) def test_strict_sanity(self, testdir): """sanity check for xfail(strict=True): a failing test should behave exactly like a normal xfail. """ - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest @pytest.mark.xfail(reason='unsupported feature', strict=True) def test_foo(): assert 0 - """) - result = testdir.runpytest(p, '-rxX') - result.stdout.fnmatch_lines([ - '*XFAIL*', - '*unsupported feature*', - ]) + """ + ) + result = testdir.runpytest(p, "-rxX") + result.stdout.fnmatch_lines(["*XFAIL*", "*unsupported feature*"]) assert result.ret == 0 - @pytest.mark.parametrize('strict', [True, False]) + @pytest.mark.parametrize("strict", [True, False]) def test_strict_xfail(self, testdir, strict): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest @pytest.mark.xfail(reason='unsupported feature', strict=%s) def test_foo(): with open('foo_executed', 'w'): pass # make sure test executes - """ % strict) - result = testdir.runpytest(p, '-rxX') + """ + % strict + ) + result = testdir.runpytest(p, "-rxX") if strict: - result.stdout.fnmatch_lines([ - '*test_foo*', - '*XPASS(strict)*unsupported feature*', - ]) + result.stdout.fnmatch_lines( + ["*test_foo*", "*XPASS(strict)*unsupported feature*"] + ) else: - result.stdout.fnmatch_lines([ - '*test_strict_xfail*', - 'XPASS test_strict_xfail.py::test_foo unsupported feature', - ]) + result.stdout.fnmatch_lines( + [ + "*test_strict_xfail*", + "XPASS test_strict_xfail.py::test_foo unsupported feature", + ] + ) assert result.ret == (1 if strict else 0) - assert testdir.tmpdir.join('foo_executed').isfile() + assert testdir.tmpdir.join("foo_executed").isfile() - @pytest.mark.parametrize('strict', [True, False]) + @pytest.mark.parametrize("strict", [True, False]) def test_strict_xfail_condition(self, testdir, strict): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest @pytest.mark.xfail(False, reason='unsupported feature', strict=%s) def test_foo(): pass - """ % strict) - result = testdir.runpytest(p, '-rxX') - result.stdout.fnmatch_lines('*1 passed*') + """ + % strict + ) + result = testdir.runpytest(p, "-rxX") + result.stdout.fnmatch_lines("*1 passed*") assert result.ret == 0 - @pytest.mark.parametrize('strict', [True, False]) + @pytest.mark.parametrize("strict", [True, False]) def test_xfail_condition_keyword(self, testdir, strict): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest @pytest.mark.xfail(condition=False, reason='unsupported feature', strict=%s) def test_foo(): pass - """ % strict) - result = testdir.runpytest(p, '-rxX') - result.stdout.fnmatch_lines('*1 passed*') + """ + % strict + ) + result = testdir.runpytest(p, "-rxX") + result.stdout.fnmatch_lines("*1 passed*") assert result.ret == 0 - @pytest.mark.parametrize('strict_val', ['true', 'false']) + @pytest.mark.parametrize("strict_val", ["true", "false"]) def test_strict_xfail_default_from_file(self, testdir, strict_val): - testdir.makeini(''' + testdir.makeini( + """ [pytest] xfail_strict = %s - ''' % strict_val) - p = testdir.makepyfile(""" + """ + % strict_val + ) + p = testdir.makepyfile( + """ import pytest @pytest.mark.xfail(reason='unsupported feature') def test_foo(): pass - """) - result = testdir.runpytest(p, '-rxX') - strict = strict_val == 'true' - result.stdout.fnmatch_lines('*1 failed*' if strict else '*1 xpassed*') + """ + ) + result = testdir.runpytest(p, "-rxX") + strict = strict_val == "true" + result.stdout.fnmatch_lines("*1 failed*" if strict else "*1 xpassed*") assert result.ret == (1 if strict else 0) class TestXFailwithSetupTeardown(object): + def test_failing_setup_issue9(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def setup_function(func): assert 0 @@ -462,14 +525,14 @@ class TestXFailwithSetupTeardown(object): @pytest.mark.xfail def test_func(): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*1 xfail*", - ]) + result.stdout.fnmatch_lines(["*1 xfail*"]) def test_failing_teardown_issue9(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def teardown_function(func): assert 0 @@ -477,16 +540,17 @@ class TestXFailwithSetupTeardown(object): @pytest.mark.xfail def test_func(): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*1 xfail*", - ]) + result.stdout.fnmatch_lines(["*1 xfail*"]) class TestSkip(object): + def test_skip_class(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.skip class TestSomething(object): @@ -497,61 +561,62 @@ class TestSkip(object): def test_baz(): pass - """) + """ + ) rec = testdir.inline_run() rec.assertoutcome(skipped=2, passed=1) def test_skips_on_false_string(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.skip('False') def test_foo(): pass - """) + """ + ) rec = testdir.inline_run() rec.assertoutcome(skipped=1) def test_arg_as_reason(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.skip('testing stuff') def test_bar(): pass - """) - result = testdir.runpytest('-rs') - result.stdout.fnmatch_lines([ - "*testing stuff*", - "*1 skipped*", - ]) + """ + ) + result = testdir.runpytest("-rs") + result.stdout.fnmatch_lines(["*testing stuff*", "*1 skipped*"]) def test_skip_no_reason(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.skip def test_foo(): pass - """) - result = testdir.runpytest('-rs') - result.stdout.fnmatch_lines([ - "*unconditional skip*", - "*1 skipped*", - ]) + """ + ) + result = testdir.runpytest("-rs") + result.stdout.fnmatch_lines(["*unconditional skip*", "*1 skipped*"]) def test_skip_with_reason(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.skip(reason="for lolz") def test_bar(): pass - """) - result = testdir.runpytest('-rs') - result.stdout.fnmatch_lines([ - "*for lolz*", - "*1 skipped*", - ]) + """ + ) + result = testdir.runpytest("-rs") + result.stdout.fnmatch_lines(["*for lolz*", "*1 skipped*"]) def test_only_skips_marked_test(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.skip def test_foo(): @@ -561,92 +626,112 @@ class TestSkip(object): pass def test_baz(): assert True - """) - result = testdir.runpytest('-rs') - result.stdout.fnmatch_lines([ - "*nothing in particular*", - "*1 passed*2 skipped*", - ]) + """ + ) + result = testdir.runpytest("-rs") + result.stdout.fnmatch_lines(["*nothing in particular*", "*1 passed*2 skipped*"]) def test_strict_and_skip(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.skip def test_hello(): pass - """) + """ + ) result = testdir.runpytest("-rs") - result.stdout.fnmatch_lines([ - "*unconditional skip*", - "*1 skipped*", - ]) + result.stdout.fnmatch_lines(["*unconditional skip*", "*1 skipped*"]) class TestSkipif(object): + def test_skipif_conditional(self, testdir): - item = testdir.getitem(""" + item = testdir.getitem( + """ import pytest @pytest.mark.skipif("hasattr(os, 'sep')") def test_func(): pass - """) # noqa - x = pytest.raises(pytest.skip.Exception, lambda: - pytest_runtest_setup(item)) + """ + ) + x = pytest.raises(pytest.skip.Exception, lambda: pytest_runtest_setup(item)) assert x.value.msg == "condition: hasattr(os, 'sep')" - @pytest.mark.parametrize('params', [ - '"hasattr(sys, \'platform\')"', - 'True, reason="invalid platform"', - ]) + @pytest.mark.parametrize( + "params", ["\"hasattr(sys, 'platform')\"", 'True, reason="invalid platform"'] + ) def test_skipif_reporting(self, testdir, params): - p = testdir.makepyfile(test_foo=""" + p = testdir.makepyfile( + test_foo=""" import pytest @pytest.mark.skipif(%(params)s) def test_that(): assert 0 - """ % dict(params=params)) - result = testdir.runpytest(p, '-s', '-rs') - result.stdout.fnmatch_lines([ - "*SKIP*1*test_foo.py*platform*", - "*1 skipped*" - ]) + """ + % dict(params=params) + ) + result = testdir.runpytest(p, "-s", "-rs") + result.stdout.fnmatch_lines(["*SKIP*1*test_foo.py*platform*", "*1 skipped*"]) assert result.ret == 0 - @pytest.mark.parametrize('marker, msg1, msg2', [ - ('skipif', 'SKIP', 'skipped'), - ('xfail', 'XPASS', 'xpassed'), - ]) + def test_skipif_using_platform(self, testdir): + item = testdir.getitem( + """ + import pytest + @pytest.mark.skipif("platform.platform() == platform.platform()") + def test_func(): + pass + """ + ) + pytest.raises(pytest.skip.Exception, lambda: pytest_runtest_setup(item)) + + @pytest.mark.parametrize( + "marker, msg1, msg2", + [("skipif", "SKIP", "skipped"), ("xfail", "XPASS", "xpassed")], + ) def test_skipif_reporting_multiple(self, testdir, marker, msg1, msg2): - testdir.makepyfile(test_foo=""" + testdir.makepyfile( + test_foo=""" import pytest @pytest.mark.{marker}(False, reason='first_condition') @pytest.mark.{marker}(True, reason='second_condition') def test_foobar(): assert 1 - """.format(marker=marker)) - result = testdir.runpytest('-s', '-rsxX') - result.stdout.fnmatch_lines([ - "*{msg1}*test_foo.py*second_condition*".format(msg1=msg1), - "*1 {msg2}*".format(msg2=msg2), - ]) + """.format( + marker=marker + ) + ) + result = testdir.runpytest("-s", "-rsxX") + result.stdout.fnmatch_lines( + [ + "*{msg1}*test_foo.py*second_condition*".format(msg1=msg1), + "*1 {msg2}*".format(msg2=msg2), + ] + ) assert result.ret == 0 def test_skip_not_report_default(testdir): - p = testdir.makepyfile(test_one=""" + p = testdir.makepyfile( + test_one=""" import pytest def test_this(): pytest.skip("hello") - """) - result = testdir.runpytest(p, '-v') - result.stdout.fnmatch_lines([ - # "*HINT*use*-r*", - "*1 skipped*", - ]) + """ + ) + result = testdir.runpytest(p, "-v") + result.stdout.fnmatch_lines( + [ + # "*HINT*use*-r*", + "*1 skipped*" + ] + ) def test_skipif_class(testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest class TestClass(object): @@ -655,11 +740,10 @@ def test_skipif_class(testdir): assert 0 def test_though(self): assert 0 - """) + """ + ) result = testdir.runpytest(p) - result.stdout.fnmatch_lines([ - "*2 skipped*" - ]) + result.stdout.fnmatch_lines(["*2 skipped*"]) def test_skip_reasons_folding(): @@ -670,6 +754,7 @@ def test_skip_reasons_folding(): class X(object): pass + ev1 = X() ev1.when = "execute" ev1.skipped = True @@ -710,12 +795,10 @@ def test_skipped_reasons_functional(testdir): import pytest def doskip(): pytest.skip('test') - """ + """, ) - result = testdir.runpytest('-rs') - result.stdout.fnmatch_lines([ - "*SKIP*2*conftest.py:4: test", - ]) + result = testdir.runpytest("-rs") + result.stdout.fnmatch_lines(["*SKIP*2*conftest.py:4: test"]) assert result.ret == 0 @@ -731,17 +814,16 @@ def test_skipped_folding(testdir): class TestClass(object): def test_method(self): pass - """, + """ ) - result = testdir.runpytest('-rs') - result.stdout.fnmatch_lines([ - "*SKIP*2*test_one.py: Folding" - ]) + result = testdir.runpytest("-rs") + result.stdout.fnmatch_lines(["*SKIP*2*test_one.py: Folding"]) assert result.ret == 0 def test_reportchars(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def test_1(): assert 0 @@ -753,14 +835,12 @@ def test_reportchars(testdir): pass def test_4(): pytest.skip("four") - """) + """ + ) result = testdir.runpytest("-rfxXs") - result.stdout.fnmatch_lines([ - "FAIL*test_1*", - "XFAIL*test_2*", - "XPASS*test_3*", - "SKIP*four*", - ]) + result.stdout.fnmatch_lines( + ["FAIL*test_1*", "XFAIL*test_2*", "XPASS*test_3*", "SKIP*four*"] + ) def test_reportchars_error(testdir): @@ -772,15 +852,15 @@ def test_reportchars_error(testdir): test_simple=""" def test_foo(): pass - """) - result = testdir.runpytest('-rE') - result.stdout.fnmatch_lines([ - 'ERROR*test_foo*', - ]) + """, + ) + result = testdir.runpytest("-rE") + result.stdout.fnmatch_lines(["ERROR*test_foo*"]) def test_reportchars_all(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def test_1(): assert 0 @@ -792,14 +872,12 @@ def test_reportchars_all(testdir): pass def test_4(): pytest.skip("four") - """) + """ + ) result = testdir.runpytest("-ra") - result.stdout.fnmatch_lines([ - "FAIL*test_1*", - "SKIP*four*", - "XFAIL*test_2*", - "XPASS*test_3*", - ]) + result.stdout.fnmatch_lines( + ["FAIL*test_1*", "SKIP*four*", "XFAIL*test_2*", "XPASS*test_3*"] + ) def test_reportchars_all_error(testdir): @@ -811,16 +889,16 @@ def test_reportchars_all_error(testdir): test_simple=""" def test_foo(): pass - """) - result = testdir.runpytest('-ra') - result.stdout.fnmatch_lines([ - 'ERROR*test_foo*', - ]) + """, + ) + result = testdir.runpytest("-ra") + result.stdout.fnmatch_lines(["ERROR*test_foo*"]) @pytest.mark.xfail("hasattr(sys, 'pypy_version_info')") def test_errors_in_xfail_skip_expressions(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.skipif("asd") def test_nameerror(): @@ -831,27 +909,31 @@ def test_errors_in_xfail_skip_expressions(testdir): def test_func(): pass - """) + """ + ) result = testdir.runpytest() markline = " ^" if sys.platform.startswith("java"): # XXX report this to java markline = "*" + markline[8:] - result.stdout.fnmatch_lines([ - "*ERROR*test_nameerror*", - "*evaluating*skipif*expression*", - "*asd*", - "*ERROR*test_syntax*", - "*evaluating*xfail*expression*", - " syntax error", - markline, - "SyntaxError: invalid syntax", - "*1 pass*2 error*", - ]) + result.stdout.fnmatch_lines( + [ + "*ERROR*test_nameerror*", + "*evaluating*skipif*expression*", + "*asd*", + "*ERROR*test_syntax*", + "*evaluating*xfail*expression*", + " syntax error", + markline, + "SyntaxError: invalid syntax", + "*1 pass*2 error*", + ] + ) def test_xfail_skipif_with_globals(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest x = 3 @pytest.mark.skipif("x == 3") @@ -860,55 +942,59 @@ def test_xfail_skipif_with_globals(testdir): @pytest.mark.xfail("x == 3") def test_boolean(): assert 0 - """) + """ + ) result = testdir.runpytest("-rsx") - result.stdout.fnmatch_lines([ - "*SKIP*x == 3*", - "*XFAIL*test_boolean*", - "*x == 3*", - ]) + result.stdout.fnmatch_lines(["*SKIP*x == 3*", "*XFAIL*test_boolean*", "*x == 3*"]) def test_direct_gives_error(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.skipif(True) def test_skip1(): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*1 error*", - ]) + result.stdout.fnmatch_lines(["*1 error*"]) def test_default_markers(testdir): result = testdir.runpytest("--markers") - result.stdout.fnmatch_lines([ - "*skipif(*condition)*skip*", - "*xfail(*condition, reason=None, run=True, raises=None, strict=False)*expected failure*", - ]) + result.stdout.fnmatch_lines( + [ + "*skipif(*condition)*skip*", + "*xfail(*condition, reason=None, run=True, raises=None, strict=False)*expected failure*", + ] + ) def test_xfail_test_setup_exception(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_runtest_setup(): 0 / 0 - """) - p = testdir.makepyfile(""" + """ + ) + p = testdir.makepyfile( + """ import pytest @pytest.mark.xfail def test_func(): assert 0 - """) + """ + ) result = testdir.runpytest(p) assert result.ret == 0 - assert 'xfailed' in result.stdout.str() - assert 'xpassed' not in result.stdout.str() + assert "xfailed" in result.stdout.str() + assert "xpassed" not in result.stdout.str() def test_imperativeskip_on_xfail_test(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.xfail def test_that_fails(): @@ -917,23 +1003,30 @@ def test_imperativeskip_on_xfail_test(testdir): @pytest.mark.skipif("True") def test_hello(): pass - """) - testdir.makeconftest(""" + """ + ) + testdir.makeconftest( + """ import pytest def pytest_runtest_setup(item): pytest.skip("abc") - """) + """ + ) result = testdir.runpytest("-rsxX") - result.stdout.fnmatch_lines_random(""" + result.stdout.fnmatch_lines_random( + """ *SKIP*abc* *SKIP*condition: True* *2 skipped* - """) + """ + ) class TestBooleanCondition(object): + def test_skipif(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.skipif(True, reason="True123") def test_func1(): @@ -941,42 +1034,54 @@ class TestBooleanCondition(object): @pytest.mark.skipif(False, reason="True123") def test_func2(): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *1 passed*1 skipped* - """) + """ + ) def test_skipif_noreason(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.skipif(True) def test_func(): pass - """) + """ + ) result = testdir.runpytest("-rs") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *1 error* - """) + """ + ) def test_xfail(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.xfail(True, reason="True123") def test_func(): assert 0 - """) + """ + ) result = testdir.runpytest("-rxs") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *XFAIL* *True123* *1 xfail* - """) + """ + ) def test_xfail_item(testdir): # Ensure pytest.xfail works with non-Python Item - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest class MyItem(pytest.Item): @@ -986,11 +1091,12 @@ def test_xfail_item(testdir): def pytest_collect_file(path, parent): return MyItem("foo", parent) - """) + """ + ) result = testdir.inline_run() passed, skipped, failed = result.listoutcomes() assert not failed - xfailed = [r for r in skipped if hasattr(r, 'wasxfail')] + xfailed = [r for r in skipped if hasattr(r, "wasxfail")] assert xfailed @@ -998,55 +1104,56 @@ def test_module_level_skip_error(testdir): """ Verify that using pytest.skip at module level causes a collection error """ - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.skip def test_func(): assert True - """) - result = testdir.runpytest() - result.stdout.fnmatch_lines( - "*Using pytest.skip outside of a test is not allowed*" + """ ) + result = testdir.runpytest() + result.stdout.fnmatch_lines("*Using pytest.skip outside of a test is not allowed*") def test_module_level_skip_with_allow_module_level(testdir): """ Verify that using pytest.skip(allow_module_level=True) is allowed """ - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest pytest.skip("skip_module_level", allow_module_level=True) def test_func(): assert 0 - """) - result = testdir.runpytest("-rxs") - result.stdout.fnmatch_lines( - "*SKIP*skip_module_level" + """ ) + result = testdir.runpytest("-rxs") + result.stdout.fnmatch_lines("*SKIP*skip_module_level") def test_invalid_skip_keyword_parameter(testdir): """ Verify that using pytest.skip() with unknown parameter raises an error """ - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest pytest.skip("skip_module_level", unknown=1) def test_func(): assert 0 - """) - result = testdir.runpytest() - result.stdout.fnmatch_lines( - "*TypeError:*['unknown']*" + """ ) + result = testdir.runpytest() + result.stdout.fnmatch_lines("*TypeError:*['unknown']*") def test_mark_xfail_item(testdir): # Ensure pytest.mark.xfail works with non-Python Item - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest class MyItem(pytest.Item): @@ -1059,9 +1166,29 @@ def test_mark_xfail_item(testdir): def pytest_collect_file(path, parent): return MyItem("foo", parent) - """) + """ + ) result = testdir.inline_run() passed, skipped, failed = result.listoutcomes() assert not failed - xfailed = [r for r in skipped if hasattr(r, 'wasxfail')] + xfailed = [r for r in skipped if hasattr(r, "wasxfail")] assert xfailed + + +def test_summary_list_after_errors(testdir): + """Ensure the list of errors/fails/xfails/skips appears after tracebacks in terminal reporting.""" + testdir.makepyfile( + """ + import pytest + def test_fail(): + assert 0 + """ + ) + result = testdir.runpytest("-ra") + result.stdout.fnmatch_lines( + [ + "=* FAILURES *=", + "*= short test summary info =*", + "FAIL test_summary_list_after_errors.py::test_fail", + ] + ) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_terminal.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_terminal.py index 97c2f71fb66..8f08ad34fa1 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_terminal.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_terminal.py @@ -14,10 +14,11 @@ from _pytest.terminal import TerminalReporter, repr_pythonversion, getreportopt from _pytest.terminal import build_summary_stats_line, _plugin_nameversions -DistInfo = collections.namedtuple('DistInfo', ['project_name', 'version']) +DistInfo = collections.namedtuple("DistInfo", ["project_name", "version"]) class Option(object): + def __init__(self, verbose=False, fulltrace=False): self.verbose = verbose self.fulltrace = fulltrace @@ -26,32 +27,40 @@ class Option(object): def args(self): values = [] if self.verbose: - values.append('-v') + values.append("-v") if self.fulltrace: - values.append('--fulltrace') + values.append("--fulltrace") return values -def pytest_generate_tests(metafunc): - if "option" in metafunc.fixturenames: - metafunc.addcall(id="default", - funcargs={'option': Option(verbose=False)}) - metafunc.addcall(id="verbose", - funcargs={'option': Option(verbose=True)}) - metafunc.addcall(id="quiet", - funcargs={'option': Option(verbose=-1)}) - metafunc.addcall(id="fulltrace", - funcargs={'option': Option(fulltrace=True)}) +@pytest.fixture( + params=[ + Option(verbose=False), + Option(verbose=True), + Option(verbose=-1), + Option(fulltrace=True), + ], + ids=["default", "verbose", "quiet", "fulltrace"], +) +def option(request): + return request.param -@pytest.mark.parametrize('input,expected', [ - ([DistInfo(project_name='test', version=1)], ['test-1']), - ([DistInfo(project_name='pytest-test', version=1)], ['test-1']), - ([ - DistInfo(project_name='test', version=1), - DistInfo(project_name='test', version=1) - ], ['test-1']), -], ids=['normal', 'prefix-strip', 'deduplicate']) +@pytest.mark.parametrize( + "input,expected", + [ + ([DistInfo(project_name="test", version=1)], ["test-1"]), + ([DistInfo(project_name="pytest-test", version=1)], ["test-1"]), + ( + [ + DistInfo(project_name="test", version=1), + DistInfo(project_name="test", version=1), + ], + ["test-1"], + ), + ], + ids=["normal", "prefix-strip", "deduplicate"], +) def test_plugin_nameversion(input, expected): pluginlist = [(None, x) for x in input] result = _plugin_nameversions(pluginlist) @@ -59,8 +68,10 @@ def test_plugin_nameversion(input, expected): class TestTerminal(object): + def test_pass_skip_fail(self, testdir, option): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def test_ok(): pass @@ -68,39 +79,36 @@ class TestTerminal(object): pytest.skip("xx") def test_func(): assert 0 - """) + """ + ) result = testdir.runpytest(*option.args) if option.verbose: - result.stdout.fnmatch_lines([ - "*test_pass_skip_fail.py::test_ok PASS*", - "*test_pass_skip_fail.py::test_skip SKIP*", - "*test_pass_skip_fail.py::test_func FAIL*", - ]) + result.stdout.fnmatch_lines( + [ + "*test_pass_skip_fail.py::test_ok PASS*", + "*test_pass_skip_fail.py::test_skip SKIP*", + "*test_pass_skip_fail.py::test_func FAIL*", + ] + ) else: - result.stdout.fnmatch_lines([ - "*test_pass_skip_fail.py .sF*" - ]) - result.stdout.fnmatch_lines([ - " def test_func():", - "> assert 0", - "E assert 0", - ]) + result.stdout.fnmatch_lines(["*test_pass_skip_fail.py .sF*"]) + result.stdout.fnmatch_lines( + [" def test_func():", "> assert 0", "E assert 0"] + ) def test_internalerror(self, testdir, linecomp): modcol = testdir.getmodulecol("def test_one(): pass") rep = TerminalReporter(modcol.config, file=linecomp.stringio) excinfo = pytest.raises(ValueError, "raise ValueError('hello')") rep.pytest_internalerror(excinfo.getrepr()) - linecomp.assert_contains_lines([ - "INTERNALERROR> *ValueError*hello*" - ]) + linecomp.assert_contains_lines(["INTERNALERROR> *ValueError*hello*"]) def test_writeline(self, testdir, linecomp): modcol = testdir.getmodulecol("def test_one(): pass") rep = TerminalReporter(modcol.config, file=linecomp.stringio) rep.write_fspath_result(modcol.nodeid, ".") rep.write_line("hello world") - lines = linecomp.stringio.getvalue().split('\n') + lines = linecomp.stringio.getvalue().split("\n") assert not lines[0] assert lines[1].endswith(modcol.name + " .") assert lines[2] == "hello world" @@ -110,191 +118,212 @@ class TestTerminal(object): tr = TerminalReporter(item.config, file=linecomp.stringio) item.config.pluginmanager.register(tr) location = item.reportinfo() - tr.config.hook.pytest_runtest_logstart(nodeid=item.nodeid, - location=location, fspath=str(item.fspath)) - linecomp.assert_contains_lines([ - "*test_show_runtest_logstart.py*" - ]) + tr.config.hook.pytest_runtest_logstart( + nodeid=item.nodeid, location=location, fspath=str(item.fspath) + ) + linecomp.assert_contains_lines(["*test_show_runtest_logstart.py*"]) def test_runtest_location_shown_before_test_starts(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_1(): import time time.sleep(20) - """) + """ + ) child = testdir.spawn_pytest("") child.expect(".*test_runtest_location.*py") child.sendeof() child.kill(15) def test_itemreport_subclasses_show_subclassed_file(self, testdir): - testdir.makepyfile(test_p1=""" + testdir.makepyfile( + test_p1=""" class BaseTests(object): def test_p1(self): pass class TestClass(BaseTests): pass - """) - p2 = testdir.makepyfile(test_p2=""" + """ + ) + p2 = testdir.makepyfile( + test_p2=""" from test_p1 import BaseTests class TestMore(BaseTests): pass - """) + """ + ) result = testdir.runpytest(p2) - result.stdout.fnmatch_lines([ - "*test_p2.py .*", - "*1 passed*", - ]) + result.stdout.fnmatch_lines(["*test_p2.py .*", "*1 passed*"]) result = testdir.runpytest("-v", p2) - result.stdout.fnmatch_lines([ - "*test_p2.py::TestMore::test_p1* <- *test_p1.py*PASSED*", - ]) + result.stdout.fnmatch_lines( + ["*test_p2.py::TestMore::test_p1* <- *test_p1.py*PASSED*"] + ) def test_itemreport_directclasses_not_shown_as_subclasses(self, testdir): a = testdir.mkpydir("a123") - a.join("test_hello123.py").write(_pytest._code.Source(""" + a.join("test_hello123.py").write( + _pytest._code.Source( + """ class TestClass(object): def test_method(self): pass - """)) + """ + ) + ) result = testdir.runpytest("-v") assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*a123/test_hello123.py*PASS*", - ]) + result.stdout.fnmatch_lines(["*a123/test_hello123.py*PASS*"]) assert " <- " not in result.stdout.str() def test_keyboard_interrupt(self, testdir, option): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_foobar(): assert 0 def test_spamegg(): import py; pytest.skip('skip me please!') def test_interrupt_me(): raise KeyboardInterrupt # simulating the user - """) + """ + ) result = testdir.runpytest(*option.args, no_reraise_ctrlc=True) - result.stdout.fnmatch_lines([ - " def test_foobar():", - "> assert 0", - "E assert 0", - "*_keyboard_interrupt.py:6: KeyboardInterrupt*", - ]) + result.stdout.fnmatch_lines( + [ + " def test_foobar():", + "> assert 0", + "E assert 0", + "*_keyboard_interrupt.py:6: KeyboardInterrupt*", + ] + ) if option.fulltrace: - result.stdout.fnmatch_lines([ - "*raise KeyboardInterrupt # simulating the user*", - ]) + result.stdout.fnmatch_lines( + ["*raise KeyboardInterrupt # simulating the user*"] + ) else: - result.stdout.fnmatch_lines([ - "to show a full traceback on KeyboardInterrupt use --fulltrace" - ]) - result.stdout.fnmatch_lines(['*KeyboardInterrupt*']) + result.stdout.fnmatch_lines( + ["(to show a full traceback on KeyboardInterrupt use --fulltrace)"] + ) + result.stdout.fnmatch_lines(["*KeyboardInterrupt*"]) def test_keyboard_in_sessionstart(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_sessionstart(): raise KeyboardInterrupt - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ def test_foobar(): pass - """) + """ + ) result = testdir.runpytest(no_reraise_ctrlc=True) assert result.ret == 2 - result.stdout.fnmatch_lines(['*KeyboardInterrupt*']) + result.stdout.fnmatch_lines(["*KeyboardInterrupt*"]) def test_collect_single_item(self, testdir): """Use singular 'item' when reporting a single test item""" - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_foobar(): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(['collected 1 item']) + result.stdout.fnmatch_lines(["collected 1 item"]) def test_rewrite(self, testdir, monkeypatch): config = testdir.parseconfig() f = py.io.TextIO() - monkeypatch.setattr(f, 'isatty', lambda *args: True) + monkeypatch.setattr(f, "isatty", lambda *args: True) tr = TerminalReporter(config, f) tr._tw.fullwidth = 10 - tr.write('hello') - tr.rewrite('hey', erase=True) - assert f.getvalue() == 'hello' + '\r' + 'hey' + (6 * ' ') + tr.write("hello") + tr.rewrite("hey", erase=True) + assert f.getvalue() == "hello" + "\r" + "hey" + (6 * " ") class TestCollectonly(object): + def test_collectonly_basic(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_func(): pass - """) - result = testdir.runpytest("--collect-only",) - result.stdout.fnmatch_lines([ - "", - " ", - ]) + """ + ) + result = testdir.runpytest("--collect-only") + result.stdout.fnmatch_lines( + ["", " "] + ) def test_collectonly_skipped_module(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest pytest.skip("hello") - """) + """ + ) result = testdir.runpytest("--collect-only", "-rs") - result.stdout.fnmatch_lines([ - "*ERROR collecting*", - ]) + result.stdout.fnmatch_lines(["*ERROR collecting*"]) def test_collectonly_failed_module(self, testdir): testdir.makepyfile("""raise ValueError(0)""") result = testdir.runpytest("--collect-only") - result.stdout.fnmatch_lines([ - "*raise ValueError*", - "*1 error*", - ]) + result.stdout.fnmatch_lines(["*raise ValueError*", "*1 error*"]) def test_collectonly_fatal(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_collectstart(collector): assert 0, "urgs" - """) + """ + ) result = testdir.runpytest("--collect-only") - result.stdout.fnmatch_lines([ - "*INTERNAL*args*" - ]) + result.stdout.fnmatch_lines(["*INTERNAL*args*"]) assert result.ret == 3 def test_collectonly_simple(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_func1(): pass class TestClass(object): def test_method(self): pass - """) + """ + ) result = testdir.runpytest("--collect-only", p) # assert stderr.startswith("inserting into sys.path") assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*", - "* ", - "* ", - # "* ", - "* ", - ]) + result.stdout.fnmatch_lines( + [ + "*", + "* ", + "* ", + # "* ", + "* ", + ] + ) def test_collectonly_error(self, testdir): p = testdir.makepyfile("import Errlkjqweqwe") result = testdir.runpytest("--collect-only", p) assert result.ret == 2 - result.stdout.fnmatch_lines(_pytest._code.Source(""" + result.stdout.fnmatch_lines( + _pytest._code.Source( + """ *ERROR* *ImportError* *No module named *Errlk* *1 error* - """).strip()) + """ + ).strip() + ) def test_collectonly_missing_path(self, testdir): """this checks issue 115, @@ -303,98 +332,105 @@ class TestCollectonly(object): """ result = testdir.runpytest("--collect-only", "uhm_missing_path") assert result.ret == 4 - result.stderr.fnmatch_lines([ - '*ERROR: file not found*', - ]) + result.stderr.fnmatch_lines(["*ERROR: file not found*"]) def test_collectonly_quiet(self, testdir): testdir.makepyfile("def test_foo(): pass") result = testdir.runpytest("--collect-only", "-q") - result.stdout.fnmatch_lines([ - '*test_foo*', - ]) + result.stdout.fnmatch_lines(["*test_foo*"]) def test_collectonly_more_quiet(self, testdir): testdir.makepyfile(test_fun="def test_foo(): pass") result = testdir.runpytest("--collect-only", "-qq") - result.stdout.fnmatch_lines([ - '*test_fun.py: 1*', - ]) + result.stdout.fnmatch_lines(["*test_fun.py: 1*"]) def test_repr_python_version(monkeypatch): try: - monkeypatch.setattr(sys, 'version_info', (2, 5, 1, 'final', 0)) + monkeypatch.setattr(sys, "version_info", (2, 5, 1, "final", 0)) assert repr_pythonversion() == "2.5.1-final-0" - py.std.sys.version_info = x = (2, 3) + sys.version_info = x = (2, 3) assert repr_pythonversion() == str(x) finally: monkeypatch.undo() # do this early as pytest can get confused class TestFixtureReporting(object): + def test_setup_fixture_error(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def setup_function(function): print ("setup func") assert 0 def test_nada(): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*ERROR at setup of test_nada*", - "*setup_function(function):*", - "*setup func*", - "*assert 0*", - "*1 error*", - ]) + result.stdout.fnmatch_lines( + [ + "*ERROR at setup of test_nada*", + "*setup_function(function):*", + "*setup func*", + "*assert 0*", + "*1 error*", + ] + ) assert result.ret != 0 def test_teardown_fixture_error(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_nada(): pass def teardown_function(function): print ("teardown func") assert 0 - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*ERROR at teardown*", - "*teardown_function(function):*", - "*assert 0*", - "*Captured stdout*", - "*teardown func*", - "*1 passed*1 error*", - ]) + result.stdout.fnmatch_lines( + [ + "*ERROR at teardown*", + "*teardown_function(function):*", + "*assert 0*", + "*Captured stdout*", + "*teardown func*", + "*1 passed*1 error*", + ] + ) def test_teardown_fixture_error_and_test_failure(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_fail(): assert 0, "failingfunc" def teardown_function(function): print ("teardown func") assert False - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*ERROR at teardown of test_fail*", - "*teardown_function(function):*", - "*assert False*", - "*Captured stdout*", - "*teardown func*", - - "*test_fail*", - "*def test_fail():", - "*failingfunc*", - "*1 failed*1 error*", - ]) + result.stdout.fnmatch_lines( + [ + "*ERROR at teardown of test_fail*", + "*teardown_function(function):*", + "*assert False*", + "*Captured stdout*", + "*teardown func*", + "*test_fail*", + "*def test_fail():", + "*failingfunc*", + "*1 failed*1 error*", + ] + ) def test_setup_teardown_output_and_test_failure(self, testdir): """ Test for issue #442 """ - testdir.makepyfile(""" + testdir.makepyfile( + """ def setup_function(function): print ("setup func") @@ -403,24 +439,28 @@ class TestFixtureReporting(object): def teardown_function(function): print ("teardown func") - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*test_fail*", - "*def test_fail():", - "*failingfunc*", - "*Captured stdout setup*", - "*setup func*", - "*Captured stdout teardown*", - "*teardown func*", - - "*1 failed*", - ]) + result.stdout.fnmatch_lines( + [ + "*test_fail*", + "*def test_fail():", + "*failingfunc*", + "*Captured stdout setup*", + "*setup func*", + "*Captured stdout teardown*", + "*teardown func*", + "*1 failed*", + ] + ) class TestTerminalFunctional(object): + def test_deselected(self, testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ def test_one(): pass def test_two(): @@ -428,16 +468,44 @@ class TestTerminalFunctional(object): def test_three(): pass """ - ) + ) result = testdir.runpytest("-k", "test_two:", testpath) - result.stdout.fnmatch_lines([ - "*test_deselected.py ..*", - "=* 1 test*deselected *=", - ]) + result.stdout.fnmatch_lines( + ["collected 3 items / 1 deselected", "*test_deselected.py ..*"] + ) + assert result.ret == 0 + + def test_show_deselected_items_using_markexpr_before_test_execution(self, testdir): + testdir.makepyfile( + """ + import pytest + + @pytest.mark.foo + def test_foobar(): + pass + + @pytest.mark.bar + def test_bar(): + pass + + def test_pass(): + pass + """ + ) + result = testdir.runpytest("-m", "not foo") + result.stdout.fnmatch_lines( + [ + "collected 3 items / 1 deselected", + "*test_show_des*.py ..*", + "*= 2 passed, 1 deselected in * =*", + ] + ) + assert "= 1 deselected =" not in result.stdout.str() assert result.ret == 0 def test_no_skip_summary_if_failure(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def test_ok(): pass @@ -445,66 +513,78 @@ class TestTerminalFunctional(object): assert 0 def test_skip(): pytest.skip("dontshow") - """) + """ + ) result = testdir.runpytest() assert result.stdout.str().find("skip test summary") == -1 assert result.ret == 1 def test_passes(self, testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ def test_passes(): pass class TestClass(object): def test_method(self): pass - """) + """ + ) old = p1.dirpath().chdir() try: result = testdir.runpytest() finally: old.chdir() - result.stdout.fnmatch_lines([ - "test_passes.py ..*", - "* 2 pass*", - ]) + result.stdout.fnmatch_lines(["test_passes.py ..*", "* 2 pass*"]) assert result.ret == 0 def test_header_trailer_info(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_passes(): pass - """) + """ + ) result = testdir.runpytest() - verinfo = ".".join(map(str, py.std.sys.version_info[:3])) - result.stdout.fnmatch_lines([ - "*===== test session starts ====*", - "platform %s -- Python %s*pytest-%s*py-%s*pluggy-%s" % ( - py.std.sys.platform, verinfo, - pytest.__version__, py.__version__, pluggy.__version__), - "*test_header_trailer_info.py .*", - "=* 1 passed*in *.[0-9][0-9] seconds *=", - ]) + verinfo = ".".join(map(str, sys.version_info[:3])) + result.stdout.fnmatch_lines( + [ + "*===== test session starts ====*", + "platform %s -- Python %s*pytest-%s*py-%s*pluggy-%s" + % ( + sys.platform, + verinfo, + pytest.__version__, + py.__version__, + pluggy.__version__, + ), + "*test_header_trailer_info.py .*", + "=* 1 passed*in *.[0-9][0-9] seconds *=", + ] + ) if pytest.config.pluginmanager.list_plugin_distinfo(): - result.stdout.fnmatch_lines([ - "plugins: *", - ]) + result.stdout.fnmatch_lines(["plugins: *"]) def test_showlocals(self, testdir): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ def test_showlocals(): x = 3 y = "x" * 5000 assert 0 - """) - result = testdir.runpytest(p1, '-l') - result.stdout.fnmatch_lines([ - # "_ _ * Locals *", - "x* = 3", - "y* = 'xxxxxx*" - ]) + """ + ) + result = testdir.runpytest(p1, "-l") + result.stdout.fnmatch_lines( + [ + # "_ _ * Locals *", + "x* = 3", + "y* = 'xxxxxx*", + ] + ) def test_verbose_reporting(self, testdir, pytestconfig): - p1 = testdir.makepyfile(""" + p1 = testdir.makepyfile( + """ import pytest def test_fail(): raise ValueError() @@ -517,151 +597,155 @@ class TestTerminalFunctional(object): def check(x): assert x == 1 yield check, 0 - """) - result = testdir.runpytest(p1, '-v') - result.stdout.fnmatch_lines([ - "*test_verbose_reporting.py::test_fail *FAIL*", - "*test_verbose_reporting.py::test_pass *PASS*", - "*test_verbose_reporting.py::TestClass::test_skip *SKIP*", - "*test_verbose_reporting.py::test_gen*0* *FAIL*", - ]) + """ + ) + result = testdir.runpytest(p1, "-v") + result.stdout.fnmatch_lines( + [ + "*test_verbose_reporting.py::test_fail *FAIL*", + "*test_verbose_reporting.py::test_pass *PASS*", + "*test_verbose_reporting.py::TestClass::test_skip *SKIP*", + "*test_verbose_reporting.py::test_gen*0* *FAIL*", + ] + ) assert result.ret == 1 if not pytestconfig.pluginmanager.get_plugin("xdist"): pytest.skip("xdist plugin not installed") - result = testdir.runpytest(p1, '-v', '-n 1') - result.stdout.fnmatch_lines([ - "*FAIL*test_verbose_reporting.py::test_fail*", - ]) + result = testdir.runpytest(p1, "-v", "-n 1") + result.stdout.fnmatch_lines(["*FAIL*test_verbose_reporting.py::test_fail*"]) assert result.ret == 1 def test_quiet_reporting(self, testdir): p1 = testdir.makepyfile("def test_pass(): pass") - result = testdir.runpytest(p1, '-q') + result = testdir.runpytest(p1, "-q") s = result.stdout.str() - assert 'test session starts' not in s + assert "test session starts" not in s assert p1.basename not in s assert "===" not in s assert "passed" in s def test_more_quiet_reporting(self, testdir): p1 = testdir.makepyfile("def test_pass(): pass") - result = testdir.runpytest(p1, '-qq') + result = testdir.runpytest(p1, "-qq") s = result.stdout.str() - assert 'test session starts' not in s + assert "test session starts" not in s assert p1.basename not in s assert "===" not in s assert "passed" not in s def test_report_collectionfinish_hook(self, testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_report_collectionfinish(config, startdir, items): return ['hello from hook: {0} items'.format(len(items))] - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ import pytest @pytest.mark.parametrize('i', range(3)) def test(i): pass - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "collected 3 items", - "hello from hook: 3 items", - ]) + result.stdout.fnmatch_lines(["collected 3 items", "hello from hook: 3 items"]) def test_fail_extra_reporting(testdir): testdir.makepyfile("def test_this(): assert 0") result = testdir.runpytest() - assert 'short test summary' not in result.stdout.str() - result = testdir.runpytest('-rf') - result.stdout.fnmatch_lines([ - "*test summary*", - "FAIL*test_fail_extra_reporting*", - ]) + assert "short test summary" not in result.stdout.str() + result = testdir.runpytest("-rf") + result.stdout.fnmatch_lines(["*test summary*", "FAIL*test_fail_extra_reporting*"]) def test_fail_reporting_on_pass(testdir): testdir.makepyfile("def test_this(): assert 1") - result = testdir.runpytest('-rf') - assert 'short test summary' not in result.stdout.str() + result = testdir.runpytest("-rf") + assert "short test summary" not in result.stdout.str() def test_pass_extra_reporting(testdir): testdir.makepyfile("def test_this(): assert 1") result = testdir.runpytest() - assert 'short test summary' not in result.stdout.str() - result = testdir.runpytest('-rp') - result.stdout.fnmatch_lines([ - "*test summary*", - "PASS*test_pass_extra_reporting*", - ]) + assert "short test summary" not in result.stdout.str() + result = testdir.runpytest("-rp") + result.stdout.fnmatch_lines(["*test summary*", "PASS*test_pass_extra_reporting*"]) def test_pass_reporting_on_fail(testdir): testdir.makepyfile("def test_this(): assert 0") - result = testdir.runpytest('-rp') - assert 'short test summary' not in result.stdout.str() + result = testdir.runpytest("-rp") + assert "short test summary" not in result.stdout.str() def test_pass_output_reporting(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_pass_output(): print("Four score and seven years ago...") - """) + """ + ) result = testdir.runpytest() - assert 'Four score and seven years ago...' not in result.stdout.str() - result = testdir.runpytest('-rP') - result.stdout.fnmatch_lines([ - "Four score and seven years ago...", - ]) + assert "Four score and seven years ago..." not in result.stdout.str() + result = testdir.runpytest("-rP") + result.stdout.fnmatch_lines(["Four score and seven years ago..."]) def test_color_yes(testdir): testdir.makepyfile("def test_this(): assert 1") - result = testdir.runpytest('--color=yes') - assert 'test session starts' in result.stdout.str() - assert '\x1b[1m' in result.stdout.str() + result = testdir.runpytest("--color=yes") + assert "test session starts" in result.stdout.str() + assert "\x1b[1m" in result.stdout.str() def test_color_no(testdir): testdir.makepyfile("def test_this(): assert 1") - result = testdir.runpytest('--color=no') - assert 'test session starts' in result.stdout.str() - assert '\x1b[1m' not in result.stdout.str() + result = testdir.runpytest("--color=no") + assert "test session starts" in result.stdout.str() + assert "\x1b[1m" not in result.stdout.str() -@pytest.mark.parametrize('verbose', [True, False]) +@pytest.mark.parametrize("verbose", [True, False]) def test_color_yes_collection_on_non_atty(testdir, verbose): """skip collect progress report when working on non-terminals. #1397 """ - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.parametrize('i', range(10)) def test_this(i): assert 1 - """) - args = ['--color=yes'] + """ + ) + args = ["--color=yes"] if verbose: - args.append('-vv') + args.append("-vv") result = testdir.runpytest(*args) - assert 'test session starts' in result.stdout.str() - assert '\x1b[1m' in result.stdout.str() - assert 'collecting 10 items' not in result.stdout.str() + assert "test session starts" in result.stdout.str() + assert "\x1b[1m" in result.stdout.str() + assert "collecting 10 items" not in result.stdout.str() if verbose: - assert 'collecting ...' in result.stdout.str() - assert 'collected 10 items' in result.stdout.str() + assert "collecting ..." in result.stdout.str() + assert "collected 10 items" in result.stdout.str() def test_getreportopt(): - class config(object): - class option(object): + + class Config(object): + + class Option(object): reportchars = "" disable_warnings = True + option = Option() + + config = Config() + config.option.reportchars = "sf" assert getreportopt(config) == "sf" @@ -679,7 +763,8 @@ def test_getreportopt(): def test_terminalreporter_reportopt_addopts(testdir): testdir.makeini("[pytest]\naddopts=-rs") - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture @@ -689,15 +774,15 @@ def test_terminalreporter_reportopt_addopts(testdir): def test_opt(tr): assert tr.hasopt('skipped') assert not tr.hasopt('qwe') - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*1 passed*" - ]) + result.stdout.fnmatch_lines(["*1 passed*"]) def test_tbstyle_short(testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest @pytest.fixture @@ -706,27 +791,22 @@ def test_tbstyle_short(testdir): def test_opt(arg): x = 0 assert x - """) + """ + ) result = testdir.runpytest("--tb=short") s = result.stdout.str() - assert 'arg = 42' not in s - assert 'x = 0' not in s - result.stdout.fnmatch_lines([ - "*%s:8*" % p.basename, - " assert x", - "E assert*", - ]) + assert "arg = 42" not in s + assert "x = 0" not in s + result.stdout.fnmatch_lines(["*%s:8*" % p.basename, " assert x", "E assert*"]) result = testdir.runpytest() s = result.stdout.str() - assert 'x = 0' in s - assert 'assert x' in s + assert "x = 0" in s + assert "assert x" in s def test_traceconfig(testdir, monkeypatch): result = testdir.runpytest("--traceconfig") - result.stdout.fnmatch_lines([ - "*active plugins*" - ]) + result.stdout.fnmatch_lines(["*active plugins*"]) assert result.ret == EXIT_NOTESTSCOLLECTED @@ -738,55 +818,56 @@ class TestGenericReporting(object): def test_collect_fail(self, testdir, option): testdir.makepyfile("import xyz\n") result = testdir.runpytest(*option.args) - result.stdout.fnmatch_lines([ - "ImportError while importing*", - "*No module named *xyz*", - "*1 error*", - ]) + result.stdout.fnmatch_lines( + ["ImportError while importing*", "*No module named *xyz*", "*1 error*"] + ) def test_maxfailures(self, testdir, option): - testdir.makepyfile(""" + testdir.makepyfile( + """ def test_1(): assert 0 def test_2(): assert 0 def test_3(): assert 0 - """) + """ + ) result = testdir.runpytest("--maxfail=2", *option.args) - result.stdout.fnmatch_lines([ - "*def test_1():*", - "*def test_2():*", - "*2 failed*", - ]) + result.stdout.fnmatch_lines( + ["*def test_1():*", "*def test_2():*", "*2 failed*"] + ) def test_tb_option(self, testdir, option): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def g(): raise IndexError def test_func(): print (6*7) g() # --calling-- - """) + """ + ) for tbopt in ["long", "short", "no"]: - print('testing --tb=%s...' % tbopt) - result = testdir.runpytest('--tb=%s' % tbopt) + print("testing --tb=%s..." % tbopt) + result = testdir.runpytest("--tb=%s" % tbopt) s = result.stdout.str() if tbopt == "long": - assert 'print (6*7)' in s + assert "print (6*7)" in s else: - assert 'print (6*7)' not in s + assert "print (6*7)" not in s if tbopt != "no": - assert '--calling--' in s - assert 'IndexError' in s + assert "--calling--" in s + assert "IndexError" in s else: - assert 'FAILURES' not in s - assert '--calling--' not in s - assert 'IndexError' not in s + assert "FAILURES" not in s + assert "--calling--" not in s + assert "IndexError" not in s def test_tb_crashline(self, testdir, option): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest def g(): raise IndexError @@ -795,38 +876,90 @@ class TestGenericReporting(object): g() # --calling-- def test_func2(): assert 0, "hello" - """) + """ + ) result = testdir.runpytest("--tb=line") bn = p.basename - result.stdout.fnmatch_lines([ - "*%s:3: IndexError*" % bn, - "*%s:8: AssertionError: hello*" % bn, - ]) + result.stdout.fnmatch_lines( + ["*%s:3: IndexError*" % bn, "*%s:8: AssertionError: hello*" % bn] + ) s = result.stdout.str() assert "def test_func2" not in s def test_pytest_report_header(self, testdir, option): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_sessionstart(session): session.config._somevalue = 42 def pytest_report_header(config): return "hello: %s" % config._somevalue - """) - testdir.mkdir("a").join("conftest.py").write(""" + """ + ) + testdir.mkdir("a").join("conftest.py").write( + """ def pytest_report_header(config, startdir): return ["line1", str(startdir)] -""") +""" + ) result = testdir.runpytest("a") - result.stdout.fnmatch_lines([ - "*hello: 42*", - "line1", - str(testdir.tmpdir), - ]) + result.stdout.fnmatch_lines(["*hello: 42*", "line1", str(testdir.tmpdir)]) + + def test_show_capture(self, testdir): + testdir.makepyfile( + """ + import sys + import logging + def test_one(): + sys.stdout.write('!This is stdout!') + sys.stderr.write('!This is stderr!') + logging.warning('!This is a warning log msg!') + assert False, 'Something failed' + """ + ) + + result = testdir.runpytest("--tb=short") + result.stdout.fnmatch_lines( + [ + "!This is stdout!", + "!This is stderr!", + "*WARNING*!This is a warning log msg!", + ] + ) + + result = testdir.runpytest("--show-capture=all", "--tb=short") + result.stdout.fnmatch_lines( + [ + "!This is stdout!", + "!This is stderr!", + "*WARNING*!This is a warning log msg!", + ] + ) + + stdout = testdir.runpytest("--show-capture=stdout", "--tb=short").stdout.str() + assert "!This is stderr!" not in stdout + assert "!This is stdout!" in stdout + assert "!This is a warning log msg!" not in stdout + + stdout = testdir.runpytest("--show-capture=stderr", "--tb=short").stdout.str() + assert "!This is stdout!" not in stdout + assert "!This is stderr!" in stdout + assert "!This is a warning log msg!" not in stdout + + stdout = testdir.runpytest("--show-capture=log", "--tb=short").stdout.str() + assert "!This is stdout!" not in stdout + assert "!This is stderr!" not in stdout + assert "!This is a warning log msg!" in stdout + + stdout = testdir.runpytest("--show-capture=no", "--tb=short").stdout.str() + assert "!This is stdout!" not in stdout + assert "!This is stderr!" not in stdout + assert "!This is a warning log msg!" not in stdout @pytest.mark.xfail("not hasattr(os, 'dup')") def test_fdopen_kept_alive_issue124(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import os, sys k = [] def test_open_file_and_keep_alive(capfd): @@ -836,15 +969,15 @@ def test_fdopen_kept_alive_issue124(testdir): def test_close_kept_alive_file(): stdout = k.pop() stdout.close() - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*2 passed*" - ]) + result.stdout.fnmatch_lines(["*2 passed*"]) def test_tbstyle_native_setup_error(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture def setup_error_fixture(): @@ -852,124 +985,126 @@ def test_tbstyle_native_setup_error(testdir): def test_error_fixture(setup_error_fixture): pass - """) + """ + ) result = testdir.runpytest("--tb=native") - result.stdout.fnmatch_lines([ - '*File *test_tbstyle_native_setup_error.py", line *, in setup_error_fixture*' - ]) + result.stdout.fnmatch_lines( + ['*File *test_tbstyle_native_setup_error.py", line *, in setup_error_fixture*'] + ) def test_terminal_summary(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_terminal_summary(terminalreporter, exitstatus): w = terminalreporter w.section("hello") w.line("world") w.line("exitstatus: {0}".format(exitstatus)) - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *==== hello ====* world exitstatus: 5 - """) + """ + ) def test_terminal_summary_warnings_are_displayed(testdir): """Test that warnings emitted during pytest_terminal_summary are displayed. (#1305). """ - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_terminal_summary(terminalreporter): config = terminalreporter.config config.warn('C1', 'internal warning') - """) - result = testdir.runpytest('-rw') - result.stdout.fnmatch_lines([ - '*internal warning', - '*== 1 warnings in *', - ]) + """ + ) + result = testdir.runpytest("-rw") + result.stdout.fnmatch_lines( + ["", "*internal warning", "*== 1 warnings in *"] + ) + assert "None" not in result.stdout.str() -@pytest.mark.parametrize("exp_color, exp_line, stats_arg", [ - # The method under test only cares about the length of each - # dict value, not the actual contents, so tuples of anything - # suffice - - # Important statuses -- the highest priority of these always wins - ("red", "1 failed", {"failed": (1,)}), - ("red", "1 failed, 1 passed", {"failed": (1,), "passed": (1,)}), - - ("red", "1 error", {"error": (1,)}), - ("red", "1 passed, 1 error", {"error": (1,), "passed": (1,)}), - - # (a status that's not known to the code) - ("yellow", "1 weird", {"weird": (1,)}), - ("yellow", "1 passed, 1 weird", {"weird": (1,), "passed": (1,)}), - - ("yellow", "1 warnings", {"warnings": (1,)}), - ("yellow", "1 passed, 1 warnings", {"warnings": (1,), - "passed": (1,)}), - - ("green", "5 passed", {"passed": (1, 2, 3, 4, 5)}), - - - # "Boring" statuses. These have no effect on the color of the summary - # line. Thus, if *every* test has a boring status, the summary line stays - # at its default color, i.e. yellow, to warn the user that the test run - # produced no useful information - ("yellow", "1 skipped", {"skipped": (1,)}), - ("green", "1 passed, 1 skipped", {"skipped": (1,), "passed": (1,)}), - - ("yellow", "1 deselected", {"deselected": (1,)}), - ("green", "1 passed, 1 deselected", {"deselected": (1,), "passed": (1,)}), - - ("yellow", "1 xfailed", {"xfailed": (1,)}), - ("green", "1 passed, 1 xfailed", {"xfailed": (1,), "passed": (1,)}), - - ("yellow", "1 xpassed", {"xpassed": (1,)}), - ("green", "1 passed, 1 xpassed", {"xpassed": (1,), "passed": (1,)}), - - # Likewise if no tests were found at all - ("yellow", "no tests ran", {}), - - # Test the empty-key special case - ("yellow", "no tests ran", {"": (1,)}), - ("green", "1 passed", {"": (1,), "passed": (1,)}), - - - # A couple more complex combinations - ("red", "1 failed, 2 passed, 3 xfailed", - {"passed": (1, 2), "failed": (1,), "xfailed": (1, 2, 3)}), - - ("green", "1 passed, 2 skipped, 3 deselected, 2 xfailed", - {"passed": (1,), - "skipped": (1, 2), - "deselected": (1, 2, 3), - "xfailed": (1, 2)}), -]) +@pytest.mark.parametrize( + "exp_color, exp_line, stats_arg", + [ + # The method under test only cares about the length of each + # dict value, not the actual contents, so tuples of anything + # suffice + # Important statuses -- the highest priority of these always wins + ("red", "1 failed", {"failed": (1,)}), + ("red", "1 failed, 1 passed", {"failed": (1,), "passed": (1,)}), + ("red", "1 error", {"error": (1,)}), + ("red", "1 passed, 1 error", {"error": (1,), "passed": (1,)}), + # (a status that's not known to the code) + ("yellow", "1 weird", {"weird": (1,)}), + ("yellow", "1 passed, 1 weird", {"weird": (1,), "passed": (1,)}), + ("yellow", "1 warnings", {"warnings": (1,)}), + ("yellow", "1 passed, 1 warnings", {"warnings": (1,), "passed": (1,)}), + ("green", "5 passed", {"passed": (1, 2, 3, 4, 5)}), + # "Boring" statuses. These have no effect on the color of the summary + # line. Thus, if *every* test has a boring status, the summary line stays + # at its default color, i.e. yellow, to warn the user that the test run + # produced no useful information + ("yellow", "1 skipped", {"skipped": (1,)}), + ("green", "1 passed, 1 skipped", {"skipped": (1,), "passed": (1,)}), + ("yellow", "1 deselected", {"deselected": (1,)}), + ("green", "1 passed, 1 deselected", {"deselected": (1,), "passed": (1,)}), + ("yellow", "1 xfailed", {"xfailed": (1,)}), + ("green", "1 passed, 1 xfailed", {"xfailed": (1,), "passed": (1,)}), + ("yellow", "1 xpassed", {"xpassed": (1,)}), + ("green", "1 passed, 1 xpassed", {"xpassed": (1,), "passed": (1,)}), + # Likewise if no tests were found at all + ("yellow", "no tests ran", {}), + # Test the empty-key special case + ("yellow", "no tests ran", {"": (1,)}), + ("green", "1 passed", {"": (1,), "passed": (1,)}), + # A couple more complex combinations + ( + "red", + "1 failed, 2 passed, 3 xfailed", + {"passed": (1, 2), "failed": (1,), "xfailed": (1, 2, 3)}, + ), + ( + "green", + "1 passed, 2 skipped, 3 deselected, 2 xfailed", + { + "passed": (1,), + "skipped": (1, 2), + "deselected": (1, 2, 3), + "xfailed": (1, 2), + }, + ), + ], +) def test_summary_stats(exp_line, exp_color, stats_arg): print("Based on stats: %s" % stats_arg) - print("Expect summary: \"%s\"; with color \"%s\"" % (exp_line, exp_color)) + print('Expect summary: "%s"; with color "%s"' % (exp_line, exp_color)) (line, color) = build_summary_stats_line(stats_arg) - print("Actually got: \"%s\"; with color \"%s\"" % (line, color)) + print('Actually got: "%s"; with color "%s"' % (line, color)) assert line == exp_line assert color == exp_color def test_no_trailing_whitespace_after_inifile_word(testdir): - result = testdir.runpytest('') - assert 'inifile:\n' in result.stdout.str() + result = testdir.runpytest("") + assert "inifile:\n" in result.stdout.str() - testdir.makeini('[pytest]') - result = testdir.runpytest('') - assert 'inifile: tox.ini\n' in result.stdout.str() + testdir.makeini("[pytest]") + result = testdir.runpytest("") + assert "inifile: tox.ini\n" in result.stdout.str() -class TestProgress: +class TestProgress(object): @pytest.fixture - def many_tests_file(self, testdir): + def many_tests_files(self, testdir): testdir.makepyfile( test_bar=""" import pytest @@ -991,7 +1126,8 @@ class TestProgress: def test_zero_tests_collected(self, testdir): """Some plugins (testmon for example) might issue pytest_runtest_logreport without any tests being actually collected (#2971).""" - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_collection_modifyitems(items, config): from _pytest.runner import CollectReport for node_id in ('nodeid1', 'nodeid2'): @@ -999,41 +1135,133 @@ class TestProgress: rep.when = 'passed' rep.duration = 0.1 config.hook.pytest_runtest_logreport(report=rep) - """) + """ + ) output = testdir.runpytest() - assert 'ZeroDivisionError' not in output.stdout.str() - output.stdout.fnmatch_lines([ - '=* 2 passed in *=', - ]) + assert "ZeroDivisionError" not in output.stdout.str() + output.stdout.fnmatch_lines(["=* 2 passed in *="]) - def test_normal(self, many_tests_file, testdir): + def test_normal(self, many_tests_files, testdir): output = testdir.runpytest() - output.stdout.re_match_lines([ - r'test_bar.py \.{10} \s+ \[ 50%\]', - r'test_foo.py \.{5} \s+ \[ 75%\]', - r'test_foobar.py \.{5} \s+ \[100%\]', - ]) + output.stdout.re_match_lines( + [ + r"test_bar.py \.{10} \s+ \[ 50%\]", + r"test_foo.py \.{5} \s+ \[ 75%\]", + r"test_foobar.py \.{5} \s+ \[100%\]", + ] + ) - def test_verbose(self, many_tests_file, testdir): - output = testdir.runpytest('-v') - output.stdout.re_match_lines([ - r'test_bar.py::test_bar\[0\] PASSED \s+ \[ 5%\]', - r'test_foo.py::test_foo\[4\] PASSED \s+ \[ 75%\]', - r'test_foobar.py::test_foobar\[4\] PASSED \s+ \[100%\]', - ]) + def test_verbose(self, many_tests_files, testdir): + output = testdir.runpytest("-v") + output.stdout.re_match_lines( + [ + r"test_bar.py::test_bar\[0\] PASSED \s+ \[ 5%\]", + r"test_foo.py::test_foo\[4\] PASSED \s+ \[ 75%\]", + r"test_foobar.py::test_foobar\[4\] PASSED \s+ \[100%\]", + ] + ) - def test_xdist_normal(self, many_tests_file, testdir): - pytest.importorskip('xdist') - output = testdir.runpytest('-n2') - output.stdout.re_match_lines([ - r'\.{20} \s+ \[100%\]', - ]) + def test_xdist_normal(self, many_tests_files, testdir): + pytest.importorskip("xdist") + output = testdir.runpytest("-n2") + output.stdout.re_match_lines([r"\.{20} \s+ \[100%\]"]) - def test_xdist_verbose(self, many_tests_file, testdir): - pytest.importorskip('xdist') - output = testdir.runpytest('-n2', '-v') - output.stdout.re_match_lines_random([ - r'\[gw\d\] \[\s*\d+%\] PASSED test_bar.py::test_bar\[1\]', - r'\[gw\d\] \[\s*\d+%\] PASSED test_foo.py::test_foo\[1\]', - r'\[gw\d\] \[\s*\d+%\] PASSED test_foobar.py::test_foobar\[1\]', - ]) + def test_xdist_verbose(self, many_tests_files, testdir): + pytest.importorskip("xdist") + output = testdir.runpytest("-n2", "-v") + output.stdout.re_match_lines_random( + [ + r"\[gw\d\] \[\s*\d+%\] PASSED test_bar.py::test_bar\[1\]", + r"\[gw\d\] \[\s*\d+%\] PASSED test_foo.py::test_foo\[1\]", + r"\[gw\d\] \[\s*\d+%\] PASSED test_foobar.py::test_foobar\[1\]", + ] + ) + + def test_capture_no(self, many_tests_files, testdir): + output = testdir.runpytest("-s") + output.stdout.re_match_lines( + [r"test_bar.py \.{10}", r"test_foo.py \.{5}", r"test_foobar.py \.{5}"] + ) + + output = testdir.runpytest("--capture=no") + assert "%]" not in output.stdout.str() + + +class TestProgressWithTeardown(object): + """Ensure we show the correct percentages for tests that fail during teardown (#3088)""" + + @pytest.fixture + def contest_with_teardown_fixture(self, testdir): + testdir.makeconftest( + """ + import pytest + + @pytest.fixture + def fail_teardown(): + yield + assert False + """ + ) + + @pytest.fixture + def many_files(self, testdir, contest_with_teardown_fixture): + testdir.makepyfile( + test_bar=""" + import pytest + @pytest.mark.parametrize('i', range(5)) + def test_bar(fail_teardown, i): + pass + """, + test_foo=""" + import pytest + @pytest.mark.parametrize('i', range(15)) + def test_foo(fail_teardown, i): + pass + """, + ) + + def test_teardown_simple(self, testdir, contest_with_teardown_fixture): + testdir.makepyfile( + """ + def test_foo(fail_teardown): + pass + """ + ) + output = testdir.runpytest() + output.stdout.re_match_lines([r"test_teardown_simple.py \.E\s+\[100%\]"]) + + def test_teardown_with_test_also_failing( + self, testdir, contest_with_teardown_fixture + ): + testdir.makepyfile( + """ + def test_foo(fail_teardown): + assert False + """ + ) + output = testdir.runpytest() + output.stdout.re_match_lines( + [r"test_teardown_with_test_also_failing.py FE\s+\[100%\]"] + ) + + def test_teardown_many(self, testdir, many_files): + output = testdir.runpytest() + output.stdout.re_match_lines( + [r"test_bar.py (\.E){5}\s+\[ 25%\]", r"test_foo.py (\.E){15}\s+\[100%\]"] + ) + + def test_teardown_many_verbose(self, testdir, many_files): + output = testdir.runpytest("-v") + output.stdout.re_match_lines( + [ + r"test_bar.py::test_bar\[0\] PASSED\s+\[ 5%\]", + r"test_bar.py::test_bar\[0\] ERROR\s+\[ 5%\]", + r"test_bar.py::test_bar\[4\] PASSED\s+\[ 25%\]", + r"test_bar.py::test_bar\[4\] ERROR\s+\[ 25%\]", + ] + ) + + def test_xdist_normal(self, many_files, testdir): + pytest.importorskip("xdist") + output = testdir.runpytest("-n2") + output.stdout.re_match_lines([r"[\.E]{40} \s+ \[100%\]"]) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_tmpdir.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_tmpdir.py index 467e77252e7..33624909495 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_tmpdir.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_tmpdir.py @@ -7,13 +7,16 @@ from _pytest.tmpdir import tmpdir def test_funcarg(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ def pytest_generate_tests(metafunc): metafunc.addcall(id='a') metafunc.addcall(id='b') def test_func(tmpdir): pass - """) + """ + ) from _pytest.tmpdir import TempdirFactory + reprec = testdir.inline_run() calls = reprec.getcalls("pytest_runtest_setup") item = calls[0].item @@ -32,15 +35,17 @@ def test_funcarg(testdir): def test_ensuretemp(recwarn): - d1 = pytest.ensuretemp('hello') - d2 = pytest.ensuretemp('hello') + d1 = pytest.ensuretemp("hello") + d2 = pytest.ensuretemp("hello") assert d1 == d2 assert d1.check(dir=1) class TestTempdirHandler(object): + def test_mktemp(self, testdir): from _pytest.tmpdir import TempdirFactory + config = testdir.parseconfig() config.option.basetemp = testdir.mkdir("hello") t = TempdirFactory(config) @@ -54,35 +59,42 @@ class TestTempdirHandler(object): class TestConfigTmpdir(object): + def test_getbasetemp_custom_removes_old(self, testdir): mytemp = testdir.tmpdir.join("xyz") - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_1(tmpdir): pass - """) - testdir.runpytest(p, '--basetemp=%s' % mytemp) + """ + ) + testdir.runpytest(p, "--basetemp=%s" % mytemp) mytemp.check() mytemp.ensure("hello") - testdir.runpytest(p, '--basetemp=%s' % mytemp) + testdir.runpytest(p, "--basetemp=%s" % mytemp) mytemp.check() assert not mytemp.join("hello").check() def test_basetemp(testdir): mytemp = testdir.tmpdir.mkdir("mytemp") - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ import pytest def test_1(): pytest.ensuretemp("hello") - """) - result = testdir.runpytest(p, '--basetemp=%s' % mytemp) + """ + ) + result = testdir.runpytest(p, "--basetemp=%s" % mytemp) assert result.ret == 0 - assert mytemp.join('hello').check() + assert mytemp.join("hello").check() -@pytest.mark.skipif(not hasattr(py.path.local, 'mksymlinkto'), - reason="symlink not available on this platform") +@pytest.mark.skipif( + not hasattr(py.path.local, "mksymlinkto"), + reason="symlink not available on this platform", +) def test_tmpdir_always_is_realpath(testdir): # the reason why tmpdir should be a realpath is that # when you cd to it and do "os.getcwd()" you will anyway @@ -93,35 +105,41 @@ def test_tmpdir_always_is_realpath(testdir): realtemp = testdir.tmpdir.mkdir("myrealtemp") linktemp = testdir.tmpdir.join("symlinktemp") linktemp.mksymlinkto(realtemp) - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ def test_1(tmpdir): import os assert os.path.realpath(str(tmpdir)) == str(tmpdir) - """) - result = testdir.runpytest("-s", p, '--basetemp=%s/bt' % linktemp) + """ + ) + result = testdir.runpytest("-s", p, "--basetemp=%s/bt" % linktemp) assert not result.ret def test_tmpdir_too_long_on_parametrization(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.mark.parametrize("arg", ["1"*1000]) def test_some(arg, tmpdir): tmpdir.ensure("hello") - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) def test_tmpdir_factory(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest @pytest.fixture(scope='session') def session_dir(tmpdir_factory): return tmpdir_factory.mktemp('data', numbered=False) def test_some(session_dir): session_dir.isdir() - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) @@ -130,59 +148,65 @@ def test_tmpdir_fallback_tox_env(testdir, monkeypatch): """Test that tmpdir works even if environment variables required by getpass module are missing (#1010). """ - monkeypatch.delenv('USER', raising=False) - monkeypatch.delenv('USERNAME', raising=False) - testdir.makepyfile(""" + monkeypatch.delenv("USER", raising=False) + monkeypatch.delenv("USERNAME", raising=False) + testdir.makepyfile( + """ import pytest def test_some(tmpdir): assert tmpdir.isdir() - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) @pytest.fixture def break_getuser(monkeypatch): - monkeypatch.setattr('os.getuid', lambda: -1) + monkeypatch.setattr("os.getuid", lambda: -1) # taken from python 2.7/3.4 - for envvar in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'): + for envvar in ("LOGNAME", "USER", "LNAME", "USERNAME"): monkeypatch.delenv(envvar, raising=False) @pytest.mark.usefixtures("break_getuser") -@pytest.mark.skipif(sys.platform.startswith('win'), reason='no os.getuid on windows') +@pytest.mark.skipif(sys.platform.startswith("win"), reason="no os.getuid on windows") def test_tmpdir_fallback_uid_not_found(testdir): """Test that tmpdir works even if the current process's user id does not correspond to a valid user. """ - testdir.makepyfile(""" + testdir.makepyfile( + """ import pytest def test_some(tmpdir): assert tmpdir.isdir() - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) @pytest.mark.usefixtures("break_getuser") -@pytest.mark.skipif(sys.platform.startswith('win'), reason='no os.getuid on windows') +@pytest.mark.skipif(sys.platform.startswith("win"), reason="no os.getuid on windows") def test_get_user_uid_not_found(): """Test that get_user() function works even if the current process's user id does not correspond to a valid user (e.g. running pytest in a Docker container with 'docker run -u'. """ from _pytest.tmpdir import get_user + assert get_user() is None -@pytest.mark.skipif(not sys.platform.startswith('win'), reason='win only') +@pytest.mark.skipif(not sys.platform.startswith("win"), reason="win only") def test_get_user(monkeypatch): """Test that get_user() function works even if environment variables required by getpass module are missing from the environment on Windows (#1010). """ from _pytest.tmpdir import get_user - monkeypatch.delenv('USER', raising=False) - monkeypatch.delenv('USERNAME', raising=False) + + monkeypatch.delenv("USER", raising=False) + monkeypatch.delenv("USERNAME", raising=False) assert get_user() is None diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_unittest.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_unittest.py index e197735871f..65ffdb97538 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_unittest.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_unittest.py @@ -5,21 +5,24 @@ import gc def test_simple_unittest(testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ import unittest class MyTestCase(unittest.TestCase): def testpassing(self): self.assertEqual('foo', 'foo') def test_failing(self): self.assertEqual('foo', 'bar') - """) + """ + ) reprec = testdir.inline_run(testpath) assert reprec.matchreport("testpassing").passed assert reprec.matchreport("test_failing").failed def test_runTest_method(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import unittest class MyTestCaseWithRunTest(unittest.TestCase): def runTest(self): @@ -29,29 +32,35 @@ def test_runTest_method(testdir): self.assertEqual('foo', 'foo') def test_something(self): pass - """) + """ + ) result = testdir.runpytest("-v") - result.stdout.fnmatch_lines(""" + result.stdout.fnmatch_lines( + """ *MyTestCaseWithRunTest::runTest* *MyTestCaseWithoutRunTest::test_something* *2 passed* - """) + """ + ) def test_isclasscheck_issue53(testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ import unittest class _E(object): def __getattr__(self, tag): pass E = _E() - """) + """ + ) result = testdir.runpytest(testpath) assert result.ret == EXIT_NOTESTSCOLLECTED def test_setup(testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ import unittest class MyTestCase(unittest.TestCase): def setUp(self): @@ -64,15 +73,17 @@ def test_setup(testdir): def teardown_method(self, method): assert 0, "42" - """) + """ + ) reprec = testdir.inline_run("-s", testpath) assert reprec.matchreport("test_both", when="call").passed rep = reprec.matchreport("test_both", when="teardown") - assert rep.failed and '42' in str(rep.longrepr) + assert rep.failed and "42" in str(rep.longrepr) def test_setUpModule(testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ values = [] def setUpModule(): @@ -86,15 +97,15 @@ def test_setUpModule(testdir): def test_world(): assert values == [1] - """) + """ + ) result = testdir.runpytest(testpath) - result.stdout.fnmatch_lines([ - "*2 passed*", - ]) + result.stdout.fnmatch_lines(["*2 passed*"]) def test_setUpModule_failing_no_teardown(testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ values = [] def setUpModule(): @@ -105,7 +116,8 @@ def test_setUpModule_failing_no_teardown(testdir): def test_hello(): pass - """) + """ + ) reprec = testdir.inline_run(testpath) reprec.assertoutcome(passed=0, failed=1) call = reprec.getcalls("pytest_runtest_setup")[0] @@ -113,20 +125,23 @@ def test_setUpModule_failing_no_teardown(testdir): def test_new_instances(testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ import unittest class MyTestCase(unittest.TestCase): def test_func1(self): self.x = 2 def test_func2(self): assert not hasattr(self, 'x') - """) + """ + ) reprec = testdir.inline_run(testpath) reprec.assertoutcome(passed=2) def test_teardown(testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ import unittest class MyTestCase(unittest.TestCase): values = [] @@ -137,7 +152,8 @@ def test_teardown(testdir): class Second(unittest.TestCase): def test_check(self): self.assertEqual(MyTestCase.values, [None]) - """) + """ + ) reprec = testdir.inline_run(testpath) passed, skipped, failed = reprec.countoutcomes() assert failed == 0, failed @@ -153,7 +169,8 @@ def test_teardown_issue1649(testdir): The TestCase will not be cleaned up if the test fails, because it would then exist in the stackframe. """ - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ import unittest class TestCaseObjectsShouldBeCleanedUp(unittest.TestCase): def setUp(self): @@ -161,15 +178,17 @@ def test_teardown_issue1649(testdir): def test_demo(self): pass - """) + """ + ) testdir.inline_run("-s", testpath) gc.collect() for obj in gc.get_objects(): - assert type(obj).__name__ != 'TestCaseObjectsShouldBeCleanedUp' + assert type(obj).__name__ != "TestCaseObjectsShouldBeCleanedUp" def test_unittest_skip_issue148(testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ import unittest @unittest.skip("hello") @@ -182,33 +201,39 @@ def test_unittest_skip_issue148(testdir): @classmethod def tearDownClass(self): xxx - """) + """ + ) reprec = testdir.inline_run(testpath) reprec.assertoutcome(skipped=1) def test_method_and_teardown_failing_reporting(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import unittest, pytest class TC(unittest.TestCase): def tearDown(self): assert 0, "down1" def test_method(self): assert False, "down2" - """) + """ + ) result = testdir.runpytest("-s") assert result.ret == 1 - result.stdout.fnmatch_lines([ - "*tearDown*", - "*assert 0*", - "*test_method*", - "*assert False*", - "*1 failed*1 error*", - ]) + result.stdout.fnmatch_lines( + [ + "*tearDown*", + "*assert 0*", + "*test_method*", + "*assert False*", + "*1 failed*1 error*", + ] + ) def test_setup_failure_is_shown(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import unittest import pytest class TC(unittest.TestCase): @@ -217,19 +242,17 @@ def test_setup_failure_is_shown(testdir): def test_method(self): print ("never42") xyz - """) + """ + ) result = testdir.runpytest("-s") assert result.ret == 1 - result.stdout.fnmatch_lines([ - "*setUp*", - "*assert 0*down1*", - "*1 failed*", - ]) - assert 'never42' not in result.stdout.str() + result.stdout.fnmatch_lines(["*setUp*", "*assert 0*down1*", "*1 failed*"]) + assert "never42" not in result.stdout.str() def test_setup_setUpClass(testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ import unittest import pytest class MyTestCase(unittest.TestCase): @@ -246,13 +269,15 @@ def test_setup_setUpClass(testdir): cls.x -= 1 def test_teareddown(): assert MyTestCase.x == 0 - """) + """ + ) reprec = testdir.inline_run(testpath) reprec.assertoutcome(passed=3) def test_setup_class(testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ import unittest import pytest class MyTestCase(unittest.TestCase): @@ -267,14 +292,16 @@ def test_setup_class(testdir): cls.x -= 1 def test_teareddown(): assert MyTestCase.x == 0 - """) + """ + ) reprec = testdir.inline_run(testpath) reprec.assertoutcome(passed=3) -@pytest.mark.parametrize("type", ['Error', 'Failure']) +@pytest.mark.parametrize("type", ["Error", "Failure"]) def test_testcase_adderrorandfailure_defers(testdir, type): - testdir.makepyfile(""" + testdir.makepyfile( + """ from unittest import TestCase import pytest class MyTestCase(TestCase): @@ -288,14 +315,17 @@ def test_testcase_adderrorandfailure_defers(testdir, type): pytest.fail("add%s should not raise") def test_hello(self): pass - """ % (type, type)) + """ + % (type, type) + ) result = testdir.runpytest() - assert 'should not raise' not in result.stdout.str() + assert "should not raise" not in result.stdout.str() -@pytest.mark.parametrize("type", ['Error', 'Failure']) +@pytest.mark.parametrize("type", ["Error", "Failure"]) def test_testcase_custom_exception_info(testdir, type): - testdir.makepyfile(""" + testdir.makepyfile( + """ from unittest import TestCase import py, pytest import _pytest._code @@ -316,69 +346,83 @@ def test_testcase_custom_exception_info(testdir, type): mp.undo() def test_hello(self): pass - """ % locals()) + """ + % locals() + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "NOTE: Incompatible Exception Representation*", - "*ZeroDivisionError*", - "*1 failed*", - ]) + result.stdout.fnmatch_lines( + [ + "NOTE: Incompatible Exception Representation*", + "*ZeroDivisionError*", + "*1 failed*", + ] + ) def test_testcase_totally_incompatible_exception_info(testdir): - item, = testdir.getitems(""" + item, = testdir.getitems( + """ from unittest import TestCase class MyTestCase(TestCase): def test_hello(self): pass - """) + """ + ) item.addError(None, 42) excinfo = item._excinfo.pop(0) - assert 'ERROR: Unknown Incompatible' in str(excinfo.getrepr()) + assert "ERROR: Unknown Incompatible" in str(excinfo.getrepr()) def test_module_level_pytestmark(testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ import unittest import pytest pytestmark = pytest.mark.xfail class MyTestCase(unittest.TestCase): def test_func1(self): assert 0 - """) + """ + ) reprec = testdir.inline_run(testpath, "-s") reprec.assertoutcome(skipped=1) class TestTrialUnittest(object): + def setup_class(cls): cls.ut = pytest.importorskip("twisted.trial.unittest") # on windows trial uses a socket for a reactor and apparently doesn't close it properly # https://twistedmatrix.com/trac/ticket/9227 - cls.ignore_unclosed_socket_warning = ('-W', 'always') + cls.ignore_unclosed_socket_warning = ("-W", "always") def test_trial_testcase_runtest_not_collected(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ from twisted.trial.unittest import TestCase class TC(TestCase): def test_hello(self): pass - """) + """ + ) reprec = testdir.inline_run(*self.ignore_unclosed_socket_warning) reprec.assertoutcome(passed=1) - testdir.makepyfile(""" + testdir.makepyfile( + """ from twisted.trial.unittest import TestCase class TC(TestCase): def runTest(self): pass - """) + """ + ) reprec = testdir.inline_run(*self.ignore_unclosed_socket_warning) reprec.assertoutcome(passed=1) def test_trial_exceptions_with_skips(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ from twisted.trial import unittest import pytest class TC(unittest.TestCase): @@ -409,24 +453,31 @@ class TestTrialUnittest(object): pytest.skip("skip_in_setup_class") def test_method(self): pass - """) + """ + ) from _pytest.compat import _is_unittest_unexpected_success_a_failure + should_fail = _is_unittest_unexpected_success_a_failure() result = testdir.runpytest("-rxs", *self.ignore_unclosed_socket_warning) - result.stdout.fnmatch_lines_random([ - "*XFAIL*test_trial_todo*", - "*trialselfskip*", - "*skip_in_setup_class*", - "*iwanto*", - "*i2wanto*", - "*sys.version_info*", - "*skip_in_method*", - "*1 failed*4 skipped*3 xfailed*" if should_fail else "*4 skipped*3 xfail*1 xpass*", - ]) + result.stdout.fnmatch_lines_random( + [ + "*XFAIL*test_trial_todo*", + "*trialselfskip*", + "*skip_in_setup_class*", + "*iwanto*", + "*i2wanto*", + "*sys.version_info*", + "*skip_in_method*", + "*1 failed*4 skipped*3 xfailed*" + if should_fail + else "*4 skipped*3 xfail*1 xpass*", + ] + ) assert result.ret == (1 if should_fail else 0) def test_trial_error(self, testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ from twisted.trial.unittest import TestCase from twisted.internet.defer import Deferred from twisted.internet import reactor @@ -460,81 +511,97 @@ class TestTrialUnittest(object): reactor.callLater(0.3, d.callback, None) return d # will crash both at test time and at teardown - """) + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - "*ERRORS*", - "*DelayedCalls*", - "*test_four*", - "*NameError*crash*", - "*test_one*", - "*NameError*crash*", - "*test_three*", - "*DelayedCalls*", - "*test_two*", - "*crash*", - ]) + result.stdout.fnmatch_lines( + [ + "*ERRORS*", + "*DelayedCalls*", + "*test_four*", + "*NameError*crash*", + "*test_one*", + "*NameError*crash*", + "*test_three*", + "*DelayedCalls*", + "*test_two*", + "*crash*", + ] + ) def test_trial_pdb(self, testdir): - p = testdir.makepyfile(""" + p = testdir.makepyfile( + """ from twisted.trial import unittest import pytest class TC(unittest.TestCase): def test_hello(self): assert 0, "hellopdb" - """) + """ + ) child = testdir.spawn_pytest(p) child.expect("hellopdb") child.sendeof() def test_trial_testcase_skip_property(self, testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ from twisted.trial import unittest class MyTestCase(unittest.TestCase): skip = 'dont run' def test_func(self): pass - """) + """ + ) reprec = testdir.inline_run(testpath, "-s") reprec.assertoutcome(skipped=1) def test_trial_testfunction_skip_property(self, testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ from twisted.trial import unittest class MyTestCase(unittest.TestCase): def test_func(self): pass test_func.skip = 'dont run' - """) + """ + ) reprec = testdir.inline_run(testpath, "-s") reprec.assertoutcome(skipped=1) def test_trial_testcase_todo_property(self, testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ from twisted.trial import unittest class MyTestCase(unittest.TestCase): todo = 'dont run' def test_func(self): assert 0 - """) + """ + ) reprec = testdir.inline_run(testpath, "-s") reprec.assertoutcome(skipped=1) def test_trial_testfunction_todo_property(self, testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ from twisted.trial import unittest class MyTestCase(unittest.TestCase): def test_func(self): assert 0 test_func.todo = 'dont run' - """) - reprec = testdir.inline_run(testpath, "-s", *self.ignore_unclosed_socket_warning) + """ + ) + reprec = testdir.inline_run( + testpath, "-s", *self.ignore_unclosed_socket_warning + ) reprec.assertoutcome(skipped=1) def test_djangolike_testcase(testdir): # contributed from Morten Breekevold - testdir.makepyfile(""" + testdir.makepyfile( + """ from unittest import TestCase, main class DjangoLikeTestCase(TestCase): @@ -574,32 +641,38 @@ def test_djangolike_testcase(testdir): def _post_teardown(self): print ("_post_teardown()") - """) + """ + ) result = testdir.runpytest("-s") assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*_pre_setup()*", - "*setUp()*", - "*test_thing()*", - "*tearDown()*", - "*_post_teardown()*", - ]) + result.stdout.fnmatch_lines( + [ + "*_pre_setup()*", + "*setUp()*", + "*test_thing()*", + "*tearDown()*", + "*_post_teardown()*", + ] + ) def test_unittest_not_shown_in_traceback(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import unittest class t(unittest.TestCase): def test_hello(self): x = 3 self.assertEqual(x, 4) - """) + """ + ) res = testdir.runpytest() assert "failUnlessEqual" not in res.stdout.str() def test_unorderable_types(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import unittest class TestJoinEmpty(unittest.TestCase): pass @@ -610,27 +683,31 @@ def test_unorderable_types(testdir): Test.__name__ = "TestFoo" return Test TestFoo = make_test() - """) + """ + ) result = testdir.runpytest() assert "TypeError" not in result.stdout.str() assert result.ret == EXIT_NOTESTSCOLLECTED def test_unittest_typerror_traceback(testdir): - testdir.makepyfile(""" + testdir.makepyfile( + """ import unittest class TestJoinEmpty(unittest.TestCase): def test_hello(self, arg1): pass - """) + """ + ) result = testdir.runpytest() assert "TypeError" in result.stdout.str() assert result.ret == 1 -@pytest.mark.parametrize('runner', ['pytest', 'unittest']) +@pytest.mark.parametrize("runner", ["pytest", "unittest"]) def test_unittest_expected_failure_for_failing_test_is_xfail(testdir, runner): - script = testdir.makepyfile(""" + script = testdir.makepyfile( + """ import unittest class MyTestCase(unittest.TestCase): @unittest.expectedFailure @@ -638,25 +715,23 @@ def test_unittest_expected_failure_for_failing_test_is_xfail(testdir, runner): assert False if __name__ == '__main__': unittest.main() - """) - if runner == 'pytest': + """ + ) + if runner == "pytest": result = testdir.runpytest("-rxX") - result.stdout.fnmatch_lines([ - "*XFAIL*MyTestCase*test_failing_test_is_xfail*", - "*1 xfailed*", - ]) + result.stdout.fnmatch_lines( + ["*XFAIL*MyTestCase*test_failing_test_is_xfail*", "*1 xfailed*"] + ) else: result = testdir.runpython(script) - result.stderr.fnmatch_lines([ - "*1 test in*", - "*OK*(expected failures=1)*", - ]) + result.stderr.fnmatch_lines(["*1 test in*", "*OK*(expected failures=1)*"]) assert result.ret == 0 -@pytest.mark.parametrize('runner', ['pytest', 'unittest']) +@pytest.mark.parametrize("runner", ["pytest", "unittest"]) def test_unittest_expected_failure_for_passing_test_is_fail(testdir, runner): - script = testdir.makepyfile(""" + script = testdir.makepyfile( + """ import unittest class MyTestCase(unittest.TestCase): @unittest.expectedFailure @@ -664,31 +739,32 @@ def test_unittest_expected_failure_for_passing_test_is_fail(testdir, runner): assert True if __name__ == '__main__': unittest.main() - """) + """ + ) from _pytest.compat import _is_unittest_unexpected_success_a_failure + should_fail = _is_unittest_unexpected_success_a_failure() - if runner == 'pytest': + if runner == "pytest": result = testdir.runpytest("-rxX") - result.stdout.fnmatch_lines([ - "*MyTestCase*test_passing_test_is_fail*", - "*1 failed*" if should_fail else "*1 xpassed*", - ]) + result.stdout.fnmatch_lines( + [ + "*MyTestCase*test_passing_test_is_fail*", + "*1 failed*" if should_fail else "*1 xpassed*", + ] + ) else: result = testdir.runpython(script) - result.stderr.fnmatch_lines([ - "*1 test in*", - "*(unexpected successes=1)*", - ]) + result.stderr.fnmatch_lines(["*1 test in*", "*(unexpected successes=1)*"]) assert result.ret == (1 if should_fail else 0) -@pytest.mark.parametrize('fix_type, stmt', [ - ('fixture', 'return'), - ('yield_fixture', 'yield'), -]) +@pytest.mark.parametrize( + "fix_type, stmt", [("fixture", "return"), ("yield_fixture", "yield")] +) def test_unittest_setup_interaction(testdir, fix_type, stmt): - testdir.makepyfile(""" + testdir.makepyfile( + """ import unittest import pytest class MyTestCase(unittest.TestCase): @@ -710,13 +786,17 @@ def test_unittest_setup_interaction(testdir, fix_type, stmt): def test_classattr(self): assert self.__class__.hello == "world" - """.format(fix_type=fix_type, stmt=stmt)) + """.format( + fix_type=fix_type, stmt=stmt + ) + ) result = testdir.runpytest() result.stdout.fnmatch_lines("*3 passed*") def test_non_unittest_no_setupclass_support(testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ class TestFoo(object): x = 0 @@ -734,13 +814,15 @@ def test_non_unittest_no_setupclass_support(testdir): def test_not_teareddown(): assert TestFoo.x == 0 - """) + """ + ) reprec = testdir.inline_run(testpath) reprec.assertoutcome(passed=2) def test_no_teardown_if_setupclass_failed(testdir): - testpath = testdir.makepyfile(""" + testpath = testdir.makepyfile( + """ import unittest class MyTestCase(unittest.TestCase): @@ -760,63 +842,77 @@ def test_no_teardown_if_setupclass_failed(testdir): def test_notTornDown(): assert MyTestCase.x == 1 - """) + """ + ) reprec = testdir.inline_run(testpath) reprec.assertoutcome(passed=1, failed=1) def test_issue333_result_clearing(testdir): - testdir.makeconftest(""" + testdir.makeconftest( + """ import pytest @pytest.hookimpl(hookwrapper=True) def pytest_runtest_call(item): yield assert 0 - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ import unittest class TestIt(unittest.TestCase): def test_func(self): 0/0 - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(failed=1) def test_unittest_raise_skip_issue748(testdir): - testdir.makepyfile(test_foo=""" + testdir.makepyfile( + test_foo=""" import unittest class MyTestCase(unittest.TestCase): def test_one(self): raise unittest.SkipTest('skipping due to reasons') - """) - result = testdir.runpytest("-v", '-rs') - result.stdout.fnmatch_lines(""" + """ + ) + result = testdir.runpytest("-v", "-rs") + result.stdout.fnmatch_lines( + """ *SKIP*[1]*test_foo.py*skipping due to reasons* *1 skipped* - """) + """ + ) def test_unittest_skip_issue1169(testdir): - testdir.makepyfile(test_foo=""" + testdir.makepyfile( + test_foo=""" import unittest class MyTestCase(unittest.TestCase): @unittest.skip("skipping due to reasons") def test_skip(self): self.fail() - """) - result = testdir.runpytest("-v", '-rs') - result.stdout.fnmatch_lines(""" + """ + ) + result = testdir.runpytest("-v", "-rs") + result.stdout.fnmatch_lines( + """ *SKIP*[1]*skipping due to reasons* *1 skipped* - """) + """ + ) def test_class_method_containing_test_issue1558(testdir): - testdir.makepyfile(test_foo=""" + testdir.makepyfile( + test_foo=""" import unittest class MyTestCase(unittest.TestCase): @@ -825,6 +921,72 @@ def test_class_method_containing_test_issue1558(testdir): def test_should_not_run(self): pass test_should_not_run.__test__ = False - """) + """ + ) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) + + +@pytest.mark.issue(3498) +@pytest.mark.parametrize( + "base", ["six.moves.builtins.object", "unittest.TestCase", "unittest2.TestCase"] +) +def test_usefixtures_marker_on_unittest(base, testdir): + module = base.rsplit(".", 1)[0] + pytest.importorskip(module) + testdir.makepyfile( + conftest=""" + import pytest + + @pytest.fixture(scope='function') + def fixture1(request, monkeypatch): + monkeypatch.setattr(request.instance, 'fixture1', True ) + + + @pytest.fixture(scope='function') + def fixture2(request, monkeypatch): + monkeypatch.setattr(request.instance, 'fixture2', True ) + + def node_and_marks(item): + print(item.nodeid) + for mark in item.iter_markers(): + print(" ", mark) + + @pytest.fixture(autouse=True) + def my_marks(request): + node_and_marks(request.node) + + def pytest_collection_modifyitems(items): + for item in items: + node_and_marks(item) + + """ + ) + + testdir.makepyfile( + """ + import pytest + import {module} + + class Tests({base}): + fixture1 = False + fixture2 = False + + @pytest.mark.usefixtures("fixture1") + def test_one(self): + assert self.fixture1 + assert not self.fixture2 + + @pytest.mark.usefixtures("fixture1", "fixture2") + def test_two(self): + assert self.fixture1 + assert self.fixture2 + + + """.format( + module=module, base=base + ) + ) + + result = testdir.runpytest("-s") + result.assert_outcomes(passed=2) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_warnings.py b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_warnings.py index 02400bd1ded..c5bea052a47 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_warnings.py +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_warnings.py @@ -6,7 +6,7 @@ import sys import pytest -WARNINGS_SUMMARY_HEADER = 'warnings summary' +WARNINGS_SUMMARY_HEADER = "warnings summary" @pytest.fixture @@ -16,48 +16,52 @@ def pyfile_with_warnings(testdir, request): """ testdir.syspathinsert() test_name = request.function.__name__ - module_name = test_name.lstrip('test_') + '_module' - testdir.makepyfile(**{ - module_name: ''' + module_name = test_name.lstrip("test_") + "_module" + testdir.makepyfile( + **{ + module_name: """ import warnings def foo(): warnings.warn(UserWarning("user warning")) warnings.warn(RuntimeWarning("runtime warning")) return 1 - ''', - test_name: ''' + """, + test_name: """ import {module_name} def test_func(): assert {module_name}.foo() == 1 - '''.format(module_name=module_name) - }) + """.format( + module_name=module_name + ), + } + ) -@pytest.mark.filterwarnings('always') +@pytest.mark.filterwarnings("always") def test_normal_flow(testdir, pyfile_with_warnings): """ Check that the warnings section is displayed, containing test node ids followed by all warnings generated by that test node. """ result = testdir.runpytest() - result.stdout.fnmatch_lines([ - '*== %s ==*' % WARNINGS_SUMMARY_HEADER, - - '*test_normal_flow.py::test_func', - - '*normal_flow_module.py:3: UserWarning: user warning', - '* warnings.warn(UserWarning("user warning"))', - - '*normal_flow_module.py:4: RuntimeWarning: runtime warning', - '* warnings.warn(RuntimeWarning("runtime warning"))', - '* 1 passed, 2 warnings*', - ]) - assert result.stdout.str().count('test_normal_flow.py::test_func') == 1 + result.stdout.fnmatch_lines( + [ + "*== %s ==*" % WARNINGS_SUMMARY_HEADER, + "*test_normal_flow.py::test_func", + "*normal_flow_module.py:3: UserWarning: user warning", + '* warnings.warn(UserWarning("user warning"))', + "*normal_flow_module.py:4: RuntimeWarning: runtime warning", + '* warnings.warn(RuntimeWarning("runtime warning"))', + "* 1 passed, 2 warnings*", + ] + ) + assert result.stdout.str().count("test_normal_flow.py::test_func") == 1 -@pytest.mark.filterwarnings('always') +@pytest.mark.filterwarnings("always") def test_setup_teardown_warnings(testdir, pyfile_with_warnings): - testdir.makepyfile(''' + testdir.makepyfile( + """ import warnings import pytest @@ -69,57 +73,64 @@ def test_setup_teardown_warnings(testdir, pyfile_with_warnings): def test_func(fix): pass - ''') + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - '*== %s ==*' % WARNINGS_SUMMARY_HEADER, - - '*test_setup_teardown_warnings.py:6: UserWarning: warning during setup', - '*warnings.warn(UserWarning("warning during setup"))', - - '*test_setup_teardown_warnings.py:8: UserWarning: warning during teardown', - '*warnings.warn(UserWarning("warning during teardown"))', - '* 1 passed, 2 warnings*', - ]) + result.stdout.fnmatch_lines( + [ + "*== %s ==*" % WARNINGS_SUMMARY_HEADER, + "*test_setup_teardown_warnings.py:6: UserWarning: warning during setup", + '*warnings.warn(UserWarning("warning during setup"))', + "*test_setup_teardown_warnings.py:8: UserWarning: warning during teardown", + '*warnings.warn(UserWarning("warning during teardown"))', + "* 1 passed, 2 warnings*", + ] + ) -@pytest.mark.parametrize('method', ['cmdline', 'ini']) +@pytest.mark.parametrize("method", ["cmdline", "ini"]) def test_as_errors(testdir, pyfile_with_warnings, method): - args = ('-W', 'error') if method == 'cmdline' else () - if method == 'ini': - testdir.makeini(''' + args = ("-W", "error") if method == "cmdline" else () + if method == "ini": + testdir.makeini( + """ [pytest] filterwarnings= error - ''') + """ + ) result = testdir.runpytest(*args) - result.stdout.fnmatch_lines([ - 'E UserWarning: user warning', - 'as_errors_module.py:3: UserWarning', - '* 1 failed in *', - ]) + result.stdout.fnmatch_lines( + [ + "E UserWarning: user warning", + "as_errors_module.py:3: UserWarning", + "* 1 failed in *", + ] + ) -@pytest.mark.parametrize('method', ['cmdline', 'ini']) +@pytest.mark.parametrize("method", ["cmdline", "ini"]) def test_ignore(testdir, pyfile_with_warnings, method): - args = ('-W', 'ignore') if method == 'cmdline' else () - if method == 'ini': - testdir.makeini(''' + args = ("-W", "ignore") if method == "cmdline" else () + if method == "ini": + testdir.makeini( + """ [pytest] filterwarnings= ignore - ''') + """ + ) result = testdir.runpytest(*args) - result.stdout.fnmatch_lines([ - '* 1 passed in *', - ]) + result.stdout.fnmatch_lines(["* 1 passed in *"]) assert WARNINGS_SUMMARY_HEADER not in result.stdout.str() -@pytest.mark.skipif(sys.version_info < (3, 0), - reason='warnings message is unicode is ok in python3') -@pytest.mark.filterwarnings('always') +@pytest.mark.skipif( + sys.version_info < (3, 0), reason="warnings message is unicode is ok in python3" +) +@pytest.mark.filterwarnings("always") def test_unicode(testdir, pyfile_with_warnings): - testdir.makepyfile(''' + testdir.makepyfile( + """ # -*- coding: utf8 -*- import warnings import pytest @@ -132,21 +143,30 @@ def test_unicode(testdir, pyfile_with_warnings): def test_func(fix): pass - ''') + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - '*== %s ==*' % WARNINGS_SUMMARY_HEADER, - '*test_unicode.py:8: UserWarning: \u6d4b\u8bd5*', - '* 1 passed, 1 warnings*', - ]) + result.stdout.fnmatch_lines( + [ + "*== %s ==*" % WARNINGS_SUMMARY_HEADER, + "*test_unicode.py:8: UserWarning: \u6d4b\u8bd5*", + "* 1 passed, 1 warnings*", + ] + ) -@pytest.mark.skipif(sys.version_info >= (3, 0), - reason='warnings message is broken as it is not str instance') +@pytest.mark.skipif( + sys.version_info >= (3, 0), + reason="warnings message is broken as it is not str instance", +) def test_py2_unicode(testdir, pyfile_with_warnings): - if getattr(sys, "pypy_version_info", ())[:2] == (5, 9) and sys.platform.startswith('win'): + if ( + getattr(sys, "pypy_version_info", ())[:2] == (5, 9) + and sys.platform.startswith("win") + ): pytest.xfail("fails with unicode error on PyPy2 5.9 and Windows (#2905)") - testdir.makepyfile(''' + testdir.makepyfile( + """ # -*- coding: utf8 -*- import warnings import pytest @@ -160,41 +180,48 @@ def test_py2_unicode(testdir, pyfile_with_warnings): @pytest.mark.filterwarnings('always') def test_func(fix): pass - ''') + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - '*== %s ==*' % WARNINGS_SUMMARY_HEADER, - - '*test_py2_unicode.py:8: UserWarning: \\u6d4b\\u8bd5', - '*warnings.warn(u"\u6d4b\u8bd5")', - '*warnings.py:*: UnicodeWarning: Warning is using unicode non*', - '* 1 passed, 2 warnings*', - ]) + result.stdout.fnmatch_lines( + [ + "*== %s ==*" % WARNINGS_SUMMARY_HEADER, + "*test_py2_unicode.py:8: UserWarning: \\u6d4b\\u8bd5", + '*warnings.warn(u"\u6d4b\u8bd5")', + "*warnings.py:*: UnicodeWarning: Warning is using unicode non*", + "* 1 passed, 2 warnings*", + ] + ) def test_py2_unicode_ascii(testdir): """Ensure that our warning about 'unicode warnings containing non-ascii messages' does not trigger with ascii-convertible messages""" - testdir.makeini('[pytest]') - testdir.makepyfile(''' + testdir.makeini("[pytest]") + testdir.makepyfile( + """ import pytest import warnings @pytest.mark.filterwarnings('always') def test_func(): warnings.warn(u"hello") - ''') + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - '*== %s ==*' % WARNINGS_SUMMARY_HEADER, - '*warnings.warn(u"hello")', - '* 1 passed, 1 warnings in*' - ]) + result.stdout.fnmatch_lines( + [ + "*== %s ==*" % WARNINGS_SUMMARY_HEADER, + '*warnings.warn(u"hello")', + "* 1 passed, 1 warnings in*", + ] + ) def test_works_with_filterwarnings(testdir): """Ensure our warnings capture does not mess with pre-installed filters (#2430).""" - testdir.makepyfile(''' + testdir.makepyfile( + """ import warnings class MyWarning(Warning): @@ -209,24 +236,26 @@ def test_works_with_filterwarnings(testdir): assert False except MyWarning: assert True - ''') + """ + ) result = testdir.runpytest() - result.stdout.fnmatch_lines([ - '*== 1 passed in *', - ]) + result.stdout.fnmatch_lines(["*== 1 passed in *"]) -@pytest.mark.parametrize('default_config', ['ini', 'cmdline']) +@pytest.mark.parametrize("default_config", ["ini", "cmdline"]) def test_filterwarnings_mark(testdir, default_config): """ Test ``filterwarnings`` mark works and takes precedence over command line and ini options. """ - if default_config == 'ini': - testdir.makeini(""" + if default_config == "ini": + testdir.makeini( + """ [pytest] filterwarnings = always - """) - testdir.makepyfile(""" + """ + ) + testdir.makepyfile( + """ import warnings import pytest @@ -240,19 +269,22 @@ def test_filterwarnings_mark(testdir, default_config): def test_show_warning(): warnings.warn(RuntimeWarning()) - """) - result = testdir.runpytest('-W always' if default_config == 'cmdline' else '') - result.stdout.fnmatch_lines(['*= 1 failed, 2 passed, 1 warnings in *']) + """ + ) + result = testdir.runpytest("-W always" if default_config == "cmdline" else "") + result.stdout.fnmatch_lines(["*= 1 failed, 2 passed, 1 warnings in *"]) def test_non_string_warning_argument(testdir): """Non-str argument passed to warning breaks pytest (#2956)""" - testdir.makepyfile(""" + testdir.makepyfile( + """ import warnings import pytest def test(): warnings.warn(UserWarning(1, u'foo')) - """) - result = testdir.runpytest('-W', 'always') - result.stdout.fnmatch_lines(['*= 1 passed, 1 warnings in *']) + """ + ) + result = testdir.runpytest("-W", "always") + result.stdout.fnmatch_lines(["*= 1 passed, 1 warnings in *"]) diff --git a/tests/wpt/web-platform-tests/tools/third_party/pytest/tox.ini b/tests/wpt/web-platform-tests/tools/third_party/pytest/tox.ini index 900b602dc33..cb3846d5422 100644 --- a/tests/wpt/web-platform-tests/tools/third_party/pytest/tox.ini +++ b/tests/wpt/web-platform-tests/tools/third_party/pytest/tox.ini @@ -13,14 +13,14 @@ envlist = {py27,py36}-{pexpect,xdist,trial,numpy,pluggymaster} py27-nobyte doctesting - py35-freeze + py36-freeze docs [testenv] commands = pytest --lsof -ra {posargs:testing} passenv = USER USERNAME deps = - hypothesis>=3.5.2 + hypothesis>=3.56 nose mock requests @@ -38,30 +38,23 @@ commands = [testenv:linting] skipsdist = True usedevelop = True -basepython = python2.7 -deps = - flake8 - # pygments required by rst-lint - pygments - restructuredtext_lint -commands = - flake8 pytest.py _pytest testing setup.py pytest.py - {envpython} scripts/check-rst.py +basepython = python3.6 +deps = pre-commit +commands = pre-commit run --all-files --show-diff-on-failure [testenv:py27-xdist] deps = pytest-xdist>=1.13 mock nose - hypothesis>=3.5.2 + hypothesis>=3.56 changedir=testing commands = - pytest -n1 -ra {posargs:.} + pytest -n8 -ra {posargs:.} [testenv:py36-xdist] deps = {[testenv:py27-xdist]deps} -commands = - pytest -n3 -ra {posargs:testing} +commands = {[testenv:py27-xdist]commands} [testenv:py27-pexpect] changedir = testing @@ -71,16 +64,16 @@ commands = pytest -ra test_pdb.py test_terminal.py test_unittest.py [testenv:py36-pexpect] -changedir = testing -platform = linux|darwin +changedir = {[testenv:py27-pexpect]changedir} +platform = {[testenv:py27-pexpect]platform} deps = {[testenv:py27-pexpect]deps} -commands = - pytest -ra test_pdb.py test_terminal.py test_unittest.py +commands = {[testenv:py27-pexpect]commands} [testenv:py27-nobyte] deps = pytest-xdist>=1.13 - hypothesis>=3.5.2 + hypothesis>=3.56 + mock distribute = true changedir=testing setenv = @@ -95,18 +88,16 @@ commands = [testenv:py36-trial] deps = {[testenv:py27-trial]deps} -commands = - pytest -ra {posargs:testing/test_unittest.py} +commands = {[testenv:py27-trial]commands} [testenv:py27-numpy] -deps=numpy +deps = numpy commands= pytest -ra {posargs:testing/python/approx.py} [testenv:py36-numpy] -deps=numpy -commands= - pytest -ra {posargs:testing/python/approx.py} +deps = {[testenv:py27-numpy]deps} +commands = {[testenv:py27-numpy]commands} [testenv:py27-pluggymaster] setenv= @@ -115,21 +106,20 @@ deps = {[testenv]deps} git+https://github.com/pytest-dev/pluggy.git@master -[testenv:py35-pluggymaster] -setenv= - _PYTEST_SETUP_SKIP_PLUGGY_DEP=1 -deps = - {[testenv:py27-pluggymaster]deps} - git+https://github.com/pytest-dev/pluggy.git@master +[testenv:py36-pluggymaster] +setenv = {[testenv:py27-pluggymaster]setenv} +deps = {[testenv:py27-pluggymaster]deps} [testenv:docs] skipsdist = True usedevelop = True -basepython = python changedir = doc/en deps = - sphinx + attrs + more-itertools PyYAML + sphinx + sphinxcontrib-trio commands = sphinx-build -W -b html . _build @@ -138,7 +128,7 @@ commands = basepython = python usedevelop = True skipsdist = True -# ensure the given pyargs cant mean anytrhing else +# ensure the given pyargs can't mean anything else changedir = doc/ deps = PyYAML @@ -174,7 +164,7 @@ changedir = testing commands = {envpython} {envbindir}/py.test-jython -ra {posargs} -[testenv:py35-freeze] +[testenv:py36-freeze] changedir = testing/freeze deps = pyinstaller commands = @@ -197,7 +187,6 @@ commands = [pytest] minversion = 2.0 plugins = pytester -#--pyargs --doctest-modules --ignore=.tox addopts = -ra -p pytester --ignore=testing/cx_freeze rsyncdirs = tox.ini pytest.py _pytest testing python_files = test_*.py *_test.py testing/*/*.py @@ -215,6 +204,9 @@ filterwarnings = ignore:.*type argument to addoption.*:DeprecationWarning # produced by python >=3.5 on execnet (pytest-xdist) ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning + # ignore warning about package resolution using __spec__ or __package__ + # should be a temporary solution, see #3061 for discussion + ignore:.*can't resolve package from __spec__ or __package__.*:ImportWarning [flake8] max-line-length = 120 diff --git a/tests/wpt/web-platform-tests/tools/tox.ini b/tests/wpt/web-platform-tests/tools/tox.ini index 24fe7427268..3eb12c357ba 100644 --- a/tests/wpt/web-platform-tests/tools/tox.ini +++ b/tests/wpt/web-platform-tests/tools/tox.ini @@ -17,30 +17,10 @@ deps = commands = pytest --cov {posargs} - flake8 + flake8 --append-config=flake8.ini passenv = HYPOTHESIS_PROFILE [flake8] -# flake8 config should be kept in sync across tools/tox.ini, tools/wpt/tox.ini, and tools/wptrunner/tox.ini -select = E,W,F,N -# E128: continuation line under-indented for visual indent -# E129: visually indented line with same indent as next logical line -# E221: multiple spaces before operator -# E226: missing whitespace around arithmetic operator -# E231: missing whitespace after ‘,’, ‘;’, or ‘:’ -# E251: unexpected spaces around keyword / parameter equals -# E265: block comment should start with ‘# ‘ -# E302: expected 2 blank lines, found 0 -# E303: too many blank lines (3) -# E305: expected 2 blank lines after end of function or class -# E402: module level import not at top of file -# E731: do not assign a lambda expression, use a def -# E901: SyntaxError or IndentationError -# W601: .has_key() is deprecated, use ‘in’ -# N801: class names should use CapWords convention -# N802: function name should be lowercase -ignore = E128,E129,E221,E226,E231,E251,E265,E302,E303,E305,E402,E731,E901,W601,N801,N802 -max-line-length = 141 -exclude = .tox,html5lib,third_party/py,third_party/pytest,third_party/funcsigs,third_party/attrs,third_party/pluggy/,pywebsocket,six,_venv,webencodings,wptserve/docs,wptserve/tests/functional/docroot/,wpt,wptrunner +exclude = .tox,html5lib,third_party,pywebsocket,six,_venv,webencodings,wptserve/docs,wptserve/tests/functional/docroot/,wpt,wptrunner diff --git a/tests/wpt/web-platform-tests/tools/webdriver/webdriver/__init__.py b/tests/wpt/web-platform-tests/tools/webdriver/webdriver/__init__.py index 9e988d3129e..217bfc65272 100644 --- a/tests/wpt/web-platform-tests/tools/webdriver/webdriver/__init__.py +++ b/tests/wpt/web-platform-tests/tools/webdriver/webdriver/__init__.py @@ -1,5 +1,13 @@ -# flake8: noqa (not ideal, but nicer than adding noqa: F401 to every line!) -from client import Cookies, Element, Find, Session, Timeouts, Window +# flake8: noqa + +from client import ( + Cookies, + Element, + Find, + Frame, + Session, + Timeouts, + Window) from error import ( ElementNotSelectableException, ElementNotVisibleException, diff --git a/tests/wpt/web-platform-tests/tools/webdriver/webdriver/client.py b/tests/wpt/web-platform-tests/tools/webdriver/webdriver/client.py index 45c4845e094..f243e286b59 100644 --- a/tests/wpt/web-platform-tests/tools/webdriver/webdriver/client.py +++ b/tests/wpt/web-platform-tests/tools/webdriver/webdriver/client.py @@ -16,7 +16,6 @@ def command(func): if session.session_id is None: session.start() - assert session.session_id is not None return func(self, *args, **kwargs) @@ -234,6 +233,8 @@ class Actions(object): class Window(object): + identifier = "window-fcc6-11e5-b4f8-330a88ab9d7f" + def __init__(self, session): self.session = session @@ -284,6 +285,23 @@ class Window(object): def fullscreen(self): return self.session.send_session_command("POST", "window/fullscreen") + @classmethod + def from_json(cls, json, session): + uuid = json[Window.identifier] + return cls(uuid, session) + + +class Frame(object): + identifier = "frame-075b-4da1-b6ba-e579c2d3230a" + + def __init__(self, session): + self.session = session + + @classmethod + def from_json(cls, json, session): + uuid = json[Frame.identifier] + return cls(uuid, session) + class Find(object): def __init__(self, session): @@ -352,7 +370,8 @@ class Session(object): extension=None): self.transport = transport.HTTPWireProtocol( host, port, url_prefix, timeout=timeout) - self.capabilities = capabilities + self.requested_capabilities = capabilities + self.capabilities = None self.session_id = None self.timeouts = None self.window = None @@ -390,8 +409,8 @@ class Session(object): body = {} - if self.capabilities is not None: - body["capabilities"] = self.capabilities + if self.requested_capabilities is not None: + body["capabilities"] = self.requested_capabilities value = self.send_command("POST", "session", body=body) self.session_id = value["sessionId"] @@ -435,7 +454,13 @@ class Session(object): session=self) if response.status != 200: - raise error.from_response(response) + err = error.from_response(response) + + if isinstance(err, error.SessionNotCreatedException): + # The driver could have already been deleted the session. + self.session_id = None + + raise err if "value" in response.body: value = response.body["value"] @@ -639,7 +664,8 @@ class Element(object): self.id = id self.session = session - assert id not in self.session._element_cache + if id in self.session._element_cache: + raise ValueError("Element already in cache: %s" % id) self.session._element_cache[self.id] = self def __repr__(self): @@ -651,7 +677,6 @@ class Element(object): @classmethod def from_json(cls, json, session): - assert Element.identifier in json uuid = json[Element.identifier] if uuid in session._element_cache: return session._element_cache[uuid] @@ -677,7 +702,7 @@ class Element(object): @command def clear(self): - self.send_element_command("POST", self.url("clear"), {}) + self.send_element_command("POST", "clear", {}) @command def send_keys(self, text): diff --git a/tests/wpt/web-platform-tests/tools/webdriver/webdriver/error.py b/tests/wpt/web-platform-tests/tools/webdriver/webdriver/error.py index ecfe8910c51..d88e20e21d0 100644 --- a/tests/wpt/web-platform-tests/tools/webdriver/webdriver/error.py +++ b/tests/wpt/web-platform-tests/tools/webdriver/webdriver/error.py @@ -6,7 +6,7 @@ class WebDriverException(Exception): http_status = None status_code = None - def __init__(self, message, stacktrace=None): + def __init__(self, message=None, stacktrace=None): super(WebDriverException, self) self.message = message self.stacktrace = stacktrace @@ -15,12 +15,15 @@ class WebDriverException(Exception): return "<%s http_status=%s>" % (self.__class__.__name__, self.http_status) def __str__(self): - message = "%s (%s): %s\n" % (self.status_code, self.http_status, self.message) + message = "%s (%s)" % (self.status_code, self.http_status) + + if self.message is not None: + message += ": %s" % self.message + message += "\n" + if self.stacktrace: - message += ("\n" - "Remote-end stacktrace:\n" - "\n" - "%s" % self.stacktrace) + message += ("\nRemote-end stacktrace:\n\n%s" % self.stacktrace) + return message diff --git a/tests/wpt/web-platform-tests/tools/webdriver/webdriver/protocol.py b/tests/wpt/web-platform-tests/tools/webdriver/webdriver/protocol.py index ea0c793accb..18a3d52c8a3 100644 --- a/tests/wpt/web-platform-tests/tools/webdriver/webdriver/protocol.py +++ b/tests/wpt/web-platform-tests/tools/webdriver/webdriver/protocol.py @@ -16,6 +16,10 @@ class Encoder(json.JSONEncoder): return [self.default(x) for x in obj] elif isinstance(obj, webdriver.Element): return {webdriver.Element.identifier: obj.id} + elif isinstance(obj, webdriver.Frame): + return {webdriver.Frame.identifier: obj.id} + elif isinstance(obj, webdriver.Window): + return {webdriver.Frame.identifier: obj.id} return super(Encoder, self).default(obj) @@ -30,6 +34,10 @@ class Decoder(json.JSONDecoder): return [self.object_hook(x) for x in payload] elif isinstance(payload, dict) and webdriver.Element.identifier in payload: return webdriver.Element.from_json(payload, self.session) + elif isinstance(payload, dict) and webdriver.Frame.identifier in payload: + return webdriver.Frame.from_json(payload, self.session) + elif isinstance(payload, dict) and webdriver.Window.identifier in payload: + return webdriver.Window.from_json(payload, self.session) elif isinstance(payload, dict): return {k: self.object_hook(v) for k, v in payload.iteritems()} return payload diff --git a/tests/wpt/web-platform-tests/tools/webdriver/webdriver/transport.py b/tests/wpt/web-platform-tests/tools/webdriver/webdriver/transport.py index 65be05017f5..619b3faee54 100644 --- a/tests/wpt/web-platform-tests/tools/webdriver/webdriver/transport.py +++ b/tests/wpt/web-platform-tests/tools/webdriver/webdriver/transport.py @@ -50,8 +50,9 @@ class HTTPWireProtocol(object): Transports messages (commands and responses) over the WebDriver wire protocol. - Complex objects, such as ``webdriver.Element``, are by default - not marshaled to enable use of `session.transport.send` in WPT tests:: + Complex objects, such as ``webdriver.Element``, ``webdriver.Frame``, + and ``webdriver.Window`` are by default not marshaled to enable + use of `session.transport.send` in WPT tests:: session = webdriver.Session("127.0.0.1", 4444) response = transport.send("GET", "element/active", None) @@ -100,8 +101,9 @@ class HTTPWireProtocol(object): The request `body` must be JSON serialisable unless a custom `encoder` has been provided. This means complex - objects such as ``webdriver.Element`` are not automatically - made into JSON. This behaviour is, however, provided by + objects such as ``webdriver.Element``, ``webdriver.Frame``, + and `webdriver.Window`` are not automatically made + into JSON. This behaviour is, however, provided by ``webdriver.protocol.Encoder``, should you want it. Similarly, the response body is returned au natural diff --git a/tests/wpt/web-platform-tests/tools/wpt/requirements.txt b/tests/wpt/web-platform-tests/tools/wpt/requirements.txt index 271baf7e23f..46c4b13a3bf 100644 --- a/tests/wpt/web-platform-tests/tools/wpt/requirements.txt +++ b/tests/wpt/web-platform-tests/tools/wpt/requirements.txt @@ -1 +1 @@ -requests==2.18.4 +requests==2.19.1 diff --git a/tests/wpt/web-platform-tests/tools/wpt/testfiles.py b/tests/wpt/web-platform-tests/tools/wpt/testfiles.py index 47431b53baf..c4e714c2640 100644 --- a/tests/wpt/web-platform-tests/tools/wpt/testfiles.py +++ b/tests/wpt/web-platform-tests/tools/wpt/testfiles.py @@ -6,6 +6,7 @@ import subprocess import sys from collections import OrderedDict +from six import iteritems from ..manifest import manifest, update @@ -67,7 +68,7 @@ def branch_point(): branch_point = None # if there are any commits, take the first parent that is not in commits - for commit, parents in commit_parents.iteritems(): + for commit, parents in iteritems(commit_parents): for parent in parents: if parent not in commit_parents: branch_point = parent diff --git a/tests/wpt/web-platform-tests/tools/wpt/tox.ini b/tests/wpt/web-platform-tests/tools/wpt/tox.ini index 31ded4894cb..e486bb221d7 100644 --- a/tests/wpt/web-platform-tests/tools/wpt/tox.ini +++ b/tests/wpt/web-platform-tests/tools/wpt/tox.ini @@ -23,26 +23,4 @@ deps = pep8-naming==0.4.1 commands = - flake8 {posargs} - -[flake8] -# flake8 config should be kept in sync across tools/tox.ini, tools/wpt/tox.ini, and tools/wptrunner/tox.ini -select = E,W,F,N -# E128: continuation line under-indented for visual indent -# E129: visually indented line with same indent as next logical line -# E221: multiple spaces before operator -# E226: missing whitespace around arithmetic operator -# E231: missing whitespace after ‘,’, ‘;’, or ‘:’ -# E251: unexpected spaces around keyword / parameter equals -# E265: block comment should start with ‘# ‘ -# E302: expected 2 blank lines, found 0 -# E303: too many blank lines (3) -# E305: expected 2 blank lines after end of function or class -# E402: module level import not at top of file -# E731: do not assign a lambda expression, use a def -# E901: SyntaxError or IndentationError -# W601: .has_key() is deprecated, use ‘in’ -# N801: class names should use CapWords convention -# N802: function name should be lowercase -ignore = E128,E129,E221,E226,E231,E251,E265,E302,E303,E305,E402,E731,E901,W601,N801,N802 -max-line-length = 141 + flake8 --append-config=../flake8.ini {posargs} diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/requirements_sauce.txt b/tests/wpt/web-platform-tests/tools/wptrunner/requirements_sauce.txt index 5ea06d34a3f..620a3a90495 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/requirements_sauce.txt +++ b/tests/wpt/web-platform-tests/tools/wptrunner/requirements_sauce.txt @@ -1,3 +1,3 @@ mozprocess == 0.26 selenium==3.12.0 -requests==2.18.4 +requests==2.19.1 diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/tox.ini b/tests/wpt/web-platform-tests/tools/wptrunner/tox.ini index 80bf12c78ec..fa7985ec80d 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/tox.ini +++ b/tests/wpt/web-platform-tests/tools/wptrunner/tox.ini @@ -33,26 +33,4 @@ deps = pep8-naming==0.4.1 commands = - flake8 - -[flake8] -# flake8 config should be kept in sync across tools/tox.ini, tools/wpt/tox.ini, and tools/wptrunner/tox.ini -select = E,W,F,N -# E128: continuation line under-indented for visual indent -# E129: visually indented line with same indent as next logical line -# E221: multiple spaces before operator -# E226: missing whitespace around arithmetic operator -# E231: missing whitespace after ‘,’, ‘;’, or ‘:’ -# E251: unexpected spaces around keyword / parameter equals -# E265: block comment should start with ‘# ‘ -# E302: expected 2 blank lines, found 0 -# E303: too many blank lines (3) -# E305: expected 2 blank lines after end of function or class -# E402: module level import not at top of file -# E731: do not assign a lambda expression, use a def -# E901: SyntaxError or IndentationError -# W601: .has_key() is deprecated, use ‘in’ -# N801: class names should use CapWords convention -# N802: function name should be lowercase -ignore = E128,E129,E221,E226,E231,E251,E265,E302,E303,E305,E402,E731,E901,W601,N801,N802 -max-line-length = 141 + flake8 --append-config=../flake8.ini diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/chrome.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/chrome.py index 696d5f1f631..5ba5ff6d0ac 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/chrome.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/chrome.py @@ -33,7 +33,8 @@ def executor_kwargs(test_type, server_config, cache_manager, run_info_data, from selenium.webdriver import DesiredCapabilities executor_kwargs = base_executor_kwargs(test_type, server_config, - cache_manager, **kwargs) + cache_manager, run_info_data, + **kwargs) executor_kwargs["close_after_done"] = True capabilities = dict(DesiredCapabilities.CHROME.items()) capabilities.setdefault("chromeOptions", {})["prefs"] = { diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/chrome_android.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/chrome_android.py index 84bc07eb308..2d1980d5ca3 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/chrome_android.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/chrome_android.py @@ -42,8 +42,8 @@ def executor_kwargs(test_type, server_config, cache_manager, run_info_data, server_config['ports']['ws'] + server_config['ports']['wss'] )) - executor_kwargs = base_executor_kwargs(test_type, server_config, - cache_manager, **kwargs) + executor_kwargs = base_executor_kwargs(test_type, server_config, cache_manager, run_info_data, + **kwargs) executor_kwargs["close_after_done"] = True capabilities = dict(DesiredCapabilities.CHROME.items()) capabilities["chromeOptions"] = {} diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/edge.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/edge.py index 75be31e5f43..36f87d96ee8 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/edge.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/edge.py @@ -36,7 +36,7 @@ def browser_kwargs(test_type, run_info_data, **kwargs): def executor_kwargs(test_type, server_config, cache_manager, run_info_data, **kwargs): executor_kwargs = base_executor_kwargs(test_type, server_config, - cache_manager, **kwargs) + cache_manager, run_info_data, **kwargs) executor_kwargs["close_after_done"] = True executor_kwargs["timeout_multiplier"] = get_timeout_multiplier(test_type, run_info_data, diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/firefox.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/firefox.py index 16f1de8f7a0..2b8709ef041 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/firefox.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/firefox.py @@ -88,11 +88,13 @@ def browser_kwargs(test_type, run_info_data, **kwargs): def executor_kwargs(test_type, server_config, cache_manager, run_info_data, **kwargs): executor_kwargs = base_executor_kwargs(test_type, server_config, - cache_manager, **kwargs) + cache_manager, run_info_data, + **kwargs) executor_kwargs["close_after_done"] = test_type != "reftest" executor_kwargs["timeout_multiplier"] = get_timeout_multiplier(test_type, run_info_data, **kwargs) + executor_kwargs["e10s"] = run_info_data["e10s"] capabilities = {} if test_type == "reftest": executor_kwargs["reftest_internal"] = kwargs["reftest_internal"] @@ -111,6 +113,7 @@ def executor_kwargs(test_type, server_config, cache_manager, run_info_data, capabilities["acceptInsecureCerts"] = True if capabilities: executor_kwargs["capabilities"] = capabilities + executor_kwargs["debug"] = run_info_data["debug"] return executor_kwargs diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/ie.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/ie.py index 1b9ce0195e7..c61d4fbea85 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/ie.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/ie.py @@ -31,7 +31,7 @@ def executor_kwargs(test_type, server_config, cache_manager, run_info_data, capabilities = {} capabilities["se:ieOptions"] = options executor_kwargs = base_executor_kwargs(test_type, server_config, - cache_manager, **kwargs) + cache_manager, run_info_data, **kwargs) executor_kwargs["close_after_done"] = True executor_kwargs["capabilities"] = capabilities return executor_kwargs diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/opera.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/opera.py index 1775191990b..b1bb8b23a47 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/opera.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/opera.py @@ -33,7 +33,7 @@ def executor_kwargs(test_type, server_config, cache_manager, run_info_data, from selenium.webdriver import DesiredCapabilities executor_kwargs = base_executor_kwargs(test_type, server_config, - cache_manager, **kwargs) + cache_manager, run_info_data, **kwargs) executor_kwargs["close_after_done"] = True capabilities = dict(DesiredCapabilities.OPERA.items()) capabilities.setdefault("operaOptions", {})["prefs"] = { diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/safari.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/safari.py index bbf9b012c70..e4c4567fc57 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/safari.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/safari.py @@ -3,13 +3,15 @@ from ..webdriver_server import SafariDriverServer from ..executors import executor_kwargs as base_executor_kwargs from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401 SeleniumRefTestExecutor) # noqa: F401 +from ..executors.executorsafari import SafariDriverWdspecExecutor # noqa: F401 __wptrunner__ = {"product": "safari", "check_args": "check_args", "browser": "SafariBrowser", "executor": {"testharness": "SeleniumTestharnessExecutor", - "reftest": "SeleniumRefTestExecutor"}, + "reftest": "SeleniumRefTestExecutor", + "wdspec": "SafariDriverWdspecExecutor"}, "browser_kwargs": "browser_kwargs", "executor_kwargs": "executor_kwargs", "env_extras": "env_extras", @@ -27,12 +29,10 @@ def browser_kwargs(test_type, run_info_data, **kwargs): def executor_kwargs(test_type, server_config, cache_manager, run_info_data, **kwargs): - from selenium.webdriver import DesiredCapabilities - executor_kwargs = base_executor_kwargs(test_type, server_config, - cache_manager, **kwargs) + cache_manager, run_info_data, **kwargs) executor_kwargs["close_after_done"] = True - executor_kwargs["capabilities"] = dict(DesiredCapabilities.SAFARI.items()) + executor_kwargs["capabilities"] = {} if kwargs["binary"] is not None: raise ValueError("Safari doesn't support setting executable location") diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/sauce.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/sauce.py index ae67baa0b3a..ef990debcc9 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/sauce.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/sauce.py @@ -104,7 +104,7 @@ def browser_kwargs(test_type, run_info_data, **kwargs): def executor_kwargs(test_type, server_config, cache_manager, run_info_data, **kwargs): executor_kwargs = base_executor_kwargs(test_type, server_config, - cache_manager, **kwargs) + cache_manager, run_info_data, **kwargs) executor_kwargs["capabilities"] = get_capabilities(**kwargs) diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/servo.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/servo.py index ae717b8f577..27dfc35c545 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/servo.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/servo.py @@ -40,7 +40,7 @@ def browser_kwargs(test_type, run_info_data, **kwargs): def executor_kwargs(test_type, server_config, cache_manager, run_info_data, **kwargs): rv = base_executor_kwargs(test_type, server_config, - cache_manager, **kwargs) + cache_manager, run_info_data, **kwargs) rv["pause_after_test"] = kwargs["pause_after_test"] if test_type == "wdspec": rv["capabilities"] = {} diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/servodriver.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/servodriver.py index ad0bcbdb1dc..168a576c25a 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/servodriver.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/servodriver.py @@ -44,7 +44,7 @@ def browser_kwargs(test_type, run_info_data, **kwargs): def executor_kwargs(test_type, server_config, cache_manager, run_info_data, **kwargs): rv = base_executor_kwargs(test_type, server_config, - cache_manager, **kwargs) + cache_manager, run_info_data, **kwargs) return rv diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/webkit.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/webkit.py index f0f777833c8..17349559f57 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/webkit.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/webkit.py @@ -51,7 +51,7 @@ def capabilities_for_port(server_config, **kwargs): def executor_kwargs(test_type, server_config, cache_manager, run_info_data, **kwargs): executor_kwargs = base_executor_kwargs(test_type, server_config, - cache_manager, **kwargs) + cache_manager, run_info_data, **kwargs) executor_kwargs["close_after_done"] = True executor_kwargs["capabilities"] = capabilities_for_port(server_config, **kwargs) diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/base.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/base.py index 1e662b0330a..1dc962cfb08 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/base.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/base.py @@ -17,7 +17,8 @@ here = os.path.split(__file__)[0] extra_timeout = 5 # seconds -def executor_kwargs(test_type, server_config, cache_manager, **kwargs): +def executor_kwargs(test_type, server_config, cache_manager, run_info_data, + **kwargs): timeout_multiplier = kwargs["timeout_multiplier"] if timeout_multiplier is None: timeout_multiplier = 1 @@ -61,12 +62,12 @@ class TestharnessResultConverter(object): 2: "TIMEOUT", 3: "NOTRUN"} - def __call__(self, test, result): + def __call__(self, test, result, extra=None): """Convert a JSON result into a (TestResult, [SubtestResult]) tuple""" result_url, status, message, stack, subtest_results = result assert result_url == test.url, ("Got results from %s, expected %s" % - (result_url, test.url)) - harness_result = test.result_cls(self.harness_codes[status], message) + (result_url, test.url)) + harness_result = test.result_cls(self.harness_codes[status], message, extra=extra, stack=stack) return (harness_result, [test.subtest_result_cls(st_name, self.test_codes[st_status], st_message, st_stack) for st_name, st_status, st_message, st_stack in subtest_results]) @@ -76,8 +77,11 @@ testharness_result_converter = TestharnessResultConverter() def reftest_result_converter(self, test, result): - return (test.result_cls(result["status"], result["message"], - extra=result.get("extra")), []) + return (test.result_cls( + result["status"], + result["message"], + extra=result.get("extra", {}), + stack=result.get("stack")), []) def pytest_result_converter(self, test, data): diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executormarionette.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executormarionette.py index 71442e682af..152fecce0a1 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executormarionette.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executormarionette.py @@ -20,7 +20,8 @@ from .base import (CallbackHandler, WebDriverProtocol, extra_timeout, strip_server) -from .protocol import (BaseProtocolPart, +from .protocol import (AssertsProtocolPart, + BaseProtocolPart, TestharnessProtocolPart, PrefsProtocolPart, Protocol, @@ -288,6 +289,50 @@ class MarionetteStorageProtocolPart(StorageProtocolPart): self.marionette.execute_script(script) +class MarionetteAssertsProtocolPart(AssertsProtocolPart): + def setup(self): + self.assert_count = {"chrome": 0, "content": 0} + self.chrome_assert_count = 0 + self.marionette = self.parent.marionette + + def get(self): + script = """ + debug = Cc["@mozilla.org/xpcom/debug;1"].getService(Ci.nsIDebug2); + if (debug.isDebugBuild) { + return debug.assertionCount; + } + return 0; + """ + + def get_count(context, **kwargs): + try: + context_count = self.marionette.execute_script(script, **kwargs) + if context_count: + self.parent.logger.info("Got %s assert count %s" % (context, context_count)) + test_count = context_count - self.assert_count[context] + self.assert_count[context] = context_count + return test_count + except errors.NoSuchWindowException: + # If the window was already closed + self.parent.logger.warning("Failed to get assertion count; window was closed") + except (errors.MarionetteException, socket.error): + # This usually happens if the process crashed + pass + + counts = [] + with self.marionette.using_context(self.marionette.CONTEXT_CHROME): + counts.append(get_count("chrome")) + if self.parent.e10s: + counts.append(get_count("content", sandbox="system")) + + counts = [item for item in counts if item is not None] + + if not counts: + return None + + return sum(counts) + + class MarionetteSelectorProtocolPart(SelectorProtocolPart): def setup(self): self.marionette = self.parent.marionette @@ -303,6 +348,7 @@ class MarionetteClickProtocolPart(ClickProtocolPart): def element(self, element): return element.click() + class MarionetteSendKeysProtocolPart(SendKeysProtocolPart): def setup(self): self.marionette = self.parent.marionette @@ -310,6 +356,7 @@ class MarionetteSendKeysProtocolPart(SendKeysProtocolPart): def send_keys(self, element, keys): return element.send_keys(keys) + class MarionetteTestDriverProtocolPart(TestDriverProtocolPart): def setup(self): self.marionette = self.parent.marionette @@ -332,9 +379,10 @@ class MarionetteProtocol(Protocol): MarionetteSelectorProtocolPart, MarionetteClickProtocolPart, MarionetteSendKeysProtocolPart, - MarionetteTestDriverProtocolPart] + MarionetteTestDriverProtocolPart, + MarionetteAssertsProtocolPart] - def __init__(self, executor, browser, capabilities=None, timeout_multiplier=1): + def __init__(self, executor, browser, capabilities=None, timeout_multiplier=1, e10s=True): do_delayed_imports() super(MarionetteProtocol, self).__init__(executor, browser) @@ -343,11 +391,12 @@ class MarionetteProtocol(Protocol): self.capabilities = capabilities self.timeout_multiplier = timeout_multiplier self.runner_handle = None + self.e10s = e10s def connect(self): self.logger.debug("Connecting to Marionette on port %i" % self.marionette_port) startup_timeout = marionette.Marionette.DEFAULT_STARTUP_TIMEOUT * self.timeout_multiplier - self.marionette = marionette.Marionette(host='localhost', + self.marionette = marionette.Marionette(host='127.0.0.1', port=self.marionette_port, socket_timeout=None, startup_timeout=startup_timeout) @@ -432,15 +481,18 @@ class ExecuteAsyncScriptRun(object): self.logger.error("Lost marionette connection before starting test") return Stop - executor = threading.Thread(target = self._run) - executor.start() - if timeout is not None: wait_timeout = timeout + 2 * extra_timeout else: wait_timeout = None - self.result_flag.wait(wait_timeout) + timer = threading.Timer(wait_timeout, self._timeout) + timer.start() + + self._run() + + self.result_flag.wait() + timer.cancel() if self.result == (None, None): self.logger.debug("Timed out waiting for a result") @@ -476,23 +528,27 @@ class ExecuteAsyncScriptRun(object): finally: self.result_flag.set() + def _timeout(self): + self.result = False, ("EXTERNAL-TIMEOUT", None) + self.result_flag.set() + class MarionetteTestharnessExecutor(TestharnessExecutor): supports_testdriver = True def __init__(self, browser, server_config, timeout_multiplier=1, close_after_done=True, debug_info=None, capabilities=None, - **kwargs): + debug=False, **kwargs): """Marionette-based executor for testharness.js tests""" TestharnessExecutor.__init__(self, browser, server_config, timeout_multiplier=timeout_multiplier, debug_info=debug_info) - - self.protocol = MarionetteProtocol(self, browser, capabilities, timeout_multiplier) + self.protocol = MarionetteProtocol(self, browser, capabilities, timeout_multiplier, kwargs["e10s"]) self.script = open(os.path.join(here, "testharness_webdriver.js")).read() self.script_resume = open(os.path.join(here, "testharness_webdriver_resume.js")).read() self.close_after_done = close_after_done self.window_id = str(uuid.uuid4()) + self.debug = debug self.original_pref_values = {} @@ -517,10 +573,23 @@ class MarionetteTestharnessExecutor(TestharnessExecutor): self.protocol, self.test_url(test), timeout).run() - if success: - return self.convert_result(test, data) + # The format of data depends on whether the test ran to completion or not + # For asserts we only care about the fact that if it didn't complete, the + # status is in the first field. + status = None + if not success: + status = data[0] - return (test.result_cls(*data), []) + extra = None + if self.debug and (success or status not in ("CRASH", "INTERNAL-ERROR")): + assertion_count = self.protocol.asserts.get() + if assertion_count is not None: + extra = {"assertion_count": assertion_count} + + if success: + return self.convert_result(test, data, extra=extra) + + return (test.result_cls(extra=extra, *data), []) def do_testharness(self, protocol, url, timeout): protocol.base.execute_script("if (window.win) {window.win.close()}") @@ -561,7 +630,7 @@ class MarionetteRefTestExecutor(RefTestExecutor): screenshot_cache=None, close_after_done=True, debug_info=None, reftest_internal=False, reftest_screenshot="unexpected", - group_metadata=None, capabilities=None, **kwargs): + group_metadata=None, capabilities=None, debug=False, **kwargs): """Marionette-based executor for reftests""" RefTestExecutor.__init__(self, browser, @@ -570,7 +639,7 @@ class MarionetteRefTestExecutor(RefTestExecutor): timeout_multiplier=timeout_multiplier, debug_info=debug_info) self.protocol = MarionetteProtocol(self, browser, capabilities, - timeout_multiplier) + timeout_multiplier, kwargs["e10s"]) self.implementation = (InternalRefTestImplementation if reftest_internal else RefTestImplementation)(self) @@ -581,6 +650,7 @@ class MarionetteRefTestExecutor(RefTestExecutor): self.has_window = False self.original_pref_values = {} self.group_metadata = group_metadata + self.debug = debug with open(os.path.join(here, "reftest.js")) as f: self.script = f.read() @@ -621,6 +691,13 @@ class MarionetteRefTestExecutor(RefTestExecutor): self.has_window = True result = self.implementation.run_test(test) + + if self.debug: + assertion_count = self.protocol.asserts.get() + if "extra" not in result: + result["extra"] = {} + result["extra"]["assertion_count"] = assertion_count + return self.convert_result(test, result) def screenshot(self, test, viewport_size, dpi): diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executorsafari.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executorsafari.py new file mode 100644 index 00000000000..ed01f4d8341 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executorsafari.py @@ -0,0 +1,10 @@ +from ..webdriver_server import SafariDriverServer +from .base import WdspecExecutor, WebDriverProtocol + + +class SafariDriverProtocol(WebDriverProtocol): + server_cls = SafariDriverServer + + +class SafariDriverWdspecExecutor(WdspecExecutor): + protocol_cls = SafariDriverProtocol diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/protocol.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/protocol.py index 3c938f04c7b..2e48162e0fd 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/protocol.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/protocol.py @@ -290,3 +290,16 @@ class TestDriverProtocolPart(ProtocolPart): previous command succeeded. :param str message: Additional data to add to the message.""" pass + + +class AssertsProtocolPart(ProtocolPart): + """ProtocolPart that implements the functionality required to get a count of non-fatal + assertions triggered""" + __metaclass__ = ABCMeta + + name = "asserts" + + @abstractmethod + def get(self): + """Get a count of assertions since the last browser start""" + pass diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/formatters.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/formatters.py index c63a052939e..1ea09dbe553 100755 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/formatters.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/formatters.py @@ -54,6 +54,8 @@ class WptreportFormatter(BaseFormatter): def test_status(self, data): subtest = self.create_subtest(data) subtest["status"] = data["status"] + if "expected" in data: + subtest["expected"] = data["expected"] if "message" in data: subtest["message"] = data["message"] @@ -62,5 +64,15 @@ class WptreportFormatter(BaseFormatter): start_time = test.pop("start_time") test["duration"] = data["time"] - start_time test["status"] = data["status"] + if "expected" in data: + test["expected"] = data["expected"] if "message" in data: test["message"] = data["message"] + + def assertion_count(self, data): + test = self.find_or_create_test(data) + test["asserts"] = { + "count": data["count"], + "min": data["min_expected"], + "max": data["max_expected"] + } diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/manifestexpected.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/manifestexpected.py index eaab26081bd..789278875e2 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/manifestexpected.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/manifestexpected.py @@ -33,6 +33,14 @@ def bool_prop(name, node): return None +def int_prop(name, node): + """Boolean property""" + try: + return int(node.get(name)) + except KeyError: + return None + + def tags(node): """Set of tags that have been applied to the test""" try: @@ -113,6 +121,14 @@ class ExpectedManifest(ManifestItem): def leaks(self): return bool_prop("leaks", self) + @property + def min_assertion_count(self): + return int_prop("min-asserts", self) + + @property + def max_assertion_count(self): + return int_prop("max-asserts", self) + @property def tags(self): return tags(self) @@ -135,6 +151,14 @@ class DirectoryManifest(ManifestItem): def leaks(self): return bool_prop("leaks", self) + @property + def min_assertion_count(self): + return int_prop("min-asserts", self) + + @property + def max_assertion_count(self): + return int_prop("max-asserts", self) + @property def tags(self): return tags(self) @@ -184,6 +208,14 @@ class TestNode(ManifestItem): def leaks(self): return bool_prop("leaks", self) + @property + def min_assertion_count(self): + return int_prop("min-asserts", self) + + @property + def max_assertion_count(self): + return int_prop("max-asserts", self) + @property def tags(self): return tags(self) diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/manifestupdate.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/manifestupdate.py index 1d3c173928f..35d0c070201 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/manifestupdate.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/manifestupdate.py @@ -1,3 +1,4 @@ +import itertools import os import urlparse from collections import namedtuple, defaultdict @@ -35,7 +36,7 @@ class ConditionError(Exception): self.cond = cond -Result = namedtuple("Result", ["run_info", "status"]) +Value = namedtuple("Value", ["run_info", "value"]) def data_cls_getter(output_node, visited_node): @@ -113,12 +114,14 @@ class TestNode(ManifestItem): :param node: AST node associated with the test""" ManifestItem.__init__(self, node) - self.updated_expected = [] - self.new_expected = [] - self.new_disabled = False self.subtests = {} - self.default_status = None self._from_file = True + self.new_disabled = False + self.update_properties = { + "expected": ExpectedUpdate(self), + "max-asserts": MaxAssertsUpdate(self), + "min-asserts": MinAssertsUpdate(self) + } @classmethod def create(cls, test_id): @@ -128,7 +131,7 @@ class TestNode(ManifestItem): :param test_id: The id of the test""" url = test_id - name = url.split("/")[-1] + name = url.rsplit("/", 1)[1] node = DataNode(name) self = cls(node) @@ -168,130 +171,37 @@ class TestNode(ManifestItem): to this run :param result: Status of the test in this run""" - if self.default_status is not None: - assert self.default_status == result.default_expected - else: - self.default_status = result.default_expected + self.update_properties["expected"].set(run_info, result) - # Add this result to the list of results satisfying - # any condition in the list of updated results it matches - for (cond, values) in self.updated_expected: - if cond(run_info): - values.append(Result(run_info, result.status)) - if result.status != cond.value: - self.root.modified = True - break - else: - # We didn't find a previous value for this - self.new_expected.append(Result(run_info, result.status)) - self.root.modified = True + def set_asserts(self, run_info, count): + """Set the assert count of a test - def coalesce_expected(self, stability=None): - """Update the underlying manifest AST for this test based on all the - added results. - - This will update existing conditionals if they got the same result in - all matching runs in the updated results, will delete existing conditionals - that get more than one different result in the updated run, and add new - conditionals for anything that doesn't match an existing conditional. - - Conditionals not matched by any added result are not changed. - - When `stability` is not None, disable any test that shows multiple - unexpected results for the same set of parameters. """ - - try: - unconditional_status = self.get("expected") - except KeyError: - unconditional_status = self.default_status - - for conditional_value, results in self.updated_expected: - if not results: - # The conditional didn't match anything in these runs so leave it alone - pass - elif all(results[0].status == result.status for result in results): - # All the new values for this conditional matched, so update the node - result = results[0] - if (result.status == unconditional_status and - conditional_value.condition_node is not None): - if "expected" in self: - self.remove_value("expected", conditional_value) - else: - conditional_value.value = result.status - elif conditional_value.condition_node is not None: - # Blow away the existing condition and rebuild from scratch - # This isn't sure to work if we have a conditional later that matches - # these values too, but we can hope, verify that we get the results - # we expect, and if not let a human sort it out - self.remove_value("expected", conditional_value) - self.new_expected.extend(results) - elif conditional_value.condition_node is None: - self.new_expected.extend(result for result in results - if result.status != unconditional_status) - - # It is an invariant that nothing in new_expected matches an existing - # condition except for the default condition - - if self.new_expected: - if all(self.new_expected[0].status == result.status - for result in self.new_expected) and not self.updated_expected: - status = self.new_expected[0].status - if status != self.default_status: - self.set("expected", status, condition=None) - else: - try: - conditionals = group_conditionals( - self.new_expected, - property_order=self.root.property_order, - boolean_properties=self.root.boolean_properties) - except ConditionError as e: - if stability is not None: - self.set("disabled", stability or "unstable", e.cond.children[0]) - self.new_disabled = True - else: - print "Conflicting test results for %s, cannot update" % self.root.test_path - return - for conditional_node, status in conditionals: - if status != unconditional_status: - self.set("expected", status, condition=conditional_node.children[0]) - - if ("expected" in self._data and - len(self._data["expected"]) > 0 and - self._data["expected"][-1].condition_node is None and - self._data["expected"][-1].value == self.default_status): - - self.remove_value("expected", self._data["expected"][-1]) - - if ("expected" in self._data and - len(self._data["expected"]) == 0): - for child in self.node.children: - if (isinstance(child, KeyValueNode) and - child.data == "expected"): - child.remove() - break + self.update_properties["min-asserts"].set(run_info, count) + self.update_properties["max-asserts"].set(run_info, count) def _add_key_value(self, node, values): ManifestItem._add_key_value(self, node, values) - if node.data == "expected": - self.updated_expected = [] + if node.data in self.update_properties: + new_updated = [] + self.update_properties[node.data].updated = new_updated for value in values: - self.updated_expected.append((value, [])) + new_updated.append((value, [])) - def clear_expected(self): + def clear(self, key): """Clear all the expected data for this test and all of its subtests""" - self.updated_expected = [] - if "expected" in self._data: + self.updated = [] + if key in self._data: for child in self.node.children: if (isinstance(child, KeyValueNode) and - child.data == "expected"): + child.data == key): child.remove() - del self._data["expected"] + del self._data[key] break for subtest in self.subtests.itervalues(): - subtest.clear_expected() + subtest.clear(key) def append(self, node): child = ManifestItem.append(self, node) @@ -311,6 +221,10 @@ class TestNode(ManifestItem): self.append(subtest) return subtest + def coalesce_properties(self, stability): + for prop_update in self.update_properties.itervalues(): + prop_update.coalesce(stability) + class SubtestNode(TestNode): def __init__(self, node): @@ -330,21 +244,252 @@ class SubtestNode(TestNode): return True +class PropertyUpdate(object): + property_name = None + cls_default_value = None + value_type = None + + def __init__(self, node): + self.node = node + self.updated = [] + self.new = [] + self.default_value = self.cls_default_value + + def set(self, run_info, in_value): + self.check_default(in_value) + value = self.get_value(in_value) + + # Add this result to the list of results satisfying + # any condition in the list of updated results it matches + for (cond, values) in self.updated: + if cond(run_info): + values.append(Value(run_info, value)) + if value != cond.value_as(self.value_type): + self.node.root.modified = True + break + else: + # We didn't find a previous value for this + self.new.append(Value(run_info, value)) + self.node.root.modified = True + + def check_default(self, result): + return + + def get_value(self, in_value): + return in_value + + def coalesce(self, stability=None): + """Update the underlying manifest AST for this test based on all the + added results. + + This will update existing conditionals if they got the same result in + all matching runs in the updated results, will delete existing conditionals + that get more than one different result in the updated run, and add new + conditionals for anything that doesn't match an existing conditional. + + Conditionals not matched by any added result are not changed. + + When `stability` is not None, disable any test that shows multiple + unexpected results for the same set of parameters. + """ + + try: + unconditional_value = self.node.get(self.property_name) + if self.value_type: + unconditional_value = self.value_type(unconditional_value) + except KeyError: + unconditional_value = self.default_value + + for conditional_value, results in self.updated: + if not results: + # The conditional didn't match anything in these runs so leave it alone + pass + elif all(results[0].value == result.value for result in results): + # All the new values for this conditional matched, so update the node + result = results[0] + if (result.value == unconditional_value and + conditional_value.condition_node is not None): + if self.property_name in self.node: + self.node.remove_value(self.property_name, conditional_value) + else: + conditional_value.value = self.update_value(conditional_value.value_as(self.value_type), + result.value) + elif conditional_value.condition_node is not None: + # Blow away the existing condition and rebuild from scratch + # This isn't sure to work if we have a conditional later that matches + # these values too, but we can hope, verify that we get the results + # we expect, and if not let a human sort it out + self.node.remove_value(self.property_name, conditional_value) + self.new.extend(results) + elif conditional_value.condition_node is None: + self.new.extend(result for result in results + if result.value != unconditional_value) + + # It is an invariant that nothing in new matches an existing + # condition except for the default condition + if self.new: + update_default, new_default_value = self.update_default() + if update_default: + if new_default_value != self.default_value: + self.node.set(self.property_name, self.update_value(None, new_default_value), condition=None) + else: + self.add_new(unconditional_value, stability) + + # Remove cases where the value matches the default + if (self.property_name in self.node._data and + len(self.node._data[self.property_name]) > 0 and + self.node._data[self.property_name][-1].condition_node is None and + self.node._data[self.property_name][-1].value_as(self.value_type) == self.default_value): + + self.node.remove_value(self.property_name, self.node._data[self.property_name][-1]) + + # Remove empty properties + if (self.property_name in self.node._data and len(self.node._data[self.property_name]) == 0): + for child in self.node.children: + if (isinstance(child, KeyValueNode) and child.data == self.property_name): + child.remove() + break + + def update_default(self): + """Get the updated default value for the property (i.e. the one chosen when no conditions match). + + :returns: (update, new_default_value) where updated is a bool indicating whether the property + should be updated, and new_default_value is the value to set if it should.""" + raise NotImplementedError + + def add_new(self, unconditional_value, stability=False): + """Add new conditional values for the property. + + Subclasses need not implement this if they only ever update the default value.""" + raise NotImplementedError + + def update_value(self, old_value, new_value): + """Get a value to set on the property, given its previous value and the new value from logs. + + By default this just returns the new value, but overriding is useful in cases + where we want the new value to be some function of both old and new e.g. max(old_value, new_value)""" + return new_value + + +class ExpectedUpdate(PropertyUpdate): + property_name = "expected" + + def check_default(self, result): + if self.default_value is not None: + assert self.default_value == result.default_expected + else: + self.default_value = result.default_expected + + def get_value(self, in_value): + return in_value.status + + def update_default(self): + update_default = all(self.new[0].value == result.value + for result in self.new) and not self.updated + new_value = self.new[0].value + return update_default, new_value + + def add_new(self, unconditional_value, stability=False): + try: + conditionals = group_conditionals( + self.new, + property_order=self.node.root.property_order, + boolean_properties=self.node.root.boolean_properties) + except ConditionError as e: + if stability is not None: + self.node.set("disabled", stability or "unstable", e.cond.children[0]) + self.node.new_disabled = True + else: + print "Conflicting metadata values for %s, cannot update" % self.root.test_path + return + for conditional_node, value in conditionals: + if value != unconditional_value: + self.node.set(self.property_name, value, condition=conditional_node.children[0]) + + +class MaxAssertsUpdate(PropertyUpdate): + property_name = "max-asserts" + cls_default_value = 0 + value_type = int + + def update_value(self, old_value, new_value): + if old_value is not None: + old_value = self.value_type(old_value) + if old_value and old_value < new_value: + return new_value + if old_value is None: + return new_value + return old_value + + def update_default(self): + """For asserts we always update the default value and never add new conditionals. + The value we set as the default is the maximum the current default or one more than the + number of asserts we saw in any configuration.""" + # Current values + values = [] + current_default = None + if self.property_name in self.node._data: + current_default = [item for item in + self.node._data[self.property_name] + if item.condition_node is None] + if current_default: + values.append(int(current_default[0].value)) + values.extend(item.value + 1 for item in self.new) + values.extend(item.value + 1 for item in + itertools.chain.from_iterable(results for _, results in self.updated)) + new_value = max(values) + return True, new_value + + +class MinAssertsUpdate(PropertyUpdate): + property_name = "min-asserts" + cls_default_value = 0 + value_type = int + + def update_value(self, old_value, new_value): + if old_value is not None: + old_value = self.value_type(old_value) + if old_value and new_value < old_value: + return 0 + if old_value is None: + # If we are getting some asserts for the first time, set the minimum to 0 + return 0 + return old_value + + def update_default(self): + """For asserts we always update the default value and never add new conditionals. + This is either set to the current value or one less than the number of asserts + we saw, whichever is lower.""" + values = [] + current_default = None + if self.property_name in self.node._data: + current_default = [item for item in + self.node._data[self.property_name] + if item.condition_node is None] + if current_default: + values.append(current_default[0].value_as(self.value_type)) + values.extend(max(0, item.value - 1) for item in self.new) + values.extend(max(0, item.value - 1) for item in + itertools.chain.from_iterable(results for _, results in self.updated)) + new_value = min(values) + return True, new_value + + def group_conditionals(values, property_order=None, boolean_properties=None): - """Given a list of Result objects, return a list of + """Given a list of Value objects, return a list of (conditional_node, status) pairs representing the conditional expressions that are required to match each status - :param values: List of Results + :param values: List of Values :param property_order: List of properties to use in expectation metadata from most to least significant. :param boolean_properties: Set of properties in property_order that should be treated as boolean.""" by_property = defaultdict(set) - for run_info, status in values: + for run_info, value in values: for prop_name, prop_value in run_info.iteritems(): - by_property[(prop_name, prop_value)].add(status) + by_property[(prop_name, prop_value)].add(value) if property_order is None: property_order = ["debug", "os", "version", "processor", "bits"] @@ -372,21 +517,21 @@ def group_conditionals(values, property_order=None, boolean_properties=None): conditions = {} - for run_info, status in values: + for run_info, value in values: prop_set = tuple((prop, run_info[prop]) for prop in include_props) if prop_set in conditions: - if conditions[prop_set][1] != status: + if conditions[prop_set][1] != value: # A prop_set contains contradictory results - raise ConditionError(make_expr(prop_set, status, boolean_properties)) + raise ConditionError(make_expr(prop_set, value, boolean_properties)) continue - expr = make_expr(prop_set, status, boolean_properties=boolean_properties) - conditions[prop_set] = (expr, status) + expr = make_expr(prop_set, value, boolean_properties=boolean_properties) + conditions[prop_set] = (expr, value) return conditions.values() -def make_expr(prop_set, status, boolean_properties=None): +def make_expr(prop_set, rhs, boolean_properties=None): """Create an AST that returns the value ``status`` given all the properties in prop_set match. @@ -434,7 +579,11 @@ def make_expr(prop_set, status, boolean_properties=None): node = expressions[0] root.append(node) - root.append(StringNode(status)) + if type(rhs) in number_types: + rhs_node = NumberNode(rhs) + else: + rhs_node = StringNode(rhs) + root.append(rhs_node) return root diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/metadata.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/metadata.py index 2527df875b5..4ebb2242d77 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/metadata.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/metadata.py @@ -17,6 +17,13 @@ manifestitem = None logger = structuredlog.StructuredLogger("web-platform-tests") +try: + import ujson +except ImportError: + pass +else: + reader.json = ujson + def load_test_manifests(serve_root, test_paths): do_delayed_imports(serve_root) @@ -162,11 +169,12 @@ def update_from_logs(manifests, *log_filenames, **kwargs): for tree in manifest_expected.itervalues(): for test in tree.iterchildren(): for subtest in test.iterchildren(): - subtest.coalesce_expected(stability=stability) - test.coalesce_expected(stability=stability) + subtest.coalesce_properties(stability=stability) + test.coalesce_properties(stability=stability) return expected_map + def directory_manifests(metadata_path): rv = [] for dirpath, dirname, filenames in os.walk(metadata_path): @@ -175,6 +183,7 @@ def directory_manifests(metadata_path): rv.append(os.path.join(rel_path, "__dir__.ini")) return rv + def write_changes(metadata_path, expected_map): # First write the new manifest files to a temporary directory temp_path = tempfile.mkdtemp(dir=os.path.split(metadata_path)[0]) @@ -228,11 +237,18 @@ class ExpectedUpdater(object): self.action_map = {"suite_start": self.suite_start, "test_start": self.test_start, "test_status": self.test_status, - "test_end": self.test_end} + "test_end": self.test_end, + "assertion_count": self.assertion_count} self.tests_visited = {} self.test_cache = {} + self.types_by_path = {} + for manifest in self.test_manifests.iterkeys(): + for test_type, path, _ in manifest: + if test_type in wpttest.manifest_test_cls: + self.types_by_path[path] = wpttest.manifest_test_cls[test_type] + def update_from_log(self, log_file): self.run_info = None log_reader = reader.read(log_file) @@ -241,14 +257,6 @@ class ExpectedUpdater(object): def suite_start(self, data): self.run_info = data["run_info"] - def test_type(self, path): - for manifest in self.test_manifests.iterkeys(): - tests = list(manifest.iterpath(path)) - if len(tests): - assert all(test.item_type == tests[0].item_type for test in tests) - return tests[0].item_type - assert False - def test_start(self, data): test_id = data["test"] try: @@ -261,23 +269,24 @@ class ExpectedUpdater(object): if test_id not in self.tests_visited: if self.ignore_existing: - expected_node.clear_expected() + expected_node.clear("expected") self.tests_visited[test_id] = set() def test_status(self, data): - test = self.test_cache.get(data["test"]) + test_id = data["test"] + test = self.test_cache.get(test_id) if test is None: return - test_cls = wpttest.manifest_test_cls[self.test_type(test.root.test_path)] + test_cls = self.types_by_path[test.root.test_path] subtest = test.get_subtest(data["subtest"]) - self.tests_visited[test.id].add(data["subtest"]) + self.tests_visited[test_id].add(data["subtest"]) result = test_cls.subtest_result_cls( data["subtest"], data["status"], - data.get("message")) + None) subtest.set_result(self.run_info, result) @@ -286,17 +295,25 @@ class ExpectedUpdater(object): test = self.test_cache.get(test_id) if test is None: return - test_cls = wpttest.manifest_test_cls[self.test_type(test.root.test_path)] + test_cls = self.types_by_path[test.root.test_path] if data["status"] == "SKIP": return result = test_cls.result_cls( data["status"], - data.get("message")) + None) test.set_result(self.run_info, result) del self.test_cache[test_id] + def assertion_count(self, data): + test_id = data["test"] + test = self.test_cache.get(test_id) + if test is None: + return + + test.set_asserts(self.run_info, data["count"]) + def create_test_tree(metadata_path, test_manifest, property_order=None, boolean_properties=None): diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/testrunner.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/testrunner.py index 73a106b3889..ab3c9db86b0 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/testrunner.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/testrunner.py @@ -582,11 +582,20 @@ class TestRunnerManager(threading.Thread): if status == "CRASH": self.browser.log_crash(test.id) + if "assertion_count" in file_result.extra: + assertion_count = file_result.extra.pop("assertion_count") + if assertion_count > 0: + self.logger.assertion_count(test.id, + int(assertion_count), + test.min_assertion_count, + test.max_assertion_count) + self.logger.test_end(test.id, status, message=file_result.message, expected=expected, - extra=file_result.extra) + extra=file_result.extra, + stack=file_result.stack) restart_before_next = (test.restart_after or file_result.status in ("CRASH", "EXTERNAL-TIMEOUT", "INTERNAL-ERROR") or diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/test_chunker.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/test_chunker.py index b70d54663ac..bd649d69e39 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/test_chunker.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/test_chunker.py @@ -3,28 +3,37 @@ import sys from os.path import join, dirname from mozlog import structured -sys.path.insert(0, join(dirname(__file__), "..", "..")) +sys.path.insert(0, join(dirname(__file__), "..", "..", "..")) from wptrunner.testloader import EqualTimeChunker +from manifest.sourcefile import SourceFile structured.set_default_logger(structured.structuredlog.StructuredLogger("TestChunker")) + +testharness_test = """ +""" + + class MockTest(object): default_timeout = 10 - def __init__(self, id, timeout=10): + def __init__(self, id, path, timeout=10, contents=testharness_test): self.id = id + self.url = "/" + path self.item_type = "testharness" self.timeout = timeout + self.source_file = SourceFile("/", path, "/", contents=contents) def make_mock_manifest(*items): rv = [] for test_type, dir_path, num_tests in items: for i in range(num_tests): + filename = "/%i.html" % i rv.append((test_type, - dir_path + "/%i.test" % i, - set([MockTest(i)]))) + dir_path + filename, + set([MockTest("%i.html" % i, dir_path + filename)]))) return rv diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/test_wpttest.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/test_wpttest.py new file mode 100644 index 00000000000..ff7c260f9d4 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/test_wpttest.py @@ -0,0 +1,50 @@ +import os +import sys +from io import BytesIO + +sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) + +from wptrunner import manifestexpected, wpttest +from .test_chunker import make_mock_manifest + +dir_ini_0 = """\ +prefs: [a:b] +""" + +dir_ini_1 = """\ +prefs: [@Reset, b:c] +max-asserts: 2 +min-asserts: 1 +tags: [b, c] +""" + +test_0 = """\ +[0.html] + prefs: [c:d] + max-asserts: 3 + tags: [a, @Reset] +""" + + +def test_metadata_inherit(): + tests = make_mock_manifest(("test", "a", 10), ("test", "a/b", 10), + ("test", "c", 10)) + + inherit_metadata = [ + manifestexpected.static.compile( + BytesIO(item), + {}, + data_cls_getter=lambda x,y: manifestexpected.DirectoryManifest) + for item in [dir_ini_0, dir_ini_1]] + test_metadata = manifestexpected.static.compile(BytesIO(test_0), + {}, + data_cls_getter=manifestexpected.data_cls_getter, + test_path="a", + url_base="") + + test = tests[0][2].pop() + test_obj = wpttest.from_manifest(test, inherit_metadata, test_metadata.get_test(test.id)) + assert test_obj.max_assertion_count == 3 + assert test_obj.min_assertion_count == 1 + assert test_obj.prefs == {"b": "c", "c": "d"} + assert test_obj.tags == {"a", "dir:a"} diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/backends/conditional.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/backends/conditional.py index 629d01d7158..11cdfe472c3 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/backends/conditional.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/backends/conditional.py @@ -32,8 +32,20 @@ class ConditionalValue(object): return self.condition_func(run_info) def set_value(self, value): + if type(value) not in (str, unicode): + value = unicode(value) self.value = value + def value_as(self, type_func): + """Get value and convert to a given type. + + This is unfortunate, but we don't currently have a good way to specify that + specific properties should have their data returned as specific types""" + value = self.value + if type_func is not None: + value = type_func(value) + return value + def remove(self): if len(self.node.parent.children) == 1: self.node.parent.remove() @@ -255,7 +267,7 @@ class ManifestItem(object): node = KeyValueNode(key) self.node.append(node) - value_node = ValueNode(value) + value_node = ValueNode(unicode(value)) if condition is not None: conditional_node = ConditionalNode() conditional_node.append(condition) diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/serializer.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/serializer.py index 3be2a6d94d6..7439eff47ef 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/serializer.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/serializer.py @@ -70,15 +70,19 @@ class ManifestSerializer(NodeVisitor): return ["".join(rv)] def visit_ValueNode(self, node): - if "#" in node.data or (isinstance(node.parent, ListNode) and - ("," in node.data or "]" in node.data)): - if "\"" in node.data: + if not isinstance(node.data, (str, unicode)): + data = unicode(node.data) + else: + data = node.data + if "#" in data or (isinstance(node.parent, ListNode) and + ("," in data or "]" in data)): + if "\"" in data: quote = "'" else: quote = "\"" else: quote = "" - return [quote + escape(node.data, extras=quote) + quote] + return [quote + escape(data, extras=quote) + quote] def visit_AtomNode(self, node): return [atom_names[node.data]] diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wpttest.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wpttest.py index 7c76e2e03b6..de681af11fb 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wpttest.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wpttest.py @@ -9,13 +9,14 @@ enabled_tests = set(["testharness", "reftest", "wdspec"]) class Result(object): - def __init__(self, status, message, expected=None, extra=None): + def __init__(self, status, message, expected=None, extra=None, stack=None): if status not in self.statuses: raise ValueError("Unrecognised status %s" % status) self.status = status self.message = message self.expected = expected - self.extra = extra + self.extra = extra if extra is not None else {} + self.stack = stack def __repr__(self): return "<%s.%s %s>" % (self.__module__, self.__class__.__name__, self.status) @@ -165,15 +166,14 @@ class Test(object): return self._test_metadata def itermeta(self, subtest=None): - for metadata in self._inherit_metadata: - yield metadata - if self._test_metadata is not None: - yield self._get_metadata() if subtest is not None: subtest_meta = self._get_metadata(subtest) if subtest_meta is not None: yield subtest_meta + yield self._get_metadata() + for metadata in reversed(self._inherit_metadata): + yield metadata def disabled(self, subtest=None): for meta in self.itermeta(subtest): @@ -198,16 +198,31 @@ class Test(object): return leaks return False + @property + def min_assertion_count(self): + for meta in self.itermeta(None): + count = meta.min_assertion_count + if count is not None: + return count + return 0 + + @property + def max_assertion_count(self): + for meta in self.itermeta(None): + count = meta.max_assertion_count + if count is not None: + return count + return 0 + @property def tags(self): tags = set() for meta in self.itermeta(): meta_tags = meta.tags + tags |= meta_tags if atom_reset in meta_tags: - tags = meta_tags.copy() tags.remove(atom_reset) - else: - tags |= meta_tags + break tags.add("dir:%s" % self.id.lstrip("/").split("/")[0]) @@ -218,11 +233,10 @@ class Test(object): prefs = {} for meta in self.itermeta(): meta_prefs = meta.prefs - if atom_reset in prefs: - prefs = meta_prefs.copy() + prefs.update(meta_prefs) + if atom_reset in meta_prefs: del prefs[atom_reset] - else: - prefs.update(meta_prefs) + break return prefs def expected(self, subtest=None): @@ -251,12 +265,13 @@ class TestharnessTest(Test): def __init__(self, tests_root, url, inherit_metadata, test_metadata, timeout=None, path=None, protocol="http", testdriver=False, - jsshell=False): + jsshell=False, scripts=None): Test.__init__(self, tests_root, url, inherit_metadata, test_metadata, timeout, path, protocol) self.testdriver = testdriver self.jsshell = jsshell + self.scripts = scripts or [] @classmethod def from_manifest(cls, manifest_item, inherit_metadata, test_metadata): @@ -264,6 +279,8 @@ class TestharnessTest(Test): protocol = "https" if hasattr(manifest_item, "https") and manifest_item.https else "http" testdriver = manifest_item.testdriver if hasattr(manifest_item, "testdriver") else False jsshell = manifest_item.jsshell if hasattr(manifest_item, "jsshell") else False + script_metadata = manifest_item.source_file.script_metadata or [] + scripts = [v for (k, v) in script_metadata if k == b"script"] return cls(manifest_item.source_file.tests_root, manifest_item.url, inherit_metadata, @@ -272,7 +289,8 @@ class TestharnessTest(Test): path=manifest_item.source_file.path, protocol=protocol, testdriver=testdriver, - jsshell=jsshell) + jsshell=jsshell, + scripts=scripts) @property def id(self): diff --git a/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/base.py b/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/base.py index 9b0cb50179f..0c240689cee 100644 --- a/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/base.py +++ b/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/base.py @@ -9,6 +9,7 @@ import unittest from six.moves.urllib.parse import urlencode, urlunsplit from six.moves.urllib.request import Request as BaseRequest from six.moves.urllib.request import urlopen +from six import iteritems wptserve = pytest.importorskip("wptserve") @@ -29,7 +30,7 @@ class Request(BaseRequest): return self.method def add_data(self, data): - if hasattr(data, "iteritems"): + if hasattr(data, "items"): data = urlencode(data) print(data) self.add_header("Content-Length", str(len(data))) @@ -57,7 +58,7 @@ class TestUsingServer(unittest.TestCase): if headers is None: headers = {} - for name, value in headers.iteritems(): + for name, value in iteritems(headers): req.add_header(name, value) if body is not None: diff --git a/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_cookies.py b/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_cookies.py index 305d0ac45e9..6bcb842e625 100644 --- a/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_cookies.py +++ b/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_cookies.py @@ -8,7 +8,6 @@ from .base import TestUsingServer class TestResponseSetCookie(TestUsingServer): - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_name_value(self): @wptserve.handlers.handler def handler(request, response): @@ -21,7 +20,6 @@ class TestResponseSetCookie(TestUsingServer): self.assertEqual(resp.info()["Set-Cookie"], "name=value; Path=/") - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_unset(self): @wptserve.handlers.handler def handler(request, response): @@ -35,7 +33,6 @@ class TestResponseSetCookie(TestUsingServer): self.assertTrue("Set-Cookie" not in resp.info()) - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_delete(self): @wptserve.handlers.handler def handler(request, response): diff --git a/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_handlers.py b/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_handlers.py index cf40cd1522d..ef9751a9921 100644 --- a/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_handlers.py +++ b/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_handlers.py @@ -12,7 +12,6 @@ from .base import TestUsingServer, doc_root class TestFileHandler(TestUsingServer): - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_GET(self): resp = self.request("/document.txt") self.assertEqual(200, resp.getcode()) @@ -31,7 +30,6 @@ class TestFileHandler(TestUsingServer): self.assertEqual(resp.info()["Double-Header"], "PA, SS") - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_range(self): resp = self.request("/document.txt", headers={"Range":"bytes=10-19"}) self.assertEqual(206, resp.getcode()) @@ -42,7 +40,6 @@ class TestFileHandler(TestUsingServer): self.assertEqual("10", resp.info()['Content-Length']) self.assertEqual(expected[10:20], data) - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_range_no_end(self): resp = self.request("/document.txt", headers={"Range":"bytes=10-"}) self.assertEqual(206, resp.getcode()) @@ -52,7 +49,6 @@ class TestFileHandler(TestUsingServer): self.assertEqual("bytes 10-%i/%i" % (len(expected) - 1, len(expected)), resp.info()['Content-Range']) self.assertEqual(expected[10:], data) - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_range_no_start(self): resp = self.request("/document.txt", headers={"Range":"bytes=-10"}) self.assertEqual(206, resp.getcode()) @@ -82,7 +78,6 @@ class TestFileHandler(TestUsingServer): self.assertEqual(headers["Content-Range"], "bytes %s/%i" % (expected_part[0], len(expected))) self.assertEqual(expected_part[1] + "\r\n", body) - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_range_invalid(self): with self.assertRaises(HTTPError) as cm: self.request("/document.txt", headers={"Range":"bytes=11-10"}) @@ -126,7 +121,6 @@ class TestFunctionHandler(TestUsingServer): self.assertEqual("9", resp.info()["Content-Length"]) self.assertEqual("test data", resp.read()) - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_tuple_1_rv(self): @wptserve.handlers.handler def handler(request, response): @@ -181,7 +175,6 @@ class TestFunctionHandler(TestUsingServer): self.assertEqual("test-value", resp.info()["test-header"]) self.assertEqual("test data", resp.read()) - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_tuple_4_rv(self): @wptserve.handlers.handler def handler(request, response): @@ -195,7 +188,6 @@ class TestFunctionHandler(TestUsingServer): assert cm.value.code == 500 - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_none_rv(self): @wptserve.handlers.handler def handler(request, response): @@ -210,7 +202,6 @@ class TestFunctionHandler(TestUsingServer): class TestJSONHandler(TestUsingServer): - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_json_0(self): @wptserve.handlers.json_handler def handler(request, response): @@ -222,7 +213,6 @@ class TestJSONHandler(TestUsingServer): self.assertEqual(200, resp.getcode()) self.assertEqual({"data": "test data"}, json.load(resp)) - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_json_tuple_2(self): @wptserve.handlers.json_handler def handler(request, response): @@ -235,7 +225,6 @@ class TestJSONHandler(TestUsingServer): self.assertEqual("test-value", resp.info()["test-header"]) self.assertEqual({"data": "test data"}, json.load(resp)) - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_json_tuple_3(self): @wptserve.handlers.json_handler def handler(request, response): @@ -258,22 +247,20 @@ class TestPythonHandler(TestUsingServer): self.assertEqual("text/plain", resp.info()["Content-Type"]) self.assertEqual("PASS", resp.read()) - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_tuple_2(self): resp = self.request("/test_tuple_2.py") self.assertEqual(200, resp.getcode()) self.assertEqual("text/html", resp.info()["Content-Type"]) self.assertEqual("PASS", resp.info()["X-Test"]) - self.assertEqual("PASS", resp.read()) + self.assertEqual(b"PASS", resp.read()) - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_tuple_3(self): resp = self.request("/test_tuple_3.py") self.assertEqual(202, resp.getcode()) self.assertEqual("Giraffe", resp.msg) self.assertEqual("text/html", resp.info()["Content-Type"]) self.assertEqual("PASS", resp.info()["X-Test"]) - self.assertEqual("PASS", resp.read()) + self.assertEqual(b"PASS", resp.read()) @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_import(self): @@ -287,21 +274,18 @@ class TestPythonHandler(TestUsingServer): self.assertEqual("text/plain", resp.info()["Content-Type"]) self.assertEqual("PASS", resp.read()) - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_no_main(self): with pytest.raises(HTTPError) as cm: self.request("/no_main.py") assert cm.value.code == 500 - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_invalid(self): with pytest.raises(HTTPError) as cm: self.request("/invalid.py") assert cm.value.code == 500 - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_missing(self): with pytest.raises(HTTPError) as cm: self.request("/missing.py") @@ -310,20 +294,17 @@ class TestPythonHandler(TestUsingServer): class TestDirectoryHandler(TestUsingServer): - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_directory(self): resp = self.request("/") self.assertEqual(200, resp.getcode()) self.assertEqual("text/html", resp.info()["Content-Type"]) #Add a check that the response is actually sane - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_subdirectory_trailing_slash(self): resp = self.request("/subdir/") assert resp.getcode() == 200 assert resp.info()["Content-Type"] == "text/html" - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_subdirectory_no_trailing_slash(self): # This seems to resolve the 301 transparently, so test for 200 resp = self.request("/subdir") diff --git a/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_input_file.py b/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_input_file.py index e2d8761ed7a..014386e172f 100644 --- a/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_input_file.py +++ b/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_input_file.py @@ -1,5 +1,3 @@ -import sys - from wptserve.request import InputFile from io import BytesIO import pytest @@ -23,7 +21,6 @@ def teardown_function(function): test_file.close() -@pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_seek(): input_file.seek(2) test_file.seek(2) @@ -34,7 +31,6 @@ def test_seek(): assert input_file.read(1) == test_file.read(1) -@pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_seek_backwards(): input_file.seek(2) test_file.seek(2) @@ -52,7 +48,6 @@ def test_seek_negative_offset(): input_file.seek(-1) -@pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_seek_file_bigger_than_buffer(): old_max_buf = InputFile.max_buffer_size InputFile.max_buffer_size = 10 @@ -71,12 +66,10 @@ def test_seek_file_bigger_than_buffer(): InputFile.max_buffer_size = old_max_buf -@pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_read(): assert input_file.read() == test_file.read() -@pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_read_file_bigger_than_buffer(): old_max_buf = InputFile.max_buffer_size InputFile.max_buffer_size = 10 @@ -88,7 +81,6 @@ def test_read_file_bigger_than_buffer(): InputFile.max_buffer_size = old_max_buf -@pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_readline(): assert input_file.readline() == test_file.readline() assert input_file.readline() == test_file.readline() @@ -98,20 +90,17 @@ def test_readline(): assert input_file.readline() == test_file.readline() -@pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_readline_max_byte(): line = test_file.readline() - assert input_file.readline(max_bytes=len(line)/2) == line[:len(line)/2] - assert input_file.readline(max_bytes=len(line)) == line[len(line)/2:] + assert input_file.readline(max_bytes=len(line)//2) == line[:len(line)//2] + assert input_file.readline(max_bytes=len(line)) == line[len(line)//2:] -@pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_readline_max_byte_longer_than_file(): assert input_file.readline(max_bytes=1000) == test_file.readline() assert input_file.readline(max_bytes=1000) == test_file.readline() -@pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_readline_file_bigger_than_buffer(): old_max_buf = InputFile.max_buffer_size InputFile.max_buffer_size = 10 @@ -125,12 +114,10 @@ def test_readline_file_bigger_than_buffer(): InputFile.max_buffer_size = old_max_buf -@pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_readlines(): assert input_file.readlines() == test_file.readlines() -@pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_readlines_file_bigger_than_buffer(): old_max_buf = InputFile.max_buffer_size InputFile.max_buffer_size = 10 @@ -143,13 +130,11 @@ def test_readlines_file_bigger_than_buffer(): InputFile.max_buffer_size = old_max_buf -@pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_iter(): for a, b in zip(input_file, test_file): assert a == b -@pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_iter_file_bigger_than_buffer(): old_max_buf = InputFile.max_buffer_size InputFile.max_buffer_size = 10 diff --git a/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_pipes.py b/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_pipes.py index 571e170a5cd..ebdbc3ee57d 100644 --- a/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_pipes.py +++ b/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_pipes.py @@ -13,29 +13,24 @@ from .base import TestUsingServer, doc_root class TestStatus(TestUsingServer): - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_status(self): resp = self.request("/document.txt", query="pipe=status(202)") self.assertEqual(resp.getcode(), 202) class TestHeader(TestUsingServer): - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_not_set(self): resp = self.request("/document.txt", query="pipe=header(X-TEST,PASS)") self.assertEqual(resp.info()["X-TEST"], "PASS") - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_set(self): resp = self.request("/document.txt", query="pipe=header(Content-Type,text/html)") self.assertEqual(resp.info()["Content-Type"], "text/html") - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_multiple(self): resp = self.request("/document.txt", query="pipe=header(X-Test,PASS)|header(Content-Type,text/html)") self.assertEqual(resp.info()["X-TEST"], "PASS") self.assertEqual(resp.info()["Content-Type"], "text/html") - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_multiple_same(self): resp = self.request("/document.txt", query="pipe=header(Content-Type,FAIL)|header(Content-Type,text/html)") self.assertEqual(resp.info()["Content-Type"], "text/html") @@ -46,19 +41,16 @@ class TestHeader(TestUsingServer): self.assertEqual(resp.info()["X-Test"], "1, 2") class TestSlice(TestUsingServer): - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_both_bounds(self): resp = self.request("/document.txt", query="pipe=slice(1,10)") expected = open(os.path.join(doc_root, "document.txt"), 'rb').read() self.assertEqual(resp.read(), expected[1:10]) - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_no_upper(self): resp = self.request("/document.txt", query="pipe=slice(1)") expected = open(os.path.join(doc_root, "document.txt"), 'rb').read() self.assertEqual(resp.read(), expected[1:]) - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_no_lower(self): resp = self.request("/document.txt", query="pipe=slice(null,10)") expected = open(os.path.join(doc_root, "document.txt"), 'rb').read() @@ -84,7 +76,6 @@ sha512: r8eLGRTc7ZznZkFjeVLyo6/FyQdra9qmlYCwKKxm3kfQAswRS9+3HsYk3thLUhcFmmWhK4dX JwGFonfXwg==""" self.assertEqual(resp.read().rstrip(), expected.strip()) - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_sub_file_hash_unrecognized(self): with self.assertRaises(urllib.error.HTTPError): self.request("/sub_file_hash_unrecognized.sub.txt") @@ -133,7 +124,6 @@ server: http://localhost:{0}""".format(self.server.port) self.assertEqual(resp.read().rstrip(), expected) class TestTrickle(TestUsingServer): - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_trickle(self): #Actually testing that the response trickles in is not that easy t0 = time.time() @@ -143,7 +133,6 @@ class TestTrickle(TestUsingServer): self.assertEqual(resp.read(), expected) self.assertGreater(6, t1-t0) - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_headers(self): resp = self.request("/document.txt", query="pipe=trickle(d0.01)") self.assertEqual(resp.info()["Cache-Control"], "no-cache, no-store, must-revalidate") diff --git a/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_server.py b/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_server.py index 3b8cc1ce4cd..511c86f32c5 100644 --- a/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_server.py +++ b/tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_server.py @@ -1,4 +1,3 @@ -import sys import unittest import pytest @@ -9,7 +8,6 @@ from .base import TestUsingServer class TestFileHandler(TestUsingServer): - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_not_handled(self): with self.assertRaises(HTTPError) as cm: self.request("/not_existing") @@ -17,7 +15,6 @@ class TestFileHandler(TestUsingServer): self.assertEqual(cm.exception.code, 404) class TestRewriter(TestUsingServer): - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_rewrite(self): @wptserve.handlers.handler def handler(request, response): @@ -28,10 +25,9 @@ class TestRewriter(TestUsingServer): self.server.router.register(*route) resp = self.request("/test/original") self.assertEqual(200, resp.getcode()) - self.assertEqual("/test/rewritten", resp.read()) + self.assertEqual(b"/test/rewritten", resp.read()) class TestRequestHandler(TestUsingServer): - @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2") def test_exception(self): @wptserve.handlers.handler def handler(request, response): diff --git a/tests/wpt/web-platform-tests/tools/wptserve/tests/test_replacement_tokenizer.py b/tests/wpt/web-platform-tests/tools/wptserve/tests/test_replacement_tokenizer.py index 75f504ea33a..8d0f25058d4 100644 --- a/tests/wpt/web-platform-tests/tools/wptserve/tests/test_replacement_tokenizer.py +++ b/tests/wpt/web-platform-tests/tools/wptserve/tests/test_replacement_tokenizer.py @@ -1,4 +1,4 @@ -import sys +from __future__ import unicode_literals import pytest @@ -7,33 +7,18 @@ from wptserve.pipes import ReplacementTokenizer @pytest.mark.parametrize( "content,expected", [ - ["aaa", [('ident', 'aaa')]], - ["bbb()", [('ident', 'bbb'), ('arguments', [])]], - ["$ccc:ddd", [('var', '$ccc'), ('ident', 'ddd')]], - ["$eee", [('ident', '$eee')]], - ["fff[0]", [('ident', 'fff'), ('index', 0)]], - pytest.param( - "ggg[hhh]", [('ident', 'ggg'), ('index', u'hhh')], - marks=pytest.mark.xfail(sys.version_info >= (3,), - reason="wptserve only works on Py2") - ), - pytest.param( - "[iii]", [('index', u'iii')], - marks=pytest.mark.xfail(sys.version_info >= (3,), - reason="wptserve only works on Py2") - ), - pytest.param( - "jjj['kkk']", [('ident', 'jjj'), ('index', u"'kkk'")], - marks=pytest.mark.xfail(sys.version_info >= (3,), - reason="wptserve only works on Py2") - ), - pytest.param( - "lll[]", [('ident', 'lll'), ('index', u"")], - marks=pytest.mark.xfail(sys.version_info >= (3,), - reason="wptserve only works on Py2") - ), - ["111", [('ident', u'111')]], - ["$111", [('ident', u'$111')]], + [b"aaa", [('ident', 'aaa')]], + [b"bbb()", [('ident', 'bbb'), ('arguments', [])]], + [b"bcd(uvw, xyz)", [('ident', 'bcd'), ('arguments', ['uvw', 'xyz'])]], + [b"$ccc:ddd", [('var', '$ccc'), ('ident', 'ddd')]], + [b"$eee", [('ident', '$eee')]], + [b"fff[0]", [('ident', 'fff'), ('index', 0)]], + [b"ggg[hhh]", [('ident', 'ggg'), ('index', 'hhh')]], + [b"[iii]", [('index', 'iii')]], + [b"jjj['kkk']", [('ident', 'jjj'), ('index', "'kkk'")]], + [b"lll[]", [('ident', 'lll'), ('index', "")]], + [b"111", [('ident', '111')]], + [b"$111", [('ident', '$111')]], ] ) def test_tokenizer(content, expected): @@ -45,8 +30,8 @@ def test_tokenizer(content, expected): @pytest.mark.parametrize( "content,expected", [ - ["/", []], - ["$aaa: BBB", [('var', '$aaa')]], + [b"/", []], + [b"$aaa: BBB", [('var', '$aaa')]], ] ) def test_tokenizer_errors(content, expected): diff --git a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/config.py b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/config.py index 88954a96969..38f19d7256a 100644 --- a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/config.py +++ b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/config.py @@ -155,7 +155,7 @@ class Config(Mapping): try: port = old_ports[scheme][i] except (KeyError, IndexError): - port = get_port(self.server_host) + port = get_port() else: port = port new_ports[scheme].append(port) diff --git a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/handlers.py b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/handlers.py index 4536c06acc6..1435d34a0e1 100644 --- a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/handlers.py +++ b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/handlers.py @@ -5,6 +5,7 @@ import sys import traceback from six.moves.urllib.parse import parse_qs, quote, unquote, urljoin +from six import iteritems from .constants import content_types from .pipes import Pipeline, template @@ -237,7 +238,8 @@ class PythonScriptHandler(object): try: environ = {"__file__": path} sys.path.insert(0, os.path.dirname(path)) - execfile(path, environ, environ) + with open(path, 'rb') as f: + exec(compile(f.read(), path, 'exec'), environ, environ) if "main" in environ: handler = FunctionHandler(environ["main"]) handler(request, response) @@ -375,7 +377,7 @@ class StringHandler(object): self.data = data self.resp_headers = [("Content-Type", content_type)] - for k, v in headers.iteritems(): + for k, v in iteritems(headers): self.resp_headers.append((k.replace("_", "-"), v)) self.handler = handler(self.handle_request) diff --git a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/pipes.py b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/pipes.py index 28743d36476..ad96f591a3a 100644 --- a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/pipes.py +++ b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/pipes.py @@ -5,11 +5,10 @@ import hashlib import os import re import time -import types import uuid from six.moves import StringIO -from six import text_type +from six import text_type, binary_type def resolve_content(response): return b"".join(item for item in response.iter_content(read_file=True)) @@ -281,31 +280,32 @@ def slice(request, response, start, end=None): class ReplacementTokenizer(object): def arguments(self, token): - unwrapped = token[1:-1] - return ("arguments", re.split(r",\s*", token[1:-1]) if unwrapped else []) + unwrapped = token[1:-1].decode('utf8') + return ("arguments", re.split(r",\s*", unwrapped) if unwrapped else []) def ident(self, token): - return ("ident", token) + return ("ident", token.decode('utf8')) def index(self, token): - token = token[1:-1] + token = token[1:-1].decode('utf8') try: - token = int(token) + index = int(token) except ValueError: - token = token.decode('utf8') - return ("index", token) + index = token + return ("index", index) def var(self, token): - token = token[:-1] + token = token[:-1].decode('utf8') return ("var", token) def tokenize(self, string): + assert isinstance(string, binary_type) return self.scanner.scan(string)[0] - scanner = re.Scanner([(r"\$\w+:", var), - (r"\$?\w+", ident), - (r"\[[^\]]*\]", index), - (r"\([^)]*\)", arguments)]) + scanner = re.Scanner([(br"\$\w+:", var), + (br"\$?\w+", ident), + (br"\[[^\]]*\]", index), + (br"\([^)]*\)", arguments)]) class FirstWrapper(object): @@ -392,6 +392,7 @@ class SubFunctions(object): @staticmethod def file_hash(request, algorithm, path): + algorithm = algorithm.decode("ascii") if algorithm not in SubFunctions.supported_algorithms: raise ValueError("Unsupported encryption algorithm: '%s'" % algorithm) @@ -424,6 +425,7 @@ def template(request, content, escape_type="html"): tokens = deque(tokens) token_type, field = tokens.popleft() + field = field.decode("ascii") if token_type == "var": variable = field @@ -478,7 +480,7 @@ def template(request, content, escape_type="html"): "unexpected token type %s (token '%r'), expected ident or arguments" % (ttype, field) ) - assert isinstance(value, (int,) + types.StringTypes), tokens + assert isinstance(value, (int, (binary_type, text_type))), tokens if variable is not None: variables[variable] = value @@ -490,7 +492,7 @@ def template(request, content, escape_type="html"): #TODO: read the encoding of the response return escape_func(text_type(value)).encode("utf-8") - template_regexp = re.compile(r"{{([^}]*)}}") + template_regexp = re.compile(br"{{([^}]*)}}") new_content = template_regexp.sub(config_replacement, content) return new_content diff --git a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/request.py b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/request.py index 07467c6f4dc..44f7926a2b6 100644 --- a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/request.py +++ b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/request.py @@ -1,7 +1,7 @@ import base64 import cgi from six.moves.http_cookies import BaseCookie -from six.moves import StringIO +from six import BytesIO import tempfile from six.moves.urllib.parse import parse_qsl, urlsplit @@ -52,7 +52,7 @@ class InputFile(object): if length > self.max_buffer_size: self._buf = tempfile.TemporaryFile() else: - self._buf = StringIO() + self._buf = BytesIO() @property def _buf_position(self): @@ -68,14 +68,14 @@ class InputFile(object): bytes_remaining = min(bytes, self.length - self._buf_position) if bytes_remaining == 0: - return "" + return b"" if self._buf_position != self._file_position: buf_bytes = min(bytes_remaining, self._file_position - self._buf_position) old_data = self._buf.read(buf_bytes) bytes_remaining -= buf_bytes else: - old_data = "" + old_data = b"" assert bytes_remaining == 0 or self._buf_position == self._file_position, ( "Before reading buffer position (%i) didn't match file position (%i)" % @@ -106,10 +106,10 @@ class InputFile(object): if self._buf_position < self._file_position: data = self._buf.readline(max_bytes) - if data.endswith("\n") or len(data) == max_bytes: + if data.endswith(b"\n") or len(data) == max_bytes: return data else: - data = "" + data = b"" assert self._buf_position == self._file_position @@ -121,7 +121,7 @@ class InputFile(object): readahead = self.read(min(2, max_bytes)) max_bytes -= len(readahead) for i, c in enumerate(readahead): - if c == "\n": + if c == b"\n"[0]: buf.append(readahead[:i+1]) found = True break @@ -129,7 +129,7 @@ class InputFile(object): buf.append(readahead) if not readahead or not max_bytes: break - new_data = "".join(buf) + new_data = b"".join(buf) data += new_data self.seek(initial_position + len(new_data)) return data @@ -144,13 +144,15 @@ class InputFile(object): break return rv - def next(self): + def __next__(self): data = self.readline() if data: return data else: raise StopIteration + next = __next__ + def __iter__(self): return self diff --git a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/response.py b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/response.py index 314d99768b2..07df6d9b6c7 100644 --- a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/response.py +++ b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/response.py @@ -2,14 +2,13 @@ from collections import OrderedDict from datetime import datetime, timedelta from six.moves.http_cookies import BaseCookie, Morsel import json -import types import uuid import socket from .constants import response_codes from .logger import get_logger -from six import string_types, binary_type, text_type +from six import binary_type, text_type, itervalues missing = object() @@ -182,7 +181,7 @@ class Response(object): True, the entire content of the file will be returned as a string facilitating non-streaming operations like template substitution. """ - if isinstance(self.content, types.StringTypes): + if isinstance(self.content, (binary_type, text_type)): yield self.content elif hasattr(self.content, "read"): if read_file: @@ -337,7 +336,7 @@ class ResponseHeaders(object): self.set(key, value) def __iter__(self): - for key, values in self.data.itervalues(): + for key, values in itervalues(self.data): for value in values: yield key, value @@ -402,7 +401,7 @@ class ResponseWriter(object): if name.lower() not in self._headers_seen: self.write_header(name, f()) - if (isinstance(self._response.content, string_types) and + if (isinstance(self._response.content, (binary_type, text_type)) and "content-length" not in self._headers_seen): #Would be nice to avoid double-encoding here self.write_header("Content-Length", len(self.encode(self._response.content))) @@ -426,7 +425,8 @@ class ResponseWriter(object): def write_content(self, data): """Write the body of the response.""" - if isinstance(data, types.StringTypes): + if isinstance(data, (text_type, binary_type)): + # Deliberately allows both text and binary types. See `self.encode`. self.write(data) else: self.write_content_file(data) diff --git a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/router.py b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/router.py index a35e098e62e..5118c03b728 100644 --- a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/router.py +++ b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/router.py @@ -1,8 +1,8 @@ import itertools import re -import types from .logger import get_logger +from six import binary_type, text_type any_method = object() @@ -135,7 +135,7 @@ class Router(object): object and the response object. """ - if type(methods) in types.StringTypes or methods in (any_method, "*"): + if isinstance(methods, (binary_type, text_type)) or methods is any_method: methods = [methods] for method in methods: self.routes.append((method, compile_path_match(path), handler)) diff --git a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/server.py b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/server.py index 2bbbaa970fa..1f60e7ed0d3 100644 --- a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/server.py +++ b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/server.py @@ -8,7 +8,7 @@ import sys import threading import time import traceback -import types +from six import binary_type, text_type from six.moves.urllib.parse import urlsplit, urlunsplit @@ -80,7 +80,7 @@ class RequestRewriter(object): :param output_path: Path to replace the input path with in the request. """ - if type(methods) in types.StringTypes: + if isinstance(methods, (binary_type, text_type)): methods = [methods] self.rules[input_path] = (methods, output_path) @@ -256,8 +256,9 @@ class WebTestRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): except HTTPException as e: response.set_error(e.code, e.message) except Exception as e: - if e.message: - err = [e.message] + message = str(e) + if message: + err = [message] else: err = [] err.append(traceback.format_exc()) diff --git a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/stash.py b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/stash.py index 69fa4418383..ae48a861123 100644 --- a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/stash.py +++ b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/stash.py @@ -4,6 +4,7 @@ import os import uuid import threading from multiprocessing.managers import AcquirerProxy, BaseManager, DictProxy +from six import text_type class ServerDictManager(BaseManager): shared_data = {} @@ -42,14 +43,16 @@ def load_env_config(): address = tuple(address) else: address = str(address) - authkey = base64.decodestring(authkey) + authkey = base64.b64decode(authkey) return address, authkey def store_env_config(address, authkey): - authkey = base64.encodestring(authkey) - os.environ["WPT_STASH_CONFIG"] = json.dumps((address, authkey)) + authkey = base64.b64encode(authkey) + os.environ["WPT_STASH_CONFIG"] = json.dumps((address, authkey.decode("ascii"))) def start_server(address=None, authkey=None): + if isinstance(authkey, text_type): + authkey = authkey.encode("ascii") manager = ServerDictManager(address, authkey) manager.start() diff --git a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/utils.py b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/utils.py index 1a6abc1fe25..98a7a7a8eea 100644 --- a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/utils.py +++ b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/utils.py @@ -98,7 +98,7 @@ def is_bad_port(port): 6697, # irc+tls ] -def get_port(host): +def get_port(host=''): port = 0 while True: free_socket = _open_socket(host, 0) diff --git a/tests/wpt/web-platform-tests/touch-events/META.yml b/tests/wpt/web-platform-tests/touch-events/META.yml index 2b04a527b78..3dcab9a534b 100644 --- a/tests/wpt/web-platform-tests/touch-events/META.yml +++ b/tests/wpt/web-platform-tests/touch-events/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/touch-events/ suggested_reviewers: - jtangelder - zqzhang diff --git a/tests/wpt/web-platform-tests/trusted-types/DOMParser-requiresTrustedTypes.tentative.html b/tests/wpt/web-platform-tests/trusted-types/DOMParser-requiresTrustedTypes.tentative.html new file mode 100644 index 00000000000..7e21feabd24 --- /dev/null +++ b/tests/wpt/web-platform-tests/trusted-types/DOMParser-requiresTrustedTypes.tentative.html @@ -0,0 +1,41 @@ + + + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/DOMParser.tentative.html b/tests/wpt/web-platform-tests/trusted-types/DOMParser.tentative.html new file mode 100644 index 00000000000..53d2b44febd --- /dev/null +++ b/tests/wpt/web-platform-tests/trusted-types/DOMParser.tentative.html @@ -0,0 +1,28 @@ + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/HTMLBaseElement-href.tentative.html b/tests/wpt/web-platform-tests/trusted-types/HTMLBaseElement-href.tentative.html new file mode 100644 index 00000000000..80bed807981 --- /dev/null +++ b/tests/wpt/web-platform-tests/trusted-types/HTMLBaseElement-href.tentative.html @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/HTMLImageElement-src.tentative.html b/tests/wpt/web-platform-tests/trusted-types/HTMLImageElement-src.tentative.html new file mode 100644 index 00000000000..e4c0a3e3041 --- /dev/null +++ b/tests/wpt/web-platform-tests/trusted-types/HTMLImageElement-src.tentative.html @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/HTMLMediaElement-src.tentative.html b/tests/wpt/web-platform-tests/trusted-types/HTMLMediaElement-src.tentative.html new file mode 100644 index 00000000000..ece95eaf8e6 --- /dev/null +++ b/tests/wpt/web-platform-tests/trusted-types/HTMLMediaElement-src.tentative.html @@ -0,0 +1,23 @@ + + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/HTMLSourceElement-src.tentative.html b/tests/wpt/web-platform-tests/trusted-types/HTMLSourceElement-src.tentative.html new file mode 100644 index 00000000000..e32a1fcb47d --- /dev/null +++ b/tests/wpt/web-platform-tests/trusted-types/HTMLSourceElement-src.tentative.html @@ -0,0 +1,22 @@ + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/TrustedHTML.tentative.html b/tests/wpt/web-platform-tests/trusted-types/TrustedHTML.tentative.html index 2a28f1bf02a..a8d4e78b06d 100644 --- a/tests/wpt/web-platform-tests/trusted-types/TrustedHTML.tentative.html +++ b/tests/wpt/web-platform-tests/trusted-types/TrustedHTML.tentative.html @@ -1,7 +1,7 @@ - + - + - + + + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-HTMLImageElement-src.tentative.html b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-HTMLImageElement-src.tentative.html new file mode 100644 index 00000000000..e2c7dcb61ea --- /dev/null +++ b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-HTMLImageElement-src.tentative.html @@ -0,0 +1,33 @@ + + + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-HTMLMediaElement-src.tentative.html b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-HTMLMediaElement-src.tentative.html new file mode 100644 index 00000000000..8e4b03901af --- /dev/null +++ b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-HTMLMediaElement-src.tentative.html @@ -0,0 +1,33 @@ + + + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-HTMLSourceElement-src.tentative.html b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-HTMLSourceElement-src.tentative.html new file mode 100644 index 00000000000..06262ff40a2 --- /dev/null +++ b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-HTMLSourceElement-src.tentative.html @@ -0,0 +1,36 @@ + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-createContextualFragment.tentative.html b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-createContextualFragment.tentative.html new file mode 100644 index 00000000000..1d67a51ff6a --- /dev/null +++ b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-createContextualFragment.tentative.html @@ -0,0 +1,43 @@ + + + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-embed-src.tentative.html b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-embed-src.tentative.html new file mode 100644 index 00000000000..51d553f924c --- /dev/null +++ b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-embed-src.tentative.html @@ -0,0 +1,56 @@ + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-innerHTML.tentative.html b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-innerHTML.tentative.html index 698bf9dc494..67faf6ea7d3 100644 --- a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-innerHTML.tentative.html +++ b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-innerHTML.tentative.html @@ -3,7 +3,7 @@ - + diff --git a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-insertAdjacentHTML.tentative.html b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-insertAdjacentHTML.tentative.html index 5b3bea85c16..70bb803442f 100644 --- a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-insertAdjacentHTML.tentative.html +++ b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-insertAdjacentHTML.tentative.html @@ -3,7 +3,7 @@ - + diff --git a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-location-assign.tentative.html b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-location-assign.tentative.html new file mode 100644 index 00000000000..76725da7c72 --- /dev/null +++ b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-location-assign.tentative.html @@ -0,0 +1,38 @@ + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-location-href.tentative.html b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-location-href.tentative.html index 6581ac29f5d..07cc4d5fe29 100644 --- a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-location-href.tentative.html +++ b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-location-href.tentative.html @@ -3,7 +3,7 @@ - + diff --git a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-location-replace.tentative.html b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-location-replace.tentative.html new file mode 100644 index 00000000000..9736a84b3ad --- /dev/null +++ b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-location-replace.tentative.html @@ -0,0 +1,38 @@ + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-outerHTML.tentative.html b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-outerHTML.tentative.html index 0e420e5b78c..8cf6c4b065a 100644 --- a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-outerHTML.tentative.html +++ b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-outerHTML.tentative.html @@ -3,7 +3,7 @@ - + diff --git a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-script-src.tentative.html b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-script-src.tentative.html index e0d2bc7e6d8..ade76848209 100644 --- a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-script-src.tentative.html +++ b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-script-src.tentative.html @@ -3,7 +3,7 @@ - + diff --git a/tests/wpt/web-platform-tests/trusted-types/createContextualFragment.tentative.html b/tests/wpt/web-platform-tests/trusted-types/createContextualFragment.tentative.html new file mode 100644 index 00000000000..5e50acc8065 --- /dev/null +++ b/tests/wpt/web-platform-tests/trusted-types/createContextualFragment.tentative.html @@ -0,0 +1,31 @@ + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/document-write.tentative.html b/tests/wpt/web-platform-tests/trusted-types/document-write.tentative.html index 0934db94c16..12794199722 100644 --- a/tests/wpt/web-platform-tests/trusted-types/document-write.tentative.html +++ b/tests/wpt/web-platform-tests/trusted-types/document-write.tentative.html @@ -1,7 +1,7 @@ - + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/innerHTML.tentative.html b/tests/wpt/web-platform-tests/trusted-types/innerHTML.tentative.html index 6a72dfae458..f9f32d42a76 100644 --- a/tests/wpt/web-platform-tests/trusted-types/innerHTML.tentative.html +++ b/tests/wpt/web-platform-tests/trusted-types/innerHTML.tentative.html @@ -1,7 +1,7 @@ - + - +
+ + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/location-href.tentative.html b/tests/wpt/web-platform-tests/trusted-types/location-href.tentative.html index 6dd4816f9df..2527fbf4847 100644 --- a/tests/wpt/web-platform-tests/trusted-types/location-href.tentative.html +++ b/tests/wpt/web-platform-tests/trusted-types/location-href.tentative.html @@ -1,7 +1,7 @@ - + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/outerHTML.tentative.html b/tests/wpt/web-platform-tests/trusted-types/outerHTML.tentative.html index 0a25dc2a988..1deb46bf5e3 100644 --- a/tests/wpt/web-platform-tests/trusted-types/outerHTML.tentative.html +++ b/tests/wpt/web-platform-tests/trusted-types/outerHTML.tentative.html @@ -1,7 +1,7 @@ - +
- + + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/srcDoc.tentative.html b/tests/wpt/web-platform-tests/trusted-types/srcDoc.tentative.html new file mode 100644 index 00000000000..b23703e2232 --- /dev/null +++ b/tests/wpt/web-platform-tests/trusted-types/srcDoc.tentative.html @@ -0,0 +1,28 @@ + + + + + + diff --git a/tests/wpt/web-platform-tests/trusted-types/support/helper.js b/tests/wpt/web-platform-tests/trusted-types/support/helper.sub.js similarity index 96% rename from tests/wpt/web-platform-tests/trusted-types/support/helper.js rename to tests/wpt/web-platform-tests/trusted-types/support/helper.sub.js index 1094e72c6f8..036dbed7d15 100644 --- a/tests/wpt/web-platform-tests/trusted-types/support/helper.js +++ b/tests/wpt/web-platform-tests/trusted-types/support/helper.sub.js @@ -5,7 +5,7 @@ var STRINGS = { }; var URLS = { - safe: "https://example.test/", + safe: "http://{{host}}:{{ports[http][0]}}/", javascript: "javascript:'scripted'", external: "custom-handler:whatever", sanitized: "about:invalid" diff --git a/tests/wpt/web-platform-tests/uievents/META.yml b/tests/wpt/web-platform-tests/uievents/META.yml index f4084bb8f7f..2f1ec58efec 100644 --- a/tests/wpt/web-platform-tests/uievents/META.yml +++ b/tests/wpt/web-platform-tests/uievents/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/uievents/ suggested_reviewers: - jdm - NavidZ diff --git a/tests/wpt/web-platform-tests/upgrade-insecure-requests/META.yml b/tests/wpt/web-platform-tests/upgrade-insecure-requests/META.yml index d0743949b6a..a30208ae10d 100644 --- a/tests/wpt/web-platform-tests/upgrade-insecure-requests/META.yml +++ b/tests/wpt/web-platform-tests/upgrade-insecure-requests/META.yml @@ -1,2 +1,3 @@ +spec: https://w3c.github.io/webappsec-upgrade-insecure-requests/ suggested_reviewers: - mikewest diff --git a/tests/wpt/web-platform-tests/url/META.yml b/tests/wpt/web-platform-tests/url/META.yml index e04402a67c9..459152f6f07 100644 --- a/tests/wpt/web-platform-tests/url/META.yml +++ b/tests/wpt/web-platform-tests/url/META.yml @@ -1,7 +1,6 @@ +spec: https://url.spec.whatwg.org/ suggested_reviewers: - mikewest - - rubys - - xiaojunwu - smola - domenic - Sebmaster diff --git a/tests/wpt/web-platform-tests/user-timing/META.yml b/tests/wpt/web-platform-tests/user-timing/META.yml index ee0e032763c..a97a31d766b 100644 --- a/tests/wpt/web-platform-tests/user-timing/META.yml +++ b/tests/wpt/web-platform-tests/user-timing/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/user-timing/ suggested_reviewers: - plehegar - igrigorik diff --git a/tests/wpt/web-platform-tests/vibration/META.yml b/tests/wpt/web-platform-tests/vibration/META.yml index 7c3cceb8a6f..016588931f9 100644 --- a/tests/wpt/web-platform-tests/vibration/META.yml +++ b/tests/wpt/web-platform-tests/vibration/META.yml @@ -1,4 +1,4 @@ +spec: https://w3c.github.io/vibration/ suggested_reviewers: - dontcallmedom - zqzhang - - xinliux diff --git a/tests/wpt/web-platform-tests/visual-viewport/META.yml b/tests/wpt/web-platform-tests/visual-viewport/META.yml index ef160162ebb..5499f77335b 100644 --- a/tests/wpt/web-platform-tests/visual-viewport/META.yml +++ b/tests/wpt/web-platform-tests/visual-viewport/META.yml @@ -1,2 +1,3 @@ +spec: https://wicg.github.io/visual-viewport/ suggested_reviewers: - bokand diff --git a/tests/wpt/web-platform-tests/wai-aria/META.yml b/tests/wpt/web-platform-tests/wai-aria/META.yml index d99ed62b8e3..aaa5d8166c0 100644 --- a/tests/wpt/web-platform-tests/wai-aria/META.yml +++ b/tests/wpt/web-platform-tests/wai-aria/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/aria/ suggested_reviewers: - halindrome - joanmarie diff --git a/tests/wpt/web-platform-tests/wake-lock/META.yml b/tests/wpt/web-platform-tests/wake-lock/META.yml index 186c5fdac26..a5ff85281f8 100644 --- a/tests/wpt/web-platform-tests/wake-lock/META.yml +++ b/tests/wpt/web-platform-tests/wake-lock/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/wake-lock/ suggested_reviewers: - andrey-logvinov - marcoscaceres diff --git a/tests/wpt/web-platform-tests/wake-lock/idlharness.https.window.js b/tests/wpt/web-platform-tests/wake-lock/idlharness.https.window.js new file mode 100644 index 00000000000..21d559a7a26 --- /dev/null +++ b/tests/wpt/web-platform-tests/wake-lock/idlharness.https.window.js @@ -0,0 +1,31 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://w3c.github.io/wake-lock/ + +'use strict'; + +promise_test(async () => { + const srcs = ['wake-lock', 'dom', 'html']; + const [wakelock, dom, html] = await Promise.all( + srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); + + const idl_array = new IdlArray(); + idl_array.add_idls(wakelock); + idl_array.add_dependency_idls(dom); + idl_array.add_dependency_idls(html); + + try { + window.wakelock = await navigator.getWakeLock("screen"); + window.request = window.wakelock.createRequest(); + } catch (e) { + // Surfaced in idlharness.js's test_object below. + } + + idl_array.add_objects({ + Navigator: ['navigator'], + WakeLock: ['wakelock'], + WakeLockRequest: ['request'] + }); + idl_array.test(); +}, 'Test IDL implementation of WakeLock API'); diff --git a/tests/wpt/web-platform-tests/wake-lock/interfaces.https.html b/tests/wpt/web-platform-tests/wake-lock/interfaces.https.html deleted file mode 100644 index 58b43fff1e9..00000000000 --- a/tests/wpt/web-platform-tests/wake-lock/interfaces.https.html +++ /dev/null @@ -1,33 +0,0 @@ - - -Wake Lock API IDL tests - - - - - - diff --git a/tests/wpt/web-platform-tests/wake-lock/wakelock-type.https.html b/tests/wpt/web-platform-tests/wake-lock/wakelock-type.https.html index 70aa129abcc..6f6413d1a91 100644 --- a/tests/wpt/web-platform-tests/wake-lock/wakelock-type.https.html +++ b/tests/wpt/web-platform-tests/wake-lock/wakelock-type.https.html @@ -18,11 +18,11 @@ promise_test(async t => { }, "Test that wakeLock.type is 'system' when system wake lock is invoked"); promise_test(t => { - return promise_rejects(t, new DOMException("", "WakeLockTypeNotSupported"), navigator.getWakeLock()); -}, "'WakeLockTypeNotSupported' is thrown when set an empty wake lock type"); + return promise_rejects(t, new DOMException("", "NotSupportedError"), navigator.getWakeLock()); +}, "'NotSupportedError' is thrown when set an empty wake lock type"); promise_test(t => { - return promise_rejects(t, new DOMException("", "WakeLockTypeNotSupported"), navigator.getWakeLock("unsupported")); -}, "'WakeLockTypeNotSupported' is thrown when set an unsupported wake lock type"); + return promise_rejects(t, new DOMException("", "NotSupportedError"), navigator.getWakeLock("unsupported")); +}, "'NotSupportedError' is thrown when set an unsupported wake lock type"); diff --git a/tests/wpt/web-platform-tests/wasm/idlharness.any.js b/tests/wpt/web-platform-tests/wasm/idlharness.any.js new file mode 100644 index 00000000000..9c29ad14559 --- /dev/null +++ b/tests/wpt/web-platform-tests/wasm/idlharness.any.js @@ -0,0 +1,33 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js +// META: script=resources/load_wasm.js + +'use strict'; + +// https://webassembly.github.io/spec/js-api/ + +promise_test(async () => { + const srcs = ['wasm-js-api']; + const [wasm] = await Promise.all( + srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); + + const idl_array = new IdlArray(); + idl_array.add_idls(wasm); + // Ignored errors are surfaced in idlharness.js's test_object below. + try { + self.memory = new Memory({initial: 1024}); + } catch (e) { } + + try { + self.mod = await createWasmModule(); + self.instance = new Instance(self.mod); + } catch (e) { } + + idl_array.add_objects({ + Memory: ['memory'], + Module: ['mod'], + Instance: ['instance'], + }); + idl_array.test(); +}, 'wasm-js-api interfaces.'); + diff --git a/tests/wpt/web-platform-tests/web-animations/META.yml b/tests/wpt/web-platform-tests/web-animations/META.yml index 43195c10156..bf92f7a7516 100644 --- a/tests/wpt/web-platform-tests/web-animations/META.yml +++ b/tests/wpt/web-platform-tests/web-animations/META.yml @@ -1,2 +1,6 @@ +spec: https://drafts.csswg.org/web-animations/ suggested_reviewers: - birtles + - flackr + - graouts + - stephenmcgruer diff --git a/tests/wpt/web-platform-tests/web-animations/animation-model/animation-types/property-list.js b/tests/wpt/web-platform-tests/web-animations/animation-model/animation-types/property-list.js index cb6e2c810e8..8d027178351 100644 --- a/tests/wpt/web-platform-tests/web-animations/animation-model/animation-types/property-list.js +++ b/tests/wpt/web-platform-tests/web-animations/animation-model/animation-types/property-list.js @@ -413,12 +413,6 @@ const gCSSProperties = { { type: 'discrete', options: [ [ 'auto', '1px' ] ] } ] }, - 'contain': { - // https://drafts.csswg.org/css-containment/#propdef-contain - types: [ - { type: 'discrete', options: [ [ 'strict', 'none' ] ] } - ] - }, 'content': { // https://drafts.csswg.org/css-content-3/#propdef-content types: [ @@ -446,12 +440,6 @@ const gCSSProperties = { { type: 'discrete', options: [ [ 'pointer', 'wait' ] ] } ] }, - 'direction': { - // https://drafts.csswg.org/css-writing-modes-3/#propdef-direction - types: [ - { type: 'discrete', options: [ [ 'ltr', 'rtl' ] ] } - ] - }, 'dominant-baseline': { // https://drafts.csswg.org/css-inline/#propdef-dominant-baseline types: [ @@ -711,13 +699,13 @@ const gCSSProperties = { 'hyphens': { // https://drafts.csswg.org/css-text-3/#propdef-hyphens types: [ - { type: 'discrete', options: [ [ 'manual', 'auto' ] ] } + { type: 'discrete', options: [ [ 'manual', 'none' ] ] } ] }, 'image-orientation': { // https://drafts.csswg.org/css-images-3/#propdef-image-orientation types: [ - { type: 'discrete', options: [ [ '0deg', '90deg' ] ] } + { type: 'discrete', options: [ [ 'none', 'from-image' ] ] } ] }, 'image-rendering': { @@ -1340,12 +1328,6 @@ const gCSSProperties = { types: [ ] }, - 'text-orientation': { - // https://drafts.csswg.org/css-writing-modes-3/#propdef-text-orientation - types: [ - { type: 'discrete', options: [ [ 'upright', 'sideways' ] ] } - ] - }, 'text-overflow': { // https://drafts.csswg.org/css-ui/#propdef-text-overflow types: [ @@ -1424,12 +1406,6 @@ const gCSSProperties = { // https://drafts.csswg.org/css-transforms-2/#individual-transforms types: [ 'scaleList' ] }, - 'unicode-bidi': { - // https://drafts.csswg.org/css-writing-modes-3/#propdef-unicode-bidi - types: [ - { type: 'discrete', options: [ [ 'embed', 'bidi-override' ] ] }, - ] - }, 'vector-effect': { // https://svgwg.org/svg2-draft/coords.html#VectorEffectProperty types: [ @@ -1466,18 +1442,6 @@ const gCSSProperties = { // https://drafts.csswg.org/css-text-3/#propdef-word-spacing types: [ 'lengthPercentageOrCalc' ] }, - 'will-change': { - // http://dev.w3.org/csswg/css-will-change/#propdef-will-change - types: [ - { type: 'discrete', options: [ [ 'scroll-position', 'contents' ] ] } - ] - }, - 'writing-mode': { - // https://drafts.csswg.org/css-writing-modes-3/#propdef-writing-mode - types: [ - { type: 'discrete', options: [ [ 'vertical-rl', 'sideways-rl' ] ] } - ] - }, 'z-index': { // https://drafts.csswg.org/css-position/#propdef-z-index types: [ diff --git a/tests/wpt/web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-overlapping-keyframes.html b/tests/wpt/web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-overlapping-keyframes.html index 2a41f04c05a..a2a0683921c 100644 --- a/tests/wpt/web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-overlapping-keyframes.html +++ b/tests/wpt/web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-overlapping-keyframes.html @@ -11,6 +11,10 @@ - - - -
- diff --git a/tests/wpt/web-platform-tests/web-animations/interfaces/Animation/idlharness.window.js b/tests/wpt/web-platform-tests/web-animations/interfaces/Animation/idlharness.window.js new file mode 100644 index 00000000000..14b8395a217 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-animations/interfaces/Animation/idlharness.window.js @@ -0,0 +1,21 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://w3c.github.io/web-animations/#animation + +'use strict'; + +promise_test(async () => { + const srcs = ['web-animations', 'dom', 'html']; + const [idl, dom, html] = await Promise.all( + srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); + + const idlArray = new IdlArray(); + idlArray.add_idls(idl, {only: ['Animation', 'AnimationPlayState']}); + idlArray.add_dependency_idls(idl); + idlArray.add_dependency_idls(dom); + idlArray.add_dependency_idls(html); + idlArray.add_untested_idls('interface CSSPseudoElement {};'); + idlArray.add_objects( { Animation: ['new Animation()'] } ); + idlArray.test(); +}, 'Animation interface.'); diff --git a/tests/wpt/web-platform-tests/web-animations/interfaces/Animation/onfinish.html b/tests/wpt/web-platform-tests/web-animations/interfaces/Animation/onfinish.html index 79d1d7025a7..2df3cfbd120 100644 --- a/tests/wpt/web-platform-tests/web-animations/interfaces/Animation/onfinish.html +++ b/tests/wpt/web-platform-tests/web-animations/interfaces/Animation/onfinish.html @@ -71,7 +71,7 @@ async_test(t => { animation.finish(); }, 'onfinish event is fired when animation.finish() is called'); -promise_test(t => { +promise_test(async t => { const div = createDiv(t); const animation = div.animate({}, 100 * MS_PER_SEC); @@ -82,38 +82,36 @@ promise_test(t => { animation.currentTime = 100 * MS_PER_SEC / 2; animation.pause(); - return animation.ready.then(() => { - animation.currentTime = 100 * MS_PER_SEC; - return waitForAnimationFrames(2); - }); + await animation.ready; + animation.currentTime = 100 * MS_PER_SEC; + await waitForAnimationFrames(2); }, 'onfinish event is not fired when paused'); -promise_test(t => { +promise_test(async t => { const div = createDiv(t); const animation = div.animate({}, 100 * MS_PER_SEC); animation.onfinish = event => { assert_unreached('onfinish event should not be fired'); }; - return animation.ready.then(() => { - animation.playbackRate = 0; - animation.currentTime = 100 * MS_PER_SEC; - return waitForAnimationFrames(2); - }); + await animation.ready; + animation.playbackRate = 0; + animation.currentTime = 100 * MS_PER_SEC; + await waitForAnimationFrames(2); }, 'onfinish event is not fired when the playbackRate is zero'); -promise_test(t => { +promise_test(async t => { const div = createDiv(t); const animation = div.animate({}, 100 * MS_PER_SEC); + animation.onfinish = event => { assert_unreached('onfinish event should not be fired'); }; - return animation.ready.then(() => { - animation.currentTime = 100 * MS_PER_SEC; - animation.currentTime = 100 * MS_PER_SEC / 2; - return waitForAnimationFrames(2); - }); + await animation.ready; + animation.currentTime = 100 * MS_PER_SEC; + animation.currentTime = 100 * MS_PER_SEC / 2; + await waitForAnimationFrames(2); }, 'onfinish event is not fired when the animation falls out ' + 'finished state immediately'); diff --git a/tests/wpt/web-platform-tests/web-animations/interfaces/AnimationPlaybackEvent/idlharness.html b/tests/wpt/web-platform-tests/web-animations/interfaces/AnimationPlaybackEvent/idlharness.html deleted file mode 100644 index 9570c0f0dbf..00000000000 --- a/tests/wpt/web-platform-tests/web-animations/interfaces/AnimationPlaybackEvent/idlharness.html +++ /dev/null @@ -1,39 +0,0 @@ - - -AnimationPlaybackEvent IDL - - - - - -
- diff --git a/tests/wpt/web-platform-tests/web-animations/interfaces/AnimationPlaybackEvent/idlharness.window.js b/tests/wpt/web-platform-tests/web-animations/interfaces/AnimationPlaybackEvent/idlharness.window.js new file mode 100644 index 00000000000..5124e509572 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-animations/interfaces/AnimationPlaybackEvent/idlharness.window.js @@ -0,0 +1,26 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://w3c.github.io/web-animations/#animationplaybackevent + +'use strict'; + +promise_test(async () => { + const srcs = ['web-animations', 'dom']; + const [idl, dom] = await Promise.all( + srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); + + const idlArray = new IdlArray(); + idlArray.add_idls(idl, { + only: [ + 'AnimationPlaybackEventInit', + 'AnimationPlaybackEvent', + ] + }); + idlArray.add_dependency_idls(dom); + idlArray.add_objects({ + AnimationPlaybackEvent: ['new AnimationPlaybackEvent("cancel")'], + }); + + idlArray.test(); +}, 'AnimationPlaybackEvent interface.'); diff --git a/tests/wpt/web-platform-tests/web-animations/interfaces/DocumentTimeline/idlharness.html b/tests/wpt/web-platform-tests/web-animations/interfaces/DocumentTimeline/idlharness.html deleted file mode 100644 index 6b22c91780e..00000000000 --- a/tests/wpt/web-platform-tests/web-animations/interfaces/DocumentTimeline/idlharness.html +++ /dev/null @@ -1,30 +0,0 @@ - - -DocumentTimeline IDL - - - - - -
- diff --git a/tests/wpt/web-platform-tests/web-animations/interfaces/DocumentTimeline/idlharness.window.js b/tests/wpt/web-platform-tests/web-animations/interfaces/DocumentTimeline/idlharness.window.js new file mode 100644 index 00000000000..395d133f482 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-animations/interfaces/DocumentTimeline/idlharness.window.js @@ -0,0 +1,22 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://w3c.github.io/web-animations/#documenttimeline + +'use strict'; + +promise_test(async () => { + const text = await fetch('/interfaces/web-animations.idl').then(r => r.text()); + const idlArray = new IdlArray(); + idlArray.add_idls(text, { + only: [ + 'AnimationTimeline', + 'DocumentTimelineOptions', + 'DocumentTimeline', + ] + }); + idlArray.add_objects({ DocumentTimeline: ['document.timeline'] }); + + idlArray.test(); + done(); +}, 'DocumentTimeline interface.'); diff --git a/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/idlharness.html b/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/idlharness.html deleted file mode 100644 index 00cdd998cfa..00000000000 --- a/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/idlharness.html +++ /dev/null @@ -1,79 +0,0 @@ - - -KeyframeEffect IDL - - - - - - -
- - diff --git a/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/idlharness.window.js b/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/idlharness.window.js new file mode 100644 index 00000000000..22548861ae3 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/idlharness.window.js @@ -0,0 +1,31 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://w3c.github.io/web-animations/#keyframeeffect + +'use strict'; + +promise_test(async () => { + const srcs = ['web-animations', 'html']; + const [idl, html] = await Promise.all( + srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); + + const idlArray = new IdlArray(); + idlArray.add_idls(idl, { + only: [ + 'IterationCompositeOperation', + 'CompositeOperation', + 'KeyframeEffectOptions', + 'KeyframeEffect', + ] + }); + idlArray.add_untested_idls('interface CSSPseudoElement {};'); + idlArray.add_dependency_idls(idl); + idlArray.add_dependency_idls(html); + idlArray.add_objects({ + KeyframeEffect: ['new KeyframeEffect(null, null)'], + }); + + idlArray.test(); + done(); +}, 'KeyframeEffect interface.'); diff --git a/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html b/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html index 1b28210b985..d46cf675208 100644 --- a/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html +++ b/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html @@ -35,8 +35,16 @@ const gNonAnimatableProps = [ 'transitionDuration', 'transitionProperty', 'transitionTimingFunction', + 'contain', + 'direction', 'display', + 'textOrientation', + 'unicodeBidi', + 'willChange', + 'writingMode', + 'unsupportedProperty', + 'font-size', // Supported property that uses dashes ]; diff --git a/tests/wpt/web-platform-tests/web-animations/timing-model/animations/canceling-an-animation.html b/tests/wpt/web-platform-tests/web-animations/timing-model/animations/canceling-an-animation.html index 539e922faf4..b0ef0b1bf96 100644 --- a/tests/wpt/web-platform-tests/web-animations/timing-model/animations/canceling-an-animation.html +++ b/tests/wpt/web-platform-tests/web-animations/timing-model/animations/canceling-an-animation.html @@ -106,5 +106,21 @@ promise_test(t => { }, 'The cancel event should NOT be fired if the animation is already' + ' idle'); +promise_test(async t => { + const div = createDiv(t); + const animation = div.animate({}, 100 * MS_PER_SEC); + div.remove(); + + const eventWatcher = new EventWatcher(t, animation, 'cancel'); + + await animation.ready; + animation.cancel(); + + await eventWatcher.wait_for('cancel'); + + assert_equals(animation.effect.target.parentNode, null, + 'cancel event should be fired for the animation on an orphaned element'); +}, 'Canceling an animation should fire cancel event on orphaned element'); + diff --git a/tests/wpt/web-platform-tests/web-animations/timing-model/animations/finishing-an-animation.html b/tests/wpt/web-platform-tests/web-animations/timing-model/animations/finishing-an-animation.html index 833f074d40e..cb824ae30ed 100644 --- a/tests/wpt/web-platform-tests/web-animations/timing-model/animations/finishing-an-animation.html +++ b/tests/wpt/web-platform-tests/web-animations/timing-model/animations/finishing-an-animation.html @@ -284,5 +284,20 @@ promise_test(async t => { }, 'An exception is NOT thrown when finishing if the effective playback rate' + ' is negative and the target effect end is infinity'); +promise_test(async t => { + const div = createDiv(t); + const animation = div.animate({}, 100 * MS_PER_SEC); + div.remove(); + + const eventWatcher = new EventWatcher(t, animation, 'finish'); + + await animation.ready; + animation.finish(); + + await eventWatcher.wait_for('finish'); + assert_equals(animation.effect.target.parentNode, null, + 'finish event should be fired for the animation on an orphaned element'); +}, 'Finishing an animation fires finish event on orphaned element'); + diff --git a/tests/wpt/web-platform-tests/web-animations/timing-model/timelines/update-and-send-events.html b/tests/wpt/web-platform-tests/web-animations/timing-model/timelines/update-and-send-events.html new file mode 100644 index 00000000000..d3124db03c9 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-animations/timing-model/timelines/update-and-send-events.html @@ -0,0 +1,225 @@ + + +Update animations and send events + + + + +
+ diff --git a/tests/wpt/web-platform-tests/web-locks/META.yml b/tests/wpt/web-platform-tests/web-locks/META.yml new file mode 100644 index 00000000000..39acca82900 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/META.yml @@ -0,0 +1,4 @@ +spec: https://inexorabletash.github.io/web-locks/ +suggested_reviewers: + - inexorabletash + - pwnall diff --git a/tests/wpt/web-platform-tests/web-locks/README.md b/tests/wpt/web-platform-tests/web-locks/README.md new file mode 100644 index 00000000000..e8091f8cd30 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/README.md @@ -0,0 +1,5 @@ +This directory contains a test suite for the proposed Web Locks API. + +Explainer: https://github.com/inexorabletash/web-locks + +Spec: https://inexorabletash.github.io/web-locks/ diff --git a/tests/wpt/web-platform-tests/web-locks/acquire.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/acquire.tentative.https.html new file mode 100644 index 00000000000..3c360ab4ff0 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/acquire.tentative.https.html @@ -0,0 +1,130 @@ + + +Web Locks API: navigator.locks.request method + + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/clientids.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/clientids.tentative.https.html new file mode 100644 index 00000000000..8a99d7d2e7f --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/clientids.tentative.https.html @@ -0,0 +1,44 @@ + + +Web Locks API: Client IDs in query() vs. Service Worker + + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/frames.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/frames.tentative.https.html new file mode 100644 index 00000000000..366a7eafc40 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/frames.tentative.https.html @@ -0,0 +1,239 @@ + + +Web Locks API: Frames + + + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/held.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/held.tentative.https.html new file mode 100644 index 00000000000..ccf7c0b8f67 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/held.tentative.https.html @@ -0,0 +1,97 @@ + + +Web Locks API: Lock held until callback result resolves + + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/ifAvailable.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/ifAvailable.tentative.https.html new file mode 100644 index 00000000000..ee190b2bf0c --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/ifAvailable.tentative.https.html @@ -0,0 +1,169 @@ + + +Web Locks API: ifAvailable option + + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/interfaces-serviceworker.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/interfaces-serviceworker.tentative.https.html new file mode 100644 index 00000000000..ea2a3d77c84 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/interfaces-serviceworker.tentative.https.html @@ -0,0 +1,21 @@ + + +Web Locks API: WebIDL tests in service worker + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/interfaces.idl b/tests/wpt/web-platform-tests/web-locks/interfaces.idl new file mode 100644 index 00000000000..7c7d7c344df --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/interfaces.idl @@ -0,0 +1,46 @@ + +enum LockMode { "shared", "exclusive" }; + +dictionary LockOptions { + LockMode mode = "exclusive"; + boolean ifAvailable = false; +}; + +callback LockGrantedCallback = any (Lock lock); + +[Exposed=Window] +partial interface Navigator { + [SecureContext] readonly attribute LockManager locks; +}; + +[Exposed=Worker] +partial interface WorkerNavigator { + [SecureContext] readonly attribute LockManager locks; +}; + +[Exposed=(Window,Worker), SecureContext] +interface LockManager { + Promise request(DOMString name, + LockGrantedCallback callback); + Promise request(DOMString name, + LockOptions options, + LockGrantedCallback callback); + + Promise query(); +}; + +[Exposed=(Window,Worker), SecureContext] +interface Lock { + readonly attribute DOMString name; + readonly attribute LockMode mode; +}; + +dictionary LockManagerSnapshot { + sequence pending; + sequence held; +}; + +dictionary LockInfo { + DOMString name; + LockMode mode; +}; diff --git a/tests/wpt/web-platform-tests/web-locks/interfaces.tentative.https.any.js b/tests/wpt/web-platform-tests/web-locks/interfaces.tentative.https.any.js new file mode 100644 index 00000000000..26b0bde2baf --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/interfaces.tentative.https.any.js @@ -0,0 +1,26 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +promise_test(async t => { + const response = await fetch('interfaces.idl'); + const idls = await response.text(); + + const idl_array = new IdlArray(); + + idl_array.add_untested_idls('[Exposed=Window] interface Navigator {};'); + idl_array.add_untested_idls('[Exposed=Worker] interface WorkerNavigator {};'); + + idl_array.add_idls(idls); + + let lock; + await navigator.locks.request('name', l => { lock = l; }); + + idl_array.add_objects({ + LockManager: [navigator.locks], + Lock: [lock], + }); + + idl_array.test(); +}); diff --git a/tests/wpt/web-platform-tests/web-locks/lock-attributes.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/lock-attributes.tentative.https.html new file mode 100644 index 00000000000..e0c1c5b3c80 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/lock-attributes.tentative.https.html @@ -0,0 +1,24 @@ + + +Web Locks API: Lock Attributes + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/mode-exclusive.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/mode-exclusive.tentative.https.html new file mode 100644 index 00000000000..7769ca5ec69 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/mode-exclusive.tentative.https.html @@ -0,0 +1,40 @@ + + +Web Locks API: Exclusive Mode + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/mode-mixed.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/mode-mixed.tentative.https.html new file mode 100644 index 00000000000..ac8f36534d7 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/mode-mixed.tentative.https.html @@ -0,0 +1,51 @@ + + +Web Locks API: Mixed Modes + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/mode-shared.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/mode-shared.tentative.https.html new file mode 100644 index 00000000000..cac3a571f35 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/mode-shared.tentative.https.html @@ -0,0 +1,44 @@ + + +Web Locks API: Shared Mode + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/non-secure-context.tentative.html b/tests/wpt/web-platform-tests/web-locks/non-secure-context.tentative.html new file mode 100644 index 00000000000..328e4512b8f --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/non-secure-context.tentative.html @@ -0,0 +1,19 @@ + + +Web Locks API: API not available in non-secure context + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/opaque-origin.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/opaque-origin.tentative.https.html new file mode 100644 index 00000000000..7abae82ab41 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/opaque-origin.tentative.https.html @@ -0,0 +1,61 @@ + + +Web Locks API: Opaque origins + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/query-empty.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/query-empty.tentative.https.html new file mode 100644 index 00000000000..a6133218ee6 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/query-empty.tentative.https.html @@ -0,0 +1,24 @@ + + +Web Locks API: navigator.locks.query method - no locks held + + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/query-order.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/query-order.tentative.https.html new file mode 100644 index 00000000000..25ac10a29ac --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/query-order.tentative.https.html @@ -0,0 +1,116 @@ + + +Web Locks API: navigator.locks.query ordering + + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/query.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/query.tentative.https.html new file mode 100644 index 00000000000..77d37f34f8b --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/query.tentative.https.html @@ -0,0 +1,234 @@ + + +Web Locks API: navigator.locks.query method + + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/resource-names.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/resource-names.tentative.https.html new file mode 100644 index 00000000000..1dfe11d554f --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/resource-names.tentative.https.html @@ -0,0 +1,62 @@ + + +Web Locks API: Resources DOMString edge cases + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/resources/helpers.js b/tests/wpt/web-platform-tests/web-locks/resources/helpers.js new file mode 100644 index 00000000000..d6a4af45fa7 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/resources/helpers.js @@ -0,0 +1,60 @@ +// Test helpers used by multiple Web Locks API tests. +(() => { + + // Generate a unique resource identifier, using the script path and + // test case name. This is useful to avoid lock interference between + // test cases. + let res_num = 0; + self.uniqueName = testCase => { + return `${self.location.pathname}-${testCase.name}-${++res_num}`; + }; + + // Inject an iframe showing the given url into the page, and resolve + // the returned promise when the frame is loaded. + self.iframe = url => new Promise(resolve => { + const element = document.createElement('iframe'); + element.addEventListener( + 'load', () => { resolve(element); }, { once: true }); + element.src = url; + document.documentElement.appendChild(element); + }); + + // Post a message to the target frame, and resolve the returned + // promise when a response comes back. The posted data is annotated + // with unique id to track the response. This assumes the use of + // 'iframe.html' as the frame, which implements this protocol. + let next_request_id = 0; + self.postToFrameAndWait = (frame, data) => { + const iframe_window = frame.contentWindow; + data.rqid = next_request_id++; + iframe_window.postMessage(data, '*'); + return new Promise(resolve => { + const listener = event => { + if (event.source !== iframe_window || event.data.rqid !== data.rqid) + return; + self.removeEventListener('message', listener); + resolve(event.data); + }; + self.addEventListener('message', listener); + }); + }; + + // Post a message to the target worker, and resolve the returned + // promise when a response comes back. The posted data is annotated + // with unique id to track the response. This assumes the use of + // 'worker.js' as the worker, which implements this protocol. + self.postToWorkerAndWait = (worker, data) => { + return new Promise(resolve => { + data.rqid = next_request_id++; + worker.postMessage(data); + const listener = event => { + if (event.data.rqid !== data.rqid) + return; + worker.removeEventListener('message', listener); + resolve(event.data); + }; + worker.addEventListener('message', listener); + }); + }; + +})(); diff --git a/tests/wpt/web-platform-tests/web-locks/resources/iframe.html b/tests/wpt/web-platform-tests/web-locks/resources/iframe.html new file mode 100644 index 00000000000..d3799f44f96 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/resources/iframe.html @@ -0,0 +1,43 @@ + +Helper IFrame + diff --git a/tests/wpt/web-platform-tests/web-locks/resources/interfaces-serviceworker.js b/tests/wpt/web-platform-tests/web-locks/resources/interfaces-serviceworker.js new file mode 100644 index 00000000000..f75295c9f7b --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/resources/interfaces-serviceworker.js @@ -0,0 +1,29 @@ +'use strict'; + +importScripts('/resources/testharness.js', + '/resources/WebIDLParser.js', + '/resources/idlharness.js'); + +promise_test(async t => { + const response = await fetch('../interfaces.idl'); + const idls = await response.text(); + + const idl_array = new IdlArray(); + + idl_array.add_untested_idls('[Exposed=Window] interface Navigator {};'); + idl_array.add_untested_idls('[Exposed=Worker] interface WorkerNavigator {};'); + + idl_array.add_idls(idls); + + let lock; + await navigator.locks.request('name', l => { lock = l; }); + + idl_array.add_objects({ + LockManager: [navigator.locks], + Lock: [lock], + }); + + idl_array.test(); +}, 'Interface test'); + +done(); diff --git a/tests/wpt/web-platform-tests/web-locks/resources/service-worker.js b/tests/wpt/web-platform-tests/web-locks/resources/service-worker.js new file mode 100644 index 00000000000..027863e33e0 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/resources/service-worker.js @@ -0,0 +1,7 @@ +// Responds to '/clientId' with the request's clientId. +self.addEventListener('fetch', e => { + if (new URL(e.request.url).pathname === '/clientId') { + e.respondWith(new Response(JSON.stringify({clientId: e.clientId}))); + return; + } +}); diff --git a/tests/wpt/web-platform-tests/web-locks/resources/sw-controlled-iframe.html b/tests/wpt/web-platform-tests/web-locks/resources/sw-controlled-iframe.html new file mode 100644 index 00000000000..bc5c9bdb838 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/resources/sw-controlled-iframe.html @@ -0,0 +1,35 @@ + + +iframe used in clientId test + diff --git a/tests/wpt/web-platform-tests/web-locks/resources/worker.js b/tests/wpt/web-platform-tests/web-locks/resources/worker.js new file mode 100644 index 00000000000..9bb5d3d6aad --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/resources/worker.js @@ -0,0 +1,39 @@ +'use strict'; + +// Map of id => function that releases a lock. + +const held = new Map(); +let next_lock_id = 1; + +self.addEventListener('message', e => { + function respond(data) { + self.postMessage(Object.assign(data, {rqid: e.data.rqid})); + } + + switch (e.data.op) { + case 'request': + navigator.locks.request( + e.data.name, { + mode: e.data.mode || 'exclusive', + ifAvailable: e.data.ifAvailable || false + }, lock => { + if (lock === null) { + respond({ack: 'request', failed: true}); + return; + } + let lock_id = next_lock_id++; + let release; + const promise = new Promise(r => { release = r; }); + held.set(lock_id, release); + respond({ack: 'request', lock_id: lock_id}); + return promise; + }); + break; + + case 'release': + held.get(e.data.lock_id)(); + held.delete(e.data.lock_id); + respond({ack: 'release', lock_id: e.data.lock_id}); + break; + } +}); diff --git a/tests/wpt/web-platform-tests/web-locks/secure-context.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/secure-context.tentative.https.html new file mode 100644 index 00000000000..b5b6feaa030 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/secure-context.tentative.https.html @@ -0,0 +1,19 @@ + + +Web Locks API: API requires secure context + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/signal.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/signal.tentative.https.html new file mode 100644 index 00000000000..94f07a52fa3 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/signal.tentative.https.html @@ -0,0 +1,202 @@ + + +Web Locks API: AbortSignal integration + + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/steal.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/steal.tentative.https.html new file mode 100644 index 00000000000..b796c24f7d3 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/steal.tentative.https.html @@ -0,0 +1,97 @@ + + +Web Locks API: steal option + + + + + diff --git a/tests/wpt/web-platform-tests/web-locks/workers.tentative.https.html b/tests/wpt/web-platform-tests/web-locks/workers.tentative.https.html new file mode 100644 index 00000000000..1e699194c4b --- /dev/null +++ b/tests/wpt/web-platform-tests/web-locks/workers.tentative.https.html @@ -0,0 +1,118 @@ + + +Web Locks API: Workers + + + + + diff --git a/tests/wpt/web-platform-tests/web-nfc/META.yml b/tests/wpt/web-platform-tests/web-nfc/META.yml index 0d813d61dfc..ffc54cf3355 100644 --- a/tests/wpt/web-platform-tests/web-nfc/META.yml +++ b/tests/wpt/web-platform-tests/web-nfc/META.yml @@ -1,5 +1,5 @@ +spec: https://w3c.github.io/web-nfc/ suggested_reviewers: - Honry - kenchris - - zolkis - alexshalamov diff --git a/tests/wpt/web-platform-tests/web-nfc/idlharness.https.html b/tests/wpt/web-platform-tests/web-nfc/idlharness.https.html deleted file mode 100644 index d4a95b28228..00000000000 --- a/tests/wpt/web-platform-tests/web-nfc/idlharness.https.html +++ /dev/null @@ -1,25 +0,0 @@ - - -Web NFC IDL tests - - - - - - - diff --git a/tests/wpt/web-platform-tests/web-nfc/idlharness.https.window.js b/tests/wpt/web-platform-tests/web-nfc/idlharness.https.window.js new file mode 100644 index 00000000000..1d6457b2268 --- /dev/null +++ b/tests/wpt/web-platform-tests/web-nfc/idlharness.https.window.js @@ -0,0 +1,17 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +// https://w3c.github.io/web-nfc/ + +idl_test( + ['web-nfc'], + ['html'], + idl_array => { + idl_array.add_objects({ + Navigator: ['navigator'], + NFC: ['navigator.nfc'], + }); + }, + 'Test IDL implementation of Web NFC API'); diff --git a/tests/wpt/web-platform-tests/web-share/META.yml b/tests/wpt/web-platform-tests/web-share/META.yml index d5962ab547d..1197ab9f237 100644 --- a/tests/wpt/web-platform-tests/web-share/META.yml +++ b/tests/wpt/web-platform-tests/web-share/META.yml @@ -1,3 +1,4 @@ +spec: https://wicg.github.io/web-share/ suggested_reviewers: - mgiuca - marcoscaceres diff --git a/tests/wpt/web-platform-tests/webaudio/META.yml b/tests/wpt/web-platform-tests/webaudio/META.yml index 57369d4d943..37276da5334 100644 --- a/tests/wpt/web-platform-tests/webaudio/META.yml +++ b/tests/wpt/web-platform-tests/webaudio/META.yml @@ -1,3 +1,4 @@ +spec: https://webaudio.github.io/web-audio-api/ suggested_reviewers: - chrislo - padenot diff --git a/tests/wpt/web-platform-tests/webaudio/idlharness.https.html b/tests/wpt/web-platform-tests/webaudio/idlharness.https.html index 063e4cc955a..bd1df62942c 100644 --- a/tests/wpt/web-platform-tests/webaudio/idlharness.https.html +++ b/tests/wpt/web-platform-tests/webaudio/idlharness.https.html @@ -13,7 +13,7 @@ let sample_rate, context, buffer, worklet_node; promise_test(async t => { - const srcs = ['cssom', 'dom', 'html', 'uievents', 'mediacapture-main', 'webaudio']; + const srcs = ['cssom', 'dom', 'html', 'uievents', 'mediacapture-streams', 'webaudio']; const [cssom, dom, html, uievents, mediacapture, webaudio] = await Promise.all( srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); diff --git a/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam-size.https.html b/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam-size.https.html new file mode 100644 index 00000000000..9578b268815 --- /dev/null +++ b/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam-size.https.html @@ -0,0 +1,96 @@ + + + + + Test AudioParam Array Size + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/processors/gain-processor.js b/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/processors/gain-processor.js index f5143b3ecc2..e9e130e3741 100644 --- a/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/processors/gain-processor.js +++ b/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/processors/gain-processor.js @@ -22,8 +22,13 @@ class GainProcessor extends AudioWorkletProcessor { for (let channel = 0; channel < input.length; ++channel) { let inputChannel = input[channel]; let outputChannel = output[channel]; - for (let i = 0; i < inputChannel.length; ++i) - outputChannel[i] = inputChannel[i] * gain[i]; + if (gain.length === 1) { + for (let i = 0; i < inputChannel.length; ++i) + outputChannel[i] = inputChannel[i] * gain[0]; + } else { + for (let i = 0; i < inputChannel.length; ++i) + outputChannel[i] = inputChannel[i] * gain[i]; + } } return true; diff --git a/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/processors/param-size-processor.js b/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/processors/param-size-processor.js new file mode 100644 index 00000000000..d7ce8365007 --- /dev/null +++ b/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/processors/param-size-processor.js @@ -0,0 +1,30 @@ +/** + * @class ParamSizeProcessor + * @extends AudioWorkletProcessor + * + * This processor is a source node which basically outputs the size of the + * AudioParam array for each render quantum. + */ + +class ParamSizeProcessor extends AudioWorkletProcessor { + static get parameterDescriptors() { + return [{name: 'param'}]; + } + + constructor() { + super(); + } + + process(inputs, outputs, parameters) { + let output = outputs[0]; + let param = parameters.param; + + for (let channel = 0; channel < output.length; ++channel) { + output[channel].fill(param.length); + } + + return true; + } +} + +registerProcessor('param-size', ParamSizeProcessor); diff --git a/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/test-pannernode-automation.html b/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/test-pannernode-automation.html index 74bbdc6fe1c..ce474b10b51 100644 --- a/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/test-pannernode-automation.html +++ b/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/test-pannernode-automation.html @@ -4,13 +4,18 @@ ") + + response = accept_alert(session) + value = assert_success(response) + assert value is None + def test_no_browsing_context(session, create_window): # 18.2 step 1 diff --git a/tests/wpt/web-platform-tests/webdriver/tests/actions/control_click.py b/tests/wpt/web-platform-tests/webdriver/tests/actions/control_click.py new file mode 100644 index 00000000000..f9d4448dfad --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/actions/control_click.py @@ -0,0 +1,77 @@ +import pytest + +from tests.actions.support.refine import filter_dict, get_events +from tests.actions.support.keys import Keys + + +@pytest.mark.parametrize("modifier, prop", [ + (Keys.CONTROL, "ctrlKey"), + (Keys.R_CONTROL, "ctrlKey"), +]) +def test_control_click(session, test_actions_page, key_chain, mouse_chain, modifier, prop): + os = session.capabilities["platformName"] + key_chain \ + .pause(0) \ + .key_down(modifier) \ + .pause(200) \ + .key_up(modifier) + outer = session.find.css("#outer", all=False) + mouse_chain.click(element=outer) + session.actions.perform([key_chain.dict, mouse_chain.dict]) + if os == "windows_nt": + expected = [ + {"type": "mousemove"}, + {"type": "mousedown"}, + {"type": "mouseup"}, + {"type": "click"}, + ] + else: + expected = [ + {"type": "mousemove"}, + {"type": "mousedown"}, + {"type": "contextmenu"}, + {"type": "mouseup"}, + ] + defaults = { + "altKey": False, + "metaKey": False, + "shiftKey": False, + "ctrlKey": False + } + for e in expected: + e.update(defaults) + if e["type"] != "mousemove": + e[prop] = True + filtered_events = [filter_dict(e, expected[0]) for e in get_events(session)] + assert expected == filtered_events + + +def test_release_control_click(session, key_reporter, key_chain, mouse_chain): + # The context menu stays visible during subsequent tests so let's not + # display it in the first place. + session.execute_script(""" + var keyReporter = document.getElementById("keys"); + document.addEventListener("contextmenu", function(e) { + e.preventDefault(); + }); + """) + key_chain \ + .pause(0) \ + .key_down(Keys.CONTROL) + mouse_chain \ + .pointer_move(0, 0, origin=key_reporter) \ + .pointer_down() + session.actions.perform([key_chain.dict, mouse_chain.dict]) + session.execute_script(""" + var keyReporter = document.getElementById("keys"); + keyReporter.addEventListener("mousedown", recordPointerEvent); + keyReporter.addEventListener("mouseup", recordPointerEvent); + resetEvents(); + """) + session.actions.release() + expected = [ + {"type": "mouseup"}, + {"type": "keyup"}, + ] + events = [filter_dict(e, expected[0]) for e in get_events(session)] + assert events == expected diff --git a/tests/wpt/web-platform-tests/webdriver/tests/actions/key.py b/tests/wpt/web-platform-tests/webdriver/tests/actions/key.py index 9678f8ff9ba..04d46652c1a 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/actions/key.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/actions/key.py @@ -4,6 +4,14 @@ from tests.actions.support.keys import Keys from tests.actions.support.refine import filter_dict, get_keys, get_events +def test_null_response_value(session, key_chain): + value = key_chain.key_up("a").perform() + assert value is None + + value = session.actions.release() + assert value is None + + def test_lone_keyup_sends_no_events(session, key_reporter, key_chain): key_chain.key_up("a").perform() assert len(get_keys(key_reporter)) == 0 diff --git a/tests/wpt/web-platform-tests/webdriver/tests/actions/modifier_click.py b/tests/wpt/web-platform-tests/webdriver/tests/actions/modifier_click.py index 85a23d46642..fbfd837710b 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/actions/modifier_click.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/actions/modifier_click.py @@ -43,12 +43,13 @@ def test_modifier_click(session, test_actions_page, key_chain, mouse_chain, modi def test_many_modifiers_click(session, test_actions_page, key_chain, mouse_chain): outer = session.find.css("#outer", all=False) + dblclick_timeout = 800 key_chain \ .pause(0) \ - .key_down(Keys.CONTROL) \ + .key_down(Keys.ALT) \ .key_down(Keys.SHIFT) \ - .pause(0) \ - .key_up(Keys.CONTROL) \ + .pause(dblclick_timeout) \ + .key_up(Keys.ALT) \ .key_up(Keys.SHIFT) mouse_chain \ .pointer_move(0, 0, origin=outer) \ @@ -61,7 +62,7 @@ def test_many_modifiers_click(session, test_actions_page, key_chain, mouse_chain session.actions.perform([key_chain.dict, mouse_chain.dict]) expected = [ {"type": "mousemove"}, - # shift and ctrl presses + # shift and alt pressed {"type": "mousedown"}, {"type": "mouseup"}, {"type": "click"}, @@ -78,6 +79,6 @@ def test_many_modifiers_click(session, test_actions_page, key_chain, mouse_chain e.update(defaults) for e in expected[1:4]: e["shiftKey"] = True - e["ctrlKey"] = True + e["altKey"] = True events = [filter_dict(e, expected[0]) for e in get_events(session)] assert events == expected diff --git a/tests/wpt/web-platform-tests/webdriver/tests/actions/mouse.py b/tests/wpt/web-platform-tests/webdriver/tests/actions/mouse.py index f8526539b81..acc8d9ef805 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/actions/mouse.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/actions/mouse.py @@ -12,6 +12,14 @@ def link_doc(dest): return inline(content) +def test_null_response_value(session, mouse_chain): + value = mouse_chain.click().perform() + assert value is None + + value = session.actions.release() + assert value is None + + def test_click_at_coordinates(session, test_actions_page, mouse_chain): div_point = { "x": 82, diff --git a/tests/wpt/web-platform-tests/webdriver/tests/add_cookie/add.py b/tests/wpt/web-platform-tests/webdriver/tests/add_cookie/add.py index f865a0827a2..5608cb81e0a 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/add_cookie/add.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/add_cookie/add.py @@ -10,6 +10,20 @@ def add_cookie(session, cookie): {"cookie": cookie}) +def test_null_response_value(session, url): + new_cookie = { + "name": "hello", + "value": "world", + } + + session.url = url("/common/blank.html") + clear_all_cookies(session) + + response = add_cookie(session, new_cookie) + value = assert_success(response) + assert value is None + + def test_add_domain_cookie(session, url, server_config): new_cookie = { "name": "hello", diff --git a/tests/wpt/web-platform-tests/2dcontext/building-paths/.gitkeep b/tests/wpt/web-platform-tests/webdriver/tests/back/__init__.py similarity index 100% rename from tests/wpt/web-platform-tests/2dcontext/building-paths/.gitkeep rename to tests/wpt/web-platform-tests/webdriver/tests/back/__init__.py diff --git a/tests/wpt/web-platform-tests/webdriver/tests/back/back.py b/tests/wpt/web-platform-tests/webdriver/tests/back/back.py new file mode 100644 index 00000000000..bbb353697a4 --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/back/back.py @@ -0,0 +1,16 @@ +from tests.support.inline import inline +from tests.support.asserts import assert_success + + +def back(session): + return session.transport.send( + "POST", "session/{session_id}/back".format(**vars(session))) + + +def test_null_response_value(session): + session.url = inline("
") + session.url = inline("

") + + response = back(session) + value = assert_success(response) + assert value is None diff --git a/tests/wpt/web-platform-tests/webdriver/tests/close_window/close.py b/tests/wpt/web-platform-tests/webdriver/tests/close_window/close.py index ba41b3404c4..57f52c1b9fe 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/close_window/close.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/close_window/close.py @@ -1,4 +1,8 @@ +import pytest +from webdriver import error + from tests.support.asserts import assert_error, assert_success +from tests.support.inline import inline def close(session): @@ -18,15 +22,42 @@ def test_no_browsing_context(session, create_window): def test_close_browsing_context(session, create_window): - handles = session.handles + original_handles = session.handles new_handle = create_window() session.window_handle = new_handle response = close(session) - value = assert_success(response, handles) - assert session.handles == handles - assert new_handle not in value + handles = assert_success(response, original_handles) + assert session.handles == original_handles + assert new_handle not in handles + + +def test_close_browsing_context_with_dismissed_beforeunload_prompt(session, create_window): + original_handles = session.handles + + new_handle = create_window() + session.window_handle = new_handle + + session.url = inline(""" + + + """) + + session.find.css("input", all=False).send_keys("foo") + + response = close(session) + handles = assert_success(response, original_handles) + assert session.handles == original_handles + assert new_handle not in handles + + # A beforeunload prompt has to be automatically dismissed + with pytest.raises(error.NoSuchWindowException): + session.alert.text def test_close_last_browsing_context(session): diff --git a/tests/wpt/web-platform-tests/webdriver/tests/close_window/user_prompts.py b/tests/wpt/web-platform-tests/webdriver/tests/close_window/user_prompts.py index b68ef717432..3507a1731eb 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/close_window/user_prompts.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/close_window/user_prompts.py @@ -1,8 +1,7 @@ # META: timeout=long +import pytest -from tests.support.asserts import assert_error, assert_dialog_handled -from tests.support.fixtures import create_dialog, create_window -from tests.support.inline import inline +from tests.support.asserts import assert_dialog_handled, assert_error, assert_success def close(session): @@ -10,79 +9,46 @@ def close(session): "DELETE", "session/{session_id}/window".format(**vars(session))) -def test_handle_prompt_dismiss_and_notify(): - """TODO""" +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept(session, create_dialog, create_window, dialog_type): + original_handle = session.window_handle + + session.window_handle = create_window() + create_dialog(dialog_type, text="dialog") + + response = close(session) + assert_success(response) + + # Asserting that the dialog was handled requires valid top-level browsing + # context, so we must switch to the original window. + session.window_handle = original_handle + assert_dialog_handled(session, expected_text="dialog") def test_handle_prompt_accept_and_notify(): """TODO""" +def test_handle_prompt_dismiss(): + """TODO""" + + +def test_handle_prompt_dismiss_and_notify(): + """TODO""" + + def test_handle_prompt_ignore(): """TODO""" -def test_handle_prompt_accept(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": { - "alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}}) - original_handle = session.window_handle - - session.window_handle = create_window(session)() - session.url = inline("WD doc title") - - create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") - response = close(session) - assert response.status == 200 - - # Asserting that the dialog was handled requires valid top-level browsing - # context, so we must switch to the original window. - session.window_handle = original_handle - assert_dialog_handled(session, "dismiss #1") - - session.window_handle = create_window(session)() - session.url = inline("WD doc title") - - create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") - response = close(session) - assert response.status == 200 - - # Asserting that the dialog was handled requires valid top-level browsing - # context, so we must switch to the original window. - session.window_handle = original_handle - assert_dialog_handled(session, "dismiss #2") - - session.window_handle = create_window(session)() - session.url = inline("WD doc title") - - create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") - response = close(session) - assert response.status == 200 - - # Asserting that the dialog was handled requires valid top-level browsing - # context, so we must switch to the original window. - session.window_handle = original_handle - assert_dialog_handled(session, "dismiss #3") - - -def test_handle_prompt_missing_value(session, create_dialog, create_window): +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_default(session, create_dialog, create_window, dialog_type): session.window_handle = create_window() - session.url = inline("WD doc title") - create_dialog("alert", text="dismiss #1", result_var="dismiss1") - - response = close(session) - - assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #1") - - create_dialog("confirm", text="dismiss #2", result_var="dismiss2") + create_dialog(dialog_type, text="dialog") response = close(session) assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #2") - create_dialog("prompt", text="dismiss #3", result_var="dismiss3") - - response = close(session) - assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #3") + assert_dialog_handled(session, expected_text="dialog") diff --git a/tests/wpt/web-platform-tests/webdriver/tests/conftest.py b/tests/wpt/web-platform-tests/webdriver/tests/conftest.py index b7b8b83c9a3..683dce73eac 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/conftest.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/conftest.py @@ -1,15 +1,43 @@ import pytest -from tests.support.fixtures import ( - add_browser_capabilites, configuration, create_dialog, create_frame, - create_window, http, new_session, server_config, session, url) -pytest.fixture()(add_browser_capabilites) +from tests.support.fixtures import ( + add_event_listeners, + configuration, + create_dialog, + create_frame, + create_window, + current_session, + http, + server_config, + session, + url) + +def pytest_configure(config): + # register the capabilities marker + config.addinivalue_line("markers", + "capabilities: mark test to use capabilities") + + +@pytest.fixture +def capabilities(): + """Default capabilities to use for a new WebDriver session.""" + return {} + + +def pytest_generate_tests(metafunc): + if "capabilities" in metafunc.fixturenames: + marker = metafunc.definition.get_closest_marker(name="capabilities") + if marker: + metafunc.parametrize("capabilities", marker.args, ids=None) + + +pytest.fixture()(add_event_listeners) pytest.fixture(scope="session")(configuration) pytest.fixture()(create_dialog) pytest.fixture()(create_frame) pytest.fixture()(create_window) +pytest.fixture(scope="function")(current_session) pytest.fixture()(http) -pytest.fixture(scope="function")(new_session) pytest.fixture()(server_config) pytest.fixture(scope="function")(session) pytest.fixture()(url) diff --git a/tests/wpt/web-platform-tests/2dcontext/compositing/.gitkeep b/tests/wpt/web-platform-tests/webdriver/tests/delete_all_cookies/__init__.py similarity index 100% rename from tests/wpt/web-platform-tests/2dcontext/compositing/.gitkeep rename to tests/wpt/web-platform-tests/webdriver/tests/delete_all_cookies/__init__.py diff --git a/tests/wpt/web-platform-tests/webdriver/tests/delete_all_cookies/delete.py b/tests/wpt/web-platform-tests/webdriver/tests/delete_all_cookies/delete.py new file mode 100644 index 00000000000..363797086c9 --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/delete_all_cookies/delete.py @@ -0,0 +1,12 @@ +from tests.support.asserts import assert_success + + +def delete_all_cookies(session): + return session.transport.send( + "DELETE", "/session/{session_id}/cookie".format(**vars(session))) + + +def test_null_response_value(session, url): + response = delete_all_cookies(session) + value = assert_success(response) + assert value is None diff --git a/tests/wpt/web-platform-tests/webdriver/tests/delete_cookie/delete.py b/tests/wpt/web-platform-tests/webdriver/tests/delete_cookie/delete.py index ee53dc3c339..2e79c9ba8e2 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/delete_cookie/delete.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/delete_cookie/delete.py @@ -8,6 +8,12 @@ def delete_cookie(session, name): name=name)) +def test_null_response_value(session, url): + response = delete_cookie(session, "foo") + value = assert_success(response) + assert value is None + + def test_no_browsing_context(session, create_window): session.window_handle = create_window() session.close() diff --git a/tests/wpt/web-platform-tests/webdriver/tests/delete_cookie/user_prompts.py b/tests/wpt/web-platform-tests/webdriver/tests/delete_cookie/user_prompts.py index 46bc3757a63..5b4b1f0afca 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/delete_cookie/user_prompts.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/delete_cookie/user_prompts.py @@ -1,101 +1,44 @@ -from tests.support.asserts import assert_error, assert_dialog_handled -from tests.support.fixtures import create_dialog -from tests.support.inline import inline +import pytest + +from tests.support.asserts import assert_dialog_handled, assert_error, assert_success def delete_cookie(session, name): return session.transport.send("DELETE", "/session/%s/cookie/%s" % (session.session_id, name)) -def test_handle_prompt_dismiss_and_notify(): - """TODO""" +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept(session, create_dialog, dialog_type): + create_dialog(dialog_type, text="dialog") + + response = delete_cookie(session, "foo") + assert_success(response) + + assert_dialog_handled(session, expected_text="dialog") def test_handle_prompt_accept_and_notify(): """TODO""" +def test_handle_prompt_dismiss(): + """TODO""" + + +def test_handle_prompt_dismiss_and_notify(): + """TODO""" + + def test_handle_prompt_ignore(): """TODO""" -def test_handle_prompt_accept(new_session, add_browser_capabilites): - """ - 2. Handle any user prompts and return its value if it is an error. - - [...] - - In order to handle any user prompts a remote end must take the - following steps: - - [...] - - 2. Perform the following substeps based on the current session's - user prompt handler: - - [...] - - - accept state - Accept the current user prompt. - - """ - _, session = new_session({"capabilities": { - "alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}}) - session.url = inline("WD doc title") - - create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") - response = delete_cookie(session, "foo") - assert response.status == 200 - assert_dialog_handled(session, "dismiss #1") - - create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") - response = delete_cookie(session, "foo") - assert response.status == 200 - assert_dialog_handled(session, "dismiss #2") - - create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") - response = delete_cookie(session, "foo") - assert response.status == 200 - assert_dialog_handled(session, "dismiss #3") - - -def test_handle_prompt_missing_value(session, create_dialog): - """ - 2. Handle any user prompts and return its value if it is an error. - - [...] - - In order to handle any user prompts a remote end must take the - following steps: - - [...] - - 2. Perform the following substeps based on the current session's - user prompt handler: - - [...] - - - missing value default state - 1. Dismiss the current user prompt. - 2. Return error with error code unexpected alert open. - - """ - session.url = inline("WD doc title") - create_dialog("alert", text="dismiss #1", result_var="dismiss1") - - response = delete_cookie(session, "foo") - - assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #1") - - create_dialog("confirm", text="dismiss #2", result_var="dismiss2") +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_default(session, create_dialog, dialog_type): + create_dialog(dialog_type, text="dialog") response = delete_cookie(session, "foo") assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #2") - create_dialog("prompt", text="dismiss #3", result_var="dismiss3") - - response = delete_cookie(session, "foo") - assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #3") + assert_dialog_handled(session, expected_text="dialog") diff --git a/tests/wpt/web-platform-tests/2dcontext/conformance-requirements/.gitkeep b/tests/wpt/web-platform-tests/webdriver/tests/delete_session/__init__.py similarity index 100% rename from tests/wpt/web-platform-tests/2dcontext/conformance-requirements/.gitkeep rename to tests/wpt/web-platform-tests/webdriver/tests/delete_session/__init__.py diff --git a/tests/wpt/web-platform-tests/webdriver/tests/delete_session/delete.py b/tests/wpt/web-platform-tests/webdriver/tests/delete_session/delete.py new file mode 100644 index 00000000000..835f2525792 --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/delete_session/delete.py @@ -0,0 +1,42 @@ +import pytest +from webdriver import error + +from tests.support.asserts import assert_success +from tests.support.inline import inline + + +def delete_session(session): + return session.transport.send("DELETE", "session/{session_id}".format(**vars(session))) + + +def test_null_response_value(session): + response = delete_session(session) + value = assert_success(response) + assert value is None + # Need an explicit call to session.end() to notify the test harness + # that a new session needs to be created for subsequent tests. + session.end() + + +def test_dismissed_beforeunload_prompt(session): + session.url = inline(""" + + + """) + + session.find.css("input", all=False).send_keys("foo") + + response = delete_session(session) + assert_success(response) + + # A beforeunload prompt has to be automatically dismissed, and the session deleted + with pytest.raises(error.InvalidSessionIdException): + session.alert.text + + # Need an explicit call to session.end() to notify the test harness + # that a new session needs to be created for subsequent tests. + session.end() diff --git a/tests/wpt/web-platform-tests/webdriver/tests/dismiss_alert/dismiss.py b/tests/wpt/web-platform-tests/webdriver/tests/dismiss_alert/dismiss.py index 6c06c43b75b..ebd95e4fbb1 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/dismiss_alert/dismiss.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/dismiss_alert/dismiss.py @@ -7,7 +7,13 @@ def dismiss_alert(session): "POST", "session/{session_id}/alert/dismiss".format(**vars(session))) -# 18.1 Dismiss Alert +def test_null_response_value(session, url): + session.url = inline("") + + response = dismiss_alert(session) + value = assert_success(response) + assert value is None + def test_no_browsing_context(session, create_window): # 18.1 step 1 diff --git a/tests/wpt/web-platform-tests/webdriver/tests/element_clear/clear.py b/tests/wpt/web-platform-tests/webdriver/tests/element_clear/clear.py index ddf37ee671e..a882ba7d04f 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/element_clear/clear.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/element_clear/clear.py @@ -5,11 +5,22 @@ import pytest from tests.support.asserts import ( assert_element_has_focus, assert_error, + assert_events_equal, + assert_in_events, assert_success, ) from tests.support.inline import inline +@pytest.fixture +def tracked_events(): + return [ + "blur", + "change", + "focus", + ] + + def element_clear(session, element): return session.transport.send( "POST", "/session/{session_id}/element/{element_id}/clear".format( @@ -17,23 +28,6 @@ def element_clear(session, element): element_id=element.id)) -def add_event_listeners(element): - element.session.execute_script(""" - var target = arguments[0]; - window.events = []; - var expectedEvents = ["focus", "blur", "change"]; - for (var i = 0; i < expectedEvents.length; i++) { - target.addEventListener(expectedEvents[i], function (eventObject) { - window.events.push(eventObject.type) - }); - } - """, args=(element,)) - - -def get_events(session): - return session.execute_script("return window.events") - - @pytest.fixture(scope="session") def text_file(tmpdir_factory): fh = tmpdir_factory.mktemp("tmp").join("hello.txt") @@ -41,6 +35,15 @@ def text_file(tmpdir_factory): return fh +def test_null_response_value(session): + session.url = inline("") + element = session.find.css("input", all=False) + + response = element_clear(session, element) + value = assert_success(response) + assert value is None + + def test_closed_context(session, create_window): new_window = create_window() session.window_handle = new_window @@ -106,19 +109,16 @@ def test_keyboard_interactable(session): ("time", "19:48", ""), ("month", "2017-11", ""), ("week", "2017-W52", "")]) -def test_input(session, type, value, default): +def test_input(session, add_event_listeners, tracked_events, type, value, default): session.url = inline("" % (type, value)) element = session.find.css("input", all=False) - add_event_listeners(element) + add_event_listeners(element, tracked_events) assert element.property("value") == value response = element_clear(session, element) assert_success(response) assert element.property("value") == default - events = get_events(session) - assert "focus" in events - assert "change" in events - assert "blur" in events + assert_in_events(session, ["focus", "change", "blur"]) assert_element_has_focus(session.execute_script("return document.body")) @@ -172,19 +172,16 @@ def test_input_readonly(session, type): assert_error(response, "invalid element state") -def test_textarea(session): +def test_textarea(session, add_event_listeners, tracked_events): session.url = inline("") element = session.find.css("textarea", all=False) - add_event_listeners(element) + add_event_listeners(element, tracked_events) assert element.property("value") == "foobar" response = element_clear(session, element) assert_success(response) assert element.property("value") == "" - events = get_events(session) - assert "focus" in events - assert "change" in events - assert "blur" in events + assert_in_events(session, ["focus", "change", "blur"]) def test_textarea_disabled(session): @@ -264,16 +261,16 @@ def test_button_with_subtree(session): assert_error(response, "element not interactable") -def test_contenteditable(session): +def test_contenteditable(session, add_event_listeners, tracked_events): session.url = inline("

foobar

") element = session.find.css("p", all=False) - add_event_listeners(element) + add_event_listeners(element, tracked_events) assert element.property("innerHTML") == "foobar" response = element_clear(session, element) assert_success(response) assert element.property("innerHTML") == "" - assert get_events(session) == ["focus", "change", "blur"] + assert_events_equal(session, ["focus", "change", "blur"]) assert_element_has_focus(session.execute_script("return document.body")) @@ -289,16 +286,16 @@ def test_designmode(session): assert_element_has_focus(session.execute_script("return document.body")) -def test_resettable_element_focus_when_empty(session): +def test_resettable_element_focus_when_empty(session, add_event_listeners, tracked_events): session.url = inline("") element = session.find.css("input", all=False) - add_event_listeners(element) + add_event_listeners(element, tracked_events) assert element.property("value") == "" response = element_clear(session, element) assert_success(response) assert element.property("value") == "" - assert get_events(session) == [] + assert_events_equal(session, []) @pytest.mark.parametrize("type,invalid_value", diff --git a/tests/wpt/web-platform-tests/webdriver/tests/element_click/click.py b/tests/wpt/web-platform-tests/webdriver/tests/element_click/click.py new file mode 100644 index 00000000000..ca8940c7c70 --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/element_click/click.py @@ -0,0 +1,18 @@ +from tests.support.asserts import assert_success +from tests.support.inline import inline + + +def element_click(session, element): + return session.transport.send( + "POST", "session/{session_id}/element/{element_id}/click".format( + session_id=session.session_id, + element_id=element.id)) + + +def test_null_response_value(session): + session.url = inline("

foo") + element = session.find.css("p", all=False) + + response = element_click(session, element) + value = assert_success(response) + assert value is None diff --git a/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/conftest.py b/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/conftest.py new file mode 100644 index 00000000000..54fd9d9dc01 --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/conftest.py @@ -0,0 +1,29 @@ +import pytest + + +@pytest.fixture +def create_file(tmpdir_factory): + def inner(filename): + fh = tmpdir_factory.mktemp("tmp").join(filename) + fh.write(filename) + + return fh + + inner.__name__ = "create_file" + return inner + + +@pytest.fixture +def create_files(tmpdir_factory): + def inner(filenames): + filelist = [] + tmpdir = tmpdir_factory.mktemp("tmp") + for filename in filenames: + fh = tmpdir.join(filename) + fh.write(filename) + filelist.append(fh) + + return filelist + + inner.__name__ = "create_files" + return inner diff --git a/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/events.py b/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/events.py new file mode 100644 index 00000000000..01c6e0924a4 --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/events.py @@ -0,0 +1,85 @@ +import pytest + +from tests.support.asserts import ( + assert_element_has_focus, + assert_events_equal, + assert_success, +) + +from tests.support.inline import inline + + +@pytest.fixture +def tracked_events(): + return [ + "blur", + "change", + "focus", + "input", + "keydown", + "keypress", + "keyup", + ] + + +def element_send_keys(session, element, text): + return session.transport.send( + "POST", "/session/{session_id}/element/{element_id}/value".format( + session_id=session.session_id, + element_id=element.id), + {"text": text}) + + +def test_file_upload(session, create_file, add_event_listeners, tracked_events): + expected_events = [ + "input", + "change", + ] + + single_file = create_file("foo") + + session.url = inline("") + element = session.find.css("input", all=False) + add_event_listeners(element, tracked_events) + + response = element_send_keys(session, element, str(single_file)) + assert_success(response) + + assert_events_equal(session, expected_events) + + +@pytest.mark.parametrize("tag", ["input", "textarea"]) +def test_form_control_send_text(session, add_event_listeners, tracked_events, tag): + expected_events = [ + "focus", + "keydown", + "keypress", + "input", + "keyup", + "keydown", + "keypress", + "input", + "keyup", + "keydown", + "keypress", + "input", + "keyup", + ] + + session.url = inline("<%s>" % tag) + element = session.find.css(tag, all=False) + add_event_listeners(element, tracked_events) + + response = element_send_keys(session, element, "foo") + assert_success(response) + assert_events_equal(session, expected_events) + + +@pytest.mark.parametrize("tag", ["input", "textarea"]) +def test_not_blurred(session, tag): + session.url = inline("<%s>" % tag) + element = session.find.css(tag, all=False) + + response = element_send_keys(session, element, "") + assert_success(response) + assert_element_has_focus(element) diff --git a/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/file_upload.py b/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/file_upload.py new file mode 100644 index 00000000000..0f2d85c3e3f --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/file_upload.py @@ -0,0 +1,174 @@ +from tests.support.asserts import assert_error, assert_files_uploaded, assert_success +from tests.support.inline import inline + + +def map_files_to_multiline_text(files): + return "\n".join(map(lambda f: str(f), files)) + + +def element_send_keys(session, element, text): + return session.transport.send( + "POST", "/session/{session_id}/element/{element_id}/value".format( + session_id=session.session_id, + element_id=element.id), + {"text": text}) + + +def test_empty_text(session): + session.url = inline("") + element = session.find.css("input", all=False) + + response = element_send_keys(session, element, "") + assert_error(response, "invalid argument") + + +def test_multiple_files(session, create_files): + files = create_files(["foo", "bar"]) + + session.url = inline("") + element = session.find.css("input", all=False) + + response = element_send_keys(session, element, + map_files_to_multiline_text(files)) + assert_success(response) + + assert_files_uploaded(session, element, files) + + +def test_multiple_files_multiple_directories(session, create_file): + files = [create_file("foo"), create_file("bar")] + + session.url = inline("") + element = session.find.css("input", all=False) + + response = element_send_keys(session, element, + map_files_to_multiline_text(files)) + assert_success(response) + + assert_files_uploaded(session, element, files) + + +def test_multiple_files_last_path_not_found(session, create_files): + files = create_files(["foo", "bar"]) + files.append("foo bar") + + session.url = inline("") + element = session.find.css("input", all=False) + + response = element_send_keys(session, element, + map_files_to_multiline_text(files)) + assert_error(response, "invalid argument") + + assert_files_uploaded(session, element, []) + + +def test_multiple_files_without_multiple_attribute(session, create_files): + files = create_files(["foo", "bar"]) + + session.url = inline("") + element = session.find.css("input", all=False) + + response = element_send_keys(session, element, + map_files_to_multiline_text(files)) + assert_error(response, "invalid argument") + + assert_files_uploaded(session, element, []) + + +def test_multiple_files_send_twice(session, create_files): + first_files = create_files(["foo", "bar"]) + second_files = create_files(["john", "doe"]) + + session.url = inline("") + element = session.find.css("input", all=False) + + response = element_send_keys(session, element, + map_files_to_multiline_text(first_files)) + assert_success(response) + + response = element_send_keys(session, element, + map_files_to_multiline_text(second_files)) + assert_success(response) + + assert_files_uploaded(session, element, first_files + second_files) + + +def test_multiple_files_reset_with_element_clear(session, create_files): + first_files = create_files(["foo", "bar"]) + second_files = create_files(["john", "doe"]) + + session.url = inline("") + element = session.find.css("input", all=False) + + response = element_send_keys(session, element, + map_files_to_multiline_text(first_files)) + assert_success(response) + + # Reset already uploaded files + element.clear() + assert_files_uploaded(session, element, []) + + response = element_send_keys(session, element, + map_files_to_multiline_text(second_files)) + assert_success(response) + + assert_files_uploaded(session, element, second_files) + + +def test_single_file(session, create_file): + single_file = create_file("foo") + + session.url = inline("") + element = session.find.css("input", all=False) + + response = element_send_keys(session, element, str(single_file)) + assert_success(response) + + assert_files_uploaded(session, element, [single_file]) + + +def test_single_file_replaces_without_multiple_attribute(session, create_file): + first_file = create_file("foo") + second_file = create_file("bar") + + session.url = inline("") + element = session.find.css("input", all=False) + + response = element_send_keys(session, element, str(first_file)) + assert_success(response) + + response = element_send_keys(session, element, str(second_file)) + assert_success(response) + + assert_files_uploaded(session, element, [second_file]) + + +def test_single_file_appends_with_multiple_attribute(session, create_files): + files = create_files(["foo", "bar"]) + + session.url = inline("") + element = session.find.css("input", all=False) + + response = element_send_keys(session, element, str(files[0])) + assert_success(response) + + response = element_send_keys(session, element, str(files[1])) + assert_success(response) + + assert_files_uploaded(session, element, files) + + +def test_single_file_multiple_directory_appends_with_multiple_attribute(session, create_file): + first_file = create_file("foo") + second_file = create_file("bar") + + session.url = inline("") + element = session.find.css("input", all=False) + + response = element_send_keys(session, element, str(first_file)) + assert_success(response) + + response = element_send_keys(session, element, str(second_file)) + assert_success(response) + + assert_files_uploaded(session, element, [first_file, second_file]) diff --git a/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/form_controls.py b/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/form_controls.py index a3ff6880447..e53d0610f1e 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/form_controls.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/form_controls.py @@ -1,15 +1,8 @@ -import pytest - -from tests.support.asserts import ( - assert_element_has_focus, - assert_error, - assert_same_element, - assert_success, -) +from tests.support.asserts import assert_element_has_focus from tests.support.inline import inline -def send_keys_to_element(session, element, text): +def element_send_keys(session, element, text): return session.transport.send( "POST", "/session/{session_id}/element/{element_id}/value".format( session_id=session.session_id, @@ -17,26 +10,12 @@ def send_keys_to_element(session, element, text): {"text": text}) -def add_event_listeners(element): - element.session.execute_script(""" - window.events = []; - var trackedEvents = ["focus", "change", "keypress", "keydown", "keyup", "input"]; - for (var i = 0; i < trackedEvents.length; i++) { - arguments[0].addEventListener(trackedEvents[i], function(eventObject) { window.events.push(eventObject.type) }); - } - """, args=(element,)) - - -def get_events(session): - return session.execute_script("return window.events") - - def test_input(session): session.url = inline("") element = session.find.css("input", all=False) assert element.property("value") == "" - send_keys_to_element(session, element, "foo") + element_send_keys(session, element, "foo") assert element.property("value") == "foo" assert_element_has_focus(element) @@ -46,7 +25,7 @@ def test_textarea(session): element = session.find.css("textarea", all=False) assert element.property("value") == "" - send_keys_to_element(session, element, "foo") + element_send_keys(session, element, "foo") assert element.property("value") == "foo" assert_element_has_focus(element) @@ -56,10 +35,10 @@ def test_input_append(session): element = session.find.css("input", all=False) assert element.property("value") == "a" - send_keys_to_element(session, element, "b") + element_send_keys(session, element, "b") assert element.property("value") == "ab" - send_keys_to_element(session, element, "c") + element_send_keys(session, element, "c") assert element.property("value") == "abc" @@ -68,40 +47,8 @@ def test_textarea_append(session): element = session.find.css("textarea", all=False) assert element.property("value") == "a" - send_keys_to_element(session, element, "b") + element_send_keys(session, element, "b") assert element.property("value") == "ab" - send_keys_to_element(session, element, "c") + element_send_keys(session, element, "c") assert element.property("value") == "abc" - - -@pytest.mark.parametrize("tag", ["input", "textarea"]) -def test_events(session, tag): - session.url = inline("<%s>" % tag) - element = session.find.css(tag, all=False) - add_event_listeners(element) - - send_keys_to_element(session, element, "foo") - assert element.property("value") == "foo" - assert get_events(session) == ["focus", - "keydown", - "keypress", - "input", - "keyup", - "keydown", - "keypress", - "input", - "keyup", - "keydown", - "keypress", - "input", - "keyup"] - - -@pytest.mark.parametrize("tag", ["input", "textarea"]) -def test_not_blurred(session, tag): - session.url = inline("<%s>" % tag) - element = session.find.css(tag, all=False) - - send_keys_to_element(session, element, "") - assert_element_has_focus(element) diff --git a/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/send_keys.py b/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/send_keys.py new file mode 100644 index 00000000000..e086a16332c --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/send_keys.py @@ -0,0 +1,52 @@ +import pytest + +from tests.support.asserts import assert_error, assert_success +from tests.support.inline import inline + + +def element_send_keys(session, element, text): + return session.transport.send( + "POST", "/session/{session_id}/element/{element_id}/value".format( + session_id=session.session_id, + element_id=element.id), + {"text": text}) + + +def test_null_response_value(session): + session.url = inline("") + element = session.find.css("input", all=False) + + response = element_send_keys(session, element, "foo") + value = assert_success(response) + assert value is None + + +@pytest.mark.parametrize("value", [True, None, 1, [], {}]) +def test_invalid_text_type(session, value): + session.url = inline("") + element = session.find.css("input", all=False) + + response = element_send_keys(session, element, value) + assert_error(response, "invalid argument") + + +def test_no_browsing_context(session, create_window): + session.window_handle = create_window() + + session.url = inline("") + element = session.find.css("input", all=False) + + session.close() + + response = element_send_keys(session, element, "foo") + assert_error(response, "no such window") + + +def test_stale_element(session): + session.url = inline("") + element = session.find.css("input", all=False) + + session.refresh() + + response = element_send_keys(session, element, "foo") + assert_error(response, "stale element reference") diff --git a/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/user_prompts.py b/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/user_prompts.py new file mode 100644 index 00000000000..d2b096bc8bf --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/element_send_keys/user_prompts.py @@ -0,0 +1,55 @@ +import pytest + +from tests.support.asserts import assert_dialog_handled, assert_error, assert_success +from tests.support.inline import inline + + +def element_send_keys(session, element, text): + return session.transport.send( + "POST", "/session/{session_id}/element/{element_id}/value".format( + session_id=session.session_id, + element_id=element.id), + {"text": text}) + + +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept(session, create_dialog, dialog_type): + session.url = inline("") + element = session.find.css("input", all=False) + + create_dialog(dialog_type, text="dialog") + + response = element_send_keys(session, element, "foo") + assert_success(response) + + assert_dialog_handled(session, expected_text="dialog") + + +def test_handle_prompt_accept_and_notify(): + """TODO""" + + +def test_handle_prompt_dismiss(): + """TODO""" + + +def test_handle_prompt_dismiss_and_notify(): + """TODO""" + + +def test_handle_prompt_ignore(): + """TODO""" + + +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_default(session, create_dialog, dialog_type): + session.url = inline("") + element = session.find.css("input", all=False) + + create_dialog(dialog_type, text="dialog") + + response = element_send_keys(session, element, "foo") + assert_error(response, "unexpected alert open") + + assert_dialog_handled(session, expected_text="dialog") diff --git a/tests/wpt/web-platform-tests/webdriver/tests/execute_async_script/user_prompts.py b/tests/wpt/web-platform-tests/webdriver/tests/execute_async_script/user_prompts.py index 7daf2a99662..6d436340184 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/execute_async_script/user_prompts.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/execute_async_script/user_prompts.py @@ -1,3 +1,5 @@ +# META: timeout=long + import pytest from webdriver import error @@ -15,10 +17,10 @@ def execute_async_script(session, script, args=None): body) -def test_handle_prompt_accept(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}}) - - response = execute_async_script(session, "window.alert('Hello');") +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept(session, dialog_type): + response = execute_async_script(session, "window.{}('Hello');".format(dialog_type)) assert_success(response, None) session.title @@ -26,33 +28,10 @@ def test_handle_prompt_accept(new_session, add_browser_capabilites): session.alert.accept() -def test_handle_prompt_dismiss(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "dismiss"})}}) - - response = execute_async_script(session, "window.alert('Hello');") - assert_success(response, None) - - session.title - with pytest.raises(error.NoSuchAlertException): - session.alert.dismiss() - - -def test_handle_prompt_dismiss_and_notify(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "dismiss and notify"})}}) - - response = execute_async_script(session, "window.alert('Hello');") - assert_success(response, None) - - with pytest.raises(error.UnexpectedAlertOpenException): - session.title - with pytest.raises(error.NoSuchAlertException): - session.alert.dismiss() - - -def test_handle_prompt_accept_and_notify(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept and notify"})}}) - - response = execute_async_script(session, "window.alert('Hello');") +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept_and_notify(session, dialog_type): + response = execute_async_script(session, "window.{}('Hello');".format(dialog_type)) assert_success(response, None) with pytest.raises(error.UnexpectedAlertOpenException): @@ -61,10 +40,33 @@ def test_handle_prompt_accept_and_notify(new_session, add_browser_capabilites): session.alert.accept() -def test_handle_prompt_ignore(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "ignore"})}}) +@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_dismiss(session, dialog_type): + response = execute_async_script(session, "window.{}('Hello');".format(dialog_type)) + assert_success(response, None) - response = execute_async_script(session, "window.alert('Hello');") + session.title + with pytest.raises(error.NoSuchAlertException): + session.alert.dismiss() + + +@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_dismiss_and_notify(session, dialog_type): + response = execute_async_script(session, "window.{}('Hello');".format(dialog_type)) + assert_success(response, None) + + with pytest.raises(error.UnexpectedAlertOpenException): + session.title + with pytest.raises(error.NoSuchAlertException): + session.alert.dismiss() + + +@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_ignore(session, dialog_type): + response = execute_async_script(session, "window.{}('Hello');".format(dialog_type)) assert_success(response, None) with pytest.raises(error.UnexpectedAlertOpenException): @@ -72,10 +74,9 @@ def test_handle_prompt_ignore(new_session, add_browser_capabilites): session.alert.dismiss() -def test_handle_prompt_default(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({})}}) - - response = execute_async_script(session, "window.alert('Hello');") +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_default(session, dialog_type): + response = execute_async_script(session, "window.{}('Hello');".format(dialog_type)) assert_success(response, None) with pytest.raises(error.UnexpectedAlertOpenException): @@ -84,10 +85,11 @@ def test_handle_prompt_default(new_session, add_browser_capabilites): session.alert.dismiss() -def test_handle_prompt_twice(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}}) - - response = execute_async_script(session, "window.alert('Hello');window.alert('Bye');") +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_twice(session, dialog_type): + response = execute_async_script( + session, "window.{0}('Hello');window.{0}('Bye');".format(dialog_type)) assert_success(response, None) session.alert.dismiss() diff --git a/tests/wpt/web-platform-tests/webdriver/tests/execute_script/cyclic.py b/tests/wpt/web-platform-tests/webdriver/tests/execute_script/cyclic.py index bc52b473685..16bdcdd1dea 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/execute_script/cyclic.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/execute_script/cyclic.py @@ -1,4 +1,5 @@ -from tests.support.asserts import assert_error +from tests.support.asserts import assert_error, assert_same_element, assert_success +from tests.support.inline import inline def execute_script(session, script, args=None): @@ -46,3 +47,30 @@ def test_object_in_array(session): return [obj]; """) assert_error(response, "javascript error") + + +def test_element_in_collection(session): + session.url = inline("

") + divs = session.find.css("div") + + response = execute_script(session, """ + let div = document.querySelector("div"); + div.reference = div; + return [div]; + """) + value = assert_success(response) + for expected, actual in zip(divs, value): + assert_same_element(session, expected, actual) + + +def test_element_in_object(session): + session.url = inline("
") + div = session.find.css("div", all=False) + + response = execute_script(session, """ + let div = document.querySelector("div"); + div.reference = div; + return {foo: div}; + """) + value = assert_success(response) + assert_same_element(session, div, value["foo"]) diff --git a/tests/wpt/web-platform-tests/webdriver/tests/execute_script/user_prompts.py b/tests/wpt/web-platform-tests/webdriver/tests/execute_script/user_prompts.py index a4cc680de98..1a20dbf7744 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/execute_script/user_prompts.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/execute_script/user_prompts.py @@ -1,3 +1,5 @@ +# META: timeout=long + import pytest from webdriver import error @@ -16,10 +18,10 @@ def execute_script(session, script, args=None): body) -def test_handle_prompt_accept(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}}) - - response = execute_script(session, "window.alert('Hello');") +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept(session, dialog_type): + response = execute_script(session, "window.{}('Hello');".format(dialog_type)) assert_success(response, None) session.title @@ -27,33 +29,10 @@ def test_handle_prompt_accept(new_session, add_browser_capabilites): session.alert.accept() -def test_handle_prompt_dismiss(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "dismiss"})}}) - - response = execute_script(session, "window.alert('Hello');") - assert_success(response, None) - - session.title - with pytest.raises(error.NoSuchAlertException): - session.alert.dismiss() - - -def test_handle_prompt_dismiss_and_notify(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "dismiss and notify"})}}) - - response = execute_script(session, "window.alert('Hello');") - assert_success(response, None) - - with pytest.raises(error.UnexpectedAlertOpenException): - session.title - with pytest.raises(error.NoSuchAlertException): - session.alert.dismiss() - - -def test_handle_prompt_accept_and_notify(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept and notify"})}}) - - response = execute_script(session, "window.alert('Hello');") +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept_and_notify(session, dialog_type): + response = execute_script(session, "window.{}('Hello');".format(dialog_type)) assert_success(response, None) with pytest.raises(error.UnexpectedAlertOpenException): @@ -62,10 +41,33 @@ def test_handle_prompt_accept_and_notify(new_session, add_browser_capabilites): session.alert.accept() -def test_handle_prompt_ignore(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "ignore"})}}) +@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_dismiss(session, dialog_type): + response = execute_script(session, "window.{}('Hello');".format(dialog_type)) + assert_success(response, None) - response = execute_script(session, "window.alert('Hello');") + session.title + with pytest.raises(error.NoSuchAlertException): + session.alert.dismiss() + + +@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_dismiss_and_notify(session, dialog_type): + response = execute_script(session, "window.{}('Hello');".format(dialog_type)) + assert_success(response, None) + + with pytest.raises(error.UnexpectedAlertOpenException): + session.title + with pytest.raises(error.NoSuchAlertException): + session.alert.dismiss() + + +@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_ignore(session, dialog_type): + response = execute_script(session, "window.{}('Hello');".format(dialog_type)) assert_success(response, None) with pytest.raises(error.UnexpectedAlertOpenException): @@ -73,10 +75,9 @@ def test_handle_prompt_ignore(new_session, add_browser_capabilites): session.alert.dismiss() -def test_handle_prompt_default(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({})}}) - - response = execute_script(session, "window.alert('Hello');") +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_default(session, dialog_type): + response = execute_script(session, "window.{}('Hello');".format(dialog_type)) assert_success(response, None) with pytest.raises(error.UnexpectedAlertOpenException): @@ -85,10 +86,11 @@ def test_handle_prompt_default(new_session, add_browser_capabilites): session.alert.dismiss() -def test_handle_prompt_twice(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}}) - - response = execute_script(session, "window.alert('Hello');window.alert('Bye');") +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_twice(session, dialog_type): + response = execute_script( + session, "window.{0}('Hello');window.{0}('Bye');".format(dialog_type)) assert_success(response, None) session.alert.dismiss() diff --git a/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/.gitkeep b/tests/wpt/web-platform-tests/webdriver/tests/forward/__init__.py similarity index 100% rename from tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/.gitkeep rename to tests/wpt/web-platform-tests/webdriver/tests/forward/__init__.py diff --git a/tests/wpt/web-platform-tests/webdriver/tests/forward/forward.py b/tests/wpt/web-platform-tests/webdriver/tests/forward/forward.py new file mode 100644 index 00000000000..3f59143a4d6 --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/forward/forward.py @@ -0,0 +1,17 @@ +from tests.support.inline import inline +from tests.support.asserts import assert_success + + +def forward(session): + return session.transport.send( + "POST", "session/{session_id}/forward".format(**vars(session))) + + +def test_null_response_value(session): + session.url = inline("
") + session.url = inline("

") + session.back() + + response = forward(session) + value = assert_success(response) + assert value is None diff --git a/tests/wpt/web-platform-tests/webdriver/tests/fullscreen_window/user_prompts.py b/tests/wpt/web-platform-tests/webdriver/tests/fullscreen_window/user_prompts.py index 421ce8105f1..e1f03c0d4d1 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/fullscreen_window/user_prompts.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/fullscreen_window/user_prompts.py @@ -1,116 +1,44 @@ -from tests.support.asserts import assert_error, assert_dialog_handled -from tests.support.fixtures import create_dialog -from tests.support.inline import inline +import pytest - -def read_global(session, name): - return session.execute_script("return %s;" % name) +from tests.support.asserts import assert_dialog_handled, assert_error, assert_success def fullscreen(session): return session.transport.send("POST", "session/%s/window/fullscreen" % session.session_id) -def test_handle_prompt_dismiss_and_notify(): - """TODO""" +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept(session, create_dialog, dialog_type): + create_dialog(dialog_type, text="dialog") + + response = fullscreen(session) + assert_success(response) + + assert_dialog_handled(session, expected_text="dialog") def test_handle_prompt_accept_and_notify(): """TODO""" +def test_handle_prompt_dismiss(): + """TODO""" + + +def test_handle_prompt_dismiss_and_notify(): + """TODO""" + + def test_handle_prompt_ignore(): """TODO""" -def test_handle_prompt_accept(new_session, add_browser_capabilites): - """ - 2. Handle any user prompts and return its value if it is an error. - - [...] - - In order to handle any user prompts a remote end must take the - following steps: - - [...] - - 2. Perform the following substeps based on the current session's - user prompt handler: - - [...] - - - accept state - Accept the current user prompt. - - """ - _, session = new_session({"capabilities": { - "alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}}) - session.url = inline("WD doc title") - create_dialog(session)("alert", text="accept #1", result_var="accept1") - - fullscreen(session) - - assert_dialog_handled(session, "accept #1") - assert read_global(session, "accept1") is None - - read_global(session, "document.title") - create_dialog(session)("confirm", text="accept #2", result_var="accept2") - - fullscreen(session) - - assert_dialog_handled(session, "accept #2") - assert read_global(session, "accept2"), True - - create_dialog(session)("prompt", text="accept #3", result_var="accept3") - - fullscreen(session) - - assert_dialog_handled(session, "accept #3") - assert read_global(session, "accept3") == "" or read_global(session, "accept3") == "undefined" - - -def test_handle_prompt_missing_value(session, create_dialog): - """ - 2. Handle any user prompts and return its value if it is an error. - - [...] - - In order to handle any user prompts a remote end must take the - following steps: - - [...] - - 2. Perform the following substeps based on the current session's - user prompt handler: - - [...] - - - missing value default state - 1. Dismiss the current user prompt. - 2. Return error with error code unexpected alert open. - - """ - session.url = inline("WD doc title") - create_dialog("alert", text="dismiss #1", result_var="dismiss1") +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_default(session, create_dialog, dialog_type): + create_dialog(dialog_type, text="dialog") response = fullscreen(session) - assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #1") - assert read_global(session, "dismiss1") is None - create_dialog("confirm", text="dismiss #2", result_var="dismiss2") - - response = fullscreen(session) - - assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #2") - assert read_global(session, "dismiss2") is False - - create_dialog("prompt", text="dismiss #3", result_var="dismiss3") - - response = fullscreen(session) - - assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #3") - assert read_global(session, "dismiss3") is None + assert_dialog_handled(session, expected_text="dialog") diff --git a/tests/wpt/web-platform-tests/webdriver/tests/get_current_url/user_prompts.py b/tests/wpt/web-platform-tests/webdriver/tests/get_current_url/user_prompts.py index 8bf2867078b..bae2778bd32 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/get_current_url/user_prompts.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/get_current_url/user_prompts.py @@ -1,77 +1,50 @@ -from tests.support.asserts import assert_error, assert_dialog_handled -from tests.support.fixtures import create_dialog +import pytest + +from tests.support.asserts import assert_dialog_handled, assert_error, assert_success from tests.support.inline import inline -def read_global(session, name): - return session.execute_script("return %s;" % name) - - def get_current_url(session): return session.transport.send("GET", "session/%s/url" % session.session_id) -def test_handle_prompt_dismiss_and_notify(): - """TODO""" +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept(session, create_dialog, dialog_type): + session.url = inline("WD doc title") + expected_url = session.url + + create_dialog(dialog_type, text="dialog") + + response = get_current_url(session) + assert_success(response, expected_url) + + assert_dialog_handled(session, expected_text="dialog") def test_handle_prompt_accept_and_notify(): """TODO""" +def test_handle_prompt_dismiss(): + """TODO""" + + +def test_handle_prompt_dismiss_and_notify(): + """TODO""" + + def test_handle_prompt_ignore(): """TODO""" -def test_handle_prompt_accept(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": { - "alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_default(session, create_dialog, dialog_type): session.url = inline("WD doc title") - create_dialog(session)("alert", text="accept #1", result_var="accept1") - get_current_url(session) - - assert_dialog_handled(session, "accept #1") - assert read_global(session, "accept1") is None - - read_global(session, "document.title") - create_dialog(session)("confirm", text="accept #2", result_var="accept2") - - get_current_url(session) - - assert_dialog_handled(session, "accept #2") - assert read_global(session, "accept2"), True - - create_dialog(session)("prompt", text="accept #3", result_var="accept3") - - get_current_url(session) - - assert_dialog_handled(session, "accept #3") - assert read_global(session, "accept3") == "" or read_global(session, "accept3") == "undefined" - - -def test_handle_prompt_missing_value(session, create_dialog): - session.url = inline("WD doc title") - create_dialog("alert", text="dismiss #1", result_var="dismiss1") + create_dialog(dialog_type, text="dialog") response = get_current_url(session) - assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #1") - assert read_global(session, "dismiss1") is None - create_dialog("confirm", text="dismiss #2", result_var="dismiss2") - - response = get_current_url(session) - - assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #2") - assert read_global(session, "dismiss2") is False - - create_dialog("prompt", text="dismiss #3", result_var="dismiss3") - - response = get_current_url(session) - - assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #3") - assert read_global(session, "dismiss3") is None + assert_dialog_handled(session, expected_text="dialog") diff --git a/tests/wpt/web-platform-tests/webdriver/tests/get_element_property/user_prompts.py b/tests/wpt/web-platform-tests/webdriver/tests/get_element_property/user_prompts.py index 8d46d02073b..d8f2ed11d5f 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/get_element_property/user_prompts.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/get_element_property/user_prompts.py @@ -1,87 +1,63 @@ +import pytest + from tests.support.asserts import assert_error, assert_success, assert_dialog_handled -from tests.support.fixtures import create_dialog from tests.support.inline import inline -def read_global(session, name): - return session.execute_script("return %s;" % name) - - def get_property(session, element_id, name): return session.transport.send( "GET", "session/{session_id}/element/{element_id}/property/{name}".format( session_id=session.session_id, element_id=element_id, name=name)) -def test_handle_prompt_dismiss(new_session, add_browser_capabilites): - # 13.3 step 2 - _, session = new_session({"capabilities": { - "alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "dismiss"})}}) +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept(session, create_dialog, dialog_type): session.url = inline("") element = session.find.css("#foo", all=False) - create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") + create_dialog(dialog_type, text="dialog") - result = get_property(session, element.id, "id") - assert_success(result, "foo") - assert_dialog_handled(session, "dismiss #1") + response = get_property(session, element.id, "id") + assert_success(response, "foo") - create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") - - result = get_property(session, element.id, "id") - assert_success(result, "foo") - assert_dialog_handled(session, "dismiss #2") - - create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") - - result = get_property(session, element.id, "id") - assert_success(result, "foo") - assert_dialog_handled(session, "dismiss #3") + assert_dialog_handled(session, expected_text="dialog") -def test_handle_prompt_accept(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": { - "alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}}) +def test_handle_prompt_accept_and_notify(): + """TODO""" + + +@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_dismiss(session, create_dialog, dialog_type): session.url = inline("") element = session.find.css("#foo", all=False) - create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") + create_dialog(dialog_type, text="dialog") - result = get_property(session, element.id, "id") - assert_success(result, "foo") - assert_dialog_handled(session, "dismiss #1") + response = get_property(session, element.id, "id") + assert_success(response, "foo") - create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") - - result = get_property(session, element.id, "id") - assert_success(result, "foo") - assert_dialog_handled(session, "dismiss #2") - - create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") - - result = get_property(session, element.id, "id") - assert_success(result, "foo") - assert_dialog_handled(session, "dismiss #3") + assert_dialog_handled(session, expected_text="dialog") -def test_handle_prompt_missing_value(session): +def test_handle_prompt_dismiss_and_notify(): + """TODO""" + + +def test_handle_prompt_ignore(): + """TODO""" + + +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_default(session, create_dialog, dialog_type): session.url = inline("") element = session.find.css("#foo", all=False) - create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") + create_dialog(dialog_type, text="dialog") - result = get_property(session, element.id, "id") - assert_error(result, "unexpected alert open") - assert_dialog_handled(session, "dismiss #1") + response = get_property(session, element.id, "id") + assert_error(response, "unexpected alert open") - create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") - - result = get_property(session, element.id, "id") - assert_error(result, "unexpected alert open") - assert_dialog_handled(session, "dismiss #2") - - create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") - - result = get_property(session, element.id, "id") - assert_error(result, "unexpected alert open") - assert_dialog_handled(session, "dismiss #3") + assert_dialog_handled(session, expected_text="dialog") diff --git a/tests/wpt/web-platform-tests/webdriver/tests/get_element_tag_name/user_prompts.py b/tests/wpt/web-platform-tests/webdriver/tests/get_element_tag_name/user_prompts.py index 71828c66c20..1b6fff5b308 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/get_element_tag_name/user_prompts.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/get_element_tag_name/user_prompts.py @@ -1,85 +1,62 @@ +import pytest + from tests.support.asserts import assert_error, assert_success, assert_dialog_handled -from tests.support.fixtures import create_dialog from tests.support.inline import inline -def read_global(session, name): - return session.execute_script("return %s;" % name) - - def get_tag_name(session, element_id): return session.transport.send("GET", "session/{session_id}/element/{element_id}/name".format( session_id=session.session_id, element_id=element_id)) -def test_handle_prompt_dismiss(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": { - "alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "dismiss"})}}) +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept(session, create_dialog, dialog_type): session.url = inline("") element = session.find.css("#foo", all=False) - create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") + create_dialog(dialog_type, text="dialog") - result = get_tag_name(session, element.id) - assert_success(result, "input") - assert_dialog_handled(session, "dismiss #1") + response = get_tag_name(session, element.id) + assert_success(response, "input") - create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") - - result = get_tag_name(session, element.id) - assert_success(result, "input") - assert_dialog_handled(session, "dismiss #2") - - create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") - - result = get_tag_name(session, element.id) - assert_success(result, "input") - assert_dialog_handled(session, "dismiss #3") + assert_dialog_handled(session, expected_text="dialog") -def test_handle_prompt_accept(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": { - "alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}}) +def test_handle_prompt_accept_and_notify(): + """TODO""" + + +@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_dismiss(session, create_dialog, dialog_type): session.url = inline("") element = session.find.css("#foo", all=False) - create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") + create_dialog(dialog_type, text="dialog") - result = get_tag_name(session, element.id) - assert_success(result, "input") - assert_dialog_handled(session, "dismiss #1") + response = get_tag_name(session, element.id) + assert_success(response, "input") - create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") - - result = get_tag_name(session, element.id) - assert_success(result, "input") - assert_dialog_handled(session, "dismiss #2") - - create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") - - result = get_tag_name(session, element.id) - assert_success(result, "input") - assert_dialog_handled(session, "dismiss #3") + assert_dialog_handled(session, expected_text="dialog") -def test_handle_prompt_missing_value(session): +def test_handle_prompt_dismiss_and_notify(): + """TODO""" + + +def test_handle_prompt_ignore(): + """TODO""" + + +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_default(session, create_dialog, dialog_type): session.url = inline("") element = session.find.css("#foo", all=False) - create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") + create_dialog(dialog_type, text="dialog") - result = get_tag_name(session, element.id) - assert_error(result, "unexpected alert open") - assert_dialog_handled(session, "dismiss #1") + response = get_tag_name(session, element.id) + assert_error(response, "unexpected alert open") - create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") - - result = get_tag_name(session, element.id) - assert_error(result, "unexpected alert open") - assert_dialog_handled(session, "dismiss #2") - - create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") - - result = get_tag_name(session, element.id) - assert_error(result, "unexpected alert open") - assert_dialog_handled(session, "dismiss #3") + assert_dialog_handled(session, expected_text="dialog") diff --git a/tests/wpt/web-platform-tests/webdriver/tests/get_title/user_prompts.py b/tests/wpt/web-platform-tests/webdriver/tests/get_title/user_prompts.py index 39afeb565f5..28918809a0a 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/get_title/user_prompts.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/get_title/user_prompts.py @@ -1,99 +1,64 @@ -from tests.support.asserts import assert_error, assert_success, assert_dialog_handled -from tests.support.fixtures import create_dialog +import pytest + +from tests.support.asserts import assert_dialog_handled, assert_error, assert_success from tests.support.inline import inline -def read_global(session, name): - return session.execute_script("return %s;" % name) - - def get_title(session): return session.transport.send( "GET", "session/{session_id}/title".format(**vars(session))) -def test_title_handle_prompt_dismiss(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": { - "alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "dismiss"})}}) +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept(session, create_dialog, dialog_type): + session.url = inline("WD doc title") + expected_title = session.title + + create_dialog(dialog_type, text="dialog") + + response = get_title(session) + assert_success(response, expected_title) + + assert_dialog_handled(session, expected_text="dialog") + + +def test_handle_prompt_accept_and_notify(): + """TODO""" + + +@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_dismiss(session, create_dialog, dialog_type): + session.url = inline("WD doc title") + expected_title = session.title + + create_dialog(dialog_type, text="dialog") + + response = get_title(session) + assert_success(response, expected_title) + + assert_dialog_handled(session, expected_text="dialog") + + +def test_handle_prompt_dismiss_and_notify(): + """TODO""" + + +def test_handle_prompt_ignore(): + """TODO""" + + +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_default(session, create_dialog, dialog_type): session.url = inline("WD doc title") - expected_title = read_global(session, "document.title") - create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") + create_dialog(dialog_type, text="dialog") - result = get_title(session) - assert_success(result, expected_title) - assert_dialog_handled(session, "dismiss #1") - assert read_global(session, "dismiss1") is None + response = get_title(session) + assert_error(response, "unexpected alert open") - expected_title = read_global(session, "document.title") - create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") - - result = get_title(session) - assert_success(result, expected_title) - assert_dialog_handled(session, "dismiss #2") - assert read_global(session, "dismiss2") is False - - expected_title = read_global(session, "document.title") - create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") - - result = get_title(session) - assert_success(result, expected_title) - assert_dialog_handled(session, "dismiss #3") - assert read_global(session, "dismiss3") is None - - -def test_title_handle_prompt_accept(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": { - "alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}}) - session.url = inline("WD doc title") - create_dialog(session)("alert", text="accept #1", result_var="accept1") - - expected_title = read_global(session, "document.title") - - result = get_title(session) - assert_success(result, expected_title) - assert_dialog_handled(session, "accept #1") - assert read_global(session, "accept1") is None - - expected_title = read_global(session, "document.title") - create_dialog(session)("confirm", text="accept #2", result_var="accept2") - - result = get_title(session) - assert_success(result, expected_title) - assert_dialog_handled(session, "accept #2") - assert read_global(session, "accept2") is True - - expected_title = read_global(session, "document.title") - create_dialog(session)("prompt", text="accept #3", result_var="accept3") - - result = get_title(session) - assert_success(result, expected_title) - assert_dialog_handled(session, "accept #3") - assert read_global(session, "accept3") == "" or read_global(session, "accept3") == "undefined" - - -def test_title_handle_prompt_missing_value(session, create_dialog): - session.url = inline("WD doc title") - create_dialog("alert", text="dismiss #1", result_var="dismiss1") - - result = get_title(session) - assert_error(result, "unexpected alert open") - assert_dialog_handled(session, "dismiss #1") - assert read_global(session, "dismiss1") is None - - create_dialog("confirm", text="dismiss #2", result_var="dismiss2") - - result = get_title(session) - assert_error(result, "unexpected alert open") - assert_dialog_handled(session, "dismiss #2") - assert read_global(session, "dismiss2") is False - - create_dialog("prompt", text="dismiss #3", result_var="dismiss3") - - result = get_title(session) - assert_error(result, "unexpected alert open") - assert_dialog_handled(session, "dismiss #3") - assert read_global(session, "dismiss3") is None + assert_dialog_handled(session, expected_text="dialog") # The behavior of the `window.print` function is platform-dependent and may not diff --git a/tests/wpt/web-platform-tests/webdriver/tests/get_window_rect/user_prompts.py b/tests/wpt/web-platform-tests/webdriver/tests/get_window_rect/user_prompts.py index f2e8dddb8bd..4f85dbb7cc4 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/get_window_rect/user_prompts.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/get_window_rect/user_prompts.py @@ -1,9 +1,6 @@ -from tests.support.asserts import assert_error, assert_dialog_handled -from tests.support.fixtures import create_dialog -from tests.support.inline import inline +import pytest - -alert_doc = inline("") +from tests.support.asserts import assert_dialog_handled, assert_error, assert_success def get_window_rect(session): @@ -11,55 +8,38 @@ def get_window_rect(session): "GET", "session/{session_id}/window/rect".format(**vars(session))) -def test_handle_prompt_dismiss_and_notify(): - """TODO""" +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept(session, create_dialog, dialog_type): + create_dialog(dialog_type, text="dialog") + + response = get_window_rect(session) + assert_success(response) + + assert_dialog_handled(session, expected_text="dialog") def test_handle_prompt_accept_and_notify(): """TODO""" +def test_handle_prompt_dismiss(): + """TODO""" + + +def test_handle_prompt_dismiss_and_notify(): + """TODO""" + + def test_handle_prompt_ignore(): """TODO""" -def test_handle_prompt_accept(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}}) - session.url = inline("WD doc title") - - create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") - response = get_window_rect(session) - assert response.status == 200 - assert_dialog_handled(session, "dismiss #1") - - create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") - response = get_window_rect(session) - assert response.status == 200 - assert_dialog_handled(session, "dismiss #2") - - create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") - response = get_window_rect(session) - assert response.status == 200 - assert_dialog_handled(session, "dismiss #3") - - -def test_handle_prompt_missing_value(session, create_dialog): - session.url = inline("WD doc title") - create_dialog("alert", text="dismiss #1", result_var="dismiss1") - - response = get_window_rect(session) - - assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #1") - - create_dialog("confirm", text="dismiss #2", result_var="dismiss2") +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_default(session, create_dialog, dialog_type): + create_dialog(dialog_type, text="dialog") response = get_window_rect(session) assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #2") - create_dialog("prompt", text="dismiss #3", result_var="dismiss3") - - response = get_window_rect(session) - assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #3") + assert_dialog_handled(session, expected_text="dialog") diff --git a/tests/wpt/web-platform-tests/webdriver/tests/is_element_selected/user_prompts.py b/tests/wpt/web-platform-tests/webdriver/tests/is_element_selected/user_prompts.py index b1a181a108b..468dc95b752 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/is_element_selected/user_prompts.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/is_element_selected/user_prompts.py @@ -1,6 +1,7 @@ +import pytest + from tests.support.asserts import assert_error, assert_dialog_handled, assert_success from tests.support.inline import inline -from tests.support.fixtures import create_dialog def is_element_selected(session, element_id): @@ -10,75 +11,54 @@ def is_element_selected(session, element_id): element_id=element_id)) -def test_handle_prompt_dismiss(new_session, add_browser_capabilites): - # 13.1 step 2 - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "dismiss"})}}) +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept(session, create_dialog, dialog_type): session.url = inline("") element = session.find.css("#foo", all=False) - create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") + create_dialog(dialog_type, text="dialog") - result = is_element_selected(session, element.id) - assert_success(result, False) - assert_dialog_handled(session, "dismiss #1") + response = is_element_selected(session, element.id) + assert_success(response, False) - create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") - - result = is_element_selected(session, element.id) - assert_success(result, False) - assert_dialog_handled(session, "dismiss #2") - - create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") - - result = is_element_selected(session, element.id) - assert_success(result, False) - assert_dialog_handled(session, "dismiss #3") + assert_dialog_handled(session, expected_text="dialog") -def test_handle_prompt_accept(new_session, add_browser_capabilites): - # 13.1 step 2 - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}}) +def test_handle_prompt_accept_and_notify(): + """TODO""" + + +@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_dismiss(session, create_dialog, dialog_type): session.url = inline("") element = session.find.css("#foo", all=False) - create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") + create_dialog(dialog_type, text="dialog") - result = is_element_selected(session, element.id) - assert_success(result, False) - assert_dialog_handled(session, "dismiss #1") + response = is_element_selected(session, element.id) + assert_success(response, False) - create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") - - result = is_element_selected(session, element.id) - assert_success(result, False) - assert_dialog_handled(session, "dismiss #2") - - create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") - - result = is_element_selected(session, element.id) - assert_success(result, False) - assert_dialog_handled(session, "dismiss #3") + assert_dialog_handled(session, expected_text="dialog") -def test_handle_prompt_missing_value(session): - # 13.1 step 2 +def test_handle_prompt_dismiss_and_notify(): + """TODO""" + + +def test_handle_prompt_ignore(): + """TODO""" + + +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_default(session, create_dialog, dialog_type): session.url = inline("") element = session.find.css("#foo", all=False) - create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") + create_dialog(dialog_type, text="dialog") - result = is_element_selected(session, element.id) - assert_error(result, "unexpected alert open") - assert_dialog_handled(session, "dismiss #1") + response = is_element_selected(session, element.id) + assert_error(response, "unexpected alert open") - create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") - - result = is_element_selected(session, element.id) - assert_error(result, "unexpected alert open") - assert_dialog_handled(session, "dismiss #2") - - create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") - - result = is_element_selected(session, element.id) - assert_error(result, "unexpected alert open") - assert_dialog_handled(session, "dismiss #3") + assert_dialog_handled(session, expected_text="dialog") diff --git a/tests/wpt/web-platform-tests/webdriver/tests/maximize_window/user_prompts.py b/tests/wpt/web-platform-tests/webdriver/tests/maximize_window/user_prompts.py index 41ef3beaa84..4797cb0bd87 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/maximize_window/user_prompts.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/maximize_window/user_prompts.py @@ -1,6 +1,6 @@ -from tests.support.asserts import assert_error, assert_dialog_handled -from tests.support.fixtures import create_dialog -from tests.support.inline import inline +import pytest + +from tests.support.asserts import assert_dialog_handled, assert_error, assert_success def maximize(session): @@ -8,55 +8,38 @@ def maximize(session): "POST", "session/{session_id}/window/maximize".format(**vars(session))) -def test_handle_prompt_dismiss_and_notify(): - """TODO""" +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept(session, create_dialog, dialog_type): + create_dialog(dialog_type, text="dialog") + + response = maximize(session) + assert_success(response) + + assert_dialog_handled(session, expected_text="dialog") def test_handle_prompt_accept_and_notify(): """TODO""" +def test_handle_prompt_dismiss(): + """TODO""" + + +def test_handle_prompt_dismiss_and_notify(): + """TODO""" + + def test_handle_prompt_ignore(): """TODO""" -def test_handle_prompt_accept(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}}) - session.url = inline("WD doc title") - - create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") - response = maximize(session) - assert response.status == 200 - assert_dialog_handled(session, "dismiss #1") - - create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") - response = maximize(session) - assert response.status == 200 - assert_dialog_handled(session, "dismiss #2") - - create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") - response = maximize(session) - assert response.status == 200 - assert_dialog_handled(session, "dismiss #3") - - -def test_handle_prompt_missing_value(session, create_dialog): - session.url = inline("WD doc title") - create_dialog("alert", text="dismiss #1", result_var="dismiss1") - - response = maximize(session) - - assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #1") - - create_dialog("confirm", text="dismiss #2", result_var="dismiss2") +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_default(session, create_dialog, dialog_type): + create_dialog(dialog_type, text="dialog") response = maximize(session) assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #2") - create_dialog("prompt", text="dismiss #3", result_var="dismiss3") - - response = maximize(session) - assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #3") + assert_dialog_handled(session, expected_text="dialog") diff --git a/tests/wpt/web-platform-tests/webdriver/tests/minimize_window/user_prompts.py b/tests/wpt/web-platform-tests/webdriver/tests/minimize_window/user_prompts.py index 406862b23c7..0de6586e08b 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/minimize_window/user_prompts.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/minimize_window/user_prompts.py @@ -1,6 +1,6 @@ -from tests.support.asserts import assert_error, assert_dialog_handled -from tests.support.fixtures import create_dialog -from tests.support.inline import inline +import pytest + +from tests.support.asserts import assert_dialog_handled, assert_error, assert_success def minimize(session): @@ -8,55 +8,38 @@ def minimize(session): "POST", "session/{session_id}/window/minimize".format(**vars(session))) -def test_handle_prompt_dismiss_and_notify(): - """TODO""" +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept(session, create_dialog, dialog_type): + create_dialog(dialog_type, text="dialog") + + response = minimize(session) + assert_success(response) + + assert_dialog_handled(session, expected_text="dialog") def test_handle_prompt_accept_and_notify(): """TODO""" +def test_handle_prompt_dismiss(): + """TODO""" + + +def test_handle_prompt_dismiss_and_notify(): + """TODO""" + + def test_handle_prompt_ignore(): """TODO""" -def test_handle_prompt_accept(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}}) - session.url = inline("WD doc title") - - create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") - response = minimize(session) - assert response.status == 200 - assert_dialog_handled(session, "dismiss #1") - - create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") - response = minimize(session) - assert response.status == 200 - assert_dialog_handled(session, "dismiss #2") - - create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") - response = minimize(session) - assert response.status == 200 - assert_dialog_handled(session, "dismiss #3") - - -def test_handle_prompt_missing_value(session, create_dialog): - session.url = inline("WD doc title") - create_dialog("alert", text="dismiss #1", result_var="dismiss1") - - response = minimize(session) - - assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #1") - - create_dialog("confirm", text="dismiss #2", result_var="dismiss2") +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_default(session, create_dialog, dialog_type): + create_dialog(dialog_type, text="dialog") response = minimize(session) assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #2") - create_dialog("prompt", text="dismiss #3", result_var="dismiss3") - - response = minimize(session) - assert_error(response, "unexpected alert open") - assert_dialog_handled(session, "dismiss #3") + assert_dialog_handled(session, expected_text="dialog") diff --git a/tests/wpt/web-platform-tests/2dcontext/drawing-model/.gitkeep b/tests/wpt/web-platform-tests/webdriver/tests/navigate_to/__init__.py similarity index 100% rename from tests/wpt/web-platform-tests/2dcontext/drawing-model/.gitkeep rename to tests/wpt/web-platform-tests/webdriver/tests/navigate_to/__init__.py diff --git a/tests/wpt/web-platform-tests/webdriver/tests/navigate_to/navigate.py b/tests/wpt/web-platform-tests/webdriver/tests/navigate_to/navigate.py new file mode 100644 index 00000000000..7f5414b2b0f --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/navigate_to/navigate.py @@ -0,0 +1,14 @@ +from tests.support.inline import inline +from tests.support.asserts import assert_success + + +def navigate_to(session, url): + return session.transport.send( + "POST", "session/{session_id}/url".format(**vars(session)), + {"url": url}) + + +def test_null_response_value(session): + response = navigate_to(session, inline("

")) + value = assert_success(response) + assert value is None diff --git a/tests/wpt/web-platform-tests/webdriver/tests/new_session/conftest.py b/tests/wpt/web-platform-tests/webdriver/tests/new_session/conftest.py index d3ee199fb28..74563f7b866 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/new_session/conftest.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/new_session/conftest.py @@ -1,7 +1,8 @@ -import pytest import sys -import webdriver +import pytest + +from webdriver.transport import HTTPWireProtocol def product(a, b): @@ -11,6 +12,62 @@ def product(a, b): def flatten(l): return [item for x in l for item in x] + +@pytest.fixture(name="add_browser_capabilities") +def fixture_add_browser_capabilities(configuration): + + def add_browser_capabilities(capabilities): + # Make sure there aren't keys in common. + assert not set(configuration["capabilities"]).intersection(set(capabilities)) + result = dict(configuration["capabilities"]) + result.update(capabilities) + + return result + + return add_browser_capabilities + + +@pytest.fixture(name="new_session") +def fixture_new_session(request, configuration, current_session): + """Start a new session for tests which themselves test creating new sessions. + + :param body: The content of the body for the new session POST request. + + :param delete_existing_session: Allows the fixture to delete an already + created custom session before the new session is getting created. This + is useful for tests which call this fixture multiple times within the + same test. + """ + custom_session = {} + + transport = HTTPWireProtocol( + configuration["host"], configuration["port"], url_prefix="/", + ) + + def _delete_session(session_id): + transport.send("DELETE", "session/{}".format(session_id)) + + def new_session(body, delete_existing_session=False): + # If there is an active session from the global session fixture, + # delete that one first + if current_session is not None: + current_session.end() + + if delete_existing_session: + _delete_session(custom_session["session"]["sessionId"]) + + response = transport.send("POST", "session", body) + if response.status == 200: + custom_session["session"] = response.body["value"] + return response, custom_session.get("session", None) + + yield new_session + + if custom_session.get("session") is not None: + _delete_session(custom_session["session"]["sessionId"]) + custom_session = None + + @pytest.fixture(scope="session") def platform_name(): return { @@ -19,4 +76,3 @@ def platform_name(): "cygwin": "windows", "darwin": "mac" }.get(sys.platform) - diff --git a/tests/wpt/web-platform-tests/webdriver/tests/new_session/create_alwaysMatch.py b/tests/wpt/web-platform-tests/webdriver/tests/new_session/create_alwaysMatch.py index 23350488ddc..097764e4a99 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/new_session/create_alwaysMatch.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/new_session/create_alwaysMatch.py @@ -1,13 +1,15 @@ -#META: timeout=long +# META: timeout=long import pytest from conftest import product, flatten -from support.create import valid_data +from tests.support.asserts import assert_success +from tests.new_session.support.create import valid_data @pytest.mark.parametrize("key,value", flatten(product(*item) for item in valid_data)) -def test_valid(new_session, add_browser_capabilites, key, value): - resp = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({key: value})}}) - +def test_valid(new_session, add_browser_capabilities, key, value): + response, _ = new_session({"capabilities": { + "alwaysMatch": add_browser_capabilities({key: value})}}) + assert_success(response) diff --git a/tests/wpt/web-platform-tests/webdriver/tests/new_session/create_firstMatch.py b/tests/wpt/web-platform-tests/webdriver/tests/new_session/create_firstMatch.py index 58203e5fc3a..f00f6042b08 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/new_session/create_firstMatch.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/new_session/create_firstMatch.py @@ -1,12 +1,16 @@ -#META: timeout=long +# META: timeout=long import pytest from conftest import product, flatten -from support.create import valid_data + +from tests.support.asserts import assert_success +from tests.new_session.support.create import valid_data @pytest.mark.parametrize("key,value", flatten(product(*item) for item in valid_data)) -def test_valid(new_session, add_browser_capabilites, key, value): - resp = new_session({"capabilities": {"firstMatch": [add_browser_capabilites({key: value})]}}) +def test_valid(new_session, add_browser_capabilities, key, value): + response, _ = new_session({"capabilities": { + "firstMatch": [add_browser_capabilities({key: value})]}}) + assert_success(response) diff --git a/tests/wpt/web-platform-tests/webdriver/tests/new_session/default_values.py b/tests/wpt/web-platform-tests/webdriver/tests/new_session/default_values.py index 0dbc798b907..61816812eb1 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/new_session/default_values.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/new_session/default_values.py @@ -1,48 +1,55 @@ # META: timeout=long -import uuid - -import pytest - -from webdriver import error +from tests.support.asserts import assert_error, assert_success -def test_basic(new_session, add_browser_capabilites): - resp, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({})}}) - assert set(resp.keys()) == {"sessionId", "capabilities"} +def test_basic(new_session, add_browser_capabilities): + response, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilities({})}}) + value = assert_success(response) + assert set(value.keys()) == {"sessionId", "capabilities"} -def test_repeat_new_session(new_session, add_browser_capabilites): - resp, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({})}}) - with pytest.raises(error.SessionNotCreatedException): - new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({})}}) +def test_repeat_new_session(new_session, add_browser_capabilities): + response, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilities({})}}) + assert_success(response) + + response, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilities({})}}) + assert_error(response, "session not created") def test_no_capabilites(new_session): - with pytest.raises(error.InvalidArgumentException): - new_session({}) + response, _ = new_session({}) + assert_error(response, "invalid argument") -def test_missing_first_match(new_session, add_browser_capabilites): - resp, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({})}}) +def test_missing_first_match(new_session, add_browser_capabilities): + response, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilities({})}}) + assert_success(response) -def test_missing_always_match(new_session, add_browser_capabilites): - resp, _ = new_session({"capabilities": {"firstMatch": [add_browser_capabilites({})]}}) +def test_missing_always_match(new_session, add_browser_capabilities): + response, _ = new_session({"capabilities": {"firstMatch": [add_browser_capabilities({})]}}) + assert_success(response) -def test_desired(new_session, add_browser_capabilites): - with pytest.raises(error.InvalidArgumentException): - resp, _ = new_session({"desiredCapbilities": add_browser_capabilites({})}) +def test_desired(new_session, add_browser_capabilities): + response, _ = new_session({"desiredCapbilities": add_browser_capabilities({})}) + assert_error(response, "invalid argument") -def test_ignore_non_spec_fields_in_capabilities(new_session, add_browser_capabilites): - resp, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({}), "desiredCapbilities": {"pageLoadStrategy": "eager"}}}) - assert resp["capabilities"]["pageLoadStrategy"] == "normal" +def test_ignore_non_spec_fields_in_capabilities(new_session, add_browser_capabilities): + response, _ = new_session({"capabilities": { + "alwaysMatch": add_browser_capabilities({}), + "desiredCapbilities": {"pageLoadStrategy": "eager"}, + }}) + value = assert_success(response) + assert value["capabilities"]["pageLoadStrategy"] == "normal" -def test_valid_but_unmatchable_key(new_session, add_browser_capabilites): - resp, _ = new_session({"capabilities": { - "firstMatch": [add_browser_capabilites({"pageLoadStrategy": "eager", "foo:unmatchable": True}), - {"pageLoadStrategy": "none"}]}}) - assert resp["capabilities"]["pageLoadStrategy"] == "none" +def test_valid_but_unmatchable_key(new_session, add_browser_capabilities): + response, _ = new_session({"capabilities": {"firstMatch": [ + add_browser_capabilities({"pageLoadStrategy": "eager", "foo:unmatchable": True}), + {"pageLoadStrategy": "none"}, + ]}}) + value = assert_success(response) + assert value["capabilities"]["pageLoadStrategy"] == "none" diff --git a/tests/wpt/web-platform-tests/webdriver/tests/new_session/invalid_capabilities.py b/tests/wpt/web-platform-tests/webdriver/tests/new_session/invalid_capabilities.py index 52f258243fa..83f93ea22f7 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/new_session/invalid_capabilities.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/new_session/invalid_capabilities.py @@ -1,27 +1,29 @@ -#META: timeout=long - import pytest -from webdriver import error +from tests.support.asserts import assert_error from conftest import product, flatten @pytest.mark.parametrize("value", [None, 1, "{}", []]) def test_invalid_capabilites(new_session, value): - with pytest.raises(error.InvalidArgumentException): - new_session({"capabilities": value}) + response, _ = new_session({"capabilities": value}) + assert_error(response, "invalid argument") @pytest.mark.parametrize("value", [None, 1, "{}", []]) -def test_invalid_always_match(new_session, add_browser_capabilites, value): - with pytest.raises(error.InvalidArgumentException): - new_session({"capabilities": {"alwaysMatch": value, "firstMatch": [add_browser_capabilites({})]}}) +def test_invalid_always_match(new_session, add_browser_capabilities, value): + capabilities = {"alwaysMatch": value, "firstMatch": [add_browser_capabilities({})]} + + response, _ = new_session({"capabilities": capabilities}) + assert_error(response, "invalid argument") @pytest.mark.parametrize("value", [None, 1, "[]", {}]) -def test_invalid_first_match(new_session, add_browser_capabilites, value): - with pytest.raises(error.InvalidArgumentException): - new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({}), "firstMatch": value}}) +def test_invalid_first_match(new_session, add_browser_capabilities, value): + capabilities = {"alwaysMatch": add_browser_capabilities({}), "firstMatch": value} + + response, _ = new_session({"capabilities": capabilities}) + assert_error(response, "invalid argument") invalid_data = [ @@ -46,17 +48,19 @@ invalid_data = [ " dismiss", "dismiss "]) ] + @pytest.mark.parametrize("body", [lambda key, value: {"alwaysMatch": {key: value}}, lambda key, value: {"firstMatch": [{key: value}]}]) @pytest.mark.parametrize("key,value", flatten(product(*item) for item in invalid_data)) -def test_invalid_values(new_session, add_browser_capabilites, body, key, value): +def test_invalid_values(new_session, add_browser_capabilities, body, key, value): capabilities = body(key, value) if "alwaysMatch" in capabilities: - capabilities["alwaysMatch"] = add_browser_capabilites(capabilities["alwaysMatch"]) + capabilities["alwaysMatch"] = add_browser_capabilities(capabilities["alwaysMatch"]) else: - capabilities["firstMatch"][0] = add_browser_capabilites(capabilities["firstMatch"][0]) - with pytest.raises(error.InvalidArgumentException): - resp = new_session({"capabilities": capabilities}) + capabilities["firstMatch"][0] = add_browser_capabilities(capabilities["firstMatch"][0]) + + response, _ = new_session({"capabilities": capabilities}) + assert_error(response, "invalid argument") invalid_extensions = [ @@ -87,12 +91,12 @@ invalid_extensions = [ @pytest.mark.parametrize("body", [lambda key, value: {"alwaysMatch": {key: value}}, lambda key, value: {"firstMatch": [{key: value}]}]) @pytest.mark.parametrize("key", invalid_extensions) -def test_invalid_extensions(new_session, add_browser_capabilites, body, key): +def test_invalid_extensions(new_session, add_browser_capabilities, body, key): capabilities = body(key, {}) if "alwaysMatch" in capabilities: - capabilities["alwaysMatch"] = add_browser_capabilites(capabilities["alwaysMatch"]) + capabilities["alwaysMatch"] = add_browser_capabilities(capabilities["alwaysMatch"]) else: - capabilities["firstMatch"][0] = add_browser_capabilites(capabilities["firstMatch"][0]) - with pytest.raises(error.InvalidArgumentException): - resp = new_session({"capabilities": capabilities}) + capabilities["firstMatch"][0] = add_browser_capabilities(capabilities["firstMatch"][0]) + response, _ = new_session({"capabilities": capabilities}) + assert_error(response, "invalid argument") diff --git a/tests/wpt/web-platform-tests/webdriver/tests/new_session/merge.py b/tests/wpt/web-platform-tests/webdriver/tests/new_session/merge.py index 480fbcdcbdb..d4b4ee56388 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/new_session/merge.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/new_session/merge.py @@ -1,22 +1,25 @@ -#META: timeout=long +# META: timeout=long import pytest -from webdriver import error +from tests.support.asserts import assert_error, assert_success from conftest import platform_name @pytest.mark.skipif(platform_name() is None, reason="Unsupported platform") @pytest.mark.parametrize("body", [lambda key, value: {"alwaysMatch": {key: value}}, lambda key, value: {"firstMatch": [{key: value}]}]) -def test_platform_name(new_session, add_browser_capabilites, platform_name, body): +def test_platform_name(new_session, add_browser_capabilities, platform_name, body): capabilities = body("platformName", platform_name) if "alwaysMatch" in capabilities: - capabilities["alwaysMatch"] = add_browser_capabilites(capabilities["alwaysMatch"]) + capabilities["alwaysMatch"] = add_browser_capabilities(capabilities["alwaysMatch"]) else: - capabilities["firstMatch"][0] = add_browser_capabilites(capabilities["firstMatch"][0]) - resp, _ = new_session({"capabilities": capabilities}) - assert resp["capabilities"]["platformName"] == platform_name + capabilities["firstMatch"][0] = add_browser_capabilities(capabilities["firstMatch"][0]) + + response, _ = new_session({"capabilities": capabilities}) + value = assert_success(response) + + assert value["capabilities"]["platformName"] == platform_name invalid_merge = [ @@ -29,53 +32,51 @@ invalid_merge = [ @pytest.mark.parametrize("key,value", invalid_merge) -def test_merge_invalid(new_session, add_browser_capabilites, key, value): - with pytest.raises(error.InvalidArgumentException): - new_session({"capabilities": - {"alwaysMatch": add_browser_capabilites({key: value[0]}), - "firstMatch": [{}, {key: value[1]}]}}) +def test_merge_invalid(new_session, add_browser_capabilities, key, value): + response, _ = new_session({"capabilities": { + "alwaysMatch": add_browser_capabilities({key: value[0]}), + "firstMatch": [{}, {key: value[1]}], + }}) + assert_error(response, "invalid argument") @pytest.mark.skipif(platform_name() is None, reason="Unsupported platform") -def test_merge_platformName(new_session, add_browser_capabilites, platform_name): - resp, _ = new_session({"capabilities": - {"alwaysMatch": add_browser_capabilites({"timeouts": {"script": 10}}), - "firstMatch": [ - { - "platformName": platform_name.upper(), - "pageLoadStrategy": "none" - }, - { - "platformName": platform_name, - "pageLoadStrategy": "eager" - } - ]}}) +def test_merge_platformName(new_session, add_browser_capabilities, platform_name): + response, _ = new_session({"capabilities": { + "alwaysMatch": add_browser_capabilities({"timeouts": {"script": 10}}), + "firstMatch": [{ + "platformName": platform_name.upper(), + "pageLoadStrategy": "none", + }, { + "platformName": platform_name, + "pageLoadStrategy": "eager", + }]}}) - assert resp["capabilities"]["platformName"] == platform_name - assert resp["capabilities"]["pageLoadStrategy"] == "eager" + value = assert_success(response) + + assert value["capabilities"]["platformName"] == platform_name + assert value["capabilities"]["pageLoadStrategy"] == "eager" -def test_merge_browserName(new_session, add_browser_capabilites): - resp, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({})}}) +def test_merge_browserName(new_session, add_browser_capabilities): + response, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilities({})}}) + value = assert_success(response) + browser_settings = { - "browserName": resp["capabilities"]["browserName"], - "browserVersion": resp["capabilities"]["browserVersion"], - "platformName": resp["capabilities"]["platformName"] + "browserName": value["capabilities"]["browserName"], + "browserVersion": value["capabilities"]["browserVersion"], } - session.end() - resp, _ = new_session({"capabilities": - {"alwaysMatch": add_browser_capabilites({"timeouts": {"script": 10}}), - "firstMatch": [ - { - "browserName": browser_settings["browserName"] + "invalid", - "pageLoadStrategy": "none" - }, - { - "browserName": browser_settings["browserName"], - "pageLoadStrategy": "eager" - } - ]}}) + response, _ = new_session({"capabilities": { + "alwaysMatch": add_browser_capabilities({"timeouts": {"script": 10}}), + "firstMatch": [{ + "browserName": browser_settings["browserName"] + "invalid", + "pageLoadStrategy": "none", + }, { + "browserName": browser_settings["browserName"], + "pageLoadStrategy": "eager", + }]}}, delete_existing_session=True) + value = assert_success(response) - assert resp["capabilities"]["browserName"] == browser_settings['browserName'] - assert resp["capabilities"]["pageLoadStrategy"] == "eager" + assert value["capabilities"]["browserName"] == browser_settings['browserName'] + assert value["capabilities"]["pageLoadStrategy"] == "eager" diff --git a/tests/wpt/web-platform-tests/webdriver/tests/new_session/response.py b/tests/wpt/web-platform-tests/webdriver/tests/new_session/response.py index c9a8c766eca..e3b096abb9c 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/new_session/response.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/new_session/response.py @@ -2,53 +2,73 @@ import uuid -def test_resp_sessionid(new_session, add_browser_capabilites): - resp, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({})}}) - assert isinstance(resp["sessionId"], unicode) - uuid.UUID(hex=resp["sessionId"]) +from tests.support.asserts import assert_success -def test_resp_capabilites(new_session, add_browser_capabilites): - resp, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({})}}) - assert isinstance(resp["sessionId"], unicode) - assert isinstance(resp["capabilities"], dict) - assert {"browserName", - "browserVersion", - "platformName", - "acceptInsecureCerts", - "setWindowRect", - "timeouts", - "proxy", - "pageLoadStrategy"}.issubset( - set(resp["capabilities"].keys())) +def test_sessionid(new_session, add_browser_capabilities): + response, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilities({})}}) + value = assert_success(response) + assert isinstance(value["sessionId"], basestring) + uuid.UUID(hex=value["sessionId"]) -def test_resp_data(new_session, add_browser_capabilites, platform_name): - resp, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({})}}) +def test_capabilites(new_session, add_browser_capabilities): + response, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilities({})}}) + value = assert_success(response) + assert isinstance(value["capabilities"], dict) - assert isinstance(resp["capabilities"]["browserName"], unicode) - assert isinstance(resp["capabilities"]["browserVersion"], unicode) + all_capabilities = set(value["capabilities"].keys()) + expected_capabilities = { + "browserName", + "browserVersion", + "platformName", + "acceptInsecureCerts", + "setWindowRect", + "timeouts", + "proxy", + "pageLoadStrategy", + } + + assert expected_capabilities.issubset(all_capabilities), ( + "{0} cannot be found in {1}".format( + list(expected_capabilities - all_capabilities), all_capabilities)) + + +def test_data(new_session, add_browser_capabilities, platform_name): + response, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilities({})}}) + value = assert_success(response) + + assert isinstance(value["capabilities"]["browserName"], basestring) + assert isinstance(value["capabilities"]["browserVersion"], basestring) if platform_name: - assert resp["capabilities"]["platformName"] == platform_name + assert value["capabilities"]["platformName"] == platform_name else: - assert "platformName" in resp["capabilities"] - assert resp["capabilities"]["acceptInsecureCerts"] is False - assert isinstance(resp["capabilities"]["setWindowRect"], bool) - assert resp["capabilities"]["timeouts"]["implicit"] == 0 - assert resp["capabilities"]["timeouts"]["pageLoad"] == 300000 - assert resp["capabilities"]["timeouts"]["script"] == 30000 - assert resp["capabilities"]["proxy"] == {} - assert resp["capabilities"]["pageLoadStrategy"] == "normal" + assert "platformName" in value["capabilities"] + assert value["capabilities"]["acceptInsecureCerts"] is False + assert isinstance(value["capabilities"]["setWindowRect"], bool) + assert value["capabilities"]["timeouts"]["implicit"] == 0 + assert value["capabilities"]["timeouts"]["pageLoad"] == 300000 + assert value["capabilities"]["timeouts"]["script"] == 30000 + assert value["capabilities"]["proxy"] == {} + assert value["capabilities"]["pageLoadStrategy"] == "normal" -def test_timeouts(new_session, add_browser_capabilites, platform_name): - resp, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"timeouts": {"implicit": 1000}})}}) - assert resp["capabilities"]["timeouts"] == { +def test_timeouts(new_session, add_browser_capabilities, platform_name): + response, _ = new_session({"capabilities": { + "alwaysMatch": add_browser_capabilities({"timeouts": {"implicit": 1000}}), + }}) + value = assert_success(response) + + assert value["capabilities"]["timeouts"] == { "implicit": 1000, "pageLoad": 300000, "script": 30000 } -def test_pageLoadStrategy(new_session, add_browser_capabilites, platform_name): - resp, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"pageLoadStrategy": "eager"})}}) - assert resp["capabilities"]["pageLoadStrategy"] == "eager" + +def test_pageLoadStrategy(new_session, add_browser_capabilities, platform_name): + response, _ = new_session({"capabilities": { + "alwaysMatch": add_browser_capabilities({"pageLoadStrategy": "eager"})}}) + value = assert_success(response) + + assert value["capabilities"]["pageLoadStrategy"] == "eager" diff --git a/tests/wpt/web-platform-tests/2dcontext/drawing-paths-to-the-canvas/.gitkeep b/tests/wpt/web-platform-tests/webdriver/tests/refresh/__init__.py similarity index 100% rename from tests/wpt/web-platform-tests/2dcontext/drawing-paths-to-the-canvas/.gitkeep rename to tests/wpt/web-platform-tests/webdriver/tests/refresh/__init__.py diff --git a/tests/wpt/web-platform-tests/webdriver/tests/refresh/refresh.py b/tests/wpt/web-platform-tests/webdriver/tests/refresh/refresh.py new file mode 100644 index 00000000000..2305cfc6dda --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/refresh/refresh.py @@ -0,0 +1,15 @@ +from tests.support.inline import inline +from tests.support.asserts import assert_success + + +def refresh(session): + return session.transport.send( + "POST", "session/{session_id}/refresh".format(**vars(session))) + + +def test_null_response_value(session): + session.url = inline("
") + + response = refresh(session) + value = assert_success(response) + assert value is None diff --git a/tests/wpt/web-platform-tests/webdriver/tests/send_alert_text/send.py b/tests/wpt/web-platform-tests/webdriver/tests/send_alert_text/send.py index 5b38b6ff9e5..3c00925865e 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/send_alert_text/send.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/send_alert_text/send.py @@ -4,19 +4,25 @@ from tests.support.asserts import assert_error, assert_success from tests.support.inline import inline -def send_alert_text(session, body=None): +def send_alert_text(session, text=None): return session.transport.send( "POST", "session/{session_id}/alert/text".format(**vars(session)), - body) + {"text": text}) -# 18.4 Send Alert Text +def test_null_response_value(session, url): + session.url = inline("") + + response = send_alert_text(session, "Federer") + value = assert_success(response) + assert value is None + @pytest.mark.parametrize("text", [None, {}, [], 42, True]) def test_invalid_input(session, text): # 18.4 step 2 session.url = inline("") - response = send_alert_text(session, {"text": text}) + response = send_alert_text(session, text) assert_error(response, "invalid argument") @@ -24,40 +30,40 @@ def test_no_browsing_context(session, create_window): # 18.4 step 3 session.window_handle = create_window() session.close() - body = {"text": "Federer"} - response = send_alert_text(session, body) + + response = send_alert_text(session, "Federer") assert_error(response, "no such window") def test_no_user_prompt(session): # 18.4 step 4 - body = {"text": "Federer"} - response = send_alert_text(session, body) + response = send_alert_text(session, "Federer") assert_error(response, "no such alert") def test_alert_element_not_interactable(session): # 18.4 step 5 session.url = inline("") - body = {"text": "Federer"} - response = send_alert_text(session, body) + + response = send_alert_text(session, "Federer") assert_error(response, "element not interactable") def test_confirm_element_not_interactable(session): # 18.4 step 5 session.url = inline("") - body = {"text": "Federer"} - response = send_alert_text(session, body) + + response = send_alert_text(session, "Federer") assert_error(response, "element not interactable") def test_send_alert_text(session): # 18.4 step 6 session.url = inline("") - body = {"text": "Federer"} - send_response = send_alert_text(session, body) + + send_response = send_alert_text(session, "Federer") assert_success(send_response) + accept_response = session.transport.send("POST", "session/{session_id}/alert/accept" .format(session_id=session.session_id)) assert_success(accept_response) @@ -67,9 +73,10 @@ def test_send_alert_text(session): def test_send_alert_text_with_whitespace(session): # 18.4 step 6 session.url = inline("") - body = {"text": " Fed erer "} - send_response = send_alert_text(session, body) + + send_response = send_alert_text(session, " Fed erer ") assert_success(send_response) + accept_response = session.transport.send("POST", "session/{session_id}/alert/accept" .format(session_id=session.session_id)) assert_success(accept_response) diff --git a/tests/wpt/web-platform-tests/2dcontext/drawing-rectangles-to-the-canvas/.gitkeep b/tests/wpt/web-platform-tests/webdriver/tests/set_timeouts/__init__.py similarity index 100% rename from tests/wpt/web-platform-tests/2dcontext/drawing-rectangles-to-the-canvas/.gitkeep rename to tests/wpt/web-platform-tests/webdriver/tests/set_timeouts/__init__.py diff --git a/tests/wpt/web-platform-tests/webdriver/tests/set_timeouts/set.py b/tests/wpt/web-platform-tests/webdriver/tests/set_timeouts/set.py new file mode 100644 index 00000000000..8dd0344dca5 --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/set_timeouts/set.py @@ -0,0 +1,21 @@ +from tests.support.asserts import assert_success + + +def set_timeouts(session, timeouts): + return session.transport.send( + "POST", "session/{session_id}/timeouts".format(**vars(session)), + timeouts) + + +def test_null_response_value(session): + response = set_timeouts(session, {"implicit": 1000}) + value = assert_success(response) + assert value is None + + response = set_timeouts(session, {"pageLoad": 1000}) + value = assert_success(response) + assert value is None + + response = set_timeouts(session, {"script": 1000}) + value = assert_success(response) + assert value is None diff --git a/tests/wpt/web-platform-tests/webdriver/tests/set_window_rect/user_prompts.py b/tests/wpt/web-platform-tests/webdriver/tests/set_window_rect/user_prompts.py index 85249d9202b..7a7cff50d91 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/set_window_rect/user_prompts.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/set_window_rect/user_prompts.py @@ -1,5 +1,6 @@ +import pytest + from tests.support.asserts import assert_dialog_handled, assert_error, assert_success -from tests.support.fixtures import create_dialog def set_window_rect(session, rect): @@ -8,66 +9,43 @@ def set_window_rect(session, rect): rect) +@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_accept(session, create_dialog, dialog_type): + original = session.window.rect + + create_dialog(dialog_type, text="dialog") + + response = set_window_rect(session, {"x": original["x"], "y": original["y"]}) + assert_success(response) + + assert_dialog_handled(session, expected_text="dialog") + + +def test_handle_prompt_accept_and_notify(): + """TODO""" + + def test_handle_prompt_dismiss(): """TODO""" -def test_handle_prompt_accept(new_session, add_browser_capabilites): - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}}) - original = session.window.rect - - # step 2 - create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") - result = set_window_rect(session, {"x": original["x"], - "y": original["y"]}) - assert result.status == 200 - assert_dialog_handled(session, "dismiss #1") - - create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") - result = set_window_rect(session, {"x": original["x"], - "y": original["y"]}) - assert result.status == 200 - assert_dialog_handled(session, "dismiss #2") - - create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") - result = set_window_rect(session, {"x": original["x"], - "y": original["y"]}) - assert_success(result) - assert_dialog_handled(session, "dismiss #3") - - def test_handle_prompt_dismiss_and_notify(): """TODO""" -def test_handle_prompt_accept_and_notify(): - """TODO""" - - def test_handle_prompt_ignore(): """TODO""" -def test_handle_prompt_missing_value(session, create_dialog): +@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) +def test_handle_prompt_default(session, create_dialog, dialog_type): original = session.window.rect - create_dialog("alert", text="dismiss #1", result_var="dismiss1") + create_dialog(dialog_type, text="dialog") - result = set_window_rect(session, {"x": original["x"], - "y": original["y"]}) - assert_error(result, "unexpected alert open") - assert_dialog_handled(session, "dismiss #1") + response = set_window_rect(session, {"x": original["x"], + "y": original["y"]}) + assert_error(response, "unexpected alert open") - create_dialog("confirm", text="dismiss #2", result_var="dismiss2") - - result = set_window_rect(session, {"x": original["x"], - "y": original["y"]}) - assert_error(result, "unexpected alert open") - assert_dialog_handled(session, "dismiss #2") - - create_dialog("prompt", text="dismiss #3", result_var="dismiss3") - - result = set_window_rect(session, {"x": original["x"], - "y": original["y"]}) - assert_error(result, "unexpected alert open") - assert_dialog_handled(session, "dismiss #3") + assert_dialog_handled(session, expected_text="dialog") diff --git a/tests/wpt/web-platform-tests/webdriver/tests/status/status.py b/tests/wpt/web-platform-tests/webdriver/tests/status/status.py index 95b264353ba..bcd6e27fb3d 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/status/status.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/status/status.py @@ -26,14 +26,12 @@ def test_get_status_no_session(http): assert isinstance(value["message"], basestring) -def test_status_with_session_running_on_endpoint_node(new_session, add_browser_capabilites): +def test_status_with_session_running_on_endpoint_node(session): # For an endpoint node, the maximum number of active # sessions is 1: https://www.w3.org/TR/webdriver/#dfn-maximum-active-sessions # A session is open, so we expect `ready` to be False # 8.3 step 1. - _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({})}}) - response = get_status(session) value = assert_success(response) assert value["ready"] is False diff --git a/tests/wpt/web-platform-tests/webdriver/tests/support/asserts.py b/tests/wpt/web-platform-tests/webdriver/tests/support/asserts.py index a1cd0f95419..a4303784ec1 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/support/asserts.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/support/asserts.py @@ -1,4 +1,4 @@ -from webdriver import Element, WebDriverException +from webdriver import Element, NoSuchAlertException, WebDriverException # WebDriver specification ID: dfn-error-response-data @@ -88,19 +88,50 @@ def assert_success(response, value=None): def assert_dialog_handled(session, expected_text): - result = session.transport.send("GET", - "session/%s/alert/text" % session.session_id) - # If there were any existing dialogs prior to the creation of this # fixture's dialog, then the "Get Alert Text" command will return # successfully. In that case, the text must be different than that # of this fixture's dialog. try: - assert_error(result, "no such alert") - except: - assert (result.status == 200 and - result.body["value"] != expected_text), ( - "Dialog with text '%s' was not handled." % expected_text) + assert session.alert.text != expected_text, ( + "User prompt with text '%s' was not handled." % expected_text) + + except NoSuchAlertException: + pass + + +def assert_files_uploaded(session, element, files): + + def get_file_contents(file_index): + return session.execute_async_script(""" + let files = arguments[0].files; + let index = arguments[1]; + let resolve = arguments[2]; + + var reader = new FileReader(); + reader.onload = function(event) { + resolve(reader.result); + }; + reader.readAsText(files[index]); + """, (element, file_index)) + + def get_uploaded_file_names(): + return session.execute_script(""" + let fileList = arguments[0].files; + let files = []; + + for (var i = 0; i < fileList.length; i++) { + files.push(fileList[i].name); + } + + return files; + """, args=(element,)) + + expected_file_names = [str(f.basename) for f in files] + assert get_uploaded_file_names() == expected_file_names + + for index, f in enumerate(files): + assert get_file_contents(index) == f.read() def assert_same_element(session, a, b): @@ -139,6 +170,17 @@ def assert_same_element(session, a, b): raise AssertionError(message) +def assert_in_events(session, expected_events): + actual_events = session.execute_script("return window.events") + for expected_event in expected_events: + assert expected_event in actual_events + + +def assert_events_equal(session, expected_events): + actual_events = session.execute_script("return window.events") + assert actual_events == expected_events + + def assert_element_has_focus(target_element): session = target_element.session diff --git a/tests/wpt/web-platform-tests/webdriver/tests/support/fixtures.py b/tests/wpt/web-platform-tests/webdriver/tests/support/fixtures.py index dbf9f1d5e56..2e9e6326233 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/support/fixtures.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/support/fixtures.py @@ -1,5 +1,6 @@ from __future__ import print_function +import copy import json import os import urlparse @@ -14,6 +15,14 @@ from tests.support.wait import wait default_host = "http://127.0.0.1" default_port = "4444" +default_script_timeout = 30 +default_page_load_timeout = 300 +default_implicit_wait_timeout = 0 + + +_current_session = None +_custom_session = False + def ignore_exceptions(f): def inner(*args, **kwargs): @@ -25,55 +34,67 @@ def ignore_exceptions(f): return inner -@ignore_exceptions -def _ensure_valid_window(session): - """If current window is not open anymore, ensure to have a valid - one selected. +def cleanup_session(session): + """Clean-up the current session for a clean state.""" + @ignore_exceptions + def _dismiss_user_prompts(session): + """Dismiss any open user prompts in windows.""" + current_window = session.window_handle - """ - try: - session.window_handle - except webdriver.NoSuchWindowException: - session.window_handle = session.handles[0] + for window in _windows(session): + session.window_handle = window + try: + session.alert.dismiss() + except webdriver.NoSuchAlertException: + pass + session.window_handle = current_window -@ignore_exceptions -def _dismiss_user_prompts(session): - """Dismisses any open user prompts in windows.""" - current_window = session.window_handle - - for window in _windows(session): - session.window_handle = window + @ignore_exceptions + def _ensure_valid_window(session): + """If current window was closed, ensure to have a valid one selected.""" try: - session.alert.dismiss() - except webdriver.NoSuchAlertException: - pass + session.window_handle + except webdriver.NoSuchWindowException: + session.window_handle = session.handles[0] - session.window_handle = current_window + @ignore_exceptions + def _restore_timeouts(session): + """Restore modified timeouts to their default values.""" + session.timeouts.implicit = default_implicit_wait_timeout + session.timeouts.page_load = default_page_load_timeout + session.timeouts.script = default_script_timeout + @ignore_exceptions + def _restore_window_state(session): + """Reset window to an acceptable size. -@ignore_exceptions -def _restore_window_state(session): - """Reset window to an acceptable size, bringing it out of maximized, - minimized, or fullscreened state + This also includes bringing it out of maximized, minimized, + or fullscreened state. + """ + session.window.size = (800, 600) - """ - session.window.size = (800, 600) + @ignore_exceptions + def _restore_windows(session): + """Close superfluous windows opened by the test. + It will not end the session implicitly by closing the last window. + """ + current_window = session.window_handle -@ignore_exceptions -def _restore_windows(session): - """Closes superfluous windows opened by the test without ending - the session implicitly by closing the last window. - """ - current_window = session.window_handle + for window in _windows(session, exclude=[current_window]): + session.window_handle = window + if len(session.handles) > 1: + session.close() - for window in _windows(session, exclude=[current_window]): - session.window_handle = window - if len(session.handles) > 1: - session.close() + session.window_handle = current_window - session.window_handle = current_window + _restore_timeouts(session) + _ensure_valid_window(session) + _dismiss_user_prompts(session) + _restore_windows(session) + _restore_window_state(session) + _switch_to_top_level_browsing_context(session) @ignore_exceptions @@ -95,6 +116,26 @@ def _windows(session, exclude=None): return set(wins) +def add_event_listeners(session): + """Register listeners for tracked events on element.""" + def add_event_listeners(element, tracked_events): + element.session.execute_script(""" + let element = arguments[0]; + let trackedEvents = arguments[1]; + + if (!("events" in window)) { + window.events = []; + } + + for (var i = 0; i < trackedEvents.length; i++) { + element.addEventListener(trackedEvents[i], function (event) { + window.events.push(event.type); + }); + } + """, args=(element, tracked_events)) + return add_event_listeners + + def create_frame(session): """Create an `iframe` element in the current browsing context and insert it into the document. Return a reference to the newly-created element.""" @@ -140,10 +181,7 @@ def configuration(): } -_current_session = None - - -def session(configuration, request): +def session(capabilities, configuration, request): """Create and start a session for a test that does not itself test session creation. By default the session will stay open after each test, but we always try to start a @@ -151,67 +189,39 @@ def session(configuration, request): possible to recover from some errors that might leave the session in a bad state, but does not demand that we start a new session per test.""" global _current_session + + # Update configuration capabilities with custom ones from the + # capabilities fixture, which can be set by tests + caps = copy.deepcopy(configuration["capabilities"]) + caps.update(capabilities) + caps = {"alwaysMatch": caps} + + # If there is a session with different capabilities active, end it now + if _current_session is not None and ( + caps != _current_session.requested_capabilities): + _current_session.end() + _current_session = None + if _current_session is None: - _current_session = webdriver.Session(configuration["host"], - configuration["port"], - capabilities={"alwaysMatch": configuration["capabilities"]}) + _current_session = webdriver.Session( + configuration["host"], + configuration["port"], + capabilities=caps) try: _current_session.start() except webdriver.error.SessionNotCreatedException: if not _current_session.session_id: raise - # finalisers are popped off a stack, - # making their ordering reverse - request.addfinalizer(lambda: _switch_to_top_level_browsing_context(_current_session)) - request.addfinalizer(lambda: _restore_window_state(_current_session)) - request.addfinalizer(lambda: _restore_windows(_current_session)) - request.addfinalizer(lambda: _dismiss_user_prompts(_current_session)) - request.addfinalizer(lambda: _ensure_valid_window(_current_session)) + yield _current_session + cleanup_session(_current_session) + + +def current_session(): return _current_session -def new_session(configuration, request): - """Return a factory function that will attempt to start a session with a given body. - - This is intended for tests that are themselves testing new session creation, and the - session created is closed at the end of the test.""" - def end(): - global _current_session - if _current_session is not None and _current_session.session_id: - _current_session.end() - - _current_session = None - - def create_session(body): - global _current_session - _session = webdriver.Session(configuration["host"], - configuration["port"], - capabilities=None) - value = _session.send_command("POST", "session", body=body) - # Don't set the global session until we are sure this succeeded - _current_session = _session - _session.session_id = value["sessionId"] - - return value, _current_session - - end() - request.addfinalizer(end) - - return create_session - - -def add_browser_capabilites(configuration): - def update_capabilities(capabilities): - # Make sure there aren't keys in common. - assert not set(configuration["capabilities"]).intersection(set(capabilities)) - result = dict(configuration["capabilities"]) - result.update(capabilities) - return result - return update_capabilities - - def url(server_config): def inner(path, protocol="http", query="", fragment=""): port = server_config["ports"][protocol][0] @@ -221,6 +231,7 @@ def url(server_config): inner.__name__ = "url" return inner + def create_dialog(session): """Create a dialog (one of "alert", "prompt", or "confirm") and provide a function to validate that the dialog has been "handled" (either accepted or @@ -228,7 +239,7 @@ def create_dialog(session): def create_dialog(dialog_type, text=None, result_var=None): assert dialog_type in ("alert", "confirm", "prompt"), ( - "Invalid dialog type: '%s'" % dialog_type) + "Invalid dialog type: '%s'" % dialog_type) if text is None: text = "" @@ -241,23 +252,16 @@ def create_dialog(session): assert re.search(r"^[_$a-z$][_$a-z0-9]*$", result_var, re.IGNORECASE), ( 'The `result_var` must be a valid JavaScript identifier') - # Script completion and modal summoning are scheduled on two separate - # turns of the event loop to ensure that both occur regardless of how - # the user agent manages script execution. - spawn = """ - var done = arguments[0]; - setTimeout(done, 0); + # Script completes itself when the user prompt has been opened. + session.execute_async_script(""" setTimeout(function() {{ window.{0} = window.{1}("{2}"); }}, 0); - """.format(result_var, dialog_type, text) + """.format(result_var, dialog_type, text)) - session.send_session_command("POST", - "execute/async", - {"script": spawn, "args": []}) wait(session, - lambda s: s.send_session_command("GET", "alert/text") == text, - "modal has not appeared", + lambda s: s.alert.text == text, + "No user prompt with text '{}' detected".format(text), timeout=15, ignored_exceptions=webdriver.NoSuchAlertException) diff --git a/tests/wpt/web-platform-tests/2dcontext/drawing-text-to-the-canvas/.gitkeep b/tests/wpt/web-platform-tests/webdriver/tests/switch_to_frame/__init__.py similarity index 100% rename from tests/wpt/web-platform-tests/2dcontext/drawing-text-to-the-canvas/.gitkeep rename to tests/wpt/web-platform-tests/webdriver/tests/switch_to_frame/__init__.py diff --git a/tests/wpt/web-platform-tests/webdriver/tests/switch_to_frame/switch.py b/tests/wpt/web-platform-tests/webdriver/tests/switch_to_frame/switch.py new file mode 100644 index 00000000000..955bd6b936d --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/switch_to_frame/switch.py @@ -0,0 +1,21 @@ +import webdriver.protocol as protocol + +from tests.support.asserts import assert_success +from tests.support.inline import inline, iframe + + +def switch_to_frame(session, frame): + return session.transport.send( + "POST", "session/{session_id}/frame".format(**vars(session)), + {"id": frame}, + encoder=protocol.Encoder, decoder=protocol.Decoder, + session=session) + + +def test_null_response_value(session): + session.url = inline(iframe("

foo")) + frame_element = session.find.css("iframe", all=False) + + response = switch_to_frame(session, frame_element) + value = assert_success(response) + assert value is None diff --git a/tests/wpt/web-platform-tests/webdriver/tests/switch_to_parent_frame/switch.py b/tests/wpt/web-platform-tests/webdriver/tests/switch_to_parent_frame/switch.py index 215c2a4f4f7..c5234727f2c 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/switch_to_parent_frame/switch.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/switch_to_parent_frame/switch.py @@ -10,6 +10,16 @@ def switch_to_parent_frame(session): "POST", "session/{session_id}/frame/parent".format(**vars(session))) +def test_null_response_value(session): + session.url = inline(iframe("

foo")) + frame_element = session.find.css("iframe", all=False) + session.switch_frame(frame_element) + + response = switch_to_parent_frame(session) + value = assert_success(response) + assert value is None + + def test_stale_element_from_iframe(session): session.url = inline(iframe("

foo")) frame_element = session.find.css("iframe", all=False) diff --git a/tests/wpt/web-platform-tests/2dcontext/drawingstyle-objects/.gitkeep b/tests/wpt/web-platform-tests/webdriver/tests/switch_to_window/__init__.py similarity index 100% rename from tests/wpt/web-platform-tests/2dcontext/drawingstyle-objects/.gitkeep rename to tests/wpt/web-platform-tests/webdriver/tests/switch_to_window/__init__.py diff --git a/tests/wpt/web-platform-tests/webdriver/tests/switch_to_window/switch.py b/tests/wpt/web-platform-tests/webdriver/tests/switch_to_window/switch.py new file mode 100644 index 00000000000..17f7c4da328 --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/switch_to_window/switch.py @@ -0,0 +1,15 @@ +from tests.support.asserts import assert_success + + +def switch_to_window(session, handle): + return session.transport.send( + "POST", "session/{session_id}/window".format(**vars(session)), + {"handle": handle}) + + +def test_null_response_value(session, create_window): + new_handle = create_window() + + response = switch_to_window(session, new_handle) + value = assert_success(response) + assert value is None diff --git a/tests/wpt/web-platform-tests/webmessaging/META.yml b/tests/wpt/web-platform-tests/webmessaging/META.yml index 8831129e2fd..e70b780b57a 100644 --- a/tests/wpt/web-platform-tests/webmessaging/META.yml +++ b/tests/wpt/web-platform-tests/webmessaging/META.yml @@ -1,3 +1,4 @@ +spec: https://html.spec.whatwg.org/multipage/web-messaging.html suggested_reviewers: - zqzhang - aogilvie diff --git a/tests/wpt/web-platform-tests/webmessaging/with-options/broken-origin.tentative.html b/tests/wpt/web-platform-tests/webmessaging/with-options/broken-origin.tentative.html new file mode 100644 index 00000000000..e4d28c8e40c --- /dev/null +++ b/tests/wpt/web-platform-tests/webmessaging/with-options/broken-origin.tentative.html @@ -0,0 +1,12 @@ + +resolving broken url + + +

+ diff --git a/tests/wpt/web-platform-tests/webmessaging/with-options/host-specific-origin.tentative.html b/tests/wpt/web-platform-tests/webmessaging/with-options/host-specific-origin.tentative.html new file mode 100644 index 00000000000..7e6d1619913 --- /dev/null +++ b/tests/wpt/web-platform-tests/webmessaging/with-options/host-specific-origin.tentative.html @@ -0,0 +1,14 @@ + +resolving url with stuff in host-specific + + +
+ diff --git a/tests/wpt/web-platform-tests/webmessaging/with-options/invalid-args.tentative.html b/tests/wpt/web-platform-tests/webmessaging/with-options/invalid-args.tentative.html new file mode 100644 index 00000000000..b04918a0004 --- /dev/null +++ b/tests/wpt/web-platform-tests/webmessaging/with-options/invalid-args.tentative.html @@ -0,0 +1,10 @@ + +unknown parameter + + +
+ diff --git a/tests/wpt/web-platform-tests/webmessaging/with-options/message-channel-transferable.tentative.html b/tests/wpt/web-platform-tests/webmessaging/with-options/message-channel-transferable.tentative.html new file mode 100644 index 00000000000..f474286a79e --- /dev/null +++ b/tests/wpt/web-platform-tests/webmessaging/with-options/message-channel-transferable.tentative.html @@ -0,0 +1,15 @@ + +message channel as ports + + +
+ diff --git a/tests/wpt/web-platform-tests/webmessaging/with-options/no-target-origin.tentative.html b/tests/wpt/web-platform-tests/webmessaging/with-options/no-target-origin.tentative.html new file mode 100644 index 00000000000..e11e49d86cd --- /dev/null +++ b/tests/wpt/web-platform-tests/webmessaging/with-options/no-target-origin.tentative.html @@ -0,0 +1,14 @@ + +no targetOrigin + + +
+ diff --git a/tests/wpt/web-platform-tests/webmessaging/with-options/null-arg-two.tentative.html b/tests/wpt/web-platform-tests/webmessaging/with-options/null-arg-two.tentative.html new file mode 100644 index 00000000000..d344dc48ed8 --- /dev/null +++ b/tests/wpt/web-platform-tests/webmessaging/with-options/null-arg-two.tentative.html @@ -0,0 +1,10 @@ + +null arg two interpreted as null string + + +
+ diff --git a/tests/wpt/web-platform-tests/webmessaging/with-options/one-arg.tentative.html b/tests/wpt/web-platform-tests/webmessaging/with-options/one-arg.tentative.html new file mode 100644 index 00000000000..2595134b544 --- /dev/null +++ b/tests/wpt/web-platform-tests/webmessaging/with-options/one-arg.tentative.html @@ -0,0 +1,14 @@ + +just one argument + + +
+ diff --git a/tests/wpt/web-platform-tests/webmessaging/with-options/slash-origin.tentative.html b/tests/wpt/web-platform-tests/webmessaging/with-options/slash-origin.tentative.html new file mode 100644 index 00000000000..1c6691ae78a --- /dev/null +++ b/tests/wpt/web-platform-tests/webmessaging/with-options/slash-origin.tentative.html @@ -0,0 +1,14 @@ + +special value '/' + + +
+ diff --git a/tests/wpt/web-platform-tests/webmessaging/with-options/two-arg.tentative.html b/tests/wpt/web-platform-tests/webmessaging/with-options/two-arg.tentative.html new file mode 100644 index 00000000000..ed0314adc61 --- /dev/null +++ b/tests/wpt/web-platform-tests/webmessaging/with-options/two-arg.tentative.html @@ -0,0 +1,14 @@ + +two argument + + +
+ diff --git a/tests/wpt/web-platform-tests/webmessaging/with-options/undefined-transferable.tentative.html b/tests/wpt/web-platform-tests/webmessaging/with-options/undefined-transferable.tentative.html new file mode 100644 index 00000000000..36c3fe3cee9 --- /dev/null +++ b/tests/wpt/web-platform-tests/webmessaging/with-options/undefined-transferable.tentative.html @@ -0,0 +1,14 @@ + +undefined as transferable + + +
+ diff --git a/tests/wpt/web-platform-tests/webmessaging/with-options/unknown-parameter.tentative.html b/tests/wpt/web-platform-tests/webmessaging/with-options/unknown-parameter.tentative.html new file mode 100644 index 00000000000..adcd9bf0845 --- /dev/null +++ b/tests/wpt/web-platform-tests/webmessaging/with-options/unknown-parameter.tentative.html @@ -0,0 +1,14 @@ + +unknown parameter + + +
+ diff --git a/tests/wpt/web-platform-tests/webrtc-stats/META.yml b/tests/wpt/web-platform-tests/webrtc-stats/META.yml index f4eb0f375c5..489264f23d6 100644 --- a/tests/wpt/web-platform-tests/webrtc-stats/META.yml +++ b/tests/wpt/web-platform-tests/webrtc-stats/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/webrtc-stats/ suggested_reviewers: - henbos - vr000m diff --git a/tests/wpt/web-platform-tests/webrtc/META.yml b/tests/wpt/web-platform-tests/webrtc/META.yml index e268f62867f..ea2846e97af 100644 --- a/tests/wpt/web-platform-tests/webrtc/META.yml +++ b/tests/wpt/web-platform-tests/webrtc/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/webrtc-pc/ suggested_reviewers: - snuggs - agouaillard diff --git a/tests/wpt/web-platform-tests/webrtc/RTCDTMFSender-insertDTMF.https.html b/tests/wpt/web-platform-tests/webrtc/RTCDTMFSender-insertDTMF.https.html index 2e479862acb..8a6d6456f3a 100644 --- a/tests/wpt/web-platform-tests/webrtc/RTCDTMFSender-insertDTMF.https.html +++ b/tests/wpt/web-platform-tests/webrtc/RTCDTMFSender-insertDTMF.https.html @@ -119,7 +119,9 @@ const offer = await caller.createOffer(); await caller.setLocalDescription(offer); await callee.setRemoteDescription(offer); - const track = generateMediaStreamTrack('audio'); + const stream = await navigator.mediaDevices.getUserMedia({audio: true}); + t.add_cleanup(() => stream.getTracks().forEach(track => track.stop())); + const [track] = stream.getTracks(); callee.addTrack(track); const answer = await callee.createAnswer(); await callee.setLocalDescription(answer); diff --git a/tests/wpt/web-platform-tests/webrtc/RTCPeerConnection-add-track-no-deadlock.https.html b/tests/wpt/web-platform-tests/webrtc/RTCPeerConnection-add-track-no-deadlock.https.html index 0a69431edc0..81e3b736432 100644 --- a/tests/wpt/web-platform-tests/webrtc/RTCPeerConnection-add-track-no-deadlock.https.html +++ b/tests/wpt/web-platform-tests/webrtc/RTCPeerConnection-add-track-no-deadlock.https.html @@ -3,6 +3,7 @@ RTCPeerConnection addTrack does not deadlock + diff --git a/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-encodings.html b/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-encodings.html index 00c2f479804..b4a60c8a6d4 100644 --- a/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-encodings.html +++ b/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-encodings.html @@ -12,6 +12,7 @@ // https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html // The following helper functions are called from RTCRtpParameters-helper.js: + // doOfferAnswerExchange // validateSenderRtpParameters /* @@ -114,9 +115,12 @@ Otherwise, set it to a list containing a single RTCRtpEncodingParameters with active set to true. */ - test(() => { + promise_test(async t => { const pc = new RTCPeerConnection(); + t.add_cleanup(() => pc.close()); const transceiver = pc.addTransceiver('audio'); + await doOfferAnswerExchange(t, pc); + const param = transceiver.sender.getParameters(); validateSenderRtpParameters(param); const { encodings } = param; @@ -125,9 +129,11 @@ assert_equals(encoding.active, true); }, 'addTransceiver() with undefined sendEncodings should have default encoding parameter with active set to true'); - test(() => { + promise_test(async t => { const pc = new RTCPeerConnection(); + t.add_cleanup(() => pc.close()); const transceiver = pc.addTransceiver('audio', { sendEncodings: [] }); + await doOfferAnswerExchange(t, pc); const param = transceiver.sender.getParameters(); validateSenderRtpParameters(param); @@ -151,8 +157,9 @@ 5.2. getParameters - encodings is set to the value of the [[send encodings]] internal slot. */ - test(() => { + promise_test(async t => { const pc = new RTCPeerConnection(); + t.add_cleanup(() => pc.close()); const { sender } = pc.addTransceiver('audio', { sendEncodings: [{ dtx: 'enabled', @@ -164,6 +171,7 @@ rid: 'foo' }] }); + await doOfferAnswerExchange(t, pc); const param = sender.getParameters(); validateSenderRtpParameters(param); @@ -190,10 +198,12 @@ with a newly created InvalidModificationError. Note that this also applies to transactionId. */ - promise_test(t => { + promise_test(async t => { const pc = new RTCPeerConnection(); t.add_cleanup(() => pc.close()); const { sender } = pc.addTransceiver('audio'); + await doOfferAnswerExchange(t, pc); + const param = sender.getParameters(); validateSenderRtpParameters(param); @@ -208,10 +218,12 @@ sender.setParameters(param)); }, `sender.setParameters() with mismatch number of encodings should reject with InvalidModificationError`); - promise_test(t => { + promise_test(async t => { const pc = new RTCPeerConnection(); t.add_cleanup(() => pc.close()); const { sender } = pc.addTransceiver('audio'); + await doOfferAnswerExchange(t, pc); + const param = sender.getParameters(); validateSenderRtpParameters(param); @@ -221,32 +233,11 @@ sender.setParameters(param)); }, `sender.setParameters() with encodings unset should reject with InvalidModificationError`); - promise_test(t => { - const pc = new RTCPeerConnection(); - t.add_cleanup(() => pc.close()); - const { sender } = pc.addTransceiver('audio'); - - const param = sender.getParameters(); - validateSenderRtpParameters(param); - const encoding = getFirstEncoding(param); - const { ssrc } = encoding; - - // ssrc may not be set since it is optional - if(ssrc === undefined) { - encoding.ssrc = 2; - } else { - // If it is set, increase the number by 1 to make it different from original - encoding.ssrc = ssrc + 1; - } - - return promise_rejects(t, 'InvalidModificationError', - sender.setParameters(param)); - }, `setParameters() with modified encoding.ssrc field should reject with InvalidModificationError`); - - promise_test(t => { + promise_test(async t => { const pc = new RTCPeerConnection(); t.add_cleanup(() => pc.close()); const { sender } = pc.addTransceiver('audio'); + await doOfferAnswerExchange(t, pc); const param = sender.getParameters(); validateSenderRtpParameters(param); @@ -265,34 +256,13 @@ sender.setParameters(param)); }, `setParameters() with modified encoding.rtx field should reject with InvalidModificationError`); - promise_test(t => { - const pc = new RTCPeerConnection(); - t.add_cleanup(() => pc.close()); - const { sender } = pc.addTransceiver('audio'); - - const param = sender.getParameters(); - validateSenderRtpParameters(param); - const encoding = getFirstEncoding(param); - const { fec } = encoding; - - if(fec === undefined) { - encoding.fec = { ssrc: 2 }; - } else if(fec.ssrc === undefined) { - fec.ssrc = 2; - } else { - fec.ssrc += 1; - } - - return promise_rejects(t, 'InvalidModificationError', - sender.setParameters(param)); - }, `setParameters() with modified encoding.fec field should reject with InvalidModificationError`); - - promise_test(t => { + promise_test(async t => { const pc = new RTCPeerConnection(); t.add_cleanup(() => pc.close()); const { sender } = pc.addTransceiver('audio', { sendEncodings: [{ rid: 'foo' }], }); + await doOfferAnswerExchange(t, pc); const param = sender.getParameters(); validateSenderRtpParameters(param); @@ -311,10 +281,11 @@ value less than 1.0, abort these steps and return a promise rejected with a newly created RangeError. */ - promise_test(t => { + promise_test(async t => { const pc = new RTCPeerConnection(); t.add_cleanup(() => pc.close()); const { sender } = pc.addTransceiver('audio'); + await doOfferAnswerExchange(t, pc); const param = sender.getParameters(); validateSenderRtpParameters(param); @@ -325,10 +296,11 @@ sender.setParameters(param)); }, `setParameters() with encoding.scaleResolutionDownBy field set to less than 1.0 should reject with RangeError`); - promise_test(t => { + promise_test(async t => { const pc = new RTCPeerConnection(); t.add_cleanup(() => pc.close()); const { sender } = pc.addTransceiver('audio'); + await doOfferAnswerExchange(t, pc); const param = sender.getParameters(); validateSenderRtpParameters(param); @@ -346,52 +318,76 @@ }, `setParameters() with encoding.scaleResolutionDownBy field set to greater than 1.0 should succeed`); // Helper function to test that modifying an encoding field should succeed - function test_modified_encoding(field, value1, value2, desc) { - promise_test(t => { + function test_modified_encoding(kind, field, value1, value2, desc) { + promise_test(async t => { const pc = new RTCPeerConnection(); t.add_cleanup(() => pc.close()); - const { sender } = pc.addTransceiver('audio', { + const { sender } = pc.addTransceiver(kind, { sendEncodings: [{ [field]: value1 }] }); + await doOfferAnswerExchange(t, pc); - const param = sender.getParameters(); - validateSenderRtpParameters(param); - const encoding = getFirstEncoding(param); + const param1 = sender.getParameters(); + validateSenderRtpParameters(param1); + const encoding1 = getFirstEncoding(param1); - assert_equals(encoding[field], value1); - encoding[field] = value2; + assert_equals(encoding1[field], value1); + encoding1[field] = value2; - return sender.setParameters(param) - .then(() => { - const param = sender.getParameters(); - validateSenderRtpParameters(param); - const encoding = getFirstEncoding(param); - assert_equals(encoding[field], value2); - }); - }, desc); + await sender.setParameters(param1); + const param2 = sender.getParameters(); + validateSenderRtpParameters(param2); + const encoding2 = getFirstEncoding(param2); + assert_equals(encoding2[field], value2); + }, desc + ' with RTCRtpTransceiverInit'); + + promise_test(async t => { + const pc = new RTCPeerConnection(); + t.add_cleanup(() => pc.close()); + const { sender } = pc.addTransceiver(kind); + await doOfferAnswerExchange(t, pc); + + const initParam = sender.getParameters(); + validateSenderRtpParameters(initParam); + initParam.encodings[0][field] = value1; + await sender.setParameters(initParam); + + const param1 = sender.getParameters(); + validateSenderRtpParameters(param1); + const encoding1 = getFirstEncoding(param1); + + assert_equals(encoding1[field], value1); + encoding1[field] = value2; + + await sender.setParameters(param1); + const param2 = sender.getParameters(); + validateSenderRtpParameters(param2); + const encoding2 = getFirstEncoding(param2); + assert_equals(encoding2[field], value2); + }, desc + ' without RTCRtpTransceiverInit'); } - test_modified_encoding('dtx', 'enabled', 'disabled', + test_modified_encoding('audio', 'dtx', 'enabled', 'disabled', 'setParameters() with modified encoding.dtx should succeed'); - test_modified_encoding('dtx', 'enabled', undefined, + test_modified_encoding('audio', 'dtx', 'enabled', undefined, 'setParameters() with unset encoding.dtx should succeed'); - test_modified_encoding('active', true, false, + test_modified_encoding('audio', 'active', false, true, 'setParameters() with modified encoding.active should succeed'); - test_modified_encoding('priority', 'very-low', 'high', + test_modified_encoding('audio', 'priority', 'very-low', 'high', 'setParameters() with modified encoding.priority should succeed'); - test_modified_encoding('ptime', 2, 4, + test_modified_encoding('audio', 'ptime', 2, 4, 'setParameters() with modified encoding.ptime should succeed'); - test_modified_encoding('maxBitrate', 2, 4, + test_modified_encoding('audio', 'maxBitrate', 10000, 20000, 'setParameters() with modified encoding.maxBitrate should succeed'); - test_modified_encoding('maxBitrate', 24, 16, + test_modified_encoding('video', 'maxFramerate', 24, 16, 'setParameters() with modified encoding.maxFramerate should succeed'); diff --git a/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-helper.js b/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-helper.js index a46f15b291d..9c4b6cd412e 100644 --- a/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-helper.js +++ b/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-helper.js @@ -8,6 +8,19 @@ // This file depends on dictionary-helper.js which should // be loaded from the main HTML file. +// An offer/answer exchange is necessary for getParameters() to have any +// negotiated parameters to return. +async function doOfferAnswerExchange(t, caller) { + const callee = new RTCPeerConnection(); + t.add_cleanup(() => callee.close()); + const offer = await caller.createOffer(); + await caller.setLocalDescription(offer); + await callee.setRemoteDescription(offer); + const answer = await callee.createAnswer(); + await callee.setLocalDescription(answer); + await caller.setRemoteDescription(answer); +} + /* Validates the RTCRtpParameters returned from RTCRtpSender.prototype.getParameters diff --git a/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-transactionId.html b/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-transactionId.html index 02413fe7177..ac6f6d19556 100644 --- a/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-transactionId.html +++ b/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-transactionId.html @@ -12,6 +12,7 @@ // https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html // The following helper functions are called from RTCRtpParameters-helper.js: + // doOfferAnswerExchange // validateSenderRtpParameters /* @@ -60,9 +61,10 @@ - transactionId is set to a new unique identifier, used to match this getParameters call to a setParameters call that may occur later. */ - test(() => { + promise_test(async t => { const pc = new RTCPeerConnection(); const { sender } = pc.addTransceiver('audio'); + await doOfferAnswerExchange(t, pc); const param1 = sender.getParameters(); const param2 = sender.getParameters(); @@ -83,10 +85,11 @@ with a newly created InvalidModificationError. Note that this also applies to transactionId. */ - promise_test(t => { + promise_test(async t => { const pc = new RTCPeerConnection(); t.add_cleanup(() => pc.close()); const { sender } = pc.addTransceiver('audio'); + await doOfferAnswerExchange(t, pc); const param = sender.getParameters(); validateSenderRtpParameters(param); @@ -98,10 +101,11 @@ sender.setParameters(param)); }, `sender.setParameters() with transaction ID different from last getParameters() should reject with InvalidModificationError`); - promise_test(t => { + promise_test(async t => { const pc = new RTCPeerConnection(); t.add_cleanup(() => pc.close()); const { sender } = pc.addTransceiver('audio'); + await doOfferAnswerExchange(t, pc); const param = sender.getParameters(); validateSenderRtpParameters(param); @@ -112,24 +116,26 @@ sender.setParameters(param)); }, `sender.setParameters() with transaction ID unset should reject with InvalidModificationError`); - promise_test(t => { + promise_test(async t => { const pc = new RTCPeerConnection(); t.add_cleanup(() => pc.close()); const { sender } = pc.addTransceiver('audio'); + await doOfferAnswerExchange(t, pc); const param = sender.getParameters(); validateSenderRtpParameters(param); return sender.setParameters(param) .then(() => - promise_rejects(t, 'InvalidModificationError', + promise_rejects(t, 'InvalidStateError', sender.setParameters(param))); - }, `setParameters() twice with the same parameters should reject with InvalidModificationError`); + }, `setParameters() twice with the same parameters should reject with InvalidStateError`); - promise_test(t => { + promise_test(async t => { const pc = new RTCPeerConnection(); t.add_cleanup(() => pc.close()); const { sender } = pc.addTransceiver('audio'); + await doOfferAnswerExchange(t, pc); const param1 = sender.getParameters(); const param2 = sender.getParameters(); diff --git a/tests/wpt/web-platform-tests/webrtc/RTCRtpReceiver-getStats.https.html b/tests/wpt/web-platform-tests/webrtc/RTCRtpReceiver-getStats.https.html index 083f9e12245..4a2e6a0bd8b 100644 --- a/tests/wpt/web-platform-tests/webrtc/RTCRtpReceiver-getStats.https.html +++ b/tests/wpt/web-platform-tests/webrtc/RTCRtpReceiver-getStats.https.html @@ -62,7 +62,7 @@ t.add_cleanup(() => caller.close()); const callee = new RTCPeerConnection(); t.add_cleanup(() => callee.close()); - const stream = await navigator.mediaDevices.getUserMedia({audio:true}); + const stream = await getNoiseStream({audio:true}); t.add_cleanup(() => stream.getTracks().forEach(track => track.stop())); const [track] = stream.getTracks(); caller.addTrack(track, stream); diff --git a/tests/wpt/web-platform-tests/webrtc/RTCRtpSender-getStats.https.html b/tests/wpt/web-platform-tests/webrtc/RTCRtpSender-getStats.https.html index dc403bbe6cd..18ab8255544 100644 --- a/tests/wpt/web-platform-tests/webrtc/RTCRtpSender-getStats.https.html +++ b/tests/wpt/web-platform-tests/webrtc/RTCRtpSender-getStats.https.html @@ -57,7 +57,7 @@ t.add_cleanup(() => caller.close()); const callee = new RTCPeerConnection(); t.add_cleanup(() => callee.close()); - const stream = await navigator.mediaDevices.getUserMedia({audio:true}); + const stream = await getNoiseStream({audio:true}); t.add_cleanup(() => stream.getTracks().forEach(track => track.stop())); const [track] = stream.getTracks(); const sender = caller.addTrack(track, stream); diff --git a/tests/wpt/web-platform-tests/webrtc/RTCRtpSender-replaceTrack.html b/tests/wpt/web-platform-tests/webrtc/RTCRtpSender-replaceTrack.https.html similarity index 100% rename from tests/wpt/web-platform-tests/webrtc/RTCRtpSender-replaceTrack.html rename to tests/wpt/web-platform-tests/webrtc/RTCRtpSender-replaceTrack.https.html diff --git a/tests/wpt/web-platform-tests/webrtc/interfaces.https.html b/tests/wpt/web-platform-tests/webrtc/interfaces.https.html index 5807a634981..0eefc90c210 100644 --- a/tests/wpt/web-platform-tests/webrtc/interfaces.https.html +++ b/tests/wpt/web-platform-tests/webrtc/interfaces.https.html @@ -79,7 +79,7 @@ // Asynchoronously generate MediaStreamTrack from getUserMedia function asyncInitMediaStreamTrack() { - return navigator.mediaDevices.getUserMedia({ audio: true }) + return getNoiseStream({ audio: true }) .then(mediaStream => { idlTestObjects.mediaStreamTrack = mediaStream.getTracks()[0]; }); @@ -109,7 +109,7 @@ const idlArray = new IdlArray(); let webrtcIdl = fetch('/interfaces/webrtc-pc.idl').then(r => r.text()); - let mediacaptureMainIdl = fetch('/interfaces/mediacapture-main.idl').then(r => r.text()); + let mediacaptureMainIdl = fetch('/interfaces/mediacapture-streams.idl').then(r => r.text()); idlArray.add_untested_idls(mediacaptureMainIdl, { only: ['MediaStreamConstraints'] }); idlArray.add_idls(webrtcIdl); diff --git a/tests/wpt/web-platform-tests/webrtc/simplecall.https.html b/tests/wpt/web-platform-tests/webrtc/simplecall.https.html index 4d948ee34e3..6adefe77492 100644 --- a/tests/wpt/web-platform-tests/webrtc/simplecall.https.html +++ b/tests/wpt/web-platform-tests/webrtc/simplecall.https.html @@ -1,23 +1,15 @@ - - RTCPeerConnection Connection Test +
- -
@@ -38,7 +30,7 @@ property to true in Firefox. test.done(); }); - function getUserMediaOkCallback(localStream) { + function getNoiseStreamOkCallback(localStream) { gFirstConnection = new RTCPeerConnection(null); gFirstConnection.onicecandidate = onIceCandidateToFirst; localStream.getTracks().forEach(function(track) { @@ -111,8 +103,8 @@ property to true in Firefox. // This function starts the test. test.step(function() { - navigator.mediaDevices.getUserMedia({ video: true, audio: true }) - .then(test.step_func(getUserMediaOkCallback), failed('getUserMedia')); + getNoiseStream({ video: true, audio: true }) + .then(test.step_func(getNoiseStreamOkCallback), failed('getNoiseStream')); }); diff --git a/tests/wpt/web-platform-tests/websockets/Create-on-worker-shutdown.any.js b/tests/wpt/web-platform-tests/websockets/Create-on-worker-shutdown.any.js index cb3eff82a68..15f0368d933 100644 --- a/tests/wpt/web-platform-tests/websockets/Create-on-worker-shutdown.any.js +++ b/tests/wpt/web-platform-tests/websockets/Create-on-worker-shutdown.any.js @@ -4,7 +4,15 @@ async_test(t => { function workerCode() { close(); var ws = new WebSocket(self.location.origin.replace('http', 'ws')); - postMessage(ws.readyState == WebSocket.CONNECTING); + var data = { + originalState: ws.readyState, + afterCloseState: null + }; + + ws.close(); + + data.afterCloseState = ws.readyState; + postMessage(data); } var workerBlob = new Blob([workerCode.toString() + ";workerCode();"], { @@ -12,8 +20,9 @@ async_test(t => { }); var w = new Worker(URL.createObjectURL(workerBlob)); - w.onmessage = function(e) { - assert_true(e.data, "WebSocket created on worker shutdown."); + w.onmessage = t.step_func(function(e) { + assert_equals(e.data.originalState, WebSocket.CONNECTING, "WebSocket created on worker shutdown is in connecting state."); + assert_equals(e.data.afterCloseState, WebSocket.CLOSING, "Closed WebSocket created on worker shutdown is in closing state."); t.done(); - } + }); }, 'WebSocket created after a worker self.close()'); diff --git a/tests/wpt/web-platform-tests/websockets/META.yml b/tests/wpt/web-platform-tests/websockets/META.yml index fe75a79f06b..14e23e03a85 100644 --- a/tests/wpt/web-platform-tests/websockets/META.yml +++ b/tests/wpt/web-platform-tests/websockets/META.yml @@ -1,5 +1,4 @@ +spec: https://html.spec.whatwg.org/multipage/web-sockets.html suggested_reviewers: - - kristijanburnik - zqzhang - - Jxck - jdm diff --git a/tests/wpt/web-platform-tests/websockets/handlers/set-cookie-secure_wsh.py b/tests/wpt/web-platform-tests/websockets/handlers/set-cookie-secure_wsh.py index a7ea9d604eb..4db321fc9dc 100755 --- a/tests/wpt/web-platform-tests/websockets/handlers/set-cookie-secure_wsh.py +++ b/tests/wpt/web-platform-tests/websockets/handlers/set-cookie-secure_wsh.py @@ -1,9 +1,9 @@ #!/usr/bin/python -import urlparse +from six.moves import urllib def web_socket_do_extra_handshake(request): - url_parts = urlparse.urlsplit(request.uri) + url_parts = urllib.parse.urlsplit(request.uri) request.extra_headers.append(('Set-Cookie', 'ws_test_'+(url_parts.query or '')+'=test; Secure; Path=/')) def web_socket_transfer_data(request): diff --git a/tests/wpt/web-platform-tests/websockets/handlers/set-cookie_http_wsh.py b/tests/wpt/web-platform-tests/websockets/handlers/set-cookie_http_wsh.py index acda91ca5e8..2fa0ded65d8 100755 --- a/tests/wpt/web-platform-tests/websockets/handlers/set-cookie_http_wsh.py +++ b/tests/wpt/web-platform-tests/websockets/handlers/set-cookie_http_wsh.py @@ -1,9 +1,9 @@ #!/usr/bin/python -import urlparse +from six.moves import urllib def web_socket_do_extra_handshake(request): - url_parts = urlparse.urlsplit(request.uri) + url_parts = urllib.parse.urlsplit(request.uri) request.extra_headers.append(('Set-Cookie', 'ws_test_'+(url_parts.query or '')+'=test; Path=/; HttpOnly\x0D\x0ASec-WebSocket-Origin: '+request.ws_origin)) def web_socket_transfer_data(request): diff --git a/tests/wpt/web-platform-tests/websockets/handlers/set-cookie_wsh.py b/tests/wpt/web-platform-tests/websockets/handlers/set-cookie_wsh.py index 0e2314b37c6..3cec1c041cf 100755 --- a/tests/wpt/web-platform-tests/websockets/handlers/set-cookie_wsh.py +++ b/tests/wpt/web-platform-tests/websockets/handlers/set-cookie_wsh.py @@ -1,9 +1,9 @@ #!/usr/bin/python -import urlparse +from six.moves import urllib def web_socket_do_extra_handshake(request): - url_parts = urlparse.urlsplit(request.uri) + url_parts = urllib.parse.urlsplit(request.uri) request.extra_headers.append(('Set-Cookie', 'ws_test_'+(url_parts.query or '')+'=test; Path=/')) def web_socket_transfer_data(request): diff --git a/tests/wpt/web-platform-tests/websockets/handlers/stash_responder_wsh.py b/tests/wpt/web-platform-tests/websockets/handlers/stash_responder_wsh.py index bc6f4fd6ee7..fd6eabc7023 100644 --- a/tests/wpt/web-platform-tests/websockets/handlers/stash_responder_wsh.py +++ b/tests/wpt/web-platform-tests/websockets/handlers/stash_responder_wsh.py @@ -1,5 +1,6 @@ #!/usr/bin/python -import urlparse, json +from six.moves import urllib +import json from mod_pywebsocket import common, msgutil, util from mod_pywebsocket.handshake import hybi from wptserve import stash @@ -15,7 +16,7 @@ def web_socket_transfer_data(request): line = request.ws_stream.receive_message() if line == "echo": query = request.unparsed_uri.split('?')[1] - GET = dict(urlparse.parse_qsl(query)) + GET = dict(urllib.parse.parse_qsl(query)) # TODO(kristijanburnik): This code should be reused from # /mixed-content/generic/expect.py or implemented more generally diff --git a/tests/wpt/web-platform-tests/webstorage/META.yml b/tests/wpt/web-platform-tests/webstorage/META.yml index c4b05356125..0da67a586b8 100644 --- a/tests/wpt/web-platform-tests/webstorage/META.yml +++ b/tests/wpt/web-platform-tests/webstorage/META.yml @@ -1,8 +1,7 @@ +spec: https://html.spec.whatwg.org/multipage/webstorage.html suggested_reviewers: - siusin - inexorabletash - zqzhang - - chunywang - - kangxu - ibelem - jdm diff --git a/tests/wpt/web-platform-tests/webusb/META.yml b/tests/wpt/web-platform-tests/webusb/META.yml index e400fc8d69c..546094855e5 100644 --- a/tests/wpt/web-platform-tests/webusb/META.yml +++ b/tests/wpt/web-platform-tests/webusb/META.yml @@ -1,2 +1,3 @@ +spec: https://wicg.github.io/webusb/ suggested_reviewers: - reillyeon diff --git a/tests/wpt/web-platform-tests/webusb/idlharness.https.any.js b/tests/wpt/web-platform-tests/webusb/idlharness.https.any.js index 10779ad513d..d2e4ae8f41d 100644 --- a/tests/wpt/web-platform-tests/webusb/idlharness.https.any.js +++ b/tests/wpt/web-platform-tests/webusb/idlharness.https.any.js @@ -14,52 +14,56 @@ var usbEndpoint; var usbConnectionEvent; usb_test(async () => { - const idl = await fetch('/interfaces/webusb.idl').then(r => r.text()); - const html = await fetch('/interfaces/html.idl').then(r => r.text()); - const dom = await fetch('/interfaces/dom.idl').then(r => r.text()); + // Ignored errors are surfaced in idlharness.js's test_object below. + let device; + try { + device = (await getFakeDevice()).device; + } catch (e) {} - let idl_array = new IdlArray(); - idl_array.add_idls(idl); - idl_array.add_dependency_idls(html); - idl_array.add_dependency_idls(dom); + return idl_test( + ['webusb'], + ['html', 'dom'], + idl_array => { + // Untested IDL interfaces + idl_array.add_untested_idls('dictionary PermissionDescriptor {};'); + idl_array.add_untested_idls('interface PermissionStatus {};'); - // Untested IDL interfaces - idl_array.add_untested_idls('dictionary PermissionDescriptor {};'); - idl_array.add_untested_idls('interface PermissionStatus {};'); + try { + usbDevice = device; + usbConfiguration = usbDevice.configurations[0]; + usbInterface = usbConfiguration.interfaces[0]; + usbAlternateInterface = usbInterface.alternates[0]; + usbEndpoint = usbAlternateInterface.endpoints[0]; + usbConnectionEvent = + new USBConnectionEvent('connect', { device: usbDevice }) + } catch (e) {} - let {device} = await getFakeDevice(); + if (self.GLOBAL.isWindow()) { + idl_array.add_objects({ Navigator: ['navigator'] }); + } else if (self.GLOBAL.isWorker()) { + idl_array.add_objects({ WorkerNavigator: ['navigator'] }); + } - usbDevice = device; - usbConfiguration = usbDevice.configurations[0]; - usbInterface = usbConfiguration.interfaces[0]; - usbAlternateInterface = usbInterface.alternates[0]; - usbEndpoint = usbAlternateInterface.endpoints[0]; - usbConnectionEvent = - new USBConnectionEvent('connect', { device: usbDevice }) - - if (self.GLOBAL.isWindow()) { - idl_array.add_objects({ Navigator: ['navigator'] }); - } else if (self.GLOBAL.isWorker()) { - idl_array.add_objects({ WorkerNavigator: ['navigator'] }); - } - - idl_array.add_objects({ - USB: ['navigator.usb'], - USBAlternateInterface: ['usbAlternateInterface'], - USBConfiguration: ['usbConfiguration'], - USBConnectionEvent: ['usbConnectionEvent'], - USBDevice: ['usbDevice'], - USBEndpoint: ['usbEndpoint'], - USBInterface: ['usbInterface'], - USBInTransferResult: ['new USBInTransferResult("ok")'], - USBOutTransferResult: ['new USBOutTransferResult("ok")'], - USBIsochronousInTransferResult: ['new USBIsochronousInTransferResult([])'], - USBIsochronousOutTransferResult: ['new USBIsochronousOutTransferResult([])'], - USBIsochronousInTransferPacket: ['new USBIsochronousInTransferPacket("ok")'], - USBIsochronousOutTransferPacket: ['new USBIsochronousOutTransferPacket("ok")'], - }); - - idl_array.test(); -}, 'WebUSB IDL test'); + idl_array.add_objects({ + Navigator: ['navigator'], + USB: ['navigator.usb'], + USBAlternateInterface: ['usbAlternateInterface'], + USBConfiguration: ['usbConfiguration'], + USBConnectionEvent: ['usbConnectionEvent'], + USBDevice: ['usbDevice'], + USBEndpoint: ['usbEndpoint'], + USBInterface: ['usbInterface'], + USBInTransferResult: ['new USBInTransferResult("ok")'], + USBOutTransferResult: ['new USBOutTransferResult("ok")'], + USBIsochronousInTransferResult: ['new USBIsochronousInTransferResult([])'], + USBIsochronousOutTransferResult: ['new USBIsochronousOutTransferResult([])'], + USBIsochronousInTransferPacket: ['new USBIsochronousInTransferPacket("ok")'], + USBIsochronousOutTransferPacket: ['new USBIsochronousOutTransferPacket("ok")'], + }); + idl_array.prevent_multiple_testing('Navigator'); + }, + 'WebUSB IDL test' + ) +}); done(); diff --git a/tests/wpt/web-platform-tests/webvr/META.yml b/tests/wpt/web-platform-tests/webvr/META.yml index 546f5b323f6..b50e559457d 100644 --- a/tests/wpt/web-platform-tests/webvr/META.yml +++ b/tests/wpt/web-platform-tests/webvr/META.yml @@ -1,2 +1,3 @@ +spec: https://immersive-web.github.io/webvr/spec/1.1/ suggested_reviewers: - klausw diff --git a/tests/wpt/web-platform-tests/webvtt/META.yml b/tests/wpt/web-platform-tests/webvtt/META.yml index 96e33822b5e..949f312d7ac 100644 --- a/tests/wpt/web-platform-tests/webvtt/META.yml +++ b/tests/wpt/web-platform-tests/webvtt/META.yml @@ -1,3 +1,4 @@ +spec: https://w3c.github.io/webvtt/ suggested_reviewers: - silviapfeiffer - BenjaminSchaaf diff --git a/tests/wpt/web-platform-tests/webxr/META.yml b/tests/wpt/web-platform-tests/webxr/META.yml index 33d584689cb..b5e3e65a12c 100644 --- a/tests/wpt/web-platform-tests/webxr/META.yml +++ b/tests/wpt/web-platform-tests/webxr/META.yml @@ -1,3 +1,4 @@ +spec: https://immersive-web.github.io/webxr/spec/latest/ suggested_reviewers: - toji - paezagon diff --git a/tests/wpt/web-platform-tests/workers/META.yml b/tests/wpt/web-platform-tests/workers/META.yml index 9a148eabd84..a7297d38447 100644 --- a/tests/wpt/web-platform-tests/workers/META.yml +++ b/tests/wpt/web-platform-tests/workers/META.yml @@ -1,6 +1,6 @@ +spec: https://html.spec.whatwg.org/multipage/workers.html suggested_reviewers: - zqzhang - - chunywang - caitp - jdm - annevk diff --git a/tests/wpt/web-platform-tests/workers/baseurl/alpha/importScripts.html b/tests/wpt/web-platform-tests/workers/baseurl/alpha/import-in-moduleworker.html similarity index 63% rename from tests/wpt/web-platform-tests/workers/baseurl/alpha/importScripts.html rename to tests/wpt/web-platform-tests/workers/baseurl/alpha/import-in-moduleworker.html index 0fbd35b4497..2c75dec9ce7 100644 --- a/tests/wpt/web-platform-tests/workers/baseurl/alpha/importScripts.html +++ b/tests/wpt/web-platform-tests/workers/baseurl/alpha/import-in-moduleworker.html @@ -1,13 +1,13 @@ -Base URL in workers: importScripts +Base URL in module dedicated workers: import + + diff --git a/tests/wpt/web-platform-tests/workers/baseurl/alpha/importScripts-in-worker.html b/tests/wpt/web-platform-tests/workers/baseurl/alpha/importScripts-in-worker.html new file mode 100644 index 00000000000..55907bf4238 --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/baseurl/alpha/importScripts-in-worker.html @@ -0,0 +1,8 @@ + + +Base URL in classic dedicated workers: importScripts + + + diff --git a/tests/wpt/web-platform-tests/workers/baseurl/alpha/sharedworker.html b/tests/wpt/web-platform-tests/workers/baseurl/alpha/sharedworker-in-worker.html similarity index 100% rename from tests/wpt/web-platform-tests/workers/baseurl/alpha/sharedworker.html rename to tests/wpt/web-platform-tests/workers/baseurl/alpha/sharedworker-in-worker.html diff --git a/tests/wpt/web-platform-tests/workers/baseurl/alpha/worker.html b/tests/wpt/web-platform-tests/workers/baseurl/alpha/worker-in-worker.html similarity index 100% rename from tests/wpt/web-platform-tests/workers/baseurl/alpha/worker.html rename to tests/wpt/web-platform-tests/workers/baseurl/alpha/worker-in-worker.html diff --git a/tests/wpt/web-platform-tests/workers/baseurl/alpha/xhr.html b/tests/wpt/web-platform-tests/workers/baseurl/alpha/xhr-in-moduleworker.html similarity index 74% rename from tests/wpt/web-platform-tests/workers/baseurl/alpha/xhr.html rename to tests/wpt/web-platform-tests/workers/baseurl/alpha/xhr-in-moduleworker.html index 9a1219b4549..7597a1357d1 100644 --- a/tests/wpt/web-platform-tests/workers/baseurl/alpha/xhr.html +++ b/tests/wpt/web-platform-tests/workers/baseurl/alpha/xhr-in-moduleworker.html @@ -1,11 +1,11 @@ -Base URL in workers: XHR +Base URL in module dedicated workers: XHR + + diff --git a/tests/wpt/web-platform-tests/workers/baseurl/alpha/xhr-in-worker.html b/tests/wpt/web-platform-tests/workers/baseurl/alpha/xhr-in-worker.html new file mode 100644 index 00000000000..bc58b9b2dd1 --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/baseurl/alpha/xhr-in-worker.html @@ -0,0 +1,8 @@ + + +Base URL in classic dedicated workers: XHR + + + diff --git a/tests/wpt/web-platform-tests/workers/baseurl/beta/import.py b/tests/wpt/web-platform-tests/workers/baseurl/beta/import.py new file mode 100644 index 00000000000..db18c830a4e --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/baseurl/beta/import.py @@ -0,0 +1,3 @@ +def main(request, response): + return (302, "Moved"), [("Location", "../gamma/import.js")], "postMessage('executed redirecting script');" + diff --git a/tests/wpt/web-platform-tests/workers/baseurl/beta/script.js b/tests/wpt/web-platform-tests/workers/baseurl/beta/script.js index 8fe3dfc13b1..bef771ff9eb 100644 --- a/tests/wpt/web-platform-tests/workers/baseurl/beta/script.js +++ b/tests/wpt/web-platform-tests/workers/baseurl/beta/script.js @@ -1 +1 @@ -postMessage('beta'); +var result = 'beta/script.js'; diff --git a/tests/wpt/web-platform-tests/workers/baseurl/beta/xhr-worker.py b/tests/wpt/web-platform-tests/workers/baseurl/beta/xhr-worker.py new file mode 100644 index 00000000000..77270536a50 --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/baseurl/beta/xhr-worker.py @@ -0,0 +1,2 @@ +def main(request, response): + return (302, "Moved"), [("Location", "../gamma/xhr-worker.js")], "postMessage('executed redirecting script');" diff --git a/tests/wpt/web-platform-tests/workers/baseurl/gamma/import.js b/tests/wpt/web-platform-tests/workers/baseurl/gamma/import.js new file mode 100644 index 00000000000..1246913a84b --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/baseurl/gamma/import.js @@ -0,0 +1,2 @@ +import r from "./script-module.js"; +postMessage(r); diff --git a/tests/wpt/web-platform-tests/workers/baseurl/gamma/importScripts.js b/tests/wpt/web-platform-tests/workers/baseurl/gamma/importScripts.js index 3f7685645cb..13820380a83 100644 --- a/tests/wpt/web-platform-tests/workers/baseurl/gamma/importScripts.js +++ b/tests/wpt/web-platform-tests/workers/baseurl/gamma/importScripts.js @@ -1 +1,6 @@ +importScripts('/resources/testharness.js'); importScripts("script.js"); +test(() => { + assert_equals(result, "gamma/script.js"); +}); +done(); diff --git a/tests/wpt/web-platform-tests/workers/baseurl/gamma/script-module.js b/tests/wpt/web-platform-tests/workers/baseurl/gamma/script-module.js new file mode 100644 index 00000000000..88d5f82db3e --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/baseurl/gamma/script-module.js @@ -0,0 +1 @@ +export default 'gamma/script-module.js'; diff --git a/tests/wpt/web-platform-tests/workers/baseurl/gamma/script.js b/tests/wpt/web-platform-tests/workers/baseurl/gamma/script.js index dddf2240cc3..0f9ce8eacf4 100644 --- a/tests/wpt/web-platform-tests/workers/baseurl/gamma/script.js +++ b/tests/wpt/web-platform-tests/workers/baseurl/gamma/script.js @@ -1 +1 @@ -postMessage('gamma'); +var result = 'gamma/script.js'; diff --git a/tests/wpt/web-platform-tests/workers/baseurl/gamma/xhr-worker.js b/tests/wpt/web-platform-tests/workers/baseurl/gamma/xhr-worker.js new file mode 100644 index 00000000000..a9d77827d95 --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/baseurl/gamma/xhr-worker.js @@ -0,0 +1,8 @@ +importScripts('/resources/testharness.js'); +test(t => { + var x = new XMLHttpRequest(); + x.open("GET", "test.txt", false); + x.send(); + assert_equals(x.response, "gamma\n"); +}); +done(); diff --git a/tests/wpt/web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-module.html b/tests/wpt/web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-module.html new file mode 100644 index 00000000000..b1a14be8f75 --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-module.html @@ -0,0 +1,20 @@ + +WorkerLocation with redirects: module dedicated workers + + +
+ diff --git a/tests/wpt/web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-sharedworker.html b/tests/wpt/web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-sharedworker.html new file mode 100644 index 00000000000..978a99ac8c4 --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-sharedworker.html @@ -0,0 +1,9 @@ + +WorkerLocation with redirects: classic shared workers + + +
+ diff --git a/tests/wpt/web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect.html b/tests/wpt/web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect.html index 2fd16a4c163..98a0e547602 100644 --- a/tests/wpt/web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect.html +++ b/tests/wpt/web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect.html @@ -2,7 +2,7 @@ /* --> -location with a worker in separate file that redirects +WorkerLocation with redirects: classic dedicated workers
diff --git a/tests/wpt/web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect.js b/tests/wpt/web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect.js new file mode 100644 index 00000000000..2db48544a2d --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect.js @@ -0,0 +1,7 @@ +importScripts('/resources/testharness.js'); +test(t => { + assert_equals(location.pathname, '/workers/interfaces/WorkerGlobalScope/location/redirect.js'); + assert_equals(location.search, '?a'); + assert_equals(location.hash, ''); +}); +done(); diff --git a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-blob-url.any.js b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-blob-url.any.js new file mode 100644 index 00000000000..9a50b23893b --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-blob-url.any.js @@ -0,0 +1,19 @@ +// META: script=/workers/modules/resources/import-test-cases.js + +// Imports |testCase.scriptURL| on a dedicated worker loaded from a blob URL, +// and waits until the list of imported modules is sent from the worker. Passes +// if the list is equal to |testCase.expectation|. +function import_blob_url_test(testCase) { + promise_test(async () => { + const importURL = new URL(testCase.scriptURL, location.href); + const blob = new Blob([`import "${importURL}";`], + { type: 'text/javascript' }); + const blobURL = URL.createObjectURL(blob); + + const worker = new Worker(blobURL, { type: 'module'}); + const msgEvent = await new Promise(resolve => worker.onmessage = resolve); + assert_array_equals(msgEvent.data, testCase.expectation); + }, testCase.description); +} + +testCases.forEach(import_blob_url_test); diff --git a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-data-url.any.js b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-data-url.any.js new file mode 100644 index 00000000000..10bac0dfbf7 --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-data-url.any.js @@ -0,0 +1,21 @@ +// META: script=/workers/modules/resources/import-test-cases.js + +// Imports |testCase.scriptURL| on a dedicated worker loaded from a data URL, +// and waits until the list of imported modules is sent from the worker. Passes +// if the list is equal to |testCase.expectation|. +function import_data_url_test(testCase) { + promise_test(async () => { + // The Access-Control-Allow-Origin header is necessary because a worker + // loaded from a data URL has a null origin and import() on the worker + // without the header is blocked. + const importURL = new URL(testCase.scriptURL, location.href) + + '?pipe=header(Access-Control-Allow-Origin, *)'; + const dataURL = `data:text/javascript,import "${importURL}";`; + + const worker = new Worker(dataURL, { type: 'module'}); + const msgEvent = await new Promise(resolve => worker.onmessage = resolve); + assert_array_equals(msgEvent.data, testCase.expectation); + }, testCase.description); +} + +testCases.forEach(import_data_url_test); diff --git a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-failure.html b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-failure.html index 1c3adeb3437..547f9e16dc9 100644 --- a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-failure.html +++ b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-failure.html @@ -11,10 +11,10 @@ promise_test(async () => { assert_equals(msg_event.data, 'TypeError'); }, 'importScripts() on module worker should throw an exception.'); -promise_test(async () => { +promise_test(() => { const scriptURL = 'resources/static-import-worker.js'; const worker = new Worker(scriptURL, { type: 'classic' }); - await new Promise(resolve => worker.onerror = resolve); + return new Promise(resolve => worker.onerror = resolve); }, 'Static import on classic worker should throw an exception.'); promise_test(() => { @@ -31,12 +31,22 @@ promise_test(() => { }, 'Static import for non-existent script should dispatch an ErrorEvent.'); promise_test(async () => { - const script_url = './non-existent-worker.js'; + const scriptURL = './non-existent-worker.js'; const worker = new Worker('resources/dynamic-import-given-url-worker.js', { type: 'module' }); - worker.postMessage(script_url); + worker.postMessage(scriptURL); const msg_event = await new Promise(resolve => worker.onmessage = resolve); assert_equals(msg_event.data, 'TypeError'); }, 'Dynamic import for non-existent script should throw an exception.'); +test(() => { + const scriptURL = 'http://invalid:123$'; + assert_throws('SyntaxError', () => new Worker(scriptURL, { type: 'module' })); +}, 'Worker construction for an invalid URL should throw an exception.'); + +test(() => { + const scriptURL = 'file:///static-import-worker.js'; + assert_throws('SecurityError', () => new Worker(scriptURL, { type: 'module' })); +}, 'Worker construction for a file URL should throw an exception.'); + diff --git a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import.any.js b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import.any.js index 30b48e46bab..65adcb0b503 100644 --- a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import.any.js +++ b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import.any.js @@ -1,39 +1,14 @@ -// Starts a dedicated worker for |scriptURL| and waits until the list of -// imported modules is sent from the worker. Passes if the list is equal to -// |expectedImportedModules|. -function import_test(scriptURL, expectedImportedModules, description) { +// META: script=/workers/modules/resources/import-test-cases.js + +// Starts a dedicated worker for |testCase.scriptURL| and waits until the list +// of imported modules is sent from the worker. Passes if the list is equal to +// |testCase.expectation|. +function import_test(testCase) { promise_test(async () => { - const worker = new Worker(scriptURL, { type: 'module' }); - const msg_event = await new Promise(resolve => worker.onmessage = resolve); - assert_array_equals(msg_event.data, expectedImportedModules); - }, description); + const worker = new Worker(testCase.scriptURL, { type: 'module' }); + const msgEvent = await new Promise(resolve => worker.onmessage = resolve); + assert_array_equals(msgEvent.data, testCase.expectation); + }, testCase.description); } -import_test('resources/static-import-worker.js', - ['export-on-load-script.js'], - 'Static import.'); - -import_test('resources/nested-static-import-worker.js', - ['export-on-static-import-script.js', 'export-on-load-script.js'], - 'Nested static import.'); - - -import_test('resources/static-import-and-then-dynamic-import-worker.js', - ['export-on-dynamic-import-script.js', 'export-on-load-script.js'], - 'Static import and then dynamic import.'); - -import_test('resources/dynamic-import-worker.js', - ['export-on-load-script.js'], - 'Dynamic import.'); - -import_test('resources/nested-dynamic-import-worker.js', - ['export-on-dynamic-import-script.js', 'export-on-load-script.js'], - 'Nested dynamic import.'); - -import_test('resources/dynamic-import-and-then-static-import-worker.js', - ['export-on-static-import-script.js', 'export-on-load-script.js'], - 'Dynamic import and then static import.'); - -import_test('resources/eval-dynamic-import-worker.js', - ['export-on-load-script.js'], - 'eval(import()).'); +testCases.forEach(import_test); diff --git a/tests/wpt/web-platform-tests/workers/modules/resources/export-on-dynamic-import-script.js.headers b/tests/wpt/web-platform-tests/workers/modules/resources/export-on-dynamic-import-script.js.headers new file mode 100644 index 00000000000..cb762eff806 --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/modules/resources/export-on-dynamic-import-script.js.headers @@ -0,0 +1 @@ +Access-Control-Allow-Origin: * diff --git a/tests/wpt/web-platform-tests/workers/modules/resources/export-on-static-import-script.js.headers b/tests/wpt/web-platform-tests/workers/modules/resources/export-on-static-import-script.js.headers new file mode 100644 index 00000000000..cb762eff806 --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/modules/resources/export-on-static-import-script.js.headers @@ -0,0 +1 @@ +Access-Control-Allow-Origin: * diff --git a/tests/wpt/web-platform-tests/workers/modules/resources/import-test-cases.js b/tests/wpt/web-platform-tests/workers/modules/resources/import-test-cases.js new file mode 100644 index 00000000000..919c20e0d4c --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/modules/resources/import-test-cases.js @@ -0,0 +1,49 @@ +const testCases = [ + { + scriptURL: 'resources/static-import-worker.js', + expectation: ['export-on-load-script.js'], + description: 'Static import.' + }, + { + scriptURL: 'resources/nested-static-import-worker.js', + expectation: [ + 'export-on-static-import-script.js', + 'export-on-load-script.js' + ], + description: 'Nested static import.' + }, + { + scriptURL: 'resources/static-import-and-then-dynamic-import-worker.js', + expectation: [ + 'export-on-dynamic-import-script.js', + 'export-on-load-script.js' + ], + description: 'Static import and then dynamic import.' + }, + { + scriptURL: 'resources/dynamic-import-worker.js', + expectation: ['export-on-load-script.js'], + description: 'Dynamic import.' + }, + { + scriptURL: 'resources/nested-dynamic-import-worker.js', + expectation: [ + 'export-on-dynamic-import-script.js', + 'export-on-load-script.js' + ], + description: 'Nested dynamic import.' + }, + { + scriptURL: 'resources/dynamic-import-and-then-static-import-worker.js', + expectation: [ + 'export-on-static-import-script.js', + 'export-on-load-script.js' + ], + description: 'Dynamic import and then static import.' + }, + { + scriptURL: 'resources/eval-dynamic-import-worker.js', + expectation: ['export-on-load-script.js'], + description: 'eval(import()).' + } +]; diff --git a/tests/wpt/web-platform-tests/worklets/META.yml b/tests/wpt/web-platform-tests/worklets/META.yml index 3a84e8b337a..5c92c43c538 100644 --- a/tests/wpt/web-platform-tests/worklets/META.yml +++ b/tests/wpt/web-platform-tests/worklets/META.yml @@ -1,2 +1,3 @@ +spec: https://drafts.css-houdini.org/worklets/ suggested_reviewers: - bfgeek diff --git a/tests/wpt/web-platform-tests/worklets/idlharness.worker.js b/tests/wpt/web-platform-tests/worklets/idlharness.worker.js new file mode 100644 index 00000000000..827dd02c4c5 --- /dev/null +++ b/tests/wpt/web-platform-tests/worklets/idlharness.worker.js @@ -0,0 +1,13 @@ +importScripts("/resources/testharness.js"); +importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js"); + +// https://drafts.css-houdini.org/worklets/ + +promise_test(async () => { + const idl = await fetch('/interfaces/worklets.idl').then(r => r.text()); + + const idl_array = new IdlArray(); + idl_array.add_idls(idl); + idl_array.test(); +}, 'worklets interfaces'); +done(); diff --git a/tests/wpt/web-platform-tests/x-frame-options/META.yml b/tests/wpt/web-platform-tests/x-frame-options/META.yml index 3c7f551d6bf..674a1648847 100644 --- a/tests/wpt/web-platform-tests/x-frame-options/META.yml +++ b/tests/wpt/web-platform-tests/x-frame-options/META.yml @@ -1,3 +1,4 @@ +spec: https://tools.ietf.org/html/rfc7034 suggested_reviewers: - annevk - mikewest diff --git a/tests/wpt/web-platform-tests/xhr/META.yml b/tests/wpt/web-platform-tests/xhr/META.yml index d0cabafe88e..7ad6ad95c36 100644 --- a/tests/wpt/web-platform-tests/xhr/META.yml +++ b/tests/wpt/web-platform-tests/xhr/META.yml @@ -1,13 +1,11 @@ +spec: https://xhr.spec.whatwg.org/ suggested_reviewers: - emilio - - hallvors - - kangxu - caitp - Manishearth - jungkees - ibelem - mathiasbynens - - ronkorving - jdm - annevk - wisniewskit diff --git a/tests/wpt/web-platform-tests/xhr/open-url-redirected-sharedworker-origin.htm b/tests/wpt/web-platform-tests/xhr/open-url-redirected-sharedworker-origin.htm new file mode 100644 index 00000000000..02699919585 --- /dev/null +++ b/tests/wpt/web-platform-tests/xhr/open-url-redirected-sharedworker-origin.htm @@ -0,0 +1,11 @@ + + +XMLHttpRequest: redirected classic shared worker scripts, origin and referrer + + +
+ diff --git a/tests/wpt/web-platform-tests/xhr/open-url-redirected-worker-origin.htm b/tests/wpt/web-platform-tests/xhr/open-url-redirected-worker-origin.htm index e5e5a4e8ecf..a0e064840f4 100644 --- a/tests/wpt/web-platform-tests/xhr/open-url-redirected-worker-origin.htm +++ b/tests/wpt/web-platform-tests/xhr/open-url-redirected-worker-origin.htm @@ -1,6 +1,6 @@ -XMLHttpRequest: redirected worker scripts, origin and referrer +XMLHttpRequest: redirected classic dedicated worker scripts, origin and referrer