Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of tests fail due to space in sys.executable #4629

Closed
watercrossing opened this issue Dec 3, 2013 · 4 comments · Fixed by #4631
Closed

Lots of tests fail due to space in sys.executable #4629

watercrossing opened this issue Dec 3, 2013 · 4 comments · Fixed by #4631
Milestone

Comments

@watercrossing
Copy link
Contributor

I have just created a virtualenv in my home directory, but unfortunately I have a space in my windows username, so that my home directory sits at
C:\users\Firstname Lastname. This causes a lot of tests to fail.
This is all under Win8.1x64, python2.7.5x64, and ipython's latest master branch.

Here are some fail messages:

======================================================================
FAIL: IPython.terminal.tests.test_help.test_profile_create_help
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\Firstname Lastname\temp\ipython\lib\site-packages\nose\case.py", lin
e 197, in runTest
    self.test(*self.arg)
  File "c:\users\firstname lastname\documents\github\ipython\IPython\terminal\tests\t
est_help.py", line 31, in test_profile_create_help
    tt.help_all_output_test("profile create")
  File "c:\users\firstname lastname\documents\github\ipython\IPython\testing\tools.py
", line 441, in help_all_output_test
    nt.assert_equal(rc, 0, err)
AssertionError: 'C:\Users\Firstname' is not recognized as an internal or external c
ommand,
operable program or batch file.

    '1 != 0' = '%s != %s' % (safe_repr(1), safe_repr(0))
    "'C:\\Users\\Firstname' is not recognized as an internal or external command,\r
\noperable program or batch file.\r\n" = self._formatMessage("'C:\\Users\\Firstname
' is not recognized as an internal or external command,\r\noperable program or b
atch file.\r\n", '1 != 0')
>>  raise self.failureException("'C:\\Users\\Firstname' is not recognized as an int
ernal or external command,\r\noperable program or batch file.\r\n")


======================================================================
FAIL: IPython.terminal.tests.test_help.test_locate_help
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\Firstname Lastname\temp\ipython\lib\site-packages\nose\case.py", lin
e 197, in runTest
    self.test(*self.arg)
  File "c:\users\firstname lastname\documents\github\ipython\IPython\terminal\tests\t
est_help.py", line 34, in test_locate_help
    tt.help_all_output_test("locate")
  File "c:\users\firstname lastname\documents\github\ipython\IPython\testing\tools.py
", line 441, in help_all_output_test
    nt.assert_equal(rc, 0, err)
AssertionError: 'C:\Users\Firstname' is not recognized as an internal or external c
ommand,
operable program or batch file.

    '1 != 0' = '%s != %s' % (safe_repr(1), safe_repr(0))
    "'C:\\Users\\Firstname' is not recognized as an internal or external command,\r
\noperable program or batch file.\r\n" = self._formatMessage("'C:\\Users\\Firstname
' is not recognized as an internal or external command,\r\noperable program or b
atch file.\r\n", '1 != 0')
>>  raise self.failureException("'C:\\Users\\Firstname' is not recognized as an int
ernal or external command,\r\noperable program or batch file.\r\n")


======================================================================
FAIL: IPython.terminal.tests.test_help.test_locate_profile_help
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\Firstname Lastname\temp\ipython\lib\site-packages\nose\case.py", lin
e 197, in runTest
    self.test(*self.arg)
  File "c:\users\firstname lastname\documents\github\ipython\IPython\terminal\tests\t
est_help.py", line 37, in test_locate_profile_help
    tt.help_all_output_test("locate profile")
  File "c:\users\firstname lastname\documents\github\ipython\IPython\testing\tools.py
", line 441, in help_all_output_test
    nt.assert_equal(rc, 0, err)
AssertionError: 'C:\Users\Firstname' is not recognized as an internal or external c
ommand,
operable program or batch file.

    '1 != 0' = '%s != %s' % (safe_repr(1), safe_repr(0))
    "'C:\\Users\\Firstname' is not recognized as an internal or external command,\r
\noperable program or batch file.\r\n" = self._formatMessage("'C:\\Users\\Firstname
' is not recognized as an internal or external command,\r\noperable program or b
atch file.\r\n", '1 != 0')
>>  raise self.failureException("'C:\\Users\\Firstname' is not recognized as an int
ernal or external command,\r\noperable program or batch file.\r\n")


----------------------------------------------------------------------

======================================================================
FAIL: IPython.utils.tests.test_path.test_get_long_path_name_win32
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\Firstname Lastname\temp\ipython\lib\site-packages\nose\case.py", lin
e 197, in runTest
    self.test(*self.arg)
  File "c:\users\firstname lastname\documents\github\ipython\IPython\testing\decorato
rs.py", line 225, in skipper_func
    return f(*args, **kwargs)
  File "c:\users\firstname lastname\documents\github\ipython\IPython\utils\tests\test
_path.py", line 463, in test_get_long_path_name_win32
    nt.assert_equal(evaluated_path.lower(), long_path.lower())
AssertionError: u'c:\\users\\firstname lastname\\appdata\\local\\temp\\tmpdnrflj\\thi
s is my long pat [truncated]... != u'c:\\users\\firstname~1\\appdata\\local\\temp\\
tmpdnrflj\\this is my long path nam [truncated]...
- c:\users\firstname lastname\appdata\local\temp\tmpdnrflj\this is my long path name
?                ^^^^^^^
+ c:\users\firstname~1\appdata\local\temp\tmpdnrflj\this is my long path name
?                ^^

    """Fail immediately, with the given message."""
>>  raise self.failureException(u"u'c:\\\\users\\\\firstname lastname\\\\appdata\\\\l
ocal\\\\temp\\\\tmpdnrflj\\\\this is my long pat [truncated]... != u'c:\\\\users
\\\\firstname~1\\\\appdata\\\\local\\\\temp\\\\tmpdnrflj\\\\this is my long path na
m [truncated]...\n- c:\\users\\firstname lastname\\appdata\\local\\temp\\tmpdnrflj\\t
his is my long path name\n?                ^^^^^^^\n+ c:\\users\\firstname~1\\appda
ta\\local\\temp\\tmpdnrflj\\this is my long path name\n?                ^^\n")


----------------------------------------------------------------------

It seems to me that the problem is that the problem is this:
https://github.com/ipython/ipython/blob/master/IPython/testing/tools.py#L439 naively assembles the command by doing a " ".join([sys.executable, args]), instead of escaping spaces correctly as described in the subprocess module (http://hg.python.org/cpython/file/tip/Lib/subprocess.py#l622).

However the escaping is different for unix/windows, so it shouldn't really be done here, but it should rather be possible to pass the list of sys.executable and arguments to https://github.com/ipython/ipython/blob/master/IPython/utils/_process_common.py#L42

Regards

takluyver added a commit to takluyver/ipython that referenced this issue Dec 3, 2013
Avoids quoting and escaping issues if there is a space in
sys.executable.

Closes ipythongh-4629
@takluyver
Copy link
Member

See #4631.

@watercrossing
Copy link
Contributor Author

#4631 fixes the first three error messages above, but not the last one in IPython.utils.tests.test_path.test_get_long_path_name_win32.

I will have a go at fixing that one myself!

@takluyver
Copy link
Member

Go for it ;-)

@watercrossing
Copy link
Contributor Author

See #4633.

watercrossing added a commit to watercrossing/ipython that referenced this issue Dec 4, 2013
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
Avoids quoting and escaping issues if there is a space in
sys.executable.

Closes ipythongh-4629
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants