Snapshot idea/138.1980 from git://git.jetbrains.org/idea/community.git

Change-Id: Ib567c9c152d770212a7a3db20fbf591c210920bd
diff --git a/python/helpers/pycharm/_bdd_utils.py b/python/helpers/pycharm/_bdd_utils.py
index 300feb2..eea1beb 100644
--- a/python/helpers/pycharm/_bdd_utils.py
+++ b/python/helpers/pycharm/_bdd_utils.py
@@ -15,6 +15,20 @@
 __author__ = 'Ilya.Kazakevich'
 
 
+def fix_win_drive(feature_path):
+    """
+    Workaround to fix issues like http://bugs.python.org/issue7195 on windows.
+    Pass feature dir or file path as argument.
+    This function does nothing on non-windows platforms, so it could be run safely.
+
+    :param feature_path: path to feature (c:/fe.feature or /my/features)
+    """
+    current_disk = (os.path.splitdrive(os.getcwd()))[0]
+    feature_disk = (os.path.splitdrive(feature_path))[0]
+    if current_disk and feature_disk and current_disk != feature_disk:
+        os.chdir(feature_disk)
+
+
 def get_path_by_args(arguments):
     """
     :type arguments list
diff --git a/python/helpers/pycharm/behave_runner.py b/python/helpers/pycharm/behave_runner.py
index 0ad8313..2ec649e 100644
--- a/python/helpers/pycharm/behave_runner.py
+++ b/python/helpers/pycharm/behave_runner.py
@@ -228,6 +228,8 @@
         pass
 
     command_args = list(filter(None, sys.argv[1:]))
+    if command_args:
+        _bdd_utils.fix_win_drive(command_args[0])
     my_config = configuration.Configuration(command_args=command_args)
     formatters.register_as(_Null, "com.intellij.python.null")
     my_config.format = ["com.intellij.python.null"]  # To prevent output to stdout
diff --git a/python/helpers/pycharm/lettuce_runner.py b/python/helpers/pycharm/lettuce_runner.py
index 3cd1125..f0a4b5d 100644
--- a/python/helpers/pycharm/lettuce_runner.py
+++ b/python/helpers/pycharm/lettuce_runner.py
@@ -109,4 +109,5 @@
 
 if __name__ == "__main__":
     (base_dir, what_to_run) = _bdd_utils.get_path_by_args(sys.argv)
+    _bdd_utils.fix_win_drive(what_to_run)
     _LettuceRunner(base_dir, what_to_run).run()
\ No newline at end of file