FakePopen does not work in Python 3.3+

Bug #1358085 reported by Steve Kowalik on 2014-08-18
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Python Fixtures
High
Steve Kowalik

Bug Description

While porting os-collect-config to Python 3, I came across this gem:

Traceback (most recent call last):
  File "./os_collect_config/tests/test_collect.py", line 119, in test_main
    calls = self._fake_popen_call_main(occ_args)
  File "./os_collect_config/tests/test_collect.py", line 76, in _fake_popen_call_main
    self._call_main(occ_args)
  File "./os_collect_config/tests/test_collect.py", line 67, in _call_main
    collector_kwargs_map=collector_kwargs_map)
  File "./os_collect_config/collect.py", line 240, in __main__
    call_command(content, CONF.command)
  File "./os_collect_config/collect.py", line 180, in call_command
    subprocess.check_call(CONF.command, env=env, shell=True)
  File "/usr/lib/python3.3/subprocess.py", line 542, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python3.3/subprocess.py", line 523, in call
    with Popen(*popenargs, **kwargs) as p:
AttributeError: __exit__

This looks like Python 3 has changed the behavior of the subprocess module to make use of with, which requires __entry__() and __exit__() methods, which FakePopen does not support, hence the above traceback.

Related branches

Changed in python-fixtures:
status: New → Triaged
importance: Undecided → High
status: Triaged → Fix Released
assignee: nobody → Steve Kowalik (stevenk)
milestone: none → next
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers