Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Make tests pass on 3.x again and remove six dependency #158

Merged
merged 1 commit into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions py/symbolic/common.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os
import six

from symbolic._lowlevel import lib, ffi
from symbolic._compat import string_types, int_types
from symbolic._compat import string_types, int_types, string_types
from symbolic.utils import rustcall, encode_str, decode_str
from symbolic import exceptions

Expand All @@ -20,7 +19,7 @@

def arch_is_known(arch):
"""Checks if an architecture is known."""
if not isinstance(arch, six.string_types):
if not isinstance(arch, string_types):
return False
return rustcall(lib.symbolic_arch_is_known, encode_str(arch))

Expand All @@ -29,7 +28,7 @@ def normalize_arch(arch):
"""Normalizes an architecture name."""
if arch is None:
return None
if not isinstance(arch, six.string_types):
if not isinstance(arch, string_types):
raise ValueError('Invalid architecture: expected string')

normalized = rustcall(lib.symbolic_normalize_arch, encode_str(arch))
Expand Down
4 changes: 3 additions & 1 deletion py/symbolic/debuginfo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import bisect
from weakref import WeakValueDictionary

from symbolic._compat import itervalues, range_type
from symbolic._compat import itervalues, range_type, text_type
from symbolic._lowlevel import lib, ffi
from symbolic.utils import RustObject, rustcall, decode_str, encode_str, attached_refs
from symbolic.common import parse_addr, arch_is_known
Expand All @@ -25,6 +25,8 @@ class Archive(RustObject):
@classmethod
def open(self, path):
"""Opens an archive from a given path."""
if isinstance(path, text_type):
path = path.encode('utf-8')
return Archive._from_objptr(
rustcall(lib.symbolic_archive_open, path))

Expand Down
8 changes: 4 additions & 4 deletions py/tests/test_minidump.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def test_macos_without_cfi(res_path):
state = ProcessState.from_minidump(path)
assert state.thread_count == 1
assert state.requesting_thread == 0
assert state.timestamp == 1505305307L
assert state.timestamp == 1505305307
assert state.crashed == True
assert state.crash_time == datetime(2017, 9, 13, 12, 21, 47)
assert state.crash_address == 69 # memory address: *(0x45) = 0;
Expand Down Expand Up @@ -50,7 +50,7 @@ def test_linux_without_cfi(res_path):
state = ProcessState.from_minidump(path)
assert state.thread_count == 1
assert state.requesting_thread == 0
assert state.timestamp == 1505305040L
assert state.timestamp == 1505305040
assert state.crashed == True
assert state.crash_time == datetime(2017, 9, 13, 12, 17, 20)
assert state.crash_address == 0 # memory address: *(0x0) = 0;
Expand Down Expand Up @@ -97,7 +97,7 @@ def test_macos_with_cfi(res_path):
state = ProcessState.from_minidump(minidump_path, cfi)
assert state.thread_count == 1
assert state.requesting_thread == 0
assert state.timestamp == 1505305307L
assert state.timestamp == 1505305307
assert state.crashed == True
assert state.crash_time == datetime(2017, 9, 13, 12, 21, 47)
assert state.crash_address == 69 # memory address: *(0x45) = 0;
Expand Down Expand Up @@ -149,7 +149,7 @@ def test_linux_with_cfi(res_path):
state = ProcessState.from_minidump(minidump_path, cfi)
assert state.thread_count == 1
assert state.requesting_thread == 0
assert state.timestamp == 1505305040L
assert state.timestamp == 1505305040
assert state.crashed == True
assert state.crash_time == datetime(2017, 9, 13, 12, 17, 20)
assert state.crash_address == 0 # memory address: *(0x0) = 0;
Expand Down