Skip to content

Commit

Permalink
fix lib32_path issues when testing on Windows x86
Browse files Browse the repository at this point in the history
  • Loading branch information
jborbely committed Feb 11, 2024
1 parent a4dc9e5 commit fdffaeb
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions tests/test_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ def test_equivalent(host):
if host is None:
assert c.connection is None
assert c.host is None
assert c.lib32_path.endswith(f'cpp_lib64{DEFAULT_EXTENSION}')
if sys.maxsize > 2 ** 32:
# client and server are running in 64-bit Python
assert c.lib32_path.endswith(f'cpp_lib64{DEFAULT_EXTENSION}')
else:
# client and server are running in 32-bit Python
assert c.lib32_path.endswith(f'cpp_lib32{DEFAULT_EXTENSION}')
assert c.port == -1
assert str(c) == f"<Client lib={basename} address=None (mocked)>"
else:
Expand All @@ -82,12 +87,16 @@ def test_equivalent(host):

def test_attributes():
c = Client(x=0, y='hello', z=None)
basename = os.path.basename(c.lib32_path)
assert c.connection is None
assert c.host is None
assert c.lib32_path.endswith(f'cpp_lib64{DEFAULT_EXTENSION}')
if sys.maxsize > 2 ** 32:
# client and server are running in 64-bit Python
assert c.lib32_path.endswith(f'cpp_lib64{DEFAULT_EXTENSION}')
else:
# client and server are running in 32-bit Python
assert c.lib32_path.endswith(f'cpp_lib32{DEFAULT_EXTENSION}')
assert c.port == -1
assert str(c) == f"<Client lib={basename} address=None (mocked)>"
assert str(c) == f"<Client lib={os.path.basename(c.lib32_path)} address=None (mocked)>"
assert c.add(1, 2) == 3
# kwarg values are cast to str
assert c.get_kwargs() == {'x': '0', 'y': 'hello', 'z': 'None'}
Expand Down

0 comments on commit fdffaeb

Please sign in to comment.