genlayer-test 0.4.0__py3-none-any.whl → 1.0.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.
Files changed (44) hide show
  1. {genlayer_test-0.4.0.dist-info → genlayer_test-1.0.0.dist-info}/METADATA +54 -8
  2. genlayer_test-1.0.0.dist-info/RECORD +75 -0
  3. gltest/__init__.py +7 -6
  4. gltest/{glchain/client.py → clients.py} +1 -1
  5. gltest/contracts/__init__.py +4 -0
  6. gltest/contracts/contract.py +193 -0
  7. gltest/{glchain/contract.py → contracts/contract_factory.py} +17 -135
  8. gltest/contracts/contract_functions.py +61 -0
  9. gltest/contracts/method_stats.py +163 -0
  10. gltest/contracts/stats_collector.py +259 -0
  11. gltest/contracts/utils.py +12 -0
  12. gltest/fixtures.py +2 -6
  13. gltest/helpers/take_snapshot.py +1 -1
  14. gltest/logging.py +17 -0
  15. gltest_cli/config/constants.py +1 -0
  16. gltest_cli/config/plugin.py +37 -0
  17. gltest_cli/config/pytest_context.py +9 -0
  18. gltest_cli/config/types.py +16 -0
  19. gltest_cli/config/user.py +9 -6
  20. gltest_cli/logging.py +1 -1
  21. tests/examples/tests/test_football_prediction_market.py +2 -2
  22. tests/examples/tests/test_intelligent_oracle_factory.py +6 -6
  23. tests/examples/tests/test_llm_erc20.py +5 -5
  24. tests/examples/tests/test_llm_erc20_analyze.py +50 -0
  25. tests/examples/tests/test_log_indexer.py +23 -11
  26. tests/examples/tests/test_multi_file_contract.py +2 -2
  27. tests/examples/tests/test_multi_file_contract_legacy.py +2 -2
  28. tests/examples/tests/test_multi_read_erc20.py +14 -12
  29. tests/examples/tests/test_multi_tenant_storage.py +11 -7
  30. tests/examples/tests/test_read_erc20.py +1 -1
  31. tests/examples/tests/test_storage.py +4 -4
  32. tests/examples/tests/test_storage_legacy.py +5 -3
  33. tests/examples/tests/test_user_storage.py +20 -10
  34. tests/examples/tests/test_wizard_of_coin.py +1 -1
  35. tests/gltest_cli/config/test_general_config.py +149 -0
  36. tests/gltest_cli/config/test_plugin.py +78 -0
  37. tests/gltest_cli/config/test_user.py +51 -1
  38. genlayer_test-0.4.0.dist-info/RECORD +0 -66
  39. gltest/glchain/__init__.py +0 -16
  40. {genlayer_test-0.4.0.dist-info → genlayer_test-1.0.0.dist-info}/WHEEL +0 -0
  41. {genlayer_test-0.4.0.dist-info → genlayer_test-1.0.0.dist-info}/entry_points.txt +0 -0
  42. {genlayer_test-0.4.0.dist-info → genlayer_test-1.0.0.dist-info}/licenses/LICENSE +0 -0
  43. {genlayer_test-0.4.0.dist-info → genlayer_test-1.0.0.dist-info}/top_level.txt +0 -0
  44. /gltest/{glchain/account.py → accounts.py} +0 -0
@@ -8,6 +8,8 @@ def test_help_message(pytester):
8
8
  "gltest:",
9
9
  " --contracts-dir=CONTRACTS_DIR",
10
10
  " Path to directory containing contract files",
11
+ " --artifacts-dir=ARTIFACTS_DIR",
12
+ " Path to directory for storing contract artifacts",
11
13
  " --default-wait-interval=DEFAULT_WAIT_INTERVAL",
12
14
  " Default interval (ms) between transaction receipt checks",
13
15
  " --default-wait-retries=DEFAULT_WAIT_RETRIES",
@@ -125,3 +127,79 @@ def test_network_testnet(pytester):
125
127
  ]
126
128
  )
127
129
  assert result.ret == 0
130
+
131
+
132
+ def test_artifacts_dir(pytester):
133
+ """Test that artifacts directory CLI parameter works correctly."""
134
+ pytester.makepyfile(
135
+ """
136
+ from gltest_cli.config.general import get_general_config
137
+ from pathlib import Path
138
+
139
+ def test_artifacts_dir():
140
+ general_config = get_general_config()
141
+ assert general_config.get_artifacts_dir() == Path("custom/artifacts")
142
+ """
143
+ )
144
+
145
+ result = pytester.runpytest("--artifacts-dir=custom/artifacts", "-v")
146
+
147
+ result.stdout.fnmatch_lines(
148
+ [
149
+ "*::test_artifacts_dir PASSED*",
150
+ ]
151
+ )
152
+ assert result.ret == 0
153
+
154
+
155
+ def test_contracts_and_artifacts_dirs(pytester):
156
+ """Test that both contracts and artifacts directories can be set via CLI."""
157
+ pytester.makepyfile(
158
+ """
159
+ from gltest_cli.config.general import get_general_config
160
+ from pathlib import Path
161
+
162
+ def test_both_dirs():
163
+ general_config = get_general_config()
164
+ assert general_config.get_contracts_dir() == Path("src/contracts")
165
+ assert general_config.get_artifacts_dir() == Path("build/artifacts")
166
+ """
167
+ )
168
+
169
+ result = pytester.runpytest(
170
+ "--contracts-dir=src/contracts", "--artifacts-dir=build/artifacts", "-v"
171
+ )
172
+
173
+ result.stdout.fnmatch_lines(
174
+ [
175
+ "*::test_both_dirs PASSED*",
176
+ ]
177
+ )
178
+ assert result.ret == 0
179
+
180
+
181
+ def test_artifacts_dir_default_fallback(pytester):
182
+ """Test that artifacts directory falls back to config file default when CLI not provided."""
183
+ pytester.makepyfile(
184
+ """
185
+ from gltest_cli.config.general import get_general_config
186
+ from pathlib import Path
187
+
188
+ def test_artifacts_default():
189
+ general_config = get_general_config()
190
+ # Should use the default from config
191
+ artifacts_dir = general_config.get_artifacts_dir()
192
+ assert isinstance(artifacts_dir, Path)
193
+ # Default should be 'artifacts'
194
+ assert str(artifacts_dir) == "artifacts"
195
+ """
196
+ )
197
+
198
+ result = pytester.runpytest("-v")
199
+
200
+ result.stdout.fnmatch_lines(
201
+ [
202
+ "*::test_artifacts_default PASSED*",
203
+ ]
204
+ )
205
+ assert result.ret == 0
@@ -11,6 +11,7 @@ from gltest_cli.config.user import (
11
11
  DEFAULT_NETWORK,
12
12
  DEFAULT_ENVIRONMENT,
13
13
  DEFAULT_CONTRACTS_DIR,
14
+ DEFAULT_ARTIFACTS_DIR,
14
15
  )
15
16
  from gltest_cli.config.constants import DEFAULT_RPC_URL
16
17
  from gltest_cli.config.types import UserConfig, NetworkConfigData, PathConfig
@@ -33,7 +34,7 @@ VALID_CONFIG = {
33
34
  "from": "0x123",
34
35
  },
35
36
  },
36
- "paths": {"contracts": "contracts"},
37
+ "paths": {"contracts": "contracts", "artifacts": "artifacts"},
37
38
  "environment": ".env",
38
39
  }
39
40
 
@@ -73,6 +74,7 @@ def test_get_default_user_config():
73
74
  # Check paths
74
75
  assert isinstance(config.paths, PathConfig)
75
76
  assert config.paths.contracts == DEFAULT_CONTRACTS_DIR
77
+ assert config.paths.artifacts == DEFAULT_ARTIFACTS_DIR
76
78
 
77
79
  # Check environment
78
80
  assert config.environment == DEFAULT_ENVIRONMENT
@@ -255,6 +257,7 @@ def test_load_user_config(mock_load_dotenv, mock_file):
255
257
  # Check paths
256
258
  assert isinstance(config.paths, PathConfig)
257
259
  assert config.paths.contracts == Path("contracts")
260
+ assert config.paths.artifacts == Path("artifacts")
258
261
 
259
262
  # Check environment
260
263
  assert config.environment == ".env"
@@ -349,3 +352,50 @@ def test_user_config_exists(mock_cwd):
349
352
  # Test with no files
350
353
  mock_path.iterdir.return_value = []
351
354
  assert user_config_exists() is False
