Issue #847 resolved

Test failures with Python 3.3

Arfrever Frehtes Taifersar Arahesis
created an issue

Test failures occur with Python 3.3. They can be different when test suite is run multiple times. I use Pygments 1.6.

======================================================================
FAIL: test_examplefiles.test_example_files(<pygments.lexers.AntlrPythonLexer>, '/tmp/Pygments-1.6/build/lib/test/examplefiles/ANTLRv3.g', '/tmp/Pygments-1.6/build/lib/test/examplefiles/output/ANTLRv3.g')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.3/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/tmp/Pygments-1.6/build/lib/test/test_examplefiles.py", line 71, in check_lexer
    (lx, absfn, val, len(''.join(ntext)))
AssertionError: lexer <pygments.lexers.AntlrPythonLexer> generated error token for /tmp/Pygments-1.6/build/lib/test/examplefiles/ANTLRv3.g: '?' at position 4013

======================================================================
FAIL: test_examplefiles.test_example_files(<pygments.lexers.PrologLexer>, '/tmp/Pygments-1.6/build/lib/test/examplefiles/mg_sample.pro', '/tmp/Pygments-1.6/build/lib/test/examplefiles/output/mg_sample.pro')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.3/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/tmp/Pygments-1.6/build/lib/test/test_examplefiles.py", line 71, in check_lexer
    (lx, absfn, val, len(''.join(ntext)))
AssertionError: lexer <pygments.lexers.PrologLexer> generated error token for /tmp/Pygments-1.6/build/lib/test/examplefiles/mg_sample.pro: '`' at position 87

======================================================================
FAIL: test_examplefiles.test_example_files(<pygments.lexers.RobotFrameworkLexer with {'tabsize': 2, 'encoding': 'UTF-8'}>, '/tmp/Pygments-1.6/build/lib/test/examplefiles/psql_session.txt', '/tmp/Pygments-1.6/build/lib/test/examplefiles/output/psql_session.txt')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.3/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/tmp/Pygments-1.6/build/lib/test/test_examplefiles.py", line 76, in check_lexer
    raise AssertionError('round trip failed for ' + absfn)
AssertionError: AssertionError: round trip failed for /tmp/Pygments-1.6/build/lib/test/examplefiles/psql_session.txt
-------------------- >> begin captured stdout << ---------------------
--- 

+++ 

@@ -15,7 +15,7 @@

 LINE 1: select '\x';
                ^
 HINT:  Use the escape string syntax for escapes, e.g., E'\r\n'.
- ?column?
+ ?column? 
 ----------
  x
 (1 row)
@@ -24,10 +24,10 @@


 piro=> \set foo 30;
 piro=> select * from test where foo <= :foo;
- foo | bar
+ foo | bar 
 -----+-----
-  10 |
-  20 |
+  10 | 
+  20 | 
 (2 rows)

 testdb=> \set foo 'my_table'
@@ -38,7 +38,7 @@


 regression=# select (
 regression(# 1);
- ?column?
+ ?column? 
 ----------
         1
 (1 row)
@@ -69,7 +69,7 @@


 -- One field output
 regression=# select schemaname from  pg_tables limit 3;
- schemaname
+ schemaname 
 ------------
  pg_catalog
  pg_catalog
@@ -80,12 +80,12 @@

 test=> select 1 /* multiline
 test*> and 2 /* and 3 */
 test*> end comment */, 2;
- ?column? | ?column?
+ ?column? | ?column? 
 ----------+----------
         1 |        2

 =# select 10.0, 1e-6, 1E+6;
- ?column? | ?column? | ?column?
+ ?column? | ?column? | ?column? 
 ----------+----------+----------
      10.0 | 0.000001 |  1000000
 (1 row)
@@ -97,7 +97,7 @@

 NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "asdf_pkey" for table "asdf"
 CREATE TABLE
 regression=# insert into asdf values (10) returning foo;
- foo
+ foo 
 -----
   10
 (1 row)

--------------------- >> end captured stdout << ----------------------

======================================================================
FAIL: test_examplefiles.test_example_files(<pygments.lexers.CbmBasicV2Lexer>, '/tmp/Pygments-1.6/build/lib/test/examplefiles/test.bas', '/tmp/Pygments-1.6/build/lib/test/examplefiles/output/test.bas')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.3/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/tmp/Pygments-1.6/build/lib/test/test_examplefiles.py", line 71, in check_lexer
    (lx, absfn, val, len(''.join(ntext)))
AssertionError: lexer <pygments.lexers.CbmBasicV2Lexer> generated error token for /tmp/Pygments-1.6/build/lib/test/examplefiles/test.bas: '&' at position 801

======================================================================
FAIL: test_examplefiles.test_example_files(<pygments.lexers.EvoqueHtmlLexer>, '/tmp/Pygments-1.6/build/lib/test/examplefiles/smarty_example.html', '/tmp/Pygments-1.6/build/lib/test/examplefiles/output/smarty_example.html')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.3/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/tmp/Pygments-1.6/build/lib/test/test_examplefiles.py", line 71, in check_lexer
    (lx, absfn, val, len(''.join(ntext)))
AssertionError: lexer <pygments.lexers.EvoqueHtmlLexer> generated error token for /tmp/Pygments-1.6/build/lib/test/examplefiles/smarty_example.html: '$' at position 54

======================================================================
FAIL: test_examplefiles.test_example_files(<pygments.lexers.EvoqueHtmlLexer>, '/tmp/Pygments-1.6/build/lib/test/examplefiles/cheetah_example.html', '/tmp/Pygments-1.6/build/lib/test/examplefiles/output/cheetah_example.html')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.3/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/tmp/Pygments-1.6/build/lib/test/test_examplefiles.py", line 71, in check_lexer
    (lx, absfn, val, len(''.join(ntext)))
AssertionError: lexer <pygments.lexers.EvoqueHtmlLexer> generated error token for /tmp/Pygments-1.6/build/lib/test/examplefiles/cheetah_example.html: '$' at position 23

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

Comments (3)

  1. Tim Hatch

    This is because of bad lexer guessing based on filename, and showing up for you with hash randomization. This will need to wait for the guess_lexer fix, which I haven't started coding yet.

  2. Log in to comment