2021-01-13 20:57:33 +03:00
|
|
|
#!/usr/bin/env python3
|
2022-02-05 08:56:33 +03:00
|
|
|
import glob
|
2022-08-25 19:12:55 +03:00
|
|
|
import re
|
|
|
|
|
2021-01-13 20:57:33 +03:00
|
|
|
import test_echo
|
|
|
|
import test_lint
|
|
|
|
import test_format
|
|
|
|
import test_hurl
|
|
|
|
|
2021-02-12 15:22:46 +03:00
|
|
|
|
|
|
|
def get_files(glob_expr):
|
2022-02-05 08:56:33 +03:00
|
|
|
return sorted([f.replace("\\", "/") for f in glob.glob(glob_expr)])
|
|
|
|
|
2021-02-12 15:22:46 +03:00
|
|
|
|
2022-08-25 19:12:55 +03:00
|
|
|
def accept(f: str) -> bool:
|
|
|
|
"""Returns True if file `f` should be run, False otherwise."""
|
|
|
|
return not re.match(r".*\.\d+\.hurl$", f)
|
|
|
|
|
|
|
|
|
2021-01-13 20:57:33 +03:00
|
|
|
def main():
|
|
|
|
# Static run (without server)
|
2022-02-05 08:56:33 +03:00
|
|
|
[
|
|
|
|
test_echo.test(f)
|
2022-02-14 11:13:33 +03:00
|
|
|
for f in get_files("tests_ok/*.hurl")
|
|
|
|
+ get_files("tests_failed/*.hurl")
|
|
|
|
+ get_files("tests_error_lint/*.hurl")
|
2022-08-25 19:12:55 +03:00
|
|
|
if accept(f)
|
2022-02-05 08:56:33 +03:00
|
|
|
]
|
2022-02-14 11:13:33 +03:00
|
|
|
[test_format.test("json", f) for f in get_files("tests_ok/*.hurl")]
|
|
|
|
[test_format.test("json", f) for f in get_files("tests_failed/*.hurl")]
|
|
|
|
[test_format.test("html", f) for f in get_files("tests_ok/*.hurl")]
|
|
|
|
[test_format.test("html", f) for f in get_files("tests_failed/*.hurl")]
|
2022-02-05 08:56:33 +03:00
|
|
|
[test_lint.test(f) for f in get_files("tests_error_lint/*.hurl")]
|
|
|
|
[test_hurl.test(f) for f in get_files("tests_error_parser/*.hurl")]
|
2021-01-13 20:57:33 +03:00
|
|
|
|
|
|
|
# Dynamic run (with server)
|
2022-02-14 11:13:33 +03:00
|
|
|
[
|
|
|
|
test_hurl.test(f)
|
|
|
|
for f in get_files("tests_ok/*.hurl")
|
|
|
|
+ get_files("tests_failed/*.hurl")
|
|
|
|
+ get_files("ssl/*.hurl")
|
2022-08-25 19:12:55 +03:00
|
|
|
if accept(f)
|
2022-02-14 11:13:33 +03:00
|
|
|
]
|
2021-01-13 20:57:33 +03:00
|
|
|
|
2022-02-05 08:56:33 +03:00
|
|
|
print("test integration ok!")
|
2021-01-13 20:57:33 +03:00
|
|
|
|
|
|
|
|
2022-02-05 08:56:33 +03:00
|
|
|
if __name__ == "__main__":
|
2021-01-13 20:57:33 +03:00
|
|
|
main()
|