Skip to content

Commit

Permalink
Update conftest
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim Avanov committed Mar 27, 2019
1 parent 4ceb958 commit ad5760e
Show file tree
Hide file tree
Showing 125 changed files with 688 additions and 80 deletions.
Binary file added .DS_Store
Binary file not shown.
24 changes: 8 additions & 16 deletions .circleci/config.yml
Expand Up @@ -11,30 +11,22 @@ jobs:
# specify the version you desire here
# use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
- image: python:3.7.0-alpine3.8
environment:
RAILS_ENV: test
PGHOST: 127.0.0.1
PGUSER: solo

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
- image: postgres:10.5-alpine
environment:
POSTGRES_USER: solo
POSTGRES_DB: solo

- image: redis:5.0-rc5-alpine

steps:
- checkout
# https://circleci.com/docs/2.0/building-docker-images/#overview
- setup_remote_docker

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "requirements.txt" }}
- v1-dependencies-{{ checksum "requirements_local.txt" }}
- v1-dependencies-{{ checksum "requirements_test.txt" }}
- v1-dependencies-{{ checksum "requirements/minimal.txt" }}
- v1-dependencies-{{ checksum "requirements/local.txt" }}
- v1-dependencies-{{ checksum "requirements/test.txt" }}

- run:
name: install dependencies
Expand All @@ -44,14 +36,14 @@ jobs:
apk update
apk add --virtual build-deps gcc make python-dev musl-dev
apk add postgresql-dev
pip install -r ./requirements.txt
pip install -r ./requirements_test.txt
pip install -r ./requirements/minimal.txt
pip install -r ./requirements/test.txt
pip install coveralls
- save_cache:
paths:
- ./venv
key: v1-dependencies-{{ checksum "requirements.txt" }}
key: v1-dependencies-{{ checksum "requirements/minimal.txt" }}

# run tests!
# this example uses Django's built-in test-runner
Expand Down
17 changes: 8 additions & 9 deletions .travis.yml
Expand Up @@ -4,21 +4,20 @@ sudo: true
language: python
cache: pip
services:
- postgresql
- redis-server
addons:
postgresql: "9.4"
- docker
# addons:
# postgresql: "9.4"

install:
- pip install -r ./requirements.txt
- pip install -r ./requirements_test.txt
- pip install -r ./requirements/minimal.txt
- pip install -r ./requirements/test.txt
- pip install coveralls
python:
- "3.7"

before_script:
- psql -c 'create role solo with superuser login;' -U postgres
- psql -c 'create database solo with owner solo;' -U postgres
# before_script:
# - psql -c 'create role solo with superuser login;' -U postgres
# - psql -c 'create database solo with owner solo;' -U postgres

