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

Added: pep257 docstrings for "tests/conftests.py" #1272

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 14 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-

"""
conftest
--------
conftest.

--------
Contains pytest fixtures which are globally available throughout the suite.
"""

Expand All @@ -23,6 +23,7 @@


def backup_dir(original_dir, backup_dir):
"""Method to generate backup directory based on original directory."""
# If the default original_dir is pre-existing, move it to a temp location
if not os.path.isdir(original_dir):
return False
Expand All @@ -36,6 +37,7 @@ def backup_dir(original_dir, backup_dir):


def restore_backup_dir(original_dir, backup_dir, original_dir_found):
"""Method restores default contents."""
# Carefully delete the created original_dir only in certain
# conditions.
original_dir_is_dir = os.path.isdir(original_dir)
Expand Down Expand Up @@ -92,7 +94,6 @@ def clean_system(request):
`~/.cookiecutter_replay.backup/`

"""

# If ~/.cookiecutterrc is pre-existing, move it to a temp location
user_config_path = os.path.expanduser('~/.cookiecutterrc')
user_config_path_backup = os.path.expanduser(
Expand Down Expand Up @@ -151,14 +152,16 @@ def restore_backup():

@pytest.fixture(scope='session')
def user_dir(tmpdir_factory):
"""Fixture that simulates the user's home directory"""
"""Fixture that simulates the user's home directory."""
return tmpdir_factory.mktemp('user_dir')


@pytest.fixture(scope='session')
def user_config_data(user_dir):
"""Fixture that creates 2 Cookiecutter user config dirs in the user's home
directory:
"""Fixture that creates 2 Cookiecutter user config dirs.

It will create it in the user's home directory.

* `cookiecutters_dir`
* `cookiecutter_replay`

Expand All @@ -175,8 +178,10 @@ def user_config_data(user_dir):

@pytest.fixture(scope='session')
def user_config_file(user_dir, user_config_data):
"""Fixture that creates a config file called `config` in the user's home
directory, with YAML from `user_config_data`.
"""Fixture that creates a config file called `config`.

It will create it in the user's home directory, with YAML from
`user_config_data`.

:param user_dir: Simulated user's home directory
:param user_config_data: Dict of config values
Expand All @@ -191,4 +196,5 @@ def user_config_file(user_dir, user_config_data):

@pytest.fixture(autouse=True)
def disable_poyo_logging():
"""Fixture that disables poyo logging."""
logging.getLogger('poyo').setLevel(logging.WARNING)