Merge lp://qastaging/~elopio/snapcraft/test_tmp_cwd into lp://qastaging/~snappy-dev/snapcraft/core

Proposed by Leo Arias
Status: Merged
Merged at revision: 100
Proposed branch: lp://qastaging/~elopio/snapcraft/test_tmp_cwd
Merge into: lp://qastaging/~snappy-dev/snapcraft/core
Diff against target: 69 lines (+37/-4)
3 files modified
debian/control (+1/-0)
snapcraft/tests/__init__.py (+7/-4)
snapcraft/tests/fixture_setup.py (+29/-0)
To merge this branch: bzr merge lp://qastaging/~elopio/snapcraft/test_tmp_cwd
Reviewer Review Type Date Requested Status
Michael Terry (community) Approve
Review via email: mp+265352@code.qastaging.launchpad.net

Commit message

Use a temporary cwd during the tests.
Added python3-fixtures as a build dependency.

Description of the change

There are some tests that generate directories.
If they are run in the branch directory, then it will be polluted.
By changing to a tmp dir, every test can generate whatever it wants and then it will be cleaned up.

To post a comment you must log in.
Revision history for this message
Michael Terry (mterry) wrote :

Sure, looks good. mvo's copy-plugin branch [1] did something similar, but it was opt-in instead of automatic. This is more fool-proof.

[1] https://code.launchpad.net/~mvo/snapcraft/copy-plugin/+merge/264706

review: Approve
Revision history for this message
Snappy Tarmac (snappydevtarmac) wrote :

The attempt to merge lp:~elopio/snapcraft/test_tmp_cwd into lp:snapcraft failed. Below is the output from the failed tests.

EEE
======================================================================
ERROR: snapcraft.tests.test_cmds (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.4/unittest/case.py", line 57, in testPartExecutor
    yield
  File "/usr/lib/python3.4/unittest/case.py", line 574, in run
    testMethod()
  File "/usr/lib/python3.4/unittest/loader.py", line 32, in testFailure
    raise exception
ImportError: Failed to import test module: snapcraft.tests.test_cmds
Traceback (most recent call last):
  File "/usr/lib/python3.4/unittest/loader.py", line 312, in _find_tests
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.4/unittest/loader.py", line 290, in _get_module_from_name
    __import__(name)
  File "/tmp/tarmac/branch.JBZ6bx/snapcraft/tests/__init__.py", line 17, in <module>
    import fixtures
ImportError: No module named 'fixtures'

======================================================================
ERROR: snapcraft.tests.test_plugin (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.4/unittest/case.py", line 57, in testPartExecutor
    yield
  File "/usr/lib/python3.4/unittest/case.py", line 574, in run
    testMethod()
  File "/usr/lib/python3.4/unittest/loader.py", line 32, in testFailure
    raise exception
ImportError: Failed to import test module: snapcraft.tests.test_plugin
Traceback (most recent call last):
  File "/usr/lib/python3.4/unittest/loader.py", line 312, in _find_tests
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.4/unittest/loader.py", line 290, in _get_module_from_name
    __import__(name)
  File "/tmp/tarmac/branch.JBZ6bx/snapcraft/tests/__init__.py", line 17, in <module>
    import fixtures
ImportError: No module named 'fixtures'

======================================================================
ERROR: snapcraft.tests.test_yaml (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.4/unittest/case.py", line 57, in testPartExecutor
    yield
  File "/usr/lib/python3.4/unittest/case.py", line 574, in run
    testMethod()
  File "/usr/lib/python3.4/unittest/loader.py", line 32, in testFailure
    raise exception
ImportError: Failed to import test module: snapcraft.tests.test_yaml
Traceback (most recent call last):
  File "/usr/lib/python3.4/unittest/loader.py", line 312, in _find_tests
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.4/unittest/loader.py", line 290, in _get_module_from_name
    __import__(name)
  File "/tmp/tarmac/branch.JBZ6bx/snapcraft/tests/__init__.py", line 17, in <module>
    import fixtures
ImportError: No module named 'fixtures'

----------------------------------------------------------------------
Ran 3 tests in 0.002s

FAILED (errors=3)

Revision history for this message
Michael Terry (mterry) wrote :

Tarmac instance doesn't have python3-fixtures installed... let me see.

Revision history for this message
Michael Terry (mterry) wrote :

Manually merged.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: