2
2
3
3
import json
4
4
from hashlib import sha1
5
- from pathlib import Path
6
5
7
6
from brownie ._config import ARGV , CONFIG
8
7
from brownie .project .scripts import _get_ast_hash
@@ -21,8 +20,9 @@ def __init__(self, config, project):
21
20
self .node_map = {}
22
21
self .isolated = {}
23
22
self .skip = {}
24
- build = self .project ._build
25
- self .contracts = dict ((k , v ["bytecodeSha1" ]) for k , v in build .items () if v ["bytecode" ])
23
+ self .contracts = dict (
24
+ (k , v ["bytecodeSha1" ]) for k , v in project ._build .items () if v ["bytecode" ]
25
+ )
26
26
27
27
glob = self .project_path .glob ("tests/**/conftest.py" )
28
28
self .conf_hashes = dict ((self ._path (i .parent ), _get_ast_hash (i )) for i in glob )
@@ -35,7 +35,7 @@ def __init__(self, config, project):
35
35
self .tests = dict (
36
36
(k , v )
37
37
for k , v in hashes ["tests" ].items ()
38
- if Path (k ).exists () and self ._get_hash (k ) == v ["sha1" ]
38
+ if self . project_path . joinpath (k ).exists () and self ._get_hash (k ) == v ["sha1" ]
39
39
)
40
40
41
41
changed_contracts = set (
@@ -57,14 +57,14 @@ def __init__(self, config, project):
57
57
coverage ._add_cached_transaction (txhash , coverage_eval )
58
58
59
59
def _path (self , path ):
60
- return Path ( path ). absolute ( ).relative_to (self .project_path ).as_posix ()
60
+ return self . project_path . joinpath ( path ).relative_to (self .project_path ).as_posix ()
61
61
62
62
def _test_id (self , nodeid ):
63
63
path , test_id = nodeid .split ("::" , maxsplit = 1 )
64
64
return self ._path (path ), test_id
65
65
66
66
def _get_hash (self , path ):
67
- hash_ = _get_ast_hash (path )
67
+ hash_ = _get_ast_hash (self . project_path . joinpath ( path ) )
68
68
for confpath in filter (lambda k : k in path , sorted (self .conf_hashes )):
69
69
hash_ += self .conf_hashes [confpath ]
70
70
return sha1 (hash_ .encode ()).hexdigest ()
0 commit comments