Skip to content

Commit

Permalink
test reforms
Browse files Browse the repository at this point in the history
  • Loading branch information
latentvector committed Jun 8, 2024
1 parent bd02930 commit 27639b2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 9 additions & 1 deletion commune/module/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -2273,6 +2273,9 @@ def infos(cls, *args, **kwargs) -> List[str]:
def server2info(cls, *args, **kwargs) -> List[str]:
return c.module("namespace").server2info(*args, **kwargs)




@classmethod
def has_server(cls, *args, **kwargs):
return c.module("namespace").has_server(*args, **kwargs)
Expand Down Expand Up @@ -3607,6 +3610,11 @@ def log(cls, *args, **kwargs):
def test_fns(cls, *args, **kwargs):
return [f for f in cls.functions(*args, **kwargs) if f.startswith('test_')]

@classmethod
def has_test_module(cls, module=None):
module = module or cls.module_path()
return c.module_exists(cls.module_path() + '.test')

@classmethod
def test(cls,
module=None,
Expand All @@ -3617,7 +3625,7 @@ def test(cls,
module = module or cls.module_path()
if module == 'module':
return c.cmd('pytest commune', verbose=True)
if c.module_exists(module + '.test'):
if cls.has_test_module(module):
c.print('FOUND TEST MODULE', color='yellow')
module = module + '.test'
cls = c.module(module)
Expand Down
8 changes: 4 additions & 4 deletions commune/subspace/subspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ def get_substrate(self,
: dict of options to pass to the websocket-client create_connection function
'''
url = self.resolve_url(url, mode=mode)
if cache:
if url in self.url2substrate:
return self.url2substrate[url]
while trials > 0:
try:
url = self.resolve_url(url, mode=mode)
if cache:
if url in self.url2substrate:
substrate = self.url2substrate[url]
substrate= SubstrateInterface(url=url,
websocket=websocket,
ss58_format=ss58_format,
Expand Down

0 comments on commit 27639b2

Please sign in to comment.