Issues (109)

tests/conftest.py (4 issues)

1
from __future__ import print_function
0 ignored issues
show
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2
3
import itertools
4
from datetime import datetime, timedelta
5
6
import faker
7
import pytest
8
from sqlalchemy import create_engine
9
from sqlalchemy.orm import sessionmaker
10
11
from .models import Address, Base, User
12
13
14
def populate(session):
15
    """Create 3 adresses and 50 users."""
16
    users = []
17
    f = faker.Faker(seed=1)
0 ignored issues
show
Coding Style Naming introduced by
The name f does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
18
    addresses = [Address(description=d) for d in ['Street', 'Avenue', 'Road']]
19
    session.add_all(addresses)
20
21
    for i, addr in zip(range(0, 50), itertools.cycle(addresses)):
22
        user = User(
23
            name=f.name(),
24
            address=addr,
25
            birthday=datetime(1970, 1, 2) + timedelta(days=10 * i))
26
        users.append(user)
27
28
    session.add_all(users)
29
    session.commit()
30
31
32
@pytest.fixture(scope="session")
33
def engine():
0 ignored issues
show
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
34
    print("TestCase: Using sqlite database")
35
    return create_engine('sqlite:///', echo=False)
36
37
38
@pytest.fixture(scope="session")
39
def session(engine):
0 ignored issues
show
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
40
    sessionmaker_ = sessionmaker(bind=engine)
41
    session = sessionmaker_()
42
    Base.metadata.create_all(engine)
43
    populate(session)
44
45
    yield session
46
47
    session.close()
48