Skip to content

Commit

Permalink
moving tests directory to top level
Browse files Browse the repository at this point in the history
  • Loading branch information
havok2063 committed Apr 20, 2020
1 parent f2f892f commit e16cbc4
Show file tree
Hide file tree
Showing 21 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sudo: false

services:
- postgresql

python:
- '3.6'
- '3.7'
Expand Down Expand Up @@ -39,7 +39,7 @@ install:
- pip install .[all,dev]

script:
- pytest -p no:sugar python/sdssdb/tests --cov python/sdssdb --cov-report html
- pytest -p no:sugar tests --cov python/sdssdb --cov-report html

after_success:
- coveralls
File renamed without changes.
8 changes: 4 additions & 4 deletions python/sdssdb/tests/conftest.py → tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
import pytest
import importlib
import inspect
from sdssdb.tests.sqladbs import prepare_testdb as sqla_prepdb
from sdssdb.tests.pwdbs import prepare_testdb as pw_prepdb
from .sqladbs import prepare_testdb as sqla_prepdb
from .pwdbs import prepare_testdb as pw_prepdb
from pytest_postgresql.factories import DatabaseJanitor


def pytest_addoption(parser):
""" Add new options to the pytest command-line """
# only run peewee tests
parser.addoption('--peewee', action='store_true', default=False,
parser.addoption('--peewee', action='store_true', default=False,
help='Only run tests for peewee dbs')

# only run sqla tests
Expand All @@ -31,7 +31,7 @@ def pytest_addoption(parser):

def pytest_ignore_collect(path, config):
''' pytest hook to identify tests to be ignored during collection
Looks through all test_xxx.py files in pwdbs and sqladbs and determines
which ones have databases that fail to connect and ignores them.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# !/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# Filename: conftest.py
# Project: pwdbs
# Author: Brian Cherinka
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# !/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# Filename: factories.py
# Project: pwdbs
# Author: Brian Cherinka
Expand All @@ -13,7 +13,7 @@

from __future__ import print_function, division, absolute_import
import factory
from sdssdb.tests.pwdbs import models, database as testdb
from tests.pwdbs import models, database as testdb
from sdssdb.peewee.sdss5db import database as sdss5db, targetdb
from .factoryboy import PeeweeModelFactory

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions python/sdssdb/tests/pwdbs/models.py → tests/pwdbs/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# !/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# Filename: models.py
# Project: pwdbs
# Author: Brian Cherinka
Expand All @@ -13,7 +13,7 @@

from __future__ import print_function, division, absolute_import
from peewee import CharField, AutoField
from sdssdb.tests.pwdbs import TmpModel
from tests.pwdbs import TmpModel

#
# This file contains models used by the temporary test database.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# !/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# Filename: test_factory.py
# Project: pwdbs
# Author: Brian Cherinka
Expand All @@ -12,15 +12,15 @@


from __future__ import print_function, division, absolute_import
from sdssdb.tests.pwdbs import models
from tests.pwdbs import models
import pytest


@pytest.fixture()
def batchit(user_factory):
user_factory.create_batch(10)


class TestFactory(object):

def test_factory_fixture(self, transaction, user_factory):
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# !/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# Filename: conftest.py
# Project: sqladbs
# Author: Brian Cherinka
Expand All @@ -23,8 +23,8 @@
#
# pytest_factoryboy @register decorator registers fixtures in directory where it is
# called. To make available to tests, need to either import them into conftest or register
# manually in conftest. The below code registers them manually instead of with
# @register class decorator. For docs on pytest_factoryboy,
# manually in conftest. The below code registers them manually instead of with
# @register class decorator. For docs on pytest_factoryboy,
# see https://pytest-factoryboy.readthedocs.io/en/latest
for item in dir(factories):
attr = getattr(factories, item)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# !/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# Filename: factories.py
# Project: sqladbs
# Author: Brian Cherinka
Expand All @@ -13,7 +13,7 @@

from __future__ import print_function, division, absolute_import
import factory
from sdssdb.tests.sqladbs import models, database as db, get_model_from_database
from tests.sqladbs import models, database as db, get_model_from_database
from sdssdb.sqlalchemy.mangadb import database as mangadb
from sdssdb.sqlalchemy.archive import database as archive

Expand Down Expand Up @@ -63,7 +63,7 @@ class TreeFactory(factory.alchemy.SQLAlchemyModelFactory):
''' factory for archive db tree table '''
class Meta:
model = sas.Tree
sqlalchemy_session = archive.Session
sqlalchemy_session = archive.Session

id = factory.Sequence(lambda n: n)
version = factory.Sequence(lambda n: 'dr{0}'.format(30 + n))
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# !/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# Filename: models.py
# Project: sqladbs
# Author: Brian Cherinka
Expand All @@ -14,7 +14,7 @@
from __future__ import print_function, division, absolute_import

from sqlalchemy import Column, Integer, String
from sdssdb.tests.sqladbs import TmpBase
from tests.sqladbs import TmpBase

#
# This file contains models used by the temporary test database.
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# !/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# Filename: test_testdb.py
# Project: sqladbs
# Author: Brian Cherinka
Expand All @@ -14,7 +14,7 @@
from __future__ import print_function, division, absolute_import

import pytest
from sdssdb.tests.sqladbs import models, database
from tests.sqladbs import models, database


@pytest.fixture(scope='function', autouse=True)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit e16cbc4

Please sign in to comment.