Merge ~smoser/git-ubuntu:fix/run-all-tests into git-ubuntu:master

Proposed by Scott Moser
Status: Needs review
Proposed branch: ~smoser/git-ubuntu:fix/run-all-tests
Merge into: git-ubuntu:master
Diff against target: 985 lines (+451/-396)
9 files modified
gitubuntu/build.py (+0/-43)
gitubuntu/build_test.py (+50/-0)
gitubuntu/lint.py (+0/-47)
gitubuntu/lint_test.py (+52/-0)
gitubuntu/repo_builder.py (+0/-224)
gitubuntu/repo_builder_test.py (+245/-0)
gitubuntu/versioning.py (+0/-81)
gitubuntu/versioning_test.py (+103/-0)
snap-wrappers/wrappers/git-ubuntu-self-test (+1/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
git-ubuntu developers Pending
Review via email: mp+358413@code.staging.launchpad.net

Commit message

Move tests into files named with _test.

Separate existing test functions into their own '_test.py' files.
This is not strictly necessary, but more common.

It is no longer necessary to rely on shell expansion of gitubuntu/*
to tell pytest which files to run on as it will look at the files
named _test.py. So we've changed
snap-wrappers/wrappers/git-ubuntu-self-test to pass the gitubuntu dir
directly.

Also fix flake8 for newly added test files.

Description of the change

see commit message

To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) wrote :

If you want to keep _test functions in the same files, we can do that.
But I would suggest that then we add a pytestrc file.
We could write content to a temp file and then execute with '-c <filename>'
so that it would all be contained in

./snap-wrappers/wrappers/git-ubuntu-self-test

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:233c352a3a340ac599b21c50a2198ec07ab9bcb8
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/69/
Executed test runs:
    SUCCESS: VM Setup
    SUCCESS: Build
    SUCCESS: Unit Tests
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/69/rebuild

review: Approve (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:752960ed9c0587b532a783736dd60c2c8967551e
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/71/
Executed test runs:
    SUCCESS: VM Setup
    SUCCESS: Build
    SUCCESS: Unit Tests
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/71/rebuild

review: Approve (continuous-integration)
Revision history for this message
Scott Moser (smoser) wrote :

Heres an example of the change to use a pytest.cfg
 http://paste.ubuntu.com/p/VyS2xZNyxY/

Revision history for this message
Scott Moser (smoser) wrote :

Robie suggested in IRC [1] that it was usd policy now to put tests in _test files.
So I've adjustted the commit message and also changed git-ubuntu-self-test to not
use shell wildcard as it is now not needed.

--
[1] https://irclogs.ubuntu.com/2018/11/07/%23ubuntu-server.html

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:186687fa53c6070118b3b02a1982b6df7a0fbfcf
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/72/
Executed test runs:
    SUCCESS: VM Setup
    SUCCESS: Build
    SUCCESS: Unit Tests
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/72/rebuild

review: Approve (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

FAILED: Continuous integration, rev:9c4ed53f9dbfe8956deb095183c356ff77d9fe4f
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/73/
Executed test runs:
    FAILED: VM Setup

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/73/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:9c4ed53f9dbfe8956deb095183c356ff77d9fe4f
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/74/
Executed test runs:
    SUCCESS: VM Setup
    SUCCESS: Build
    SUCCESS: Unit Tests
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/74/rebuild

review: Approve (continuous-integration)
Revision history for this message
Robie Basak (racb) wrote :

> - Drop test_source_tree. Not sure what this did.

It tests that the minimal essential use of the SourceTree class works as expected.

Revision history for this message
Scott Moser (smoser) wrote :

> > - Drop test_source_tree. Not sure what this did.
>
> It tests that the minimal essential use of the SourceTree class works as
> expected.

As it is currently in trunk, it takes a parameter (pygit2_repo) that masks
the global definition (from gitubuntu.test_fixtures import ..).

I guess this is just my unfamiliarity with pytest, but how does this get called?
How does it know to call it with pygit2_repo ?

Revision history for this message
Scott Moser (smoser) wrote :

I added it back and it does pass.

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:8cb5c592a067d5818db7fee656b2b342036070c4
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/77/
Executed test runs:
    SUCCESS: VM Setup
    SUCCESS: Build
    SUCCESS: Unit Tests
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/77/rebuild

review: Approve (continuous-integration)
Revision history for this message
Robie Basak (racb) wrote :

On Thu, Nov 08, 2018 at 07:07:43PM -0000, Scott Moser wrote:
> How does it know to call it with pygit2_repo ?

pygit2_repo is a function marked with a @pytest.fixture decorator.
pytest sees that and calls the function to create the fixture.

https://docs.pytest.org/en/latest/fixture.html#fixture

It is a little evil since you'd expect the function parameter to be
scoped inside the function only, but is very convenient.

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:edd3d1d317f3b9b2fccf323d8cb90db5e1595590
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/84/
Executed test runs:
    SUCCESS: VM Setup
    SUCCESS: Build
    SUCCESS: Unit Tests
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/84/rebuild

review: Approve (continuous-integration)

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

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