Skip to content

Commit 062b010

Browse files
authored
Merge pull request #4782 from stsewd/pipfile-schema
Pipfile support (schema)
2 parents 1648006 + 33b0093 commit 062b010

File tree

2 files changed

+85
-2
lines changed

2 files changed

+85
-2
lines changed

readthedocs/rtd_tests/fixtures/spec/v2/schema.yml

+17-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ python:
5858
system_packages: bool(required=False)
5959

6060
# Installation of packages and requiremens
61-
install: list(any(include('python-install-requirements'), include('python-install')), required=False)
61+
install: list(any(include('python-install-requirements'), include('python-install'), include('python-install-pipfile')), required=False)
6262

6363
python-install-requirements:
6464
# The path to the requirements file from the root of the project
@@ -77,6 +77,22 @@ python-install:
7777
# Default: []
7878
extra_requirements: list(str(), required=False)
7979

80+
python-install-pipfile:
81+
# The path to the directory that contains the Pipfile
82+
pipfile: path()
83+
84+
# Add the --dev option to pipenv install
85+
# Default: false
86+
dev: bool(required=False)
87+
88+
# Add the --ignore-pipfile option to pipenv install
89+
# Default: false
90+
ignore_pipfile: bool(required=False)
91+
92+
# Add the --skip-lock option to pipenv install
93+
# Default: true
94+
skip_lock: bool(required=False)
95+
8096
sphinx:
8197
# The builder type for the sphinx documentation
8298
# Default: 'html'

readthedocs/rtd_tests/tests/test_build_config.py

+68-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def test_python_install_extra_requirements(tmpdir):
319319

320320

321321
@pytest.mark.parametrize('value', ['', 'null', '[]'])
322-
def test_python_extra_requirements_empty(tmpdir, value):
322+
def test_python_install_extra_requirements_empty(tmpdir, value):
323323
content = '''
324324
version: "2"
325325
python:
@@ -330,6 +330,73 @@ def test_python_extra_requirements_empty(tmpdir, value):
330330
assertValidConfig(tmpdir, content.format(value=value))
331331

332332

333+
@pytest.mark.parametrize('pipfile', ['another_docs/', '.', 'project/'])
334+
def test_python_install_pipfile(tmpdir, pipfile):
335+
utils.apply_fs(tmpdir, {
336+
'another_docs': {
337+
'Pipfile': '',
338+
},
339+
'project': {},
340+
'Pipfile': '',
341+
})
342+
content = '''
343+
version: "2"
344+
python:
345+
install:
346+
- pipfile: {}
347+
'''
348+
assertValidConfig(tmpdir, content.format(pipfile))
349+
350+
351+
@pytest.mark.parametrize('pipfile', ['docs/', '.', 'project/'])
352+
def test_python_install_pipfile_invalid(tmpdir, pipfile):
353+
utils.apply_fs(tmpdir, {})
354+
content = '''
355+
version: "2"
356+
python:
357+
install:
358+
- pipfile: {}
359+
'''
360+
content.format(pipfile)
361+
assertInvalidConfig(tmpdir, content, ['is not a path'])
362+
363+
364+
@pytest.mark.parametrize('value', ['true', 'false'])
365+
def test_python_install_pipfile_dev(tmpdir, value):
366+
content = '''
367+
version: "2"
368+
python:
369+
install:
370+
- pipfile: .
371+
dev: {value}
372+
'''
373+
assertValidConfig(tmpdir, content.format(value=value))
374+
375+
376+
@pytest.mark.parametrize('value', ['true', 'false'])
377+
def test_python_install_pipfile_skip_lock(tmpdir, value):
378+
content = '''
379+
version: "2"
380+
python:
381+
install:
382+
- pipfile: .
383+
skip_lock: {value}
384+
'''
385+
assertValidConfig(tmpdir, content.format(value=value))
386+
387+
388+
@pytest.mark.parametrize('value', ['true', 'false'])
389+
def test_python_install_pipfile_ignore_pipfile(tmpdir, value):
390+
content = '''
391+
version: "2"
392+
python:
393+
install:
394+
- pipfile: .
395+
ignore_pipfile: {value}
396+
'''
397+
assertValidConfig(tmpdir, content.format(value=value))
398+
399+
333400
@pytest.mark.parametrize('value', ['true', 'false'])
334401
def test_python_system_packages(tmpdir, value):
335402
content = '''

0 commit comments

Comments
 (0)