Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Fix abi generation using Python 3.8 #137

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

meevee98
Copy link
Contributor

What problem does this PR solve?
The abi file generation using Python 3.8+ wasn't including any methods.

How did you solve this problem?
Passed the blocks that define the abi decorators codes to the method constructor as extra codes.
Also included a verification, so python versions before 3.8 use the same code that was already working.

How did you make sure your solution works?
Ran the same unit tests that are working in Python 3.7, but using Python 3.8 instead

@lock9
Copy link
Contributor

lock9 commented Aug 14, 2020

Hi @ixje , can you review this?

Copy link
Member

@ixje ixje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • If there is an internal difference between Python 3.7 and Python 3.8 and we have different code paths for it, then we should extend the Travis-CI config to run all tests on both 3.7 and 3.8 and make sure they pass.
  • We need to either wait for a new neo-python release (which has the fix for the pip related error currently shown in travis, or change the travis config to manually downgrade to a pip version 19.x that's supported by the current neo-python release on PyPi.
  • Note: the tests seems to fail here on 3.8
======================================================================
ERROR: test_ICOTemplate_1 (tests.test_ico_template.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_ico_template.py", line 61, in test_ICOTemplate_1
    out = output.write()
  File "/Users/erik/Documents/code/neo-boa/boa/code/module.py", line 240, in write
    self.link_methods()
  File "/Users/erik/Documents/code/neo-boa/boa/code/module.py", line 309, in link_methods
    raise Exception("Target method %s not found" % vmtoken.target_method)
Exception: Target method TOKEN_OWNER not found

======================================================================
ERROR: test_ICOTemplate_2 (tests.test_ico_template.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_ico_template.py", line 113, in test_ICOTemplate_2
    out = output.write()
  File "/Users/erik/Documents/code/neo-boa/boa/code/module.py", line 240, in write
    self.link_methods()
  File "/Users/erik/Documents/code/neo-boa/boa/code/module.py", line 309, in link_methods
    raise Exception("Target method %s not found" % vmtoken.target_method)
Exception: Target method TOKEN_OWNER not found

======================================================================
ERROR: test_ICOTemplate_3_KYC (tests.test_ico_template.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_ico_template.py", line 170, in test_ICOTemplate_3_KYC
    out = output.write()
  File "/Users/erik/Documents/code/neo-boa/boa/code/module.py", line 240, in write
    self.link_methods()
  File "/Users/erik/Documents/code/neo-boa/boa/code/module.py", line 309, in link_methods
    raise Exception("Target method %s not found" % vmtoken.target_method)
Exception: Target method TOKEN_OWNER not found

======================================================================
ERROR: test_ICOTemplate_4_attachments (tests.test_ico_template.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_ico_template.py", line 219, in test_ICOTemplate_4_attachments
    out = output.write()
  File "/Users/erik/Documents/code/neo-boa/boa/code/module.py", line 240, in write
    self.link_methods()
  File "/Users/erik/Documents/code/neo-boa/boa/code/module.py", line 309, in link_methods
    raise Exception("Target method %s not found" % vmtoken.target_method)
Exception: Target method TOKEN_OWNER not found

======================================================================
ERROR: test_ICOTemplate_5_mint (tests.test_ico_template.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_ico_template.py", line 256, in test_ICOTemplate_5_mint
    out = output.write()
  File "/Users/erik/Documents/code/neo-boa/boa/code/module.py", line 240, in write
    self.link_methods()
  File "/Users/erik/Documents/code/neo-boa/boa/code/module.py", line 309, in link_methods
    raise Exception("Target method %s not found" % vmtoken.target_method)
Exception: Target method TOKEN_OWNER not found

======================================================================
ERROR: test_ICOTemplate_6_approval (tests.test_ico_template.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_ico_template.py", line 297, in test_ICOTemplate_6_approval
    out = output.write()
  File "/Users/erik/Documents/code/neo-boa/boa/code/module.py", line 240, in write
    self.link_methods()
  File "/Users/erik/Documents/code/neo-boa/boa/code/module.py", line 309, in link_methods
    raise Exception("Target method %s not found" % vmtoken.target_method)
Exception: Target method TOKEN_OWNER not found

======================================================================
ERROR: test_many_ops (tests.test_ico_template.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_ico_template.py", line 379, in test_many_ops
    out = output.write()
  File "/Users/erik/Documents/code/neo-boa/boa/code/module.py", line 240, in write
    self.link_methods()
  File "/Users/erik/Documents/code/neo-boa/boa/code/module.py", line 309, in link_methods
    raise Exception("Target method %s not found" % vmtoken.target_method)
Exception: Target method TOKEN_OWNER not found

======================================================================
FAIL: test_dict_keys1 (tests.test_dict_create.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_dict_create.py", line 31, in test_dict_keys1
    self.assertEqual(len(results), 1)
AssertionError: 0 != 1

======================================================================
FAIL: test_dict_values1 (tests.test_dict_create.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_dict_create.py", line 38, in test_dict_values1
    self.assertEqual(len(results), 1)
AssertionError: 0 != 1

======================================================================
FAIL: test_Iter1 (tests.test_iter.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_iter.py", line 34, in test_Iter1
    self.assertEqual(len(results), 1)
AssertionError: 0 != 1

======================================================================
FAIL: test_Iter2 (tests.test_iter.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_iter.py", line 41, in test_Iter2
    self.assertEqual(len(results), 1)
AssertionError: 0 != 1

======================================================================
FAIL: test_Iter3 (tests.test_iter.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_iter.py", line 48, in test_Iter3
    self.assertEqual(len(results), 1)
AssertionError: 0 != 1

======================================================================
FAIL: test_Iter4 (tests.test_iter.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_iter.py", line 55, in test_Iter4
    self.assertEqual(len(results), 1)
AssertionError: 0 != 1

======================================================================
FAIL: test_Iter5 (tests.test_iter.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_iter.py", line 62, in test_Iter5
    self.assertEqual(len(results), 1)
AssertionError: 0 != 1

======================================================================
FAIL: test_Range2 (tests.test_iter.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_iter.py", line 77, in test_Range2
    self.assertEqual(len(results), 1)
AssertionError: 0 != 1

======================================================================
FAIL: test_Range3 (tests.test_iter.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_iter.py", line 84, in test_Range3
    self.assertEqual(len(results), 1)
AssertionError: 0 != 1

======================================================================
FAIL: test_Range4 (tests.test_iter.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_iter.py", line 91, in test_Range4
    self.assertEqual(len(results), 1)
AssertionError: 0 != 1

======================================================================
FAIL: test_M2 (tests.test_module_vars.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_module_vars.py", line 22, in test_M2
    self.assertEqual(len(results), 1)
AssertionError: 0 != 1

======================================================================
FAIL: test_Output (tests.test_tx.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_tx.py", line 23, in test_Output
    self.assertEqual(len(results), 1)
AssertionError: 0 != 1

======================================================================
FAIL: test_Transaction (tests.test_tx.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_tx.py", line 126, in test_Transaction
    self.assertEqual(len(results), 1)
AssertionError: 0 != 1

======================================================================
FAIL: test_TransactionWitnesses (tests.test_tx.TestContract)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erik/Documents/code/neo-boa/boa_test/tests/test_tx.py", line 162, in test_TransactionWitnesses
    self.assertEqual(len(results), 1)
AssertionError: 0 != 1

----------------------------------------------------------------------
Ran 111 tests in 13.835s

FAILED (failures=14, errors=7)

boa/code/method.py Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Aug 18, 2020

Coverage Status

Coverage decreased (-0.7%) to 89.153% when pulling 80752ce on simplitech:fix-abi-methods into 9c23baf on CityOfZion:development.

@meevee98
Copy link
Contributor Author

  • Note: the tests seems to fail here on 3.8

@ixje It seems that the tests were failing on 3.8 before this pull request as well.
I'm fixing the unit tests, but there's going to be many modifications in the code. Do you think it's better to fix the tests on this pull request or open another one for the fixes?

@ixje
Copy link
Member

ixje commented Aug 20, 2020

@meevee98 I didn't realize they were always failing on 3.8. I think it would be best to do it on a different PR and we can merge this PR afterwards. Note: we have to move the .travis.yml changes done here to that PR as well.
Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants