diff --git a/.coveragerc b/.coveragerc index fba9d10a2b416..bc5a3af162285 100644 --- a/.coveragerc +++ b/.coveragerc @@ -16,10 +16,10 @@ source = [report] precision = 1 -exclude_lines = - pragma: no cover +exclude_also = abc\.abstractmethod typing\.overload ^\s*\.\.\.\s*$ if typing.TYPE_CHECKING: if TYPE_CHECKING: + ^ *@pytest.mark.skip($|\() diff --git a/tests/core/data_layer/test_data_cli.py b/tests/core/data_layer/test_data_cli.py index 28e58fe4a325f..5c953e8ad4441 100644 --- a/tests/core/data_layer/test_data_cli.py +++ b/tests/core/data_layer/test_data_cli.py @@ -19,7 +19,7 @@ async def test_help(chia_root: ChiaRoot) -> None: assert "Show this message and exit" in completed_process.stdout -@pytest.mark.xfail(strict=True) +@pytest.mark.skip @pytest.mark.asyncio def test_round_trip(chia_root: ChiaRoot, chia_daemon: None, chia_data: None) -> None: """Create a table, insert a row, get the row by its hash.""" diff --git a/tests/core/data_layer/test_data_layer_util.py b/tests/core/data_layer/test_data_layer_util.py index 9be4e202be4a6..e48e54d5ab72a 100644 --- a/tests/core/data_layer/test_data_layer_util.py +++ b/tests/core/data_layer/test_data_layer_util.py @@ -78,7 +78,7 @@ def invalid_proof_of_inclusion_fixture(request: SubRequest, side: Side) -> Proof elif request.param == "bad node hash": return dataclasses.replace(valid_proof_of_inclusion, node_hash=a_hash) - raise Exception(f"Unhandled parametrization: {request.param!r}") + raise Exception(f"Unhandled parametrization: {request.param!r}") # pragma: no cover def test_proof_of_inclusion_is_valid(valid_proof_of_inclusion: ProofOfInclusion) -> None: diff --git a/tests/core/data_layer/test_data_rpc.py b/tests/core/data_layer/test_data_rpc.py index f7fb9fa53a74a..38d9260f1f504 100644 --- a/tests/core/data_layer/test_data_rpc.py +++ b/tests/core/data_layer/test_data_rpc.py @@ -149,7 +149,7 @@ async def farm_block_check_singleton( async def is_transaction_confirmed(user_wallet_id: uint32, api: WalletRpcApi, tx_id: bytes32) -> bool: try: val = await api.get_transaction({"wallet_id": user_wallet_id, "transaction_id": tx_id.hex()}) - except ValueError: + except ValueError: # pragma: no cover return False return True if TransactionRecord.from_json_dict_convenience(val["transaction"]).confirmed else False # mypy @@ -173,7 +173,7 @@ async def check_coin_state(wallet_node: WalletNode, coin_id: bytes32) -> bool: if len(coin_states) == 1 and coin_states[0].coin.name() == coin_id: return True - return False + return False # pragma: no cover async def check_singleton_confirmed(dl: DataLayer, tree_id: bytes32) -> bool: @@ -201,7 +201,7 @@ async def run_cli_cmd(*args: str, root_path: Path) -> asyncio.subprocess.Process stderr = await process.stderr.read() if sys.version_info >= (3, 10, 6): assert stderr == b"" - else: + else: # pragma: no cover # https://github.com/python/cpython/issues/92841 assert stderr == b"" or b"_ProactorBasePipeTransport.__del__" in stderr assert process.returncode == 0 @@ -789,7 +789,7 @@ async def offer_setup_fixture( except Exception as e: # TODO: more specific exceptions... if "Failed to get root for" not in str(e): - raise + raise # pragma: no cover else: break await asyncio.sleep(sleep_time) @@ -898,14 +898,14 @@ async def process_for_data_layer_keys( except Exception as e: # TODO: more specific exceptions... if "Key not found" not in str(e): - raise + raise # pragma: no cover else: if expected_value is None or value == expected_value: break await full_node_api.farm_blocks_to_puzzlehash(count=1, guarantee_transaction_blocks=True, timeout=60) await asyncio.sleep(sleep_time) else: - raise Exception("failed to confirm the new data") + raise Exception("failed to confirm the new data") # pragma: no cover @dataclass(frozen=True) @@ -1579,7 +1579,7 @@ async def test_make_and_then_take_offer_invalid_inclusion_key( broken_taker_offer["maker"][0]["proofs"][0]["key"] += "ab" elif maker_or_taker == "taker": broken_taker_offer["taker"][0]["inclusions"][0]["key"] += "ab" - else: + else: # pragma: no cover raise Exception("invalid maker or taker choice") offer_bytes = hexstr_to_bytes(broken_taker_offer["offer"]) @@ -1717,7 +1717,7 @@ async def test_make_and_cancel_offer(offer_setup: OfferSetup, reference: MakeAnd break await offer_setup.full_node_api.farm_blocks_to_puzzlehash(count=1, guarantee_transaction_blocks=True) await asyncio.sleep(0.5) - else: + else: # pragma: no cover assert False, "offer was not cancelled" taker_request = { @@ -2013,7 +2013,7 @@ async def test_clear_pending_roots( assert process.returncode == 0 if sys.version_info >= (3, 10, 6): assert stderr == b"" - else: + else: # pragma: no cover # https://github.com/python/cpython/issues/92841 assert stderr == b"" or b"_ProactorBasePipeTransport.__del__" in stderr elif layer == InterfaceLayer.client: diff --git a/tests/core/data_layer/test_data_store_schema.py b/tests/core/data_layer/test_data_store_schema.py index 3f745d79f5006..fc63d8a2e6f34 100644 --- a/tests/core/data_layer/test_data_store_schema.py +++ b/tests/core/data_layer/test_data_store_schema.py @@ -133,7 +133,7 @@ async def test_node_internal_must_be_valid_reference( values["left"] = bad_child_hash elif side == Side.RIGHT: values["right"] = bad_child_hash - else: + else: # pragma: no cover assert False async with data_store.db_wrapper.writer() as writer: diff --git a/tests/core/data_layer/util.py b/tests/core/data_layer/util.py index 77c5b029adaff..882991b65475d 100644 --- a/tests/core/data_layer/util.py +++ b/tests/core/data_layer/util.py @@ -209,4 +209,4 @@ def create_valid_node_values( "value": value, } - raise Exception(f"Unhandled node type: {node_type!r}") + raise Exception(f"Unhandled node type: {node_type!r}") # pragma: no cover