Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use mypy to check the tests dir; fix some typing errors #1610

Merged
merged 12 commits into from
Feb 6, 2020

Conversation

bradlarsen
Copy link
Contributor

Fixes #1608.

Additionally, this includes a few type annotations in a couple other places, which I added as I was looking there.

Copy link
Contributor

@ekilmer ekilmer left a comment

Choose a reason for hiding this comment

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

Very nice! 💯

@ehennenfent ehennenfent removed the tests label Feb 4, 2020
@ehennenfent
Copy link
Contributor

Speculating from the CI output, but it looks like MockMem and Memory don't behave quite the same way, which is causing the native tests to fail?

Also, I've consolidated the testing and tests labels into the former.

@bradlarsen
Copy link
Contributor Author

Speculating from the CI output, but it looks like MockMem and Memory don't behave quite the same way, which is causing the native tests to fail?

Previously, the use of Memory already referred to mockmem.MockMemory.
The previous change (Memory -> MockMemory) shouldn't make a runtime difference; it merely avoids the shadowed import that mypy didn't like.

The test failure, in this case, was actually due to me incorrectly fixing this bad format string the first time around:

diff --git a/tests/native/test_memory.py b/tests/native/test_memory.py
index ac1f6d3..c74254b 100644
--- a/tests/native/test_memory.py
+++ b/tests/native/test_memory.py
@@ -1428,7 +1428,7 @@ class MemoryTest(unittest.TestCase):
         # No Access Reading <4160741376>
         # self.assertRaisesRegexp(MemoryException, r"No access reading.*", mem.__getitem__, x)
         with self.assertRaisesRegex(
-            InvalidSymbolicMemoryAccess, "Invalid symbolic memory access.*".format(addr)
+            InvalidSymbolicMemoryAccess, f"Invalid symbolic memory access.*<{addr:x}>"
         ):
             _ = mem[x]
             # mem[addr] = 'a'

Also, I've consolidated the testing and tests labels into the former.

Thanks!

@ehennenfent ehennenfent merged commit 96f6a27 into master Feb 6, 2020
@ehennenfent ehennenfent deleted the type-annotations branch February 6, 2020 19:02
ekilmer added a commit that referenced this pull request Mar 12, 2020
* master: (23 commits)
  Update make_VMTests.py (#1628)
  Update manticore.py (#1627)
  Symbolic function strategies. (#1609)
  Fix for returndatasize (#1612)
  Improve balance related exploration (#1615)
  Add __format__ to Account (#1613)
  Use `mypy` to check the `tests` dir; fix some typing errors (#1610)
  Add a native example program & test case for #1604 (#1606)
  Hotfix: add long_description_content_type
  Manticore 0.3.3 (#1598)
  Improve WASM Memory Ergonomics (#1589)
  Make sure std files are not None before assigning peer (#1604)
  Add Examples badge to CI Badges (#1603)
  Better iterative optimization for expressions (#1599)
  Fix Regression(s) (#1577)
  Add missing `python3-dev` dep to quickstart instructions (#1600)
  Add license to setup.py (#1597)
  Streamline State Serialization Interface (#1596)
  Simplify ci.yml (#1588)
  Fix gas check (#1587)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mypy reports issues in the tests directory
3 participants