Project

General

Profile

Bug #19311

Add skipped files to futurize tests

Added by Marco Mambelli almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Category:
-
Target version:
Start date:
03/07/2018
Due date:
% Done:

0%

Estimated time:
First Occurred:
Occurs In:
Stakeholders:
Duration:

Description

Working on the run_pylint script I noticed that it checks also the scripts not ending in .py.
The current run_futurize test is not.
Those scripts should be added and their code modernized.

History

#1 Updated by Marco Mambelli almost 2 years ago

branch v3/19311 is covering the modification of the run_futurize script
branch v3/19311_1 is covering changes to the code of the scripts after futurize's feedback

#2 Updated by Marco Mambelli almost 2 years ago

These lines seem to crash futurize:


try: # necessary because systemd is not on rhel6
  from systemd import journal
  def print2( message ):
    print message
    journal.send( message )

except ImportError:
  def print2( message ):
    print message

With the following:

Traceback (most recent call last):
  File "/opt/futurize_git/venv/bin/futurize", line 9, in <module>
    load_entry_point('future==0.16.0', 'console_scripts', 'futurize')()
  File "/opt/futurize_git/venv/lib/python2.6/site-packages/libfuturize/main.py", line 293, in main
    options.processes)
  File "/usr/lib64/python2.6/lib2to3/refactor.py", line 620, in refactor
    items, write, doctests_only)
  File "/usr/lib64/python2.6/lib2to3/refactor.py", line 273, in refactor
    self.refactor_dir(dir_or_file, write, doctests_only)
  File "/usr/lib64/python2.6/lib2to3/refactor.py", line 292, in refactor_dir
    self.refactor_file(fullname, write, doctests_only)
  File "/usr/lib64/python2.6/lib2to3/refactor.py", line 661, in refactor_file
    *args, **kwargs)
  File "/usr/lib64/python2.6/lib2to3/refactor.py", line 327, in refactor_file
    tree = self.refactor_string(input, filename)
  File "/usr/lib64/python2.6/lib2to3/refactor.py", line 359, in refactor_string
    self.refactor_tree(tree, name)
  File "/usr/lib64/python2.6/lib2to3/refactor.py", line 393, in refactor_tree
    self.traverse_by(self.post_order_heads, tree.post_order())
  File "/usr/lib64/python2.6/lib2to3/refactor.py", line 417, in traverse_by
    new = fixer.transform(node, results)
  File "/opt/futurize_git/venv/lib/python2.6/site-packages/libfuturize/fixes/fix_print_with_import.py", line 20, in transform
    future_import(u'print_function', node)
  File "/opt/futurize_git/venv/lib/python2.6/site-packages/libfuturize/fixer_util.py", line 234, in future_import
    root = find_root(node)
  File "/usr/lib64/python2.6/lib2to3/fixer_util.py", line 265, in find_root
    assert node.parent, "Tree is insane! root found before "\
AssertionError: Tree is insane! root found before file_input node was found.

or

Traceback (most recent call last):
  File "/opt/futurize_git/venv/bin/futurize", line 9, in <module>
    load_entry_point('future==0.16.0', 'console_scripts', 'futurize')()
  File "/opt/futurize_git/venv/lib/python2.6/site-packages/libfuturize/main.py", line 293, in main
    options.processes)
  File "/usr/lib64/python2.6/lib2to3/refactor.py", line 620, in refactor
    items, write, doctests_only)
  File "/usr/lib64/python2.6/lib2to3/refactor.py", line 275, in refactor
    self.refactor_file(dir_or_file, write, doctests_only)
  File "/usr/lib64/python2.6/lib2to3/refactor.py", line 661, in refactor_file
    *args, **kwargs)
  File "/usr/lib64/python2.6/lib2to3/refactor.py", line 327, in refactor_file
    tree = self.refactor_string(input, filename)
  File "/usr/lib64/python2.6/lib2to3/refactor.py", line 359, in refactor_string
    self.refactor_tree(tree, name)
  File "/usr/lib64/python2.6/lib2to3/refactor.py", line 393, in refactor_tree
    self.traverse_by(self.post_order_heads, tree.post_order())
  File "/usr/lib64/python2.6/lib2to3/refactor.py", line 419, in traverse_by
    node.replace(new)
  File "/usr/lib64/python2.6/lib2to3/pytree.py", line 135, in replace
    assert self.parent is not None, str(self)
AssertionError: ################################################################################

try: # necessary because systemd is not on rhel6
  from systemd import journal
  def print2( message ):
    print(message)
    journal.send( message )

except ImportError:
  def print2( message ):
    print(message)

#3 Updated by Marco Mambelli almost 2 years ago

  • Status changed from New to Work in progress
  • Assignee set to Marco Mambelli

#4 Updated by Marco Mambelli almost 2 years ago

  • Status changed from Work in progress to Feedback
  • Assignee changed from Marco Mambelli to Dennis Box

2 separate things:
- Provide feedback on run_futurize in v3/19311
- Provide summary feedback on the scripts modernization in v3/19311_1 (lots of changes, feedback mainly via testing)

#5 Updated by Marco Mambelli almost 2 years ago

  • Status changed from Feedback to Resolved
  • Assignee changed from Dennis Box to Marco Mambelli
  • Target version changed from v3_2_22 to v3_2_23

#6 Updated by Marco Mambelli over 1 year ago

  • Target version changed from v3_2_23 to v3_4_0

#7 Updated by Marco Mambelli over 1 year ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF