summaryrefslogtreecommitdiffstats
path: root/testing/mozbase/mozcrash/tests/test_basic.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/mozbase/mozcrash/tests/test_basic.py
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/mozbase/mozcrash/tests/test_basic.py')
-rw-r--r--testing/mozbase/mozcrash/tests/test_basic.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/testing/mozbase/mozcrash/tests/test_basic.py b/testing/mozbase/mozcrash/tests/test_basic.py
new file mode 100644
index 0000000000..84fb2587eb
--- /dev/null
+++ b/testing/mozbase/mozcrash/tests/test_basic.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# coding=UTF-8
+
+import mozunit
+import pytest
+from conftest import fspath
+
+
+def test_no_dump_files(check_for_crashes):
+ """Test that check_for_crashes returns 0 if no dumps are present."""
+ assert 0 == check_for_crashes()
+
+
+@pytest.mark.parametrize("minidump_files", [3], indirect=True)
+def test_dump_count(check_for_crashes, minidump_files):
+ """Test that check_for_crashes returns the number of crash dumps."""
+ assert 3 == check_for_crashes()
+
+
+def test_dump_directory_unicode(request, check_for_crashes, tmpdir, capsys):
+ """Test that check_for_crashes can handle unicode in dump_directory."""
+ from conftest import minidump_files
+
+ tmpdir = tmpdir.ensure(u"🍪", dir=1)
+ minidump_files = minidump_files(request, tmpdir)
+
+ assert 1 == check_for_crashes(dump_directory=fspath(tmpdir), quiet=False)
+
+ out, _ = capsys.readouterr()
+ assert fspath(minidump_files[0]["dmp"]) in out
+ assert u"🍪" in out
+
+
+def test_test_name_unicode(check_for_crashes, minidump_files, capsys):
+ """Test that check_for_crashes can handle unicode in dump_directory."""
+ assert 1 == check_for_crashes(test_name=u"🍪", quiet=False)
+
+ out, err = capsys.readouterr()
+ assert u"| 🍪" in out
+
+
+if __name__ == "__main__":
+ mozunit.main()