Integration tests are broken

Open
#21 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python

Research direction

Start by running the two nose commands in the issue and compare failures across integrationtests/test_context_performance.py and integrationtests/blocks. Then inspect the referenced block_test_case.py, analysis_test_case.py, unparser_test_case.py, and codetools/blocks/analysis.py locations. Done means the reported integration tests and doctests pass without the listed errors.

Written by the indexing model from the issue text.

Description

Running the integration tests one gets two kind of errors

A. When running

python -m nose.core ./integrationtests -v

we get

test_write (test_context_performance.MultiContextTestCase) ... ok
Compare exec with Adapter to the speed of a dict. (slowdown < 2.5) ... FAIL

======================================================================
FAIL: Compare exec with Adapter to the speed of a dict. (slowdown < 2.5)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\itziakos\Projects\codetools\integrationtests\test_context_performance.py", line 219, in test_exec_is_not_slow
    assert slowdown < allowed_slowdown, msg
AssertionError: ('actual slowdown, time: 3.065822', 6.364452719815567e-05)
-------------------- >> begin captured stdout << ---------------------
[actual slowdown=3.07]
--------------------- >> end captured stdout << ----------------------

----------------------------------------------------------------------
Ran 49 tests in 1.340s

B. When running

python -m nose.core ./integrationtests/block

we get

ith_string (unparser_test_case.UnparseCompilerAstTestCase) ... ok
test_unary_minus (unparser_test_case.UnparseCompilerAstTestCase) ... ok
test_with (unparser_test_case.UnparseCompilerAstTestCase) ... ok

======================================================================
ERROR: Expressions
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\itziakos\Projects\codetools\integrationtests\blocks\block_test_case.py", line 473, in test
    self._base('1+2', 3, ())
  File "C:\Users\itziakos\Projects\codetools\integrationtests\blocks\block_test_case.py", line 467, in _base
    self.assertEqual(value, e.evaluate(dict(mapping)))
  File "C:\Users\itziakos\Projects\codetools\codetools\blocks\block.py", line 966, in evaluate
    return eval(self._code, {}, context)
  File "c:\users\itziakos\projects\traits\traits\trait_handlers.py", line 109, in _undefined_get
    name, class_of( object ) )
TraitError: The '_code' trait of an Expression instance is a property that has no 'get' or 'set' method

======================================================================
FAIL: Doctest: codetools.blocks.analysis.Transformer
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\runtimes\default\lib\doctest.py", line 2201, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for codetools.blocks.analysis.Transformer
  File "C:\Users\itziakos\Projects\codetools\codetools\blocks\analysis.py", line 612, in Transformer

----------------------------------------------------------------------
File "C:\Users\itziakos\Projects\codetools\codetools\blocks\analysis.py", line 616, in codetools.blocks.analysis.Transformer
Failed example:
    from compiler_.ast.api import similar
Exception raised:
    Traceback (most recent call last):
      File "c:\runtimes\default\lib\doctest.py", line 1289, in __run
        compileflags, 1) in test.globs
      File "<doctest codetools.blocks.analysis.Transformer[1]>", line 1, in <module>
        from compiler_.ast.api import similar
    ImportError: No module named ast.api
----------------------------------------------------------------------
File "C:\Users\itziakos\Projects\codetools\codetools\blocks\analysis.py", line 618, in codetools.blocks.analysis.Transformer
Failed example:
    similar(ast, Transformer().transform(ast))
Exception raised:
    Traceback (most recent call last):
      File "c:\runtimes\default\lib\doctest.py", line 1289, in __run
        compileflags, 1) in test.globs
      File "<doctest codetools.blocks.analysis.Transformer[3]>", line 1, in <module>
        similar(ast, Transformer().transform(ast))
    NameError: name 'similar' is not defined


======================================================================
FAIL: Doctest: codetools.blocks.analysis.extract_const_assigns
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\runtimes\default\lib\doctest.py", line 2201, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for codetools.blocks.analysis.extract_const_assigns
  File "C:\Users\itziakos\Projects\codetools\codetools\blocks\analysis.py", line 52, in extract_const_assigns

