Skip to content

Commit 947c35e

Browse files
refactor: Fix imports for enum and dataclasses
Switched from direct class imports to full module imports to follow style guide consistency.
1 parent 63b7344 commit 947c35e

File tree

3 files changed

+37
-20
lines changed

3 files changed

+37
-20
lines changed

.github/workflows/regression-dbsync.yaml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: db-sync config tests
1+
name: 02 Regression tests with db-sync
22

33
on:
44
workflow_dispatch:
@@ -19,6 +19,22 @@ on:
1919
- conway 10
2020
- conway 9
2121
default: conway 10
22+
markexpr:
23+
type: choice
24+
description: "Selection of tests"
25+
options:
26+
- all
27+
- dbsync
28+
- smoke
29+
- plutus
30+
- plutus and smoke
31+
- team_plutus
32+
- not long
33+
- conway only
34+
- dbsync and smoke
35+
- dbsync and plutus
36+
- dbsync and not long
37+
default: dbsync
2238
topology:
2339
type: choice
2440
description: "Network topology"
@@ -58,12 +74,13 @@ jobs:
5874
cli_rev: ${{ inputs.cli_rev }}
5975
dbsync_rev: ${{ inputs.dbsync_rev }}
6076
cluster_era: ${{ inputs.cluster_era }}
77+
markexpr: ${{ inputs.markexpr }}
6178
topology: ${{ inputs.topology }}
6279
utxo_backend: ${{ inputs.utxo_backend }}
6380
byron_cluster: ${{ inputs.byron_cluster }}
6481
testrun_name: ${{ inputs.testrun_name }}
6582
skip_passed: ${{ inputs.skip_passed }}
66-
env-path: .github/env_dbsync_config
83+
env-path: .github/env_regression_dbsync
6784
secrets:
6885
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6986
TCACHE_BASIC_AUTH: ${{ secrets.TCACHE_BASIC_AUTH }}

cardano_node_tests/tests/test_dbsync_config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""Tests for basic DB-Sync configuration options."""
22

3+
import enum
34
import logging
45
import typing as tp
5-
from enum import Enum
66

77
import allure
88
import pytest
@@ -17,14 +17,14 @@
1717

1818
pytestmark = [
1919
pytest.mark.skipif(
20-
configuration.CLUSTERS_COUNT != 1 and not configuration.HAS_DBSYNC,
20+
configuration.CLUSTERS_COUNT != 1 or not configuration.HAS_DBSYNC,
2121
reason="db-sync config tests can run on a single cluster only",
2222
),
2323
pytest.mark.dbsync_config,
2424
]
2525

2626

27-
class TableCondition(str, Enum):
27+
class TableCondition(str, enum.Enum):
2828
"""Enum for table-level db-sync state conditions."""
2929

3030
EMPTY = "empty"
@@ -33,7 +33,7 @@ class TableCondition(str, Enum):
3333
NOT_EXISTS = "not_exists"
3434

3535

36-
class ColumnCondition(str, Enum):
36+
class ColumnCondition(str, enum.Enum):
3737
"""Enum for column-level db-sync condition checks."""
3838

3939
ZERO = "column_condition:=0"

cardano_node_tests/utils/dbsync_service_manager.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""Functionality for managing db-sync service."""
22

3+
import dataclasses
4+
import enum
35
import logging
46
import os
57
import pathlib as pl
68
import typing as tp
7-
from dataclasses import dataclass
8-
from enum import StrEnum
99

1010
import pytest
1111
import yaml
@@ -20,7 +20,7 @@
2020
LOGGER = logging.getLogger(__name__)
2121

2222

23-
class Table(StrEnum):
23+
class Table(enum.StrEnum):
2424
"""Enum representing all tables in the Cardano db-sync database."""
2525

2626
ADA_POTS = "ada_pots"
@@ -106,63 +106,63 @@ def get_all_tables(cls) -> list[str]:
106106

107107

108108
class Column:
109-
class Tx(StrEnum):
109+
class Tx(enum.StrEnum):
110110
FEE = "tx.fee"
111111

112-
class Redeemer(StrEnum):
112+
class Redeemer(enum.StrEnum):
113113
SCRIPT_HASH = "redeemer.script_hash"
114114

115115

116-
class SettingState(StrEnum):
116+
class SettingState(enum.StrEnum):
117117
ENABLE = "enable"
118118
DISABLE = "disable"
119119

120120

121-
class TxOutMode(StrEnum):
121+
class TxOutMode(enum.StrEnum):
122122
ENABLE = "enable"
123123
DISABLE = "disable"
124124
CONSUMED = "consumed"
125125
PRUNE = "prune"
126126
BOOTSTRAP = "bootstrap"
127127

128128

129-
class LedgerMode(StrEnum):
129+
class LedgerMode(enum.StrEnum):
130130
ENABLE = "enable"
131131
DISABLE = "disable"
132132
IGNORE = "ignore"
133133

134134

135-
class Preset(StrEnum):
135+
class Preset(enum.StrEnum):
136136
FULL = "full"
137137
ONLY_UTXO = "only_utxo"
138138
ONLY_GOVERNANCE = "only_governance"
139139
DISABLE_ALL = "disable_all"
140140

141141

142-
@dataclass
142+
@dataclasses.dataclass
143143
class TxOutConfig:
144144
value: TxOutMode = TxOutMode.ENABLE
145145
force_tx_in: bool | None = None
146146
use_address_table: bool | None = None
147147

148148

149-
@dataclass
149+
@dataclasses.dataclass
150150
class ShelleyConfig:
151151
enable: bool = True
152152

153153

154-
@dataclass
154+
@dataclasses.dataclass
155155
class MultiAssetConfig:
156156
enable: bool = True
157157

158158

159-
@dataclass
159+
@dataclasses.dataclass
160160
class MetadataConfig:
161161
enable: bool = True
162162
keys: list[int] | None = None
163163

164164

165-
@dataclass
165+
@dataclasses.dataclass
166166
class PlutusConfig:
167167
enable: bool = True
168168

0 commit comments

Comments
 (0)