zilong / google-styleguide

Automatically exported from code.google.com/p/google-styleguide
0 stars 0 forks source link

Failing on Windows using Python 3 #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install Python  3.3 on Windows XP platform
2. Execute  cpplint_unittest.py
3.

What is the expected output? What do you see instead?

Expected no failures when running unit tests.

Actual Error ...
H:\cpplinttest>D:\Python33\python.exe    cpplint_unittest.py
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEcpplint_unittest.py:2416: DeprecationWarning: 
Please use assertEqual instead.
  self.assertEquals('""', collapse('""'))             # ""     (empty)
...EEEEEEEEEEcpplint_unittest.py:62: DeprecationWarning: Please use assertTrue 
instead.
  ' which is not in _ERROR_CATEGORIES' % (message, category))
.EEEEEEE.EEEEEEEEE.E..EEEE.EEEEE.EEEEEEEEEEEEEE..EEEEEEEEEEEEEEEEEEETraceback 
(most recent call last):
  File "cpplint_unittest.py", line 3122, in <module>
    unittest.main()
  File "D:\Python33\lib\unittest\main.py", line 125, in __init__
    self.runTests()
  File "D:\Python33\lib\unittest\main.py", line 261, in runTests
    self.result = testRunner.run(self.test)
  File "D:\Python33\lib\unittest\runner.py", line 168, in run
    test(result)
  File "D:\Python33\lib\unittest\suite.py", line 67, in __call__
    return self.run(*args, **kwds)
  File "D:\Python33\lib\unittest\suite.py", line 105, in run
    test(result)
  File "D:\Python33\lib\unittest\suite.py", line 67, in __call__
    return self.run(*args, **kwds)
  File "D:\Python33\lib\unittest\suite.py", line 105, in run
    test(result)
  File "D:\Python33\lib\unittest\case.py", line 492, in __call__
    return self.run(*args, **kwds)
  File "D:\Python33\lib\unittest\case.py", line 450, in run
    result.addError(self, exc_info)
  File "D:\Python33\lib\unittest\runner.py", line 67, in addError
    super(TextTestResult, self).addError(test, err)
  File "D:\Python33\lib\unittest\result.py", line 17, in inner
    return method(self, *args, **kw)

...

What version of the product are you using? On what operating system?

   Windows XP
   Python 3.3

Please provide any additional information below.

I have since installed Python 2.4 
(http://www.python.org/download/releases/2.4.4/ ) and Python 2.7 (). This work 
better, but I still get errors ...

..............................................F.................................
........................................
.....................F..
======================================================================
FAIL: testBuildHeaderGuard (__main__.CpplintTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "cpplint_unittest.py", line 2037, in testBuildHeaderGuard
    self.assertNotEqual(expected_guard, '')
AssertionError: '' == ''

======================================================================
FAIL: testClassifyInclude (__main__.OrderOfIncludesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "cpplint_unittest.py", line 2517, in testClassifyInclude
    False))
AssertionError: 3 != 4

----------------------------------------------------------------------
Ran 144 tests in 0.766s

FAILED (failures=2)

Original issue reported on code.google.com by brim...@gmail.com on 16 Nov 2012 at 11:09

GoogleCodeExporter commented 9 years ago

Original comment by mark@chromium.org on 28 Nov 2012 at 8:41

GoogleCodeExporter commented 9 years ago
Hi, I am not sure if the code for google-styleguide is still being maintained - 
there seems to be low activity. I do not want to push this issue if it is 
unrealistic that it will be fixed - I know most of these projects are supported 
by people busy on their own work!

I am wondering if my problem is due to a bad installation of tools or Python?

Original comment by brim...@gmail.com on 17 Dec 2012 at 9:06

GoogleCodeExporter commented 9 years ago
I am having the exact same problem here, using Win7 and r99 (the latest 
revision) of the python scripts and Python 3.3.
Additionally, the cpplint.py script itself produces an empty output when run on 
any file. 

Original comment by c.tor...@gmail.com on 8 Mar 2013 at 11:47

GoogleCodeExporter commented 9 years ago
Same here. Linux works fine, while Windows gives empty output.

Original comment by triston....@gmail.com on 27 Jun 2014 at 5:20

GoogleCodeExporter commented 9 years ago
Wrong version python for cpplint.py. Version 2.7 works fine, while version 3.4 
does not. One of functions I found not supported is the xrange.

Original comment by triston....@gmail.com on 27 Jun 2014 at 10:05

GoogleCodeExporter commented 9 years ago
change

comment the line in the main() function where sys.stderr is reasigned

.itervalues() to .values()
.iteritems() to .items()
xrange(..) to range(..)

redefine GetLineWidth
def GetLineWidth(line):
  return len(line)

Original comment by aurelien...@gmail.com on 26 Aug 2014 at 5:43