Bug 1631828 - use mozilla reason when we have a crash, and track by crash, not test...
[gecko.git] / testing / mozbase / mozcrash / tests / test_basic.py
blob84fb2587eb39aed91ecf9000ed9977c23ac2aabb
1 #!/usr/bin/env python
2 # coding=UTF-8
4 import mozunit
5 import pytest
6 from conftest import fspath
9 def test_no_dump_files(check_for_crashes):
10 """Test that check_for_crashes returns 0 if no dumps are present."""
11 assert 0 == check_for_crashes()
14 @pytest.mark.parametrize("minidump_files", [3], indirect=True)
15 def test_dump_count(check_for_crashes, minidump_files):
16 """Test that check_for_crashes returns the number of crash dumps."""
17 assert 3 == check_for_crashes()
20 def test_dump_directory_unicode(request, check_for_crashes, tmpdir, capsys):
21 """Test that check_for_crashes can handle unicode in dump_directory."""
22 from conftest import minidump_files
24 tmpdir = tmpdir.ensure(u"🍪", dir=1)
25 minidump_files = minidump_files(request, tmpdir)
27 assert 1 == check_for_crashes(dump_directory=fspath(tmpdir), quiet=False)
29 out, _ = capsys.readouterr()
30 assert fspath(minidump_files[0]["dmp"]) in out
31 assert u"🍪" in out
34 def test_test_name_unicode(check_for_crashes, minidump_files, capsys):
35 """Test that check_for_crashes can handle unicode in dump_directory."""
36 assert 1 == check_for_crashes(test_name=u"🍪", quiet=False)
38 out, err = capsys.readouterr()
39 assert u"| 🍪" in out
42 if __name__ == "__main__":
43 mozunit.main()