test_tear_down.py 579 B

1234567891011121314151617
  1. import yatest.common as ya_common
  2. def test_sanity():
  3. test_path = ya_common.binary_path("library/cpp/testing/unittest/pytests/test_subject/library-cpp-testing-unittest-pytests-test_subject")
  4. tests = ya_common.execute([test_path, '-A']).std_out \
  5. .decode().strip().split('\n')
  6. assert tests
  7. for test in tests:
  8. name = test.split('::')[1]
  9. res = ya_common.execute([test_path, test], check_exit_code=False)
  10. assert res.exit_code != 0
  11. lines = res.std_err.decode().split('\n')
  12. assert f"{name}: TearDown is ran" in lines