# --source specifies what packages to cover, you probably want to use that option
script:
Expand Down
5 changes: 3 additions & 2 deletions README.rst
Expand Up @@ -63,8 +63,9 @@ You can terminate the server by sending it a SIGINT (Ctrl-C from an interactive
Test framework
--------------

Run existing test suite with
You will need docker to run test instances of Postgres and Redis.

Run existing test suite with:

.. code::
(solo) $ docker-compose -f env/dev/docker-compose.yml up -d
(solo) $ py.test
4 changes: 2 additions & 2 deletions Vagrantfile
Expand Up @@ -125,8 +125,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# chef.validation_client_name = "ORGNAME-validator"

config.vm.provision :ansible do |ansible|
ansible.playbook = "deploy/develop.yml"
ansible.inventory_path = "deploy/hosts"
ansible.playbook = "env/dev/deploy/develop.yml"
ansible.inventory_path = "env/dev/deploy/hosts"
# additional "vv" and "vvv" options are available
ansible.verbose = "v"
end
Expand Down
5 changes: 5 additions & 0 deletions docs/devdocs/index.rst
@@ -0,0 +1,5 @@
=======================
Developer Documentation
=======================


2 changes: 2 additions & 0 deletions docs/index.rst
Expand Up @@ -15,6 +15,8 @@ Contents:
providers.rst
migrations.rst

devdocs/index.rst



Indices and tables
Expand Down
5 changes: 5 additions & 0 deletions env/dev/README.rst
@@ -0,0 +1,5 @@
Dev Deployment Tools
====================


This directory contains various deployment tools.
1 change: 1 addition & 0 deletions env/dev/deploy/develop.retry
@@ -0,0 +1 @@
develop
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions env/dev/docker-compose.yml
@@ -1,7 +1,7 @@
version: "2"
services:
postgres:
image: postgres:10.5-alpine
image: postgres:11.2-alpine
environment:
POSTGRES_USER: solo
POSTGRES_PASSWORD: solo
Expand All @@ -10,6 +10,6 @@ services:
- 5432:5432

redis:
image: redis:5.0-rc5-alpine
image: redis:5.0.4-alpine
ports:
- 6379:6379
File renamed without changes.
3 changes: 2 additions & 1 deletion requirements.txt → requirements/minimal.txt
@@ -1,3 +1,4 @@
uvicorn==0.6.1
aiohttp==3.5.4
aiohttp_session[aioredis]==2.7.0
aiopg==0.16.0
Expand All @@ -12,5 +13,5 @@ venusian==1.2.0
uvloop>=0.12.1,<0.13.0
# for the parser
inflection==0.3.1
typeit==0.8.0
typeit==0.9.0
routes==2.4.1
5 changes: 4 additions & 1 deletion requirements_test.txt → requirements/test.txt
Expand Up @@ -2,4 +2,7 @@ pytest>=4.3.1,<4.4
pytest-aiohttp==0.3.0
coverage>=4.5.3,<4.6
pytest-cov==2.6.1
mypy==0.670
mypy==0.670
docker>=3.7.1,<3.8
faker>=1.0.4,<1.1
redis>=3.2.1,<3.3
8 changes: 3 additions & 5 deletions setup.py
@@ -1,16 +1,14 @@
import os

from pathlib import Path
from setuptools import setup
from setuptools import find_packages


here = Path(os.path.abspath(os.path.dirname(__file__)))
HERE = Path(__file__).absolute().parent

with here.joinpath('README.rst').open() as f:
with (HERE / 'README.rst').open() as f:
README = f.read()

with here.joinpath('requirements.txt').open() as f:
with (HERE / 'requirements' / 'minimal.txt').open() as f:
rows = f.read().strip().split('\n')
requires = []
for row in rows:
Expand Down
2 changes: 1 addition & 1 deletion solo/apps/accounts/__init__.py
Expand Up @@ -5,7 +5,7 @@
from . import predicate


__all__ = ['get_user']
__all__ = ['get_user']


def includeme(config: Configurator):
Expand Down
11 changes: 6 additions & 5 deletions solo/cli/__init__.py
Expand Up @@ -5,12 +5,13 @@
import logging
import logging.config
import sys
from pathlib import Path

from pkg_resources import get_distribution

from solo.cli import run
from . import commands
from solo.integrations.alembic import integrate_alembic_cli
from solo.server.config import Config, EventLoopType
from solo.config.app import Config, EventLoopType
from .util import parse_app_config


Expand All @@ -27,11 +28,11 @@ def main(args=None, stdout=None):

# $ solo run <config>
# ---------------------------
run.setup(subparsers)
commands.run.setup(subparsers)

# $ solo db [args]
# ---------------------------
integrate_alembic_cli(subparsers)
integrate_alembic_cli(subparsers, prefix='db')

# Common arguments
# ----------------
Expand All @@ -42,7 +43,7 @@ def main(args=None, stdout=None):
if args is None:
args = sys.argv[1:]
args = parser.parse_args(args)
solo_cfg = parse_app_config(args.solocfg)
solo_cfg = parse_app_config(Path(args.solocfg))

# Set up and run
# --------------
Expand Down
4 changes: 4 additions & 0 deletions solo/cli/commands/__init__.py
@@ -0,0 +1,4 @@
from . import run


__all__ = ('run',)
2 changes: 1 addition & 1 deletion solo/cli/run.py → solo/cli/commands/run.py
Expand Up @@ -4,7 +4,7 @@
import sys

from solo import init_webapp
from solo.server.config import Config
from solo.config.app import Config


def setup(subparsers):
Expand Down
17 changes: 12 additions & 5 deletions solo/cli/util.py
@@ -1,11 +1,18 @@
from pathlib import Path

from solo.server import config
from solo.config import app
from solo.config import docker_compose

import yaml


def parse_app_config(path: str) -> config.Config:
with Path(path).open('r') as f:
cfg = yaml.load(f.read())
return config.MakeConfig(cfg)
def parse_app_config(path: Path) -> app.Config:
with path.open('r') as f:
cfg = yaml.load(f.read(), Loader=yaml.FullLoader)
return app.mk_config(cfg)


def parse_compose_config(path: Path) -> docker_compose.Config:
with path.open('r') as f:
cfg = yaml.load(f.read(), Loader=yaml.FullLoader)
return docker_compose.mk_config(cfg)
Empty file added solo/config/__init__.py
Empty file.
19 changes: 13 additions & 6 deletions solo/server/config.py → solo/config/app.py
Expand Up @@ -25,9 +25,9 @@ class Redis(NamedTuple):


class Postgresql(NamedTuple):
user: str
dbname: str
password: str
user: str = 'solo'
dbname: str = 'solo'
password: str = 'solo'
host: str = '127.0.0.1'
port: int = 5432
min_connections: int = 1
Expand All @@ -48,14 +48,21 @@ class Server(NamedTuple):
event_loop: EventLoopType = EventLoopType.ASYNCIO


class Testing(NamedTuple):
docker_pull: bool = True
""" Pull images from registry if they are not available locally yet
"""


class Config(NamedTuple):
server: Server
postgresql: Postgresql
redis: Redis
session: Session
apps: Sequence[AppConfig] = []
logging: Dict = {'version': 1}
debug: bool = True
postgresql: Postgresql = Postgresql()
redis: Redis = Redis()
testing: Testing = Testing()


MakeConfig, serializer = type_constructor(Config)
mk_config, dict_config = type_constructor(Config)

0 comments on commit ad5760e

Please sign in to comment.