Completed
Pull Request — develop (#148)
by Jace
09:15
created

it_should_create_links()   A

Complexity

Conditions 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
c 2
b 0
f 0
dl 0
loc 5
rs 9.4285
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
204
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...
205
206
    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...
207
        gitman.install('gitman_1', depth=1)
208
        expect(os.path.isdir(config.location)) == True
209
210
        expect(gitman.uninstall()) == True
211
212
        expect(os.path.exists(config.location)) == False
213
214
    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...
215
        expect(os.path.isdir(config.location)) == False
216
217
        expect(gitman.uninstall()) == True
218
219
    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...
220
        gitman.install('gitman_1', depth=1)
221
        gitman.list()
222
        expect(os.path.exists(config.log_path)) == True
223
224
        gitman.uninstall()
225
        expect(os.path.exists(config.log_path)) == False
226
227
228
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...
229
230
    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...
231
        gitman.update('gitman_1', depth=1)
232
233
        expect(config.__mapper__.text) == CONFIG
234
235
    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...
236
        config.__mapper__.text = strip("""
237
        location: deps
238
        sources:
239
        - name: gitman_1
240
          repo: https://github.com/jacebrowning/gitman-demo
241
          rev: example-branch
242
          link: ''
243
          scripts: []
244
        - name: gitman_2
245
          repo: https://github.com/jacebrowning/gitman-demo
246
          rev: example-tag
247
          link: ''
248
          scripts: []
249
        sources_locked:
250
        - name: gitman_2
251
          repo: https://github.com/jacebrowning/gitman-demo
252
          rev: (old revision)
253
          link: ''
254
          scripts: []
255
        """)
256
257
        gitman.update(depth=1)
258
259
        expect(config.__mapper__.text) == strip("""
260
        location: deps
261
        sources:
262
        - name: gitman_1
263
          repo: https://github.com/jacebrowning/gitman-demo
264
          rev: example-branch
265
          link: ''
266
          scripts: []
267
        - name: gitman_2
268
          repo: https://github.com/jacebrowning/gitman-demo
269
          rev: example-tag
270
          link: ''
271
          scripts: []
272
        sources_locked:
273
        - name: gitman_2
274
          repo: https://github.com/jacebrowning/gitman-demo
275
          rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04
276
          link: ''
277
          scripts: []
278
        """)
279
280
    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...
281
        config.__mapper__.text = strip("""
282
        location: deps
283
        sources:
284
        - name: gitman_1
285
          repo: https://github.com/jacebrowning/gitman-demo
286
          rev: example-branch
287
          link: ''
288
          scripts: []
289
        - name: gitman_2
290
          repo: https://github.com/jacebrowning/gitman-demo
291
          rev: example-tag
292
          link: ''
293
          scripts: []
294
        sources_locked:
295
        - name: gitman_2
296
          repo: https://github.com/jacebrowning/gitman-demo
297
          rev: (old revision)
298
          link: ''
299
          scripts: []
300
        """)
301
302
        gitman.update(depth=1, lock=False)
303
304
        expect(config.__mapper__.text) == strip("""
305
        location: deps
306
        sources:
307
        - name: gitman_1
308
          repo: https://github.com/jacebrowning/gitman-demo
309
          rev: example-branch
310
          link: ''
311
          scripts: []
312
        - name: gitman_2
313
          repo: https://github.com/jacebrowning/gitman-demo
314
          rev: example-tag
315
          link: ''
316
          scripts: []
317
        sources_locked:
318
        - name: gitman_2
319
          repo: https://github.com/jacebrowning/gitman-demo
320
          rev: (old revision)
321
          link: ''
322
          scripts: []
323
        """)
324
325
    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...
326
        gitman.update(depth=1, lock=True)
327
328
        expect(config.__mapper__.text) == CONFIG + strip("""
329
        sources_locked:
330
        - name: gitman_1
331
          repo: https://github.com/jacebrowning/gitman-demo
332
          rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd
333
          link: ''
334
          scripts: []
335
        - name: gitman_2
336
          repo: https://github.com/jacebrowning/gitman-demo
337
          rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04
338
          link: ''
339
          scripts: []
340
        - name: gitman_3
341
          repo: https://github.com/jacebrowning/gitman-demo
342
          rev: 9bf18e16b956041f0267c21baad555a23237b52e
343
          link: ''
344
          scripts: []
345
        """)
346
347
348
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...
349
350
    @freeze_time("2012-01-14 12:00:01")
351
    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...
352
        gitman.install()
353
        gitman.list()
354
355
        with open(config.log_path) as stream:
356
            contents = stream.read().replace(TMP, "tmp").replace('\\', '/')
357
        expect(contents) == strip("""
358
        2012-01-14 12:00:01
359
        tmp/deps/gitman_1: https://github.com/jacebrowning/gitman-demo @ 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd
360
        tmp/deps/gitman_1/gitman_sources/gdm_3: https://github.com/jacebrowning/gdm-demo @ 050290bca3f14e13fd616604202b579853e7bfb0
361
        tmp/deps/gitman_1/gitman_sources/gdm_3/gitman_sources/gdm_3: https://github.com/jacebrowning/gdm-demo @ fb693447579235391a45ca170959b5583c5042d8
362
        tmp/deps/gitman_1/gitman_sources/gdm_3/gitman_sources/gdm_4: https://github.com/jacebrowning/gdm-demo @ 63ddfd82d308ddae72d31b61cb8942c898fa05b5
363
        tmp/deps/gitman_1/gitman_sources/gdm_4: https://github.com/jacebrowning/gdm-demo @ 63ddfd82d308ddae72d31b61cb8942c898fa05b5
364
        tmp/deps/gitman_2: https://github.com/jacebrowning/gitman-demo @ 7bd138fe7359561a8c2ff9d195dff238794ccc04
365
        tmp/deps/gitman_3: https://github.com/jacebrowning/gitman-demo @ 9bf18e16b956041f0267c21baad555a23237b52e
366
        """, end='\n\n')
367
368
369
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...
370
371
    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...
372
        expect(gitman.update(depth=1, lock=False)) == True
373
        expect(gitman.lock()) == True
374
375
        expect(config.__mapper__.text) == CONFIG + strip("""
376
        sources_locked:
377
        - name: gitman_1
378
          repo: https://github.com/jacebrowning/gitman-demo
379
          rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd
380
          link: ''
381
          scripts: []
382
        - name: gitman_2
383
          repo: https://github.com/jacebrowning/gitman-demo
384
          rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04
385
          link: ''
386
          scripts: []
387
        - name: gitman_3
388
          repo: https://github.com/jacebrowning/gitman-demo
389
          rev: 9bf18e16b956041f0267c21baad555a23237b52e
390
          link: ''
391
          scripts: []
392
        """) == config.__mapper__.text
393
394
    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...
395
        expect(gitman.update(depth=1, lock=False)) == True
396
        expect(gitman.lock('gitman_1', 'gitman_3')) == True
397
398
        expect(config.__mapper__.text) == CONFIG + strip("""
399
        sources_locked:
400
        - name: gitman_1
401
          repo: https://github.com/jacebrowning/gitman-demo
402
          rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd
403
          link: ''
404
          scripts: []
405
        - name: gitman_3
406
          repo: https://github.com/jacebrowning/gitman-demo
407
          rev: 9bf18e16b956041f0267c21baad555a23237b52e
408
          link: ''
409
          scripts: []
410
        """) == config.__mapper__.text
411
412
    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...
413
        expect(gitman.update(depth=1, lock=False)) == True
414
        shell.rm(os.path.join("deps", "gitman_1", ".project"))
415
416
        try:
417
            with pytest.raises(UncommittedChanges):
418
                gitman.lock()
419
420
            expect(config.__mapper__.text).does_not_contain("<dirty>")
421
422
        finally:
423
            shell.rm(os.path.join("deps", "gitman_1"))
424
425
    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...
426
        shell.mkdir("deps")
427
        shell.rm(os.path.join("deps", "gitman_1"))
428
429
        with pytest.raises(InvalidRepository):
430
            gitman.lock()
431
432
        expect(config.__mapper__.text).does_not_contain("<unknown>")
433
434
    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...
435
        shell.mkdir("deps")
436
        shell.rm(os.path.join("deps", "gitman_1", ".git"))
437
        shell.mkdir(os.path.join("deps", "gitman_1", ".git"))
438
439
        try:
440
            with pytest.raises(InvalidRepository):
441
                gitman.lock()
442
443
            expect(config.__mapper__.text).does_not_contain("<unknown>")
444
445
        finally:
446
            shell.rm(os.path.join("deps", "gitman_1"))
447