Completed
Push — develop ( 3dabc3...f1379d )
by Jace
03:04 queued 17s
created

describe_lock()   F

Complexity

Conditions 9

Size

Total Lines 78

Duplication

Lines 0
Ratio 0 %

Importance

Changes 12
Bugs 0 Features 0
Metric Value
cc 9
dl 0
loc 78
rs 3.8611
c 12
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A it_should_fail_on_missing_repositories() 0 8 2
A it_should_fail_on_invalid_repositories() 0 13 2
A it_records_all_versions_when_no_arguments() 0 5 1
A it_records_specified_dependencies() 0 5 1
A it_should_fail_on_dirty_repositories() 0 12 2

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
# pylint: disable=redefined-outer-name,unused-argument,unused-variable,singleton-comparison,expression-not-assigned
0 ignored issues
show
introduced by
Bad option value 'singleton-comparison'
Loading history...
introduced by
Locally disabling redefined-outer-name (W0621)
Loading history...
introduced by
Locally disabling unused-argument (W0613)
Loading history...
introduced by
Locally disabling unused-variable (W0612)
Loading history...
introduced by
Locally disabling expression-not-assigned (W0106)
Loading history...
Coding Style introduced by
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 os
4
import shutil
5
from contextlib import suppress
6
import logging
7
8
import pytest
9
from expecter import expect
0 ignored issues
show
Configuration introduced by
The import expecter could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
10
from freezegun import freeze_time
0 ignored issues
show
Configuration introduced by
The import freezegun could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
11
12
import gitman
13
from gitman import shell
14
from gitman.models import Config
15
from gitman.exceptions import UncommittedChanges, InvalidRepository
16
17
from .utilities import strip
18
19
20
ROOT = os.path.join(os.path.dirname(os.path.dirname(__file__)))
21
TMP = os.path.join(ROOT, 'tmp')
22
23
CONFIG = """
24
location: deps
25
sources:
26
- name: gitman_1
27
  repo: https://github.com/jacebrowning/gitman-demo
28
  rev: example-branch
29
  link: ''
30
  scripts: []
31
- name: gitman_2
32
  repo: https://github.com/jacebrowning/gitman-demo
33
  rev: example-tag
34
  link: ''
35
  scripts: []
36
- name: gitman_3
37
  repo: https://github.com/jacebrowning/gitman-demo
38
  rev: 9bf18e16b956041f0267c21baad555a23237b52e
39
  link: ''
40
  scripts: []
41
""".lstrip()
42
43
log = logging.getLogger(__name__)
0 ignored issues
show
Coding Style Naming introduced by
The name log does not conform to the constant naming conventions ((([A-Z_][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...
44
45
46
@pytest.yield_fixture
47
def config():
0 ignored issues
show
Coding Style introduced by
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...
48
    log.info("Temporary directory: %s", TMP)
49
50
    with suppress(FileNotFoundError, PermissionError):
51
        shutil.rmtree(TMP)
52
    with suppress(FileExistsError):
53
        os.makedirs(TMP)
54
    os.chdir(TMP)
55
56
    os.system("touch .git")
57
    config = Config(root=TMP)
58
    config.__mapper__.text = CONFIG
0 ignored issues
show
Bug introduced by
The Instance of Config does not seem to have a member named __mapper__.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
59
60
    log.debug("File listing: %s", os.listdir(TMP))
61
62
    yield config
63
64
    os.chdir(ROOT)
65
66
67
def describe_init():
0 ignored issues
show
Coding Style introduced by
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...
68
69
    def it_creates_a_new_config_file(tmpdir):
0 ignored issues
show
Coding Style introduced by
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...
70
        tmpdir.chdir()
71
72
        expect(gitman.init()) == True
73
74
        expect(Config().__mapper__.text) == strip("""
0 ignored issues
show
Bug introduced by
The Instance of Config does not seem to have a member named __mapper__.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
75
        location: gitman_sources
76
        sources:
77
        - name: sample_dependency
78
          repo: https://github.com/githubtraining/hellogitworld
79
          rev: master
80
          link: ''
81
          scripts: []
82
        sources_locked:
83
        - name: sample_dependency
84
          repo: https://github.com/githubtraining/hellogitworld
85
          rev: ebbbf773431ba07510251bb03f9525c7bab2b13a
86
          link: ''
87
          scripts: []
88
        """)
89
90
    def it_does_not_modify_existing_config_file(config):
0 ignored issues
show
Coding Style Naming introduced by
The name it_does_not_modify_existing_config_file does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

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...
Coding Style introduced by
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...
91
        expect(gitman.init()) == False
92
93
        expect(config.__mapper__.text) == CONFIG
94
95
96
def describe_install():
0 ignored issues
show
Coding Style introduced by
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...
97
98
    def it_creates_missing_directories(config):
0 ignored issues
show
Coding Style introduced by
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...
99
        shell.rm(config.location)
100
101
        expect(gitman.install('gitman_1', depth=1)) == True
102
103
        expect(os.listdir(config.location)) == ['gitman_1']
104
105
    def it_should_not_modify_config(config):
0 ignored issues
show
Coding Style introduced by
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...
106
        expect(gitman.install('gitman_1', depth=1)) == True
107
108
        expect(config.__mapper__.text) == CONFIG
109
110
    def it_merges_sources(config):
0 ignored issues
show
Coding Style introduced by
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...
111
        config.__mapper__.text = strip("""
112
        location: deps
113
        sources:
114
        - name: gitman_1
115
          repo: https://github.com/jacebrowning/gitman-demo
116
          rev: example-branch
117
          link: ''
118
          scripts: []
119
        sources_locked:
120
        - name: gitman_2
121
          repo: https://github.com/jacebrowning/gitman-demo
122
          rev: example-branch
123
          link: ''
124
          scripts: []
125
        - name: gitman_3
126
          repo: https://github.com/jacebrowning/gitman-demo
127
          rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04
128
          link: ''
129
          scripts: []
130
        """)
131
132
        expect(gitman.install(depth=1)) == True
133
134
        expect(len(os.listdir(config.location))) == 3
135
136
    def it_can_handle_missing_locked_sources(config):
0 ignored issues
show
Coding Style Naming introduced by
The name it_can_handle_missing_locked_sources does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

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...
Coding Style introduced by
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...
137
        config.__mapper__.text = strip("""
138
        location: deps
139
        sources:
140
        - name: gitman_1
141
          repo: https://github.com/jacebrowning/gitman-demo
142
          rev: example-branch
143
          link: ''
144
          scripts: []
145
        sources_locked:
146
        - name: gitman_2
147
          repo: https://github.com/jacebrowning/gitman-demo
148
          rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04
149
          link: ''
150
          scripts: []
151
        """)
152
153
        expect(gitman.install('gitman_1', depth=1)) == True
154
155
        expect(os.listdir(config.location)) == ['gitman_1']
156
157
    def it_detects_invalid_repositories(config):
0 ignored issues
show
Coding Style introduced by
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...
158
        shell.rm(os.path.join("deps", "gitman_1", ".git"))
159
        shell.mkdir(os.path.join("deps", "gitman_1", ".git"))
160
161
        try:
162
            with pytest.raises(InvalidRepository):
163
                expect(gitman.install('gitman_1', depth=1)) == False
164
165
        finally:
166
            shell.rm(os.path.join("deps", "gitman_1"))
167
168
    def describe_links():
0 ignored issues
show
Coding Style introduced by
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...
169
170
        @pytest.fixture
171
        def config_with_link(config):
0 ignored issues
show
Coding Style introduced by
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...
172
            config.__mapper__.text = strip("""
173
            location: deps
174
            sources:
175
            - name: gitman_1
176
              repo: https://github.com/jacebrowning/gitman-demo
177
              rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04
178
              link: my_link
179
              scripts: []
180
            """)
181
182
            return config
183
184
        @pytest.mark.xfail(os.name == 'nt', reason="No symlinks on Windows")
185
        def it_should_create_links(config_with_link):
0 ignored issues
show
Coding Style introduced by
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...
186
            expect(gitman.install(depth=1)) == True
187
188
            expect(os.listdir()).contains('my_link')
189
190
        @pytest.mark.xfail(os.name == 'nt', reason="No symlinks on Windows")
191
        def it_should_not_overwrite_files(config_with_link):
0 ignored issues
show
Coding Style introduced by
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...
192
            os.system("touch my_link")
193
194
            with pytest.raises(RuntimeError):
195
                gitman.install(depth=1)
196
197
        @pytest.mark.xfail(os.name == 'nt', reason="No symlinks on Windows")
198
        def it_overwrites_files_with_force(config_with_link):
0 ignored issues
show
Coding Style introduced by
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...
199
            os.system("touch my_link")
200
201
            expect(gitman.install(depth=1, force=True)) == True
202
203
    def describe_scripts():
0 ignored issues
show
Coding Style introduced by
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...
204
205
        @pytest.fixture
206
        def config_with_scripts(config):
0 ignored issues
show
Coding Style introduced by
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...
207
            config.__mapper__.text = strip("""
208
            location: deps
209
            sources:
210
            - name: gitman_1
211
              repo: https://github.com/jacebrowning/gitman-demo
212
              rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04
213
              link: ''
214
              scripts:
215
              - make foobar
216
            """)
217
218
            return config
219
220
        def it_detects_failures_in_scripts(config_with_scripts):
0 ignored issues
show
Coding Style introduced by
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...
221
            with pytest.raises(RuntimeError):
222
                expect(gitman.install())
223
224
        def script_failures_can_be_ignored(config_with_scripts):
0 ignored issues
show
Coding Style introduced by
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...
225
            expect(gitman.install(force=True)) == True
226
227
228
def describe_uninstall():
0 ignored issues
show
Coding Style introduced by
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...
229
230
    def it_deletes_dependencies_when_they_exist(config):
0 ignored issues
show
Coding Style Naming introduced by
The name it_deletes_dependencies_when_they_exist does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

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...
Coding Style introduced by
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...
231
        gitman.install('gitman_1', depth=1)
232
        expect(os.path.isdir(config.location)) == True
233
234
        expect(gitman.uninstall()) == True
235
236
        expect(os.path.exists(config.location)) == False
237
238
    def it_should_not_fail_when_no_dependnecies_exist(config):
0 ignored issues
show
Coding Style Naming introduced by
The name it_should_not_fail_when_no_dependnecies_exist does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

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...
Coding Style introduced by
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...
239
        expect(os.path.isdir(config.location)) == False
240
241
        expect(gitman.uninstall()) == True
242
243
    def it_deletes_the_log_file(config):
0 ignored issues
show
Coding Style introduced by
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...
244
        gitman.install('gitman_1', depth=1)
245
        gitman.list()
246
        expect(os.path.exists(config.log_path)) == True
247
248
        gitman.uninstall()
249
        expect(os.path.exists(config.log_path)) == False
250
251
252
def describe_update():
0 ignored issues
show
Coding Style introduced by
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...
253
254
    def it_should_not_modify_config(config):
0 ignored issues
show
Coding Style introduced by
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...
255
        gitman.update('gitman_1', depth=1)
256
257
        expect(config.__mapper__.text) == CONFIG
258
259
    def it_locks_previously_locked_dependnecies(config):
0 ignored issues
show
Coding Style Naming introduced by
The name it_locks_previously_locked_dependnecies does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

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...
Coding Style introduced by
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...
260
        config.__mapper__.text = strip("""
261
        location: deps
262
        sources:
263
        - name: gitman_1
264
          repo: https://github.com/jacebrowning/gitman-demo
265
          rev: example-branch
266
          link: ''
267
          scripts: []
268
        - name: gitman_2
269
          repo: https://github.com/jacebrowning/gitman-demo
270
          rev: example-tag
271
          link: ''
272
          scripts: []
273
        sources_locked:
274
        - name: gitman_2
275
          repo: https://github.com/jacebrowning/gitman-demo
276
          rev: (old revision)
277
          link: ''
278
          scripts: []
279
        """)
280
281
        gitman.update(depth=1)
282
283
        expect(config.__mapper__.text) == strip("""
284
        location: deps
285
        sources:
286
        - name: gitman_1
287
          repo: https://github.com/jacebrowning/gitman-demo
288
          rev: example-branch
289
          link: ''
290
          scripts: []
291
        - name: gitman_2
292
          repo: https://github.com/jacebrowning/gitman-demo
293
          rev: example-tag
294
          link: ''
295
          scripts: []
296
        sources_locked:
297
        - name: gitman_2
298
          repo: https://github.com/jacebrowning/gitman-demo
299
          rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04
300
          link: ''
301
          scripts: []
302
        """)
303
304
    def it_should_not_lock_dependnecies_when_disabled(config):
0 ignored issues
show
Coding Style Naming introduced by
The name it_should_not_lock_dependnecies_when_disabled does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

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...
Coding Style introduced by
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...
305
        config.__mapper__.text = strip("""
306
        location: deps
307
        sources:
308
        - name: gitman_1
309
          repo: https://github.com/jacebrowning/gitman-demo
310
          rev: example-branch
311
          link: ''
312
          scripts: []
313
        - name: gitman_2
314
          repo: https://github.com/jacebrowning/gitman-demo
315
          rev: example-tag
316
          link: ''
317
          scripts: []
318
        sources_locked:
319
        - name: gitman_2
320
          repo: https://github.com/jacebrowning/gitman-demo
321
          rev: (old revision)
322
          link: ''
323
          scripts: []
324
        """)
325
326
        gitman.update(depth=1, lock=False)
327
328
        expect(config.__mapper__.text) == strip("""
329
        location: deps
330
        sources:
331
        - name: gitman_1
332
          repo: https://github.com/jacebrowning/gitman-demo
333
          rev: example-branch
334
          link: ''
335
          scripts: []
336
        - name: gitman_2
337
          repo: https://github.com/jacebrowning/gitman-demo
338
          rev: example-tag
339
          link: ''
340
          scripts: []
341
        sources_locked:
342
        - name: gitman_2
343
          repo: https://github.com/jacebrowning/gitman-demo
344
          rev: (old revision)
345
          link: ''
346
          scripts: []
347
        """)
348
349
    def it_should_lock_all_dependencies_when_enabled(config):
0 ignored issues
show
Coding Style Naming introduced by
The name it_should_lock_all_dependencies_when_enabled does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

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...
Coding Style introduced by
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...
350
        gitman.update(depth=1, lock=True)
351
352
        expect(config.__mapper__.text) == CONFIG + strip("""
353
        sources_locked:
354
        - name: gitman_1
355
          repo: https://github.com/jacebrowning/gitman-demo
356
          rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd
357
          link: ''
358
          scripts: []
359
        - name: gitman_2
360
          repo: https://github.com/jacebrowning/gitman-demo
361
          rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04
362
          link: ''
363
          scripts: []
364
        - name: gitman_3
365
          repo: https://github.com/jacebrowning/gitman-demo
366
          rev: 9bf18e16b956041f0267c21baad555a23237b52e
367
          link: ''
368
          scripts: []
369
        """)
370
371
372
def describe_list():
0 ignored issues
show
Coding Style introduced by
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...
373
374
    @freeze_time("2012-01-14 12:00:01")
375
    def it_updates_the_log(config):
0 ignored issues
show
Coding Style introduced by
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...
376
        gitman.install()
377
        gitman.list()
378
379
        with open(config.log_path) as stream:
380
            contents = stream.read().replace(TMP, "tmp").replace('\\', '/')
381
        expect(contents) == strip("""
382
        2012-01-14 12:00:01
383
        tmp/deps/gitman_1: https://github.com/jacebrowning/gitman-demo @ 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd
384
        tmp/deps/gitman_1/gitman_sources/gdm_3: https://github.com/jacebrowning/gdm-demo @ 050290bca3f14e13fd616604202b579853e7bfb0
385
        tmp/deps/gitman_1/gitman_sources/gdm_3/gitman_sources/gdm_3: https://github.com/jacebrowning/gdm-demo @ fb693447579235391a45ca170959b5583c5042d8
386
        tmp/deps/gitman_1/gitman_sources/gdm_3/gitman_sources/gdm_4: https://github.com/jacebrowning/gdm-demo @ 63ddfd82d308ddae72d31b61cb8942c898fa05b5
387
        tmp/deps/gitman_1/gitman_sources/gdm_4: https://github.com/jacebrowning/gdm-demo @ 63ddfd82d308ddae72d31b61cb8942c898fa05b5
388
        tmp/deps/gitman_2: https://github.com/jacebrowning/gitman-demo @ 7bd138fe7359561a8c2ff9d195dff238794ccc04
389
        tmp/deps/gitman_3: https://github.com/jacebrowning/gitman-demo @ 9bf18e16b956041f0267c21baad555a23237b52e
390
        """, end='\n\n')
391
392
393
def describe_lock():
0 ignored issues
show
Coding Style introduced by
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...
394
395
    def it_records_all_versions_when_no_arguments(config):
0 ignored issues
show
Coding Style Naming introduced by
The name it_records_all_versions_when_no_arguments does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

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...
Coding Style introduced by
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...
396
        expect(gitman.update(depth=1, lock=False)) == True
397
        expect(gitman.lock()) == True
398
399
        expect(config.__mapper__.text) == CONFIG + strip("""
400
        sources_locked:
401
        - name: gitman_1
402
          repo: https://github.com/jacebrowning/gitman-demo
403
          rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd
404
          link: ''
405
          scripts: []
406
        - name: gitman_2
407
          repo: https://github.com/jacebrowning/gitman-demo
408
          rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04
409
          link: ''
410
          scripts: []
411
        - name: gitman_3
412
          repo: https://github.com/jacebrowning/gitman-demo
413
          rev: 9bf18e16b956041f0267c21baad555a23237b52e
414
          link: ''
415
          scripts: []
416
        """) == config.__mapper__.text
417
418
    def it_records_specified_dependencies(config):
0 ignored issues
show
Coding Style Naming introduced by
The name it_records_specified_dependencies does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

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...
Coding Style introduced by
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...
419
        expect(gitman.update(depth=1, lock=False)) == True
420
        expect(gitman.lock('gitman_1', 'gitman_3')) == True
421
422
        expect(config.__mapper__.text) == CONFIG + strip("""
423
        sources_locked:
424
        - name: gitman_1
425
          repo: https://github.com/jacebrowning/gitman-demo
426
          rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd
427
          link: ''
428
          scripts: []
429
        - name: gitman_3
430
          repo: https://github.com/jacebrowning/gitman-demo
431
          rev: 9bf18e16b956041f0267c21baad555a23237b52e
432
          link: ''
433
          scripts: []
434
        """) == config.__mapper__.text
435
436
    def it_should_fail_on_dirty_repositories(config):
0 ignored issues
show
Coding Style Naming introduced by
The name it_should_fail_on_dirty_repositories does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

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...
Coding Style introduced by
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...
437
        expect(gitman.update(depth=1, lock=False)) == True
438
        shell.rm(os.path.join("deps", "gitman_1", ".project"))
439
440
        try:
441
            with pytest.raises(UncommittedChanges):
442
                gitman.lock()
443
444
            expect(config.__mapper__.text).does_not_contain("<dirty>")
445
446
        finally:
447
            shell.rm(os.path.join("deps", "gitman_1"))
448
449
    def it_should_fail_on_missing_repositories(config):
0 ignored issues
show
Coding Style Naming introduced by
The name it_should_fail_on_missing_repositories does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

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...
Coding Style introduced by
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...
450
        shell.mkdir("deps")
451
        shell.rm(os.path.join("deps", "gitman_1"))
452
453
        with pytest.raises(InvalidRepository):
454
            gitman.lock()
455
456
        expect(config.__mapper__.text).does_not_contain("<unknown>")
457
458
    def it_should_fail_on_invalid_repositories(config):
0 ignored issues
show
Coding Style Naming introduced by
The name it_should_fail_on_invalid_repositories does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

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...
Coding Style introduced by
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...
459
        shell.mkdir("deps")
460
        shell.rm(os.path.join("deps", "gitman_1", ".git"))
461
        shell.mkdir(os.path.join("deps", "gitman_1", ".git"))
462
463
        try:
464
            with pytest.raises(InvalidRepository):
465
                gitman.lock()
466
467
            expect(config.__mapper__.text).does_not_contain("<unknown>")
468
469
        finally:
470
            shell.rm(os.path.join("deps", "gitman_1"))
471