forked from zinic/pynsive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing issue with import order when using in Python 3
In Python versions >= 3.1, other importers get added to the sys.meta_path. Unfortunately, this causes installed packages to override Pynsive loaded plugins. Causing things like coverage information to be improperly reported on Pynsive loaded modules in Python 3. This also resolves: jmvrbanac/Specter#49
- Loading branch information
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import sys | ||
import unittest | ||
|
||
import pynsive | ||
|
||
|
||
class WhenCreatingThePluginManager(unittest.TestCase): | ||
def setUp(self): | ||
self.manager = pynsive.PluginManager() | ||
|
||
def tearDown(self): | ||
self.manager.destroy() | ||
|
||
def test_correct_meta_path_insertion(self): | ||
finder_index = sys.meta_path.index(self.manager.finder) | ||
if sys.version_info >= (3, 1, 0): | ||
self.assertEqual(0, finder_index) | ||
else: | ||
self.assertEqual(len(sys.meta_path) - 1, finder_index) |