def test_symbols_path_unicode(check_for_crashes, minidump_files, tmpdir, capsys): """Test that check_for_crashes can handle unicode in dump_directory.""" symbols_path = tmpdir.mkdir(u"🍪") assert 1 == check_for_crashes(symbols_path=fspath(symbols_path), quiet=False) out, _ = capsys.readouterr() assert fspath(symbols_path) in out
def test_stackwalk_unicode(check_for_crashes, minidump_files, tmpdir, capsys): """Test that check_for_crashes can handle unicode in dump_directory.""" stackwalk = tmpdir.mkdir(u"🍪").join("stackwalk") stackwalk.write("fake binary") stackwalk.chmod(0o744) assert 1 == check_for_crashes(stackwalk_binary=fspath(stackwalk), quiet=False) out, err = capsys.readouterr() assert fspath(stackwalk) in out
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_stackwalk_envvar(check_for_crashes, minidump_files, stackwalk): """Test that check_for_crashes uses the MINIDUMP_STACKWALK environment var.""" os.environ["MINIDUMP_STACKWALK"] = fspath(stackwalk) try: assert 1 == check_for_crashes(stackwalk_binary=None) finally: del os.environ["MINIDUMP_STACKWALK"]
def test_save_path(check_for_crashes, minidump_files, tmpdir): """Test that dump_save_path works.""" save_path = tmpdir.mkdir("saved") assert 1 == check_for_crashes(dump_save_path=fspath(save_path)) assert save_path.join(minidump_files[0]["dmp"].basename).check() assert save_path.join(minidump_files[0]["extra"].basename).check()
def test_save_path_not_present(check_for_crashes, minidump_files, tmpdir): """Test that dump_save_path works when the directory doesn't exist.""" save_path = tmpdir.join("saved") assert 1 == check_for_crashes(dump_save_path=fspath(save_path)) assert save_path.join(minidump_files[0]["dmp"].basename).check() assert save_path.join(minidump_files[0]["extra"].basename).check()
def test_save_multiple(check_for_crashes, minidump_files, tmpdir): """Test that all minidumps are saved.""" save_path = tmpdir.mkdir("saved") assert 3 == check_for_crashes(dump_save_path=fspath(save_path)) for i in range(3): assert save_path.join(minidump_files[i]["dmp"].basename).check() assert save_path.join(minidump_files[i]["extra"].basename).check()
def test_save_path_isfile(check_for_crashes, minidump_files, tmpdir): """Test that dump_save_path works when the path is a file and not a directory.""" save_path = tmpdir.join("saved") save_path.write("junk") assert 1 == check_for_crashes(dump_save_path=fspath(save_path)) assert save_path.join(minidump_files[0]["dmp"].basename).check() assert save_path.join(minidump_files[0]["extra"].basename).check()
def test_stackwalk_not_found(check_for_crashes, minidump_files, tmpdir, capsys): """Test that check_for_crashes can handle unicode in dump_directory.""" stackwalk = tmpdir.join("stackwalk") assert 1 == check_for_crashes(stackwalk_binary=fspath(stackwalk), quiet=False) out, _ = capsys.readouterr() assert "MINIDUMP_STACKWALK binary not found" in out
def test_save_path_envvar(check_for_crashes, minidump_files, tmpdir): """Test that the MINDUMP_SAVE_PATH environment variable works.""" save_path = tmpdir.mkdir("saved") os.environ['MINIDUMP_SAVE_PATH'] = fspath(save_path) try: assert 1 == check_for_crashes(dump_save_path=None) finally: del os.environ['MINIDUMP_SAVE_PATH'] assert save_path.join(minidump_files[0]["dmp"].basename).check() assert save_path.join(minidump_files[0]["extra"].basename).check()