mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
add conditional expected_missing_file_errors property to manage different behaviour between local tests and CI (due to fake_server)
This commit is contained in:
@@ -44,6 +44,15 @@ class TestElements(PyScriptTest):
|
|||||||
on each the supported properties and checks if the element was created correctly
|
on each the supported properties and checks if the element was created correctly
|
||||||
and all it's properties were set correctly.
|
and all it's properties were set correctly.
|
||||||
"""
|
"""
|
||||||
|
@property
|
||||||
|
def expected_missing_file_errors(self):
|
||||||
|
# In fake server conditions this test will not throw an error due to missing files.
|
||||||
|
# If we want to skip the test, use:
|
||||||
|
# pytest.skip("Skipping: fake server doesn't throw 404 errors on missing local files.")
|
||||||
|
return [
|
||||||
|
"Failed to load resource: the server responded with a status of 404 (File not found)"
|
||||||
|
] if self.dev_server else []
|
||||||
|
|
||||||
|
|
||||||
def _create_el_and_basic_asserts(
|
def _create_el_and_basic_asserts(
|
||||||
self,
|
self,
|
||||||
@@ -157,22 +166,11 @@ class TestElements(PyScriptTest):
|
|||||||
self._create_el_and_basic_asserts("aside", "some text", interpreter)
|
self._create_el_and_basic_asserts("aside", "some text", interpreter)
|
||||||
|
|
||||||
def test_audio(self, interpreter):
|
def test_audio(self, interpreter):
|
||||||
|
|
||||||
if self.dev_server:
|
|
||||||
expected_errors = [
|
|
||||||
"Failed to load resource: the server responded with a status of 404 (File not found)"
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
# In fake server conditions this test will not throw an error due to missing files.
|
|
||||||
# If we want to skip the test, use:
|
|
||||||
# pytest.skip("Skipping: fake server doesn't throw 404 errors on missing local files.")
|
|
||||||
expected_errors = []
|
|
||||||
|
|
||||||
self._create_el_and_basic_asserts(
|
self._create_el_and_basic_asserts(
|
||||||
"audio",
|
"audio",
|
||||||
interpreter=interpreter,
|
interpreter=interpreter,
|
||||||
properties={"src": "http://localhost:8080/somefile.ogg", "controls": True},
|
properties={"src": "http://localhost:8080/somefile.ogg", "controls": True},
|
||||||
expected_errors=expected_errors,
|
expected_errors=self.expected_missing_file_errors,
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_b(self, interpreter):
|
def test_b(self, interpreter):
|
||||||
@@ -267,9 +265,7 @@ class TestElements(PyScriptTest):
|
|||||||
"embed",
|
"embed",
|
||||||
interpreter=interpreter,
|
interpreter=interpreter,
|
||||||
properties=properties,
|
properties=properties,
|
||||||
expected_errors=[
|
expected_errors=self.expected_missing_file_errors,
|
||||||
"Failed to load resource: the server responded with a status of 404 (File not found)"
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_fieldset(self, interpreter):
|
def test_fieldset(self, interpreter):
|
||||||
@@ -339,9 +335,7 @@ class TestElements(PyScriptTest):
|
|||||||
"iframe",
|
"iframe",
|
||||||
interpreter,
|
interpreter,
|
||||||
properties=properties,
|
properties=properties,
|
||||||
expected_errors=[
|
expected_errors=self.expected_missing_file_errors,
|
||||||
"Failed to load resource: the server responded with a status of 404 (File not found)"
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_img(self, interpreter):
|
def test_img(self, interpreter):
|
||||||
@@ -355,9 +349,7 @@ class TestElements(PyScriptTest):
|
|||||||
"img",
|
"img",
|
||||||
interpreter=interpreter,
|
interpreter=interpreter,
|
||||||
properties=properties,
|
properties=properties,
|
||||||
expected_errors=[
|
expected_errors=self.expected_missing_file_errors,
|
||||||
"Failed to load resource: the server responded with a status of 404 (File not found)"
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_input(self, interpreter):
|
def test_input(self, interpreter):
|
||||||
@@ -403,9 +395,7 @@ class TestElements(PyScriptTest):
|
|||||||
"link",
|
"link",
|
||||||
interpreter=interpreter,
|
interpreter=interpreter,
|
||||||
properties=properties,
|
properties=properties,
|
||||||
expected_errors=[
|
expected_errors=self.expected_missing_file_errors,
|
||||||
"Failed to load resource: the server responded with a status of 404 (File not found)"
|
|
||||||
],
|
|
||||||
additional_selector_rules="[href='http://localhost:8080/somefile.css']",
|
additional_selector_rules="[href='http://localhost:8080/somefile.css']",
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -515,9 +505,6 @@ class TestElements(PyScriptTest):
|
|||||||
"source",
|
"source",
|
||||||
interpreter=interpreter,
|
interpreter=interpreter,
|
||||||
properties=properties,
|
properties=properties,
|
||||||
# expected_errors=[
|
|
||||||
# "Failed to load resource: the server responded with a status of 404 (File not found)"
|
|
||||||
# ],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_span(self, interpreter):
|
def test_span(self, interpreter):
|
||||||
@@ -588,9 +575,6 @@ class TestElements(PyScriptTest):
|
|||||||
"track",
|
"track",
|
||||||
interpreter=interpreter,
|
interpreter=interpreter,
|
||||||
properties=properties,
|
properties=properties,
|
||||||
# expected_errors=[
|
|
||||||
# "Failed to load resource: the server responded with a status of 404 (File not found)"
|
|
||||||
# ],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_u(self, interpreter):
|
def test_u(self, interpreter):
|
||||||
@@ -613,7 +597,5 @@ class TestElements(PyScriptTest):
|
|||||||
"video",
|
"video",
|
||||||
interpreter=interpreter,
|
interpreter=interpreter,
|
||||||
properties=properties,
|
properties=properties,
|
||||||
expected_errors=[
|
expected_errors=self.expected_missing_file_errors,
|
||||||
"Failed to load resource: the server responded with a status of 404 (File not found)"
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user