File tree 6 files changed +11
-7
lines changed
6 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ ignore-paths:
13
13
- projects/
14
14
- redirects/
15
15
- restapi/
16
- - rtd_tests/
17
16
- search/
18
17
19
18
pylint :
Original file line number Diff line number Diff line change
1
+ """Base classes and mixins for unit tests."""
1
2
import os
2
3
import shutil
3
4
import logging
@@ -18,7 +19,7 @@ def setUp(self):
18
19
self .original_DOCROOT = settings .DOCROOT
19
20
self .cwd = os .path .dirname (__file__ )
20
21
self .build_dir = os .path .join (self .cwd , 'builds' )
21
- log .info ("build dir: %s" % self .build_dir )
22
+ log .info ("build dir: %s" , self .build_dir )
22
23
if not os .path .exists (self .build_dir ):
23
24
os .makedirs (self .build_dir )
24
25
settings .DOCROOT = self .build_dir
Original file line number Diff line number Diff line change
1
+ # pylint: disable=missing-docstring
1
2
import mock
2
3
3
- from readthedocs .doc_builder .environments import BuildEnvironment
4
-
5
4
6
5
class EnvironmentMockGroup (object ):
7
6
Original file line number Diff line number Diff line change
1
+ """Mock versions of many API-related classes."""
1
2
from contextlib import contextmanager
2
3
import json
3
4
import mock
@@ -14,6 +15,7 @@ def put(self, x=None):
14
15
15
16
16
17
def mock_version (repo ):
18
+ """Construct and return a class implementing the Version interface."""
17
19
class MockVersion (object ):
18
20
def __init__ (self , x = None ):
19
21
pass
@@ -22,6 +24,7 @@ def put(self, x=None):
22
24
return x
23
25
24
26
def get (self , ** kwargs ):
27
+ """Returns mock data to emulate real Version objects."""
25
28
# SCIENTIST DOG
26
29
version = json .loads ("""
27
30
{
@@ -76,13 +79,13 @@ class MockApi(object):
76
79
def __init__ (self , repo ):
77
80
self .version = mock_version (repo )
78
81
79
- def project (self , x ):
82
+ def project (self , _ ):
80
83
return ProjectData ()
81
84
82
- def build (self , x ):
85
+ def build (self , _ ):
83
86
return mock .Mock (** {'get.return_value' : {'id' : 123 , 'state' : 'triggered' }})
84
87
85
- def command (self , x ):
88
+ def command (self , _ ):
86
89
return mock .Mock (** {'get.return_value' : {}})
87
90
88
91
Original file line number Diff line number Diff line change
1
+ """Context managers to patch os.path.exists calls."""
1
2
import os
2
3
import re
3
4
import mock
Original file line number Diff line number Diff line change
1
+ """Utility functions for use in tests."""
1
2
import logging
2
3
from os import chdir , environ , getcwd
3
4
from os .path import abspath , join as pjoin
You can’t perform that action at this time.
0 commit comments