genlayer-test 1.0.0__py3-none-any.whl → 2.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {genlayer_test-1.0.0.dist-info → genlayer_test-2.1.0.dist-info}/METADATA +23 -8
- {genlayer_test-1.0.0.dist-info → genlayer_test-2.1.0.dist-info}/RECORD +19 -18
- gltest/contracts/contract.py +18 -6
- gltest/contracts/contract_factory.py +30 -9
- gltest/contracts/contract_functions.py +9 -8
- gltest/types.py +1 -0
- gltest_cli/config/plugin.py +18 -2
- gltest_cli/config/types.py +25 -0
- gltest_cli/config/user.py +12 -2
- tests/examples/contracts/football_prediction_market.py +1 -1
- tests/examples/tests/test_intelligent_oracle_factory.py +5 -21
- tests/gltest_cli/config/test_config_integration.py +432 -0
- tests/gltest_cli/config/test_general_config.py +257 -0
- tests/gltest_cli/config/test_plugin.py +89 -0
- tests/gltest_cli/config/test_user.py +10 -0
- {genlayer_test-1.0.0.dist-info → genlayer_test-2.1.0.dist-info}/WHEEL +0 -0
- {genlayer_test-1.0.0.dist-info → genlayer_test-2.1.0.dist-info}/entry_points.txt +0 -0
- {genlayer_test-1.0.0.dist-info → genlayer_test-2.1.0.dist-info}/licenses/LICENSE +0 -0
- {genlayer_test-1.0.0.dist-info → genlayer_test-2.1.0.dist-info}/top_level.txt +0 -0
@@ -17,6 +17,8 @@ def test_help_message(pytester):
|
|
17
17
|
" --rpc-url=RPC_URL RPC endpoint URL for the GenLayer network",
|
18
18
|
" --network=NETWORK Target network (defaults to 'localnet' if no config",
|
19
19
|
" file)",
|
20
|
+
" --test-with-mocks Test with mocks",
|
21
|
+
" --leader-only Run contracts in leader-only mode",
|
20
22
|
]
|
21
23
|
)
|
22
24
|
|
@@ -178,6 +180,50 @@ def test_contracts_and_artifacts_dirs(pytester):
|
|
178
180
|
assert result.ret == 0
|
179
181
|
|
180
182
|
|
183
|
+
def test_test_with_mocks_true(pytester):
|
184
|
+
pytester.makepyfile(
|
185
|
+
"""
|
186
|
+
from gltest_cli.config.general import get_general_config
|
187
|
+
|
188
|
+
def test_test_with_mocks():
|
189
|
+
general_config = get_general_config()
|
190
|
+
assert general_config.get_test_with_mocks() == True
|
191
|
+
"""
|
192
|
+
)
|
193
|
+
|
194
|
+
result = pytester.runpytest("--test-with-mocks", "-v")
|
195
|
+
|
196
|
+
result.stdout.fnmatch_lines(
|
197
|
+
[
|
198
|
+
"*::test_test_with_mocks PASSED*",
|
199
|
+
]
|
200
|
+
)
|
201
|
+
assert result.ret == 0
|
202
|
+
|
203
|
+
|
204
|
+
def test_test_with_mocks_false(pytester):
|
205
|
+
pytester.makepyfile(
|
206
|
+
"""
|
207
|
+
from gltest_cli.config.general import get_general_config
|
208
|
+
|
209
|
+
def test_test_with_mocks():
|
210
|
+
general_config = get_general_config()
|
211
|
+
assert general_config.get_test_with_mocks() == False
|
212
|
+
"*::test_test_with_mocks PASSED*",
|
213
|
+
|
214
|
+
"""
|
215
|
+
)
|
216
|
+
|
217
|
+
result = pytester.runpytest("-v")
|
218
|
+
|
219
|
+
result.stdout.fnmatch_lines(
|
220
|
+
[
|
221
|
+
"*::test_test_with_mocks PASSED*",
|
222
|
+
]
|
223
|
+
)
|
224
|
+
assert result.ret == 0
|
225
|
+
|
226
|
+
|
181
227
|
def test_artifacts_dir_default_fallback(pytester):
|
182
228
|
"""Test that artifacts directory falls back to config file default when CLI not provided."""
|
183
229
|
pytester.makepyfile(
|
@@ -192,6 +238,7 @@ def test_artifacts_dir_default_fallback(pytester):
|
|
192
238
|
assert isinstance(artifacts_dir, Path)
|
193
239
|
# Default should be 'artifacts'
|
194
240
|
assert str(artifacts_dir) == "artifacts"
|
241
|
+
|
195
242
|
"""
|
196
243
|
)
|
197
244
|
|
@@ -203,3 +250,45 @@ def test_artifacts_dir_default_fallback(pytester):
|
|
203
250
|
]
|
204
251
|
)
|
205
252
|
assert result.ret == 0
|
253
|
+
|
254
|
+
|
255
|
+
def test_leader_only_true(pytester):
|
256
|
+
pytester.makepyfile(
|
257
|
+
"""
|
258
|
+
from gltest_cli.config.general import get_general_config
|
259
|
+
|
260
|
+
def test_leader_only():
|
261
|
+
general_config = get_general_config()
|
262
|
+
assert general_config.get_leader_only() == True
|
263
|
+
"""
|
264
|
+
)
|
265
|
+
|
266
|
+
result = pytester.runpytest("--leader-only", "-v")
|
267
|
+
|
268
|
+
result.stdout.fnmatch_lines(
|
269
|
+
[
|
270
|
+
"*::test_leader_only PASSED*",
|
271
|
+
]
|
272
|
+
)
|
273
|
+
assert result.ret == 0
|
274
|
+
|
275
|
+
|
276
|
+
def test_leader_only_false(pytester):
|
277
|
+
pytester.makepyfile(
|
278
|
+
"""
|
279
|
+
from gltest_cli.config.general import get_general_config
|
280
|
+
|
281
|
+
def test_leader_only():
|
282
|
+
general_config = get_general_config()
|
283
|
+
assert general_config.get_leader_only() == False
|
284
|
+
"""
|
285
|
+
)
|
286
|
+
|
287
|
+
result = pytester.runpytest("-v")
|
288
|
+
|
289
|
+
result.stdout.fnmatch_lines(
|
290
|
+
[
|
291
|
+
"*::test_leader_only PASSED*",
|
292
|
+
]
|
293
|
+
)
|
294
|
+
assert result.ret == 0
|
@@ -137,6 +137,11 @@ def test_validate_raw_user_config_invalid():
|
|
137
137
|
{"networks": {"default": "localnet", "localnet": {"from": 123}}}
|
138
138
|
)
|
139
139
|
|
140
|
+
with pytest.raises(ValueError, match="leader_only must be a boolean"):
|
141
|
+
validate_raw_user_config(
|
142
|
+
{"networks": {"default": "localnet", "localnet": {"leader_only": "true"}}}
|
143
|
+
)
|
144
|
+
|
140
145
|
with pytest.raises(ValueError, match="paths must be a dictionary"):
|
141
146
|
validate_raw_user_config({"paths": "not_a_dict"})
|
142
147
|
|
@@ -182,6 +187,11 @@ def test_validate_raw_user_config_invalid():
|
|
182
187
|
{"networks": {"default": "localnet", "testnet": {"from": 123}}}
|
183
188
|
)
|
184
189
|
|
190
|
+
with pytest.raises(ValueError, match="leader_only must be a boolean"):
|
191
|
+
validate_raw_user_config(
|
192
|
+
{"networks": {"default": "localnet", "testnet": {"leader_only": "true"}}}
|
193
|
+
)
|
194
|
+
|
185
195
|
# Test required fields for non-default networks
|
186
196
|
with pytest.raises(ValueError, match="network testnet must have an id"):
|
187
197
|
validate_raw_user_config(
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|