[tor-commits] [stem/master] Unit tests fail on big-endian systems
atagar at torproject.org
atagar at torproject.org
Sat Aug 8 00:29:40 UTC 2020
commit b31551f37ea60d6789cf8e56f114e7dd4bca4e5d
Author: Damian Johnson <atagar at torproject.org>
Date: Fri Aug 7 17:27:09 2020 -0700
Unit tests fail on big-endian systems
Thanks to Juan for the catch. On big-endian systems such as CentOS our unit
tests failed because we don't mock our IS_LITTLE_ENDIAN constant (so our
assertions are based on being little-endian).
By mocking the constant as 'False' we fail in the same way that Juan
reports...
https://github.com/torproject/stem/issues/71
---
test/unit/util/proc.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/test/unit/util/proc.py b/test/unit/util/proc.py
index 39087cbe..b5667c62 100644
--- a/test/unit/util/proc.py
+++ b/test/unit/util/proc.py
@@ -196,6 +196,7 @@ class TestProc(unittest.TestCase):
@patch('os.path.exists')
@patch('os.readlink')
@patch('stem.util.proc.open', create = True)
+ @patch('stem.util.proc.IS_LITTLE_ENDIAN', True)
def test_connections(self, open_mock, readlink_mock, path_exists_mock, listdir_mock):
"""
Tests the connections function.
@@ -238,6 +239,7 @@ class TestProc(unittest.TestCase):
@patch('os.path.exists')
@patch('os.readlink')
@patch('stem.util.proc.open', create = True)
+ @patch('stem.util.proc.IS_LITTLE_ENDIAN', True)
def test_connections_ipv6(self, open_mock, readlink_mock, path_exists_mock, listdir_mock):
"""
Tests the connections function with ipv6 addresses.
@@ -275,6 +277,7 @@ class TestProc(unittest.TestCase):
@patch('os.path.exists')
@patch('pwd.getpwnam')
@patch('stem.util.proc.open', create = True)
+ @patch('stem.util.proc.IS_LITTLE_ENDIAN', True)
def test_connections_ipv6_by_user(self, open_mock, getpwnam_mock, path_exists_mock):
"""
Tests the connections function with ipv6 addresses.
@@ -305,6 +308,7 @@ class TestProc(unittest.TestCase):
@patch('os.path.exists')
@patch('os.readlink')
@patch('stem.util.proc.open', create = True)
+ @patch('stem.util.proc.IS_LITTLE_ENDIAN', True)
def test_high_connection_count(self, open_mock, readlink_mock, path_exists_mock, listdir_mock):
"""
When we have over ten thousand connections the 'SL' column's width changes.
More information about the tor-commits
mailing list