From 6d40232fe4bdb026f389a31da3881a9406ab4d69 Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Wed, 21 Jan 2026 12:13:36 -0500 Subject: [PATCH] Fix Decimal serialization in subTest for pytest-xdist The parallel test execution failed on 4 tests because pytest-xdist's execnet cannot serialize Decimal objects when sending test results between workers. Solution: Convert Decimal objects to strings in subTest() parameters. The Decimal values are still used for actual test logic, but the subTest labels now use string representations. Fixed tests: - test_sweep_restocking_fee_fee_amount_calculation - test_doge_expected_amount_precision_always_rounds_up - test_xmr_expected_amount_precision_always_rounds_up - test_fee_calculations_always_round_up This is a common pytest-xdist limitation with non-serializable types. --- make_post_sell/tests/test_crypto_watcher.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/make_post_sell/tests/test_crypto_watcher.py b/make_post_sell/tests/test_crypto_watcher.py index d8773a0..fbbc79c 100644 --- a/make_post_sell/tests/test_crypto_watcher.py +++ b/make_post_sell/tests/test_crypto_watcher.py @@ -2849,7 +2849,7 @@ class SweepRestockingFeeTests(unittest.TestCase): ] for fee_amount, coin_type, expected_atomic in test_cases: - with self.subTest(fee_amount=fee_amount, coin_type=coin_type): + with self.subTest(fee_amount=str(fee_amount), coin_type=coin_type): payment = MagicMock() payment.coin_type = coin_type payment.shop_sweep_to_address = None # Will skip actual sweep @@ -4913,7 +4913,7 @@ class CryptoPrecisionTests(unittest.TestCase): ] for amount in test_cases: - with self.subTest(amount=amount): + with self.subTest(amount=str(amount)): # This is how crypto.py calculates expected amounts expected_koinu = math.ceil(amount * 100_000_000) @@ -4937,7 +4937,7 @@ class CryptoPrecisionTests(unittest.TestCase): ] for amount in test_cases: - with self.subTest(amount=amount): + with self.subTest(amount=str(amount)): # This is how crypto.py calculates expected amounts expected_piconero = math.ceil(amount * 1_000_000_000_000) @@ -4992,7 +4992,7 @@ class CryptoPrecisionTests(unittest.TestCase): ] for fee in test_fees: - with self.subTest(fee=fee): + with self.subTest(fee=str(fee)): # DOGE fee calculation doge_fee_koinu = math.ceil(fee * 100_000_000) naive_doge_fee = int(fee * 100_000_000)