Skip to content

Linting fixes for rtd_test module. #2889

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

Merged
merged 1 commit into from
May 23, 2017
Merged
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
1 change: 0 additions & 1 deletion prospector-more.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ ignore-paths:
- projects/
- redirects/
- restapi/
- rtd_tests/
- search/

pylint:
Expand Down
3 changes: 2 additions & 1 deletion readthedocs/rtd_tests/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Base classes and mixins for unit tests."""
import os
import shutil
import logging
Expand All @@ -18,7 +19,7 @@ def setUp(self):
self.original_DOCROOT = settings.DOCROOT
self.cwd = os.path.dirname(__file__)
self.build_dir = os.path.join(self.cwd, 'builds')
log.info("build dir: %s" % self.build_dir)
log.info("build dir: %s", self.build_dir)
if not os.path.exists(self.build_dir):
os.makedirs(self.build_dir)
settings.DOCROOT = self.build_dir
Expand Down
3 changes: 1 addition & 2 deletions readthedocs/rtd_tests/mocks/environment.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# pylint: disable=missing-docstring
import mock

from readthedocs.doc_builder.environments import BuildEnvironment


class EnvironmentMockGroup(object):

Expand Down
9 changes: 6 additions & 3 deletions readthedocs/rtd_tests/mocks/mock_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Mock versions of many API-related classes."""
from contextlib import contextmanager
import json
import mock
Expand All @@ -14,6 +15,7 @@ def put(self, x=None):


def mock_version(repo):
"""Construct and return a class implementing the Version interface."""
class MockVersion(object):
def __init__(self, x=None):
pass
Expand All @@ -22,6 +24,7 @@ def put(self, x=None):
return x

def get(self, **kwargs):
"""Returns mock data to emulate real Version objects."""
# SCIENTIST DOG
version = json.loads("""
{
Expand Down Expand Up @@ -76,13 +79,13 @@ class MockApi(object):
def __init__(self, repo):
self.version = mock_version(repo)

def project(self, x):
def project(self, _):
return ProjectData()

def build(self, x):
def build(self, _):
return mock.Mock(**{'get.return_value': {'id': 123, 'state': 'triggered'}})

def command(self, x):
def command(self, _):
return mock.Mock(**{'get.return_value': {}})


Expand Down
1 change: 1 addition & 0 deletions readthedocs/rtd_tests/mocks/paths.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Context managers to patch os.path.exists calls."""
import os
import re
import mock
Expand Down
1 change: 1 addition & 0 deletions readthedocs/rtd_tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Utility functions for use in tests."""
import logging
from os import chdir, environ, getcwd
from os.path import abspath, join as pjoin
Expand Down