Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

py.test -> pytest, move py3 versions fwd #315

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions chacra/tests/controllers/repos/test_repos.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import os
import pecan
import py.test
import pytest
from chacra.models import Project, Repo, Binary
from chacra.compat import b_
from chacra import asynch


class TestRepoApiController(object):

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/']
Expand All @@ -28,7 +28,7 @@ def test_repo_archs(self, session, url):
result = session.app.get(url)
assert result.json['archs'] == ['x86_64']

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/repo/',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/repo/']
Expand All @@ -48,7 +48,7 @@ def test_repo_endpoint_deb(self, session, url):
result = session.app.get(url)
assert b_("deb") in result.body

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/centos/7/repo/',
'/repos/foobar/firefly/head/centos/7/flavors/default/repo/']
Expand All @@ -70,7 +70,7 @@ def test_repo_endpoint_rpm(self, session, url):
assert b_("noarch") in result.body
assert b_("SRPMS") in result.body

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar-opensuse/firefly/head/opensuse/15.1/repo/',
'/repos/foobar-opensuse/firefly/head/opensuse/15.1/flavors/default/repo/']
Expand All @@ -92,7 +92,7 @@ def test_repo_endpoint_rpm_opensuse_sle(self, session, url):
assert b_("noarch") not in result.body
assert b_("SRPMS") not in result.body

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/']
Expand All @@ -115,7 +115,7 @@ def test_repo_exists(self, session, url):
assert result.json["ref"] == "firefly"
assert result.json["sha1"] == "head"

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/']
Expand All @@ -138,7 +138,7 @@ def test_repo_exists_no_path(self, session, url):
assert result.json["sha1"] == "head"


@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/']
Expand All @@ -158,7 +158,7 @@ def test_repo_is_not_queued(self, session, url):
assert result.status_int == 200
assert result.json["is_queued"] is False

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/']
Expand All @@ -178,7 +178,7 @@ def test_repo_is_not_updating(self, session, url):
assert result.status_int == 200
assert result.json["is_updating"] is False

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/']
Expand All @@ -198,7 +198,7 @@ def test_repo_type(self, session, url):
assert result.status_int == 200
assert result.json["type"] is None

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/precise/',
'/repos/foobar/firefly/head/ubuntu/precise/flavors/default/']
Expand All @@ -217,7 +217,7 @@ def test_distro_version_does_not_exist(self, session, url):
result = session.app.get(url, expect_errors=True)
assert result.status_int == 404

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/centos/trusty/',
'/repos/foobar/firefly/head/centos/trusty/flavors/default/']
Expand All @@ -236,7 +236,7 @@ def test_distro_does_not_exist(self, session, url):
result = session.app.get(url, expect_errors=True)
assert result.status_int == 404

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/hammer/head/ubuntu/trusty/',
'/repos/foobar/hammer/head/ubuntu/trusty/flavors/default/']
Expand All @@ -255,7 +255,7 @@ def test_ref_does_not_exist(self, session, url):
result = session.app.get('/repos/foobar/hammer/head/ubuntu/trusty/', expect_errors=True)
assert result.status_int == 404

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/sha1/ubuntu/trusty/',
'/repos/foobar/firefly/sha1/ubuntu/trusty/flavors/default/']
Expand All @@ -274,7 +274,7 @@ def test_sha1_does_not_exist(self, session, url):
result = session.app.get(url, expect_errors=True)
assert result.status_int == 404

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/']
Expand All @@ -293,7 +293,7 @@ def test_extra_metadata_default(self, session, url):
result = session.app.get(url)
assert result.json['extra'] == {}

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/extra/',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/extra/']
Expand All @@ -318,7 +318,7 @@ def test_add_extra_metadata(self, session, url):
updated_repo = Repo.get(repo_id)
assert updated_repo.extra == {"version": "0.94.8", 'distros': ['precise']}

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/']
Expand All @@ -345,7 +345,7 @@ def test_update_single_field(self, session, url):
assert updated_repo.distro_version == "precise"
assert result.json['distro_version'] == "precise"

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/']
Expand Down Expand Up @@ -374,7 +374,7 @@ def test_update_multiple_fields(self, session, url):
assert result.json['distro_version'] == "7"
assert result.json['distro'] == "centos"

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/']
Expand All @@ -401,7 +401,7 @@ def test_update_invalid_fields(self, session, url):
updated_repo = Repo.get(repo_id)
assert updated_repo.distro == "ubuntu"

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/']
Expand All @@ -424,7 +424,7 @@ def test_update_empty_json(self, session, url):
)
assert result.status_int == 400

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/']
Expand All @@ -451,7 +451,7 @@ def test_update_invalid_field_value(self, session, url):

class TestRepoCRUDOperations(object):

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/update',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/update']
Expand All @@ -477,8 +477,8 @@ def test_update(self, session, tmpdir, url):
assert result.json['needs_update'] is True
assert result.json['is_queued'] is False

@py.test.mark.dmick
@py.test.mark.parametrize(
@pytest.mark.dmick
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/'],
Expand Down Expand Up @@ -520,7 +520,7 @@ def test_create(self, session, url):
result = session.app.get(url)
assert result.json['type'] == 'raw'

@py.test.mark.dmick
@pytest.mark.dmick
def test_raw_post_update(self, session, recorder, monkeypatch):
pecan.conf.repos_root = '/tmp/root'
url = '/repos/foobar/main/head/windows/999/'
Expand Down Expand Up @@ -550,7 +550,7 @@ def test_raw_post_update(self, session, recorder, monkeypatch):
result = session.app.post(url + 'update/')
assert fake_post_status.recorder_calls[0]['args'][0] == 'ready'

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/update',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/update']
Expand All @@ -569,7 +569,7 @@ def test_update_head(self, session, tmpdir, url):
result = session.app.head(url)
assert result.status_int == 200

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/recreate',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/recreate']
Expand All @@ -591,7 +591,7 @@ def test_recreate(self, session, tmpdir, url):
assert result.json['needs_update'] is True
assert result.json['is_queued'] is False

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/recreate',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/recreate']
Expand All @@ -616,7 +616,7 @@ def test_recreate_and_requeue(self, session, tmpdir, url):
assert result.json['needs_update'] is True
assert result.json['is_queued'] is False

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/recreate',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/recreate']
Expand All @@ -638,7 +638,7 @@ def test_recreate_invalid_path(self, session, tmpdir, url):
assert os.path.exists(path) is True
assert result.json['needs_update'] is True

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/recreate',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/recreate']
Expand All @@ -657,7 +657,7 @@ def test_recreate_head(self, session, tmpdir, url):
result = session.app.head(url)
assert result.status_int == 200

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/recreate',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/recreate']
Expand All @@ -670,7 +670,7 @@ def test_recreate_head_not_found(self, session, tmpdir, url):
)
assert result.status_int == 404

@py.test.mark.parametrize(
@pytest.mark.parametrize(
'url',
['/repos/foobar/firefly/head/ubuntu/trusty/recreate',
'/repos/foobar/firefly/head/ubuntu/trusty/flavors/default/recreate']
Expand Down
Loading