File: fix-marshaling-tests-on-big-endian.patch

package info (click to toggle)
txdbus 1.1.0-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 996 kB
  • sloc: python: 6,658; makefile: 7
file content (33 lines) | stat: -rw-r--r-- 1,178 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Description: Fix (un-) marshaling tests on big endian systems
Author: Hugh Daschbach <hdasch@ccss.com>
Origin: upstream
Bug: https://github.com/cocagne/txdbus/issues/95, https://github.com/cocagne/txdbus/issues/96
Applied-Upstream: 24cd61a3
Last-Update: 2024-09-14
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/tests/test_marshal.py
+++ b/tests/test_marshal.py
@@ -1,3 +1,4 @@
+import sys
 import unittest
 from struct import pack
 
@@ -131,7 +132,7 @@
 
 class TestMarshal(unittest.TestCase):
 
-    def check(self, sig, var_list, expected_encoding, little_endian=True):
+    def check(self, sig, var_list, expected_encoding, little_endian = sys.byteorder == 'little'):
         if not isinstance(var_list, list):
             var_list = [var_list]
         nbytes, chunks = m.marshal(sig, var_list, 0, little_endian)
@@ -354,7 +355,7 @@
 class TestUnmarshal(unittest.TestCase):
 
     def check(self, sig, expected_value, encoding):
-        nbytes, value = m.unmarshal(sig, encoding, 0)
+        nbytes, value = m.unmarshal(sig, encoding, 0, sys.byteorder == 'little')
         self.assertEqual(
             nbytes,
             len(encoding),