Skip to content

Commit

Permalink
Fixed KeyError while importing by UnitTesting packages,
Browse files Browse the repository at this point in the history
issue:
SystemError: Parent module '' not loaded, cannot perform relative import
https://github.com/randy3k/UnitTesting/issues/67
  • Loading branch information
evandrocoan committed Dec 6, 2017
1 parent fc21b14 commit 9ad7129
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
13 changes: 10 additions & 3 deletions tests/clear_cursors_carets_first_selection_unit_tests.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@


import sys

import sublime
import sublime_plugin

import os
import sys
import importlib

CURRENT_DIRECTORY = os.path.dirname( os.path.dirname( os.path.realpath( __file__ ) ) )
CURRENT_PACKAGE_NAME = os.path.basename( CURRENT_DIRECTORY ).rsplit('.', 1)[0]

utilities = importlib.import_module( CURRENT_PACKAGE_NAME + ".tests.utilities" )


class ClearCursorsCaretsFirstSelectionUnitTests(sys.modules["ClearCursorsCarets.tests.utilities"].BasicSublimeTextViewTestCase):
class ClearCursorsCaretsFirstSelectionUnitTests(utilities.BasicSublimeTextViewTestCase):

def test_1_selections_at_first_word(self):
self.create_test_text(0)
Expand Down
13 changes: 10 additions & 3 deletions tests/clear_cursors_carets_last_selection_unit_tests.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@


import sys

import sublime
import sublime_plugin

import os
import sys
import importlib

CURRENT_DIRECTORY = os.path.dirname( os.path.dirname( os.path.realpath( __file__ ) ) )
CURRENT_PACKAGE_NAME = os.path.basename( CURRENT_DIRECTORY ).rsplit('.', 1)[0]

utilities = importlib.import_module( CURRENT_PACKAGE_NAME + ".tests.utilities" )


class ClearCursorsCaretsLastSelectionUnitTests(sys.modules["ClearCursorsCarets.tests.utilities"].BasicSublimeTextViewTestCase):
class ClearCursorsCaretsLastSelectionUnitTests(utilities.BasicSublimeTextViewTestCase):

def test_1_selections_at_first_word(self):
self.create_test_text(0)
Expand Down

0 comments on commit 9ad7129

Please sign in to comment.