diff --git a/test/example.py b/test/example.py new file mode 100644 index 0000000000000000000000000000000000000000..22cc4df666ae911f557198c21dbec185051b35c6 --- /dev/null +++ b/test/example.py @@ -0,0 +1,61 @@ +#/bin/env python3 +#-*- encoding=utf8 -*- +""" +create by: miaokaibo +date: 2020-10-30 + +test all: pytest -s example.py --html=result.html +test one class: pytest -s xxxx.py::Testxx --html=result.html +test one class one case: pytest -s xxxx.py::Testxx::test_xxx --html=result.html +""" +import pytest + + +class TestCase(object): + def setup_class(self): + """ + setup before all cases + """ + print("setup_class") + + def teardown_class(self): + """ + teardown after all cases + """ + print("teardown_class") + + def setup_method(self): + """ + setup before everyone case + """ + print("setup_method") + + def teardown_method(self): + """ + teardown after everyone case + """ + print("teardown_method") + + def test_1(self): + """ + case name must start with test_ + """ + print("test_1") + assert False + + def test_2(self): + """ + case name must start with test_ + """ + print("test_2") + assert True + + def test_3(self): + """ + case name must start with test_ + """ + print("test_3") + assert True + +#if __main__ == "__name__": +