355
+
356
+
357
+ # Tests for artifacts directory functionality
358
+ def test_artifacts_path_in_config():
359
+ """Test that artifacts path is properly handled in configuration."""
360
+ config_with_artifacts = {
361
+ "networks": {"default": "localnet"},
362
+ "paths": {"contracts": "contracts", "artifacts": "build/artifacts"},
363
+ }
364
+
365
+ config = transform_raw_to_user_config_with_defaults(config_with_artifacts)
366
+ assert config.paths.artifacts == Path("build/artifacts")
367
+
368
+
369
+ def test_artifacts_path_defaults():
370
+ """Test that artifacts path defaults to DEFAULT_ARTIFACTS_DIR when not specified."""
371
+ config_without_artifacts = {
372
+ "networks": {"default": "localnet"},
373
+ "paths": {"contracts": "contracts"},
374
+ }
375
+
376
+ config = transform_raw_to_user_config_with_defaults(config_without_artifacts)
377
+ assert config.paths.artifacts == DEFAULT_ARTIFACTS_DIR
378
+
379
+
380
+ def test_artifacts_path_validation():
381
+ """Test validation of artifacts path configuration."""
382
+ # Valid config with artifacts
383
+ valid_config = {"paths": {"artifacts": "custom/artifacts"}}
384
+ validate_raw_user_config(valid_config) # Should not raise
385
+
386
+ # Test that artifacts is included in valid path keys
387
+ from gltest_cli.config.user import VALID_PATHS_KEYS
388
+
389
+ assert "artifacts" in VALID_PATHS_KEYS
390
+
391
+
392
+ def test_artifacts_path_only_config():
393
+ """Test configuration with only artifacts path specified."""
394
+ config_artifacts_only = {
395
+ "networks": {"default": "localnet"},
396
+ "paths": {"artifacts": "my_artifacts"},
397
+ }
398
+
399
+ config = transform_raw_to_user_config_with_defaults(config_artifacts_only)
400
+ assert config.paths.contracts == DEFAULT_CONTRACTS_DIR
401
+ assert config.paths.artifacts == Path("my_artifacts")
@@ -1,66 +0,0 @@
1
- genlayer_test-0.4.0.dist-info/licenses/LICENSE,sha256=che_H4vE0QUx3HvWrAa1_jDEVInift0U6VO15-QqEls,1064
2
- gltest/__init__.py,sha256=Uozr4VS-_oKUxEdXbWoEVLB8JQKBWGs6vGEHDj1-6LY,348
3
- gltest/assertions.py,sha256=0dEk0VxcHK4I7GZPHxJmz-2jaA60V499gOSR74rZbfM,1748
4
- gltest/exceptions.py,sha256=deJPmrTe5gF33qkkKF2IVJY7lc_knI7Ql3N7jZ8aLZs,510
5
- gltest/fixtures.py,sha256=IyaTe3b-4weU2Bb5XKnP23dpk3jNKJDAOmYoYqRXFLQ,2501
6
- gltest/types.py,sha256=BODmwTr2gAUEiO9FjiuTiWwuKvXgo4xZWstQWNUfnlw,156
7
- gltest/artifacts/__init__.py,sha256=qTt3TE19gVNWnQLUlt5aDe4nNvJ2YJ1jzDkMmYIsCG0,194
8
- gltest/artifacts/contract.py,sha256=KChpmfjZod_0dVB8y-dvWz6IVm7QlIJsgG2ArtvVDaU,6457
9
- gltest/glchain/__init__.py,sha256=QLd55hVB9xVTAtCKbjmGPAwh0M8_tUNJ5xI0H93YyTY,428
10
- gltest/glchain/account.py,sha256=HUmWguJMolggQaZNRPw-LGlRlQCjLLdUanKRowMv6pI,812
11
- gltest/glchain/client.py,sha256=urRvnLt8GpdCV3yOBSvJNZQzu_TsZr8HqKn14Q2SpIQ,1547
12
- gltest/glchain/contract.py,sha256=RFLbEZseWatX0Xvt3-Eo_zOowxLMhukoXjK8V8Ca0Ok,11370
13
- gltest/helpers/__init__.py,sha256=I7HiTu_H7_hP65zY6Wl02r-5eAMr2eZvqBVmusuQLX4,180
14
- gltest/helpers/fixture_snapshot.py,sha256=bMgvlEVQBGIQzj7NOyosXWlphI1H2C1o75Zo0C-kGfQ,1931
15
- gltest/helpers/take_snapshot.py,sha256=eXqEKXM2hcox3pLGIcNddobU8zXPQvD-Iwf87eHqW2s,1276
16
- gltest_cli/logging.py,sha256=2Bkh6OR5C19HefARLQN5xBfam3apXzf7_Wei2PBfKlM,1241
17
- gltest_cli/main.py,sha256=Ti2-0Ev1x5_cM0D1UKqdgaDt80CDHEQGtdRne2qLm4M,53
18
- gltest_cli/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- gltest_cli/config/constants.py,sha256=lX8C3aS7zXWazA8LWgE0BkPvy7NopyEMyJNI2yYWX9M,300
20
- gltest_cli/config/general.py,sha256=ezpoGsT8grO9zQH6RugV14b1GzeFt-htYToHQBJhNvY,186
21
- gltest_cli/config/plugin.py,sha256=8eA19hNI8dmnZLwcruXj6MChyspjtqiiCbfFKRT4_yk,3695
22
- gltest_cli/config/types.py,sha256=2mbbEPD15zHh6-BkLSEByalL4-bi2OP4Qy3EFslqs5M,5669
23
- gltest_cli/config/user.py,sha256=LjjoqXWRLPeNgOvLKy2tJDNl1M0uLb-5rwEsnGyJunE,8065
24
- tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
- tests/conftest.py,sha256=RKdoE5_zcMimeojAoA_GSFI9du4pMzMi1vZ1njtfoAs,28
26
- tests/examples/contracts/football_prediction_market.py,sha256=0Lm2x2F1DhmUP1fcfzGQAfc50tWFcaHliwyAzXIRFVw,3247
27
- tests/examples/contracts/intelligent_oracle.py,sha256=cZNGbjKMXY-pimVmPIKIlS963Gd3L1JAipq0VBR1J5Q,12360
28
- tests/examples/contracts/intelligent_oracle_factory.py,sha256=8lBEn3Atb0yUpXwlvnShlcRxCBTXCrrkoITDHWoWuHU,1499
29
- tests/examples/contracts/llm_erc20.py,sha256=pOvSUszCtC_f5yDX0tZnj494Ce10uESZ09JLLE8V67o,2534
30
- tests/examples/contracts/log_indexer.py,sha256=Nlf8XUt13ujam3k6hbbVrPHK-KJ366Csz1TBjc4P07g,1901
31
- tests/examples/contracts/multi_read_erc20.py,sha256=28qYqn191Ro3rP7YJtZwL6Sc7JDXTeh8_QoqvdVPdqM,864
32
- tests/examples/contracts/multi_tenant_storage.py,sha256=5F3MCKbzyHMFqLRT9hZNCd3RzjSJvAKVJwLFMeazwog,1906
33
- tests/examples/contracts/read_erc20.py,sha256=RgH269F0x482WuLLYcacBnZsGJjhgJp6sG_33cV6Z-w,454
34
- tests/examples/contracts/storage.py,sha256=3DD3qvzb0JkVcBtu240e5kaZWgkh-bu6YExqBUYvfaw,501
35
- tests/examples/contracts/user_storage.py,sha256=2W2Iv-hQZMkAaPl2RY_F-OeJpD4IlPxgWzN6e1bTkKE,649
36
- tests/examples/contracts/wizard_of_coin.py,sha256=Y8daPpoSKdM8wfbCPOIgEdpkLIA1ZMmeg6Hu5fBB-kU,1624
37
- tests/examples/contracts/multi_file_contract/__init__.py,sha256=CCdaK5p12GDf35hgbBWURNM5KUn6SWAcuyieTmZwVWE,548
38
- tests/examples/contracts/multi_file_contract/other.py,sha256=jHDtjUL3eAUgE6yOYKFw_RfAH7kIwk8CvxUjbWHNruk,236
39
- tests/examples/tests/test_football_prediction_market.py,sha256=ADIWjh4zmT_9R0xJ4UU5jchPySxKPG_ujp9fy1i3tvQ,1093
40
- tests/examples/tests/test_intelligent_oracle_factory.py,sha256=K2Xhgth1VLpM7C3qUw1PDp3ODNRs56hx-iv7aP1fTzA,8267
41
- tests/examples/tests/test_llm_erc20.py,sha256=JZokOzdhxqH9J1x5KrpUukARLOXAGJpIjSh-FImXnN8,2057
42
- tests/examples/tests/test_log_indexer.py,sha256=KoOeTkwDmFamE8vyqM95y10cvpr1C22EcsYxv2L5unY,2688
43
- tests/examples/tests/test_multi_file_contract.py,sha256=asZ32ZO4LsttLSFq_CNozX_j19PQbRRW81xw0d8HNp0,551
44
- tests/examples/tests/test_multi_file_contract_legacy.py,sha256=IovwcE1KzDZ__FszvwQyGFHwlLIxdV4cC9S9hWSGVv4,566
45
- tests/examples/tests/test_multi_read_erc20.py,sha256=yBac795CA4_uMmtXtIvPLigfjozWi5nPQK6bcJlafvQ,3635
46
- tests/examples/tests/test_multi_tenant_storage.py,sha256=d4c4fNAjc2a6MkkHDexAP-pFf0tqipHwyM_fouGhA0g,2756
47
- tests/examples/tests/test_read_erc20.py,sha256=0bMSNUHo9MqRzeJGGKw5ToB9U_MJTa4YFRPdYIeWS-s,1247
48
- tests/examples/tests/test_storage.py,sha256=c9Yu8556DyQjJktAPsEUKzeMCn_-5CRNzXFgacVuDNY,751
49
- tests/examples/tests/test_storage_legacy.py,sha256=kXxMA-nNTuj4cV8yXkC_6iLJd8yS0HsyeVM9NnvbXLo,716
50
- tests/examples/tests/test_user_storage.py,sha256=Kg034FS4sD9p22-S0fEAH0HaDyevk0HQJiiLDjCBCTs,2776
51
- tests/examples/tests/test_wizard_of_coin.py,sha256=LiiN86ehRKUTbavGfPdqvkyyyY0DD0pp31j3BEgZciw,843
52
- tests/gltest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
- tests/gltest/artifact/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
- tests/gltest/artifact/test_contract_definition.py,sha256=6R8THNFKKpG7brULzp63vT1_pPd_JFNp3ZS08CJJWrg,3642
55
- tests/gltest/artifact/contracts/duplicate_ic_contract_1.py,sha256=bSWsUVjBy5cGtI72cjnkstsMzuUJbB3IG5JjTxOF-dc,500
56
- tests/gltest/artifact/contracts/duplicate_ic_contract_2.py,sha256=bSWsUVjBy5cGtI72cjnkstsMzuUJbB3IG5JjTxOF-dc,500
57
- tests/gltest/artifact/contracts/not_ic_contract.py,sha256=hQyGnYiiVceYdLI2WrvcFgPqzy1S4-YMb9FPhiHEGSA,510
58
- tests/gltest/assertions/test_assertions.py,sha256=qzVrOdOM4xYtIy1sFHVAD_-naDHOequ23tEN0MELh0k,10781
59
- tests/gltest_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
- tests/gltest_cli/config/test_plugin.py,sha256=06-GENVugrL6mPQkgRgQqRsCTuQMy3WZcbh_9Du6zHo,3502
61
- tests/gltest_cli/config/test_user.py,sha256=oJDcM6NbA16tQzQj5s8ZDvQYBm2uuvar5junFcVeitY,12116
62
- genlayer_test-0.4.0.dist-info/METADATA,sha256=HVE6uUnkt7Z_Cldbxr-V1JkEGiiqYHyo6HRrThXpb4Q,21928
63
- genlayer_test-0.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
64
- genlayer_test-0.4.0.dist-info/entry_points.txt,sha256=RWPcSArBpz_G4BYioh5L8Q8hyClRbSgzLimjcWMp-BQ,94
65
- genlayer_test-0.4.0.dist-info/top_level.txt,sha256=-qiGZxTRBytujzgVcKpxjvQ-WNeUDjXa59ceGMwMpko,24
66
- genlayer_test-0.4.0.dist-info/RECORD,,
@@ -1,16 +0,0 @@
1
- from .contract import Contract, ContractFactory, get_contract_factory
2
- from .client import get_gl_client, get_gl_provider
3
- from .account import create_account, get_accounts, get_default_account, create_accounts
4
-
5
-
6
- __all__ = [
7
- "Contract",
8
- "ContractFactory",
9
- "get_contract_factory",
10
- "create_account",
11
- "create_accounts",
12
- "get_accounts",
13
- "get_default_account",
14
- "get_gl_client",
15
- "get_gl_provider",
16
- ]
File without changes