----------------------------------------------------------------------
File "C:\Users\itziakos\Projects\codetools\codetools\blocks\analysis.py", line 56, in codetools.blocks.analysis.extract_const_assigns
Failed example:
    from compiler_.ast.api import similar
Exception raised:
    Traceback (most recent call last):
      File "c:\runtimes\default\lib\doctest.py", line 1289, in __run
        compileflags, 1) in test.globs
      File "<doctest codetools.blocks.analysis.extract_const_assigns[1]>", line 1, in <module>
        from compiler_.ast.api import similar
    ImportError: No module named ast.api
----------------------------------------------------------------------
File "C:\Users\itziakos\Projects\codetools\codetools\blocks\analysis.py", line 58, in codetools.blocks.analysis.extract_const_assigns
Failed example:
    similar(ast, parse('a = __a'))
Exception raised:
    Traceback (most recent call last):
      File "c:\runtimes\default\lib\doctest.py", line 1289, in __run
        compileflags, 1) in test.globs
      File "<doctest codetools.blocks.analysis.extract_const_assigns[3]>", line 1, in <module>
        similar(ast, parse('a = __a'))
    NameError: name 'similar' is not defined


======================================================================
FAIL: test_function_kwargs_dict_args (analysis_test_case.NameAnalysisTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\itziakos\Projects\codetools\integrationtests\blocks\analysis_test_case.py", line 360, in test_function_kwargs_dict_args
    self.assertRaises(TypeError, test_raises, code)
AssertionError: TypeError not raised

======================================================================
FAIL: test_function_varargs_args (analysis_test_case.NameAnalysisTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\itziakos\Projects\codetools\integrationtests\blocks\analysis_test_case.py", line 318, in test_function_varargs_args
    self.assertRaises(TypeError, test_raises, code)
AssertionError: TypeError not raised

======================================================================
FAIL: Tracebacks have correct file names and line numbers
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\itziakos\Projects\codetools\integrationtests\blocks\block_test_case.py", line 332, in test_tracebacks
    test(tracebacks()[-1], 1, 'foo/a.py')
  File "C:\Users\itziakos\Projects\codetools\integrationtests\blocks\block_test_case.py", line 310, in test
    self.assertEqual(tb.tb_lineno, lineno+1)
AssertionError: 1 != 2

======================================================================
FAIL: test_if2 (unparser_test_case.UnparseCompilerAstTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\itziakos\Projects\codetools\integrationtests\blocks\unparser_test_case.py", line 178, in test_if2
    self._check_round_trip(code)
  File "C:\Users\itziakos\Projects\codetools\integrationtests\blocks\unparser_test_case.py", line 389, in _check_round_trip
    self.assertEqual(desired.strip(), actual.strip())
AssertionError: 'if True: \n    \n    x = 4\nelse: \n    \n    x = 5' != 'if True: \n    \n    x = 4\n\nelse: \n    \n    x = 5'

======================================================================
FAIL: test_if3 (unparser_test_case.UnparseCompilerAstTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\itziakos\Projects\codetools\integrationtests\blocks\unparser_test_case.py", line 187, in test_if3
    self._check_round_trip(code)
  File "C:\Users\itziakos\Projects\codetools\integrationtests\blocks\unparser_test_case.py", line 389, in _check_round_trip
    self.assertEqual(desired.strip(), actual.strip())
AssertionError: 'if True: \n    pass\n\nelif False: \n    pass\n\nelse: \n    pass' != 'if True: \n    pass\n\nelif False: \n    pass\n\n\nelse: \n    pass'

======================================================================
FAIL: tests if block nested in else block.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\itziakos\Projects\codetools\integrationtests\blocks\unparser_test_case.py", line 207, in test_if5
    self._check_round_trip(code)
  File "C:\Users\itziakos\Projects\codetools\integrationtests\blocks\unparser_test_case.py", line 389, in _check_round_trip
    self.assertEqual(desired.strip(), actual.strip())
AssertionError: 'if True: \n    pass\n\nelse: \n    \n    if True: \n        pass' != 'if True: \n    pass\n\n\nelse: \n    \n    if True: \n        pass'

----------------------------------------------------------------------
Ran 137 tests in 2.158s
Dominant language
Python
Stars
54
Forks
10
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from enthought/codetools

All issues in enthought/codetools

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.