Commit Graph

17 Commits (6931cc10c4a1e08161a58cf4b6b555b71cdc62b5)

Author SHA1 Message Date
Alex Willmer 8bcff6c87c tests: Fix typo in ResolveRelPathTest 8 years ago
Alex Willmer bd0a3cbe7c tests: Remove jinja2/markupsafe modules from FindRelatedTest
Not sure how they got there, but Django doesn't use Jinja without
explicit configuration.
8 years ago
Alex Willmer 71c00789f0 tests: Fix expected values FindRelatedTest for Django 1.11.4 8 years ago
Alex Willmer a931113a2c tests: Add new FindRelatedImportsTest 8 years ago
Alex Willmer 81e22a12e9 tests: Remove module under search from expected results
This matches a tweak made in 8765f761c9
8 years ago
Alex Willmer 4ae7fcc9bc tests: Rename FindRelatedImportsTest -> FindRelatedTest 8 years ago
Alex Willmer 49b6c586e3 FIx syntax error in FindRelatedImportsTest.test_django_db_models 8 years ago
David Wilson e01632c431 Move django test script into permanent test 8 years ago
dw 5e552e597c
Merge pull request #65 from moreati/unittest2-this-time-its-personal
Use unittest2 and specific assertX methods
8 years ago
Alex Willmer 110eba05ce Import and use unittest2 without aliasing it 8 years ago
Alex Willmer 7473addfd2 Replace all calls to file() with open()
Although these are synonyms in Python 2.x, when using MyPy to typecheck
code use of file() causes spurious errors.

This commit also serves as one small step to Python 3.x compatibility,
since 3.x removes the file() builtin.
8 years ago
Alex Willmer 81a77a453a Use specific TestCase assertions throughout tests
e.g. assert x == y -> self.assertEqual(x, y);
self.assertTrue(isinstance(x, y)) -> self.assertIsInstance(x, y)

These specific methods give more useful errors in the case of a test
failure.
8 years ago
Alex Willmer 9351a44784 Use unittest2 in all tests
This allows using features such as TestCase,assertIsInstance on Python
2.6 and earlier.
8 years ago
Alex Willmer 29529c9a5c tests: Fix GetModuleViaPkgutilTest fetching .pyc
On my laptop (Ubuntu 17.10, Python 2.7.14 in a virtualenv),
`test_regular_mod` fails with

```
AssertionError: "\nimport sys\n\n\ndef say_hi():\n    print 'hi'\n" !=
'\x03\xf3\r\n\xbbW\xd5Yc\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00@\x00\x00\x00s\x19\x00\x00\x00d\x00\x00d\x01\x00l\x00\x00Z\x00\x00d\x02\x00\x84\x00\x00Z\x01\x00d\x01\x00S(\x03\x00\x00\x00i\xff\xff\xff\xffNc\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00C\x00\x00\x00s\t\x00\x00\x00d\x01\x00GHd\x00\x00S(\x02\x00\x00\x00Nt\x02\x00\x00\x00hi(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00sF\x00\x00\x00/home/alex/src/mitogen/tests/data/module_finder_testmod/regular_mod.pyt\x06\x00\x00\x00say_hi\x05\x00\x00\x00s\x02\x00\x00\x00\x00\x01(\x02\x00\x00\x00t\x03\x00\x00\x00sysR\x01\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00sF\x00\x00\x00/home/alex/src/mitogen/tests/data/module_finder_testmod/regular_mod.pyt\x08\x00\x00\x00<module>\x02\x00\x00\x00s\x02\x00\x00\x00\x0c\x03'
```

`__file__` contains the path of the compiled `.pyc`, not the `.py`
source file.
8 years ago
David Wilson c83d86f050 importer: Delete _get_module_via_parent entirely
Can't figure out what it's supposed to do any more, and can't find a
version of Ansible before August 2016 (when I wrote that code) that
seems to need it.

Add some more mitigations to avoid sending dylibs.
8 years ago
David Wilson eb6afee514 Beginnings of module_finder_test 8 years ago
David Wilson e6795a5c43 core: loosen assertion to allow fakessh_test to succeed. 8 years ago