Skip to content

Commit

Permalink
update assert messages
Browse files Browse the repository at this point in the history
  • Loading branch information
meevee98 committed Jul 4, 2023
1 parent 333b0b6 commit 016bcc2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
10 changes: 7 additions & 3 deletions boa3_test/tests/boa_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,13 @@ def get_contract_path(self, *args: str) -> str:

def get_deploy_file_paths_without_compiling(self, contract_path: str, output_name: str = None) -> Tuple[str, str]:
if isinstance(output_name, str):
file_path = os.path.dirname(contract_path)
file_name, _ = os.path.splitext(os.path.basename(output_name))
file_path_without_ext = f'{file_path}/{file_name}'
output_path, output_file = os.path.split(output_name)
if len(output_path) == 0:
file_path = os.path.dirname(contract_path)
file_name, _ = os.path.splitext(os.path.basename(output_name))
file_path_without_ext = f'{file_path}/{file_name}'
else:
file_path_without_ext, _ = os.path.splitext(output_name)
else:
file_path_without_ext, _ = os.path.splitext(contract_path)

Expand Down
39 changes: 26 additions & 13 deletions boa3_test/tests/cli_tests/test_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ def test_cli_compile(self):

self.assertTrue(any(f'neo3-boa v{constants.BOA_VERSION}\tPython {constants.SYS_VERSION}' in log for log in logs.output))
self.assertTrue(any('Started compiling' in log for log in logs.output))
self.assertTrue(any(f'Wrote {sc_nef_name} to ' in log in log for log in logs.output))
self.assertTrue(os.path.isfile(nef_path))
self.assertTrue(os.path.isfile(manifest_path))
self.assertFalse(os.path.isfile(debug_info_path))
self.assertTrue(any(f'Wrote {sc_nef_name} to ' in log in log for log in logs.output),
msg=f'Something went wrong when compiling {sc_nef_name}')
self.assertTrue(os.path.isfile(nef_path),
msg=f'{nef_path} not found')
self.assertTrue(os.path.isfile(manifest_path),
msg=f'{manifest_path} not found')
self.assertFalse(os.path.isfile(debug_info_path),
msg=f'{debug_info_path} exists')

@neo3_boa_cli('compile', get_path_from_boa3_test('test_sc', 'boa_built_in_methods_test', 'Env.py'),
'-db')
Expand All @@ -60,10 +64,14 @@ def test_cli_compile_debug(self):

self.assertTrue(any(f'neo3-boa v{constants.BOA_VERSION}\tPython {constants.SYS_VERSION}' in log for log in logs.output))
self.assertTrue(any('Started compiling' in log for log in logs.output))
self.assertTrue(any(f'Wrote {sc_nef_name} to ' in log in log for log in logs.output))
self.assertTrue(os.path.isfile(nef_path))
self.assertTrue(os.path.isfile(manifest_path))
self.assertTrue(os.path.isfile(debug_info_path))
self.assertTrue(any(f'Wrote {sc_nef_name} to ' in log in log for log in logs.output),
msg=f'Something went wrong when compiling {sc_nef_name}')
self.assertTrue(os.path.isfile(nef_path),
msg=f'{nef_path} not found')
self.assertTrue(os.path.isfile(manifest_path),
msg=f'{manifest_path} not found')
self.assertTrue(os.path.isfile(debug_info_path),
msg=f'{debug_info_path} not found')

@neo3_boa_cli('compile', get_path_from_boa3_test('test_sc', 'boa_built_in_methods_test', 'Env.py'),
'-o', get_path_from_boa3_test('test_cli', 'smart_contract.nef', get_unique=True))
Expand All @@ -86,16 +94,20 @@ def test_cli_compile_new_output_path(self):

self.assertTrue(any(f'neo3-boa v{constants.BOA_VERSION}\tPython {constants.SYS_VERSION}' in log for log in logs.output))
self.assertTrue(any('Started compiling' in log for log in logs.output))
self.assertTrue(any(f'Wrote {sc_nef_name} to ' in log in log for log in logs.output))
self.assertTrue(os.path.isfile(nef_path))
self.assertTrue(os.path.isfile(manifest_path))
self.assertTrue(any(f'Wrote {sc_nef_name} to ' in log in log for log in logs.output),
msg=f'Something went wrong when compiling {sc_nef_name}')
self.assertTrue(os.path.isfile(nef_path),
msg=f'{nef_path} not found')
self.assertTrue(os.path.isfile(manifest_path),
msg=f'{manifest_path} not found')

@neo3_boa_cli('compile', get_path_from_boa3_test('test_sc', 'boa_built_in_methods_test', 'Env.py'),
'-e', 'env_changed',
'-o', get_path_from_boa3_test('test_sc', 'boa_built_in_methods_test', 'Env.nef', get_unique=True))
'-o', get_path_from_boa3_test('test_sc', 'boa_built_in_methods_test', 'Env_cli.nef', get_unique=True))
def test_cli_compile_env(self):
nef_path, _ = self.get_deploy_file_paths(
get_path_from_boa3_test('test_sc', 'boa_built_in_methods_test', 'Env.py'),
output_name='Env_cli.nef',
compile_if_found=False
)
nef_generated = nef_path.split(constants.PATH_SEPARATOR)[-1]
Expand All @@ -104,7 +116,8 @@ def test_cli_compile_env(self):

self.assertTrue(any(f'neo3-boa v{constants.BOA_VERSION}\tPython {constants.SYS_VERSION}' in log for log in logs.output))
self.assertTrue(any('Started compiling' in log for log in logs.output))
self.assertTrue(any(f'Wrote {nef_generated} to ' in log in log for log in logs.output))
self.assertTrue(any(f'Wrote {nef_generated} to ' in log in log for log in logs.output),
msg=f'Something went wrong when compiling {nef_generated}')

runner = NeoTestRunner(runner_id=self.method_name())

Expand Down

0 comments on commit 016bcc2

Please sign in to comment.