Skip to content
This repository was archived by the owner on Jun 24, 2026. It is now read-only.

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

Merged
ehennenfent merged 12 commits into
masterfrom
type-annotations
Feb 6, 2020
Merged

Use mypy to check the tests dir; fix some typing errors#1610
ehennenfent merged 12 commits into
masterfrom
type-annotations

Conversation

@bradlarsen

Copy link
Copy Markdown

Fixes #1608.

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

@ekilmer ekilmer left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mypy reports issues in the tests directory

3 participants