Skip to content

Commit

Permalink
Merge pull request #4782 from stsewd/pipfile-schema
Browse files Browse the repository at this point in the history
Pipfile support (schema)
  • Loading branch information
stsewd authored Nov 13, 2018
2 parents 1648006 + 33b0093 commit 062b010
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 2 deletions.
18 changes: 17 additions & 1 deletion readthedocs/rtd_tests/fixtures/spec/v2/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ python:
system_packages: bool(required=False)

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

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

python-install-pipfile:
# The path to the directory that contains the Pipfile
pipfile: path()

# Add the --dev option to pipenv install
# Default: false
dev: bool(required=False)

# Add the --ignore-pipfile option to pipenv install
# Default: false
ignore_pipfile: bool(required=False)

# Add the --skip-lock option to pipenv install
# Default: true
skip_lock: bool(required=False)

sphinx:
# The builder type for the sphinx documentation
# Default: 'html'
Expand Down
69 changes: 68 additions & 1 deletion readthedocs/rtd_tests/tests/test_build_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def test_python_install_extra_requirements(tmpdir):


@pytest.mark.parametrize('value', ['', 'null', '[]'])
def test_python_extra_requirements_empty(tmpdir, value):
def test_python_install_extra_requirements_empty(tmpdir, value):
content = '''
version: "2"
python:
Expand All @@ -330,6 +330,73 @@ def test_python_extra_requirements_empty(tmpdir, value):
assertValidConfig(tmpdir, content.format(value=value))


@pytest.mark.parametrize('pipfile', ['another_docs/', '.', 'project/'])
def test_python_install_pipfile(tmpdir, pipfile):
utils.apply_fs(tmpdir, {
'another_docs': {
'Pipfile': '',
},
'project': {},
'Pipfile': '',
})
content = '''
version: "2"
python:
install:
- pipfile: {}
'''
assertValidConfig(tmpdir, content.format(pipfile))


@pytest.mark.parametrize('pipfile', ['docs/', '.', 'project/'])
def test_python_install_pipfile_invalid(tmpdir, pipfile):
utils.apply_fs(tmpdir, {})
content = '''
version: "2"
python:
install:
- pipfile: {}
'''
content.format(pipfile)
assertInvalidConfig(tmpdir, content, ['is not a path'])


@pytest.mark.parametrize('value', ['true', 'false'])
def test_python_install_pipfile_dev(tmpdir, value):
content = '''
version: "2"
python:
install:
- pipfile: .
dev: {value}
'''
assertValidConfig(tmpdir, content.format(value=value))


@pytest.mark.parametrize('value', ['true', 'false'])
def test_python_install_pipfile_skip_lock(tmpdir, value):
content = '''
version: "2"
python:
install:
- pipfile: .
skip_lock: {value}
'''
assertValidConfig(tmpdir, content.format(value=value))


@pytest.mark.parametrize('value', ['true', 'false'])
def test_python_install_pipfile_ignore_pipfile(tmpdir, value):
content = '''
version: "2"
python:
install:
- pipfile: .
ignore_pipfile: {value}
'''
assertValidConfig(tmpdir, content.format(value=value))


@pytest.mark.parametrize('value', ['true', 'false'])
def test_python_system_packages(tmpdir, value):
content = '''
Expand Down

0 comments on commit 062b010

Please sign in to comment.