mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Merge branch '2504-fix-array-element-serialization' of https://github.com/JacobHayes/pipenv into 2504-fix-array-element-serialization
This commit is contained in:
+8
-1
@@ -64,6 +64,12 @@ def _normalized(p):
|
||||
DEFAULT_NEWLINES = u"\n"
|
||||
|
||||
|
||||
def encode_toml_elements(obj):
|
||||
if hasattr(obj, 'primitive_value'):
|
||||
return obj.primitive_value
|
||||
raise TypeError(repr(obj) + " is not JSON serializable")
|
||||
|
||||
|
||||
def preferred_newlines(f):
|
||||
if isinstance(f.newlines, six.text_type):
|
||||
return f.newlines
|
||||
@@ -631,7 +637,8 @@ class Project(object):
|
||||
"""
|
||||
newlines = self._lockfile_newlines
|
||||
s = simplejson.dumps( # Send Unicode in to guarentee Unicode out.
|
||||
content, indent=4, separators=(u",", u": "), sort_keys=True
|
||||
content, indent=4, separators=(u",", u": "), sort_keys=True,
|
||||
default=encode_toml_elements,
|
||||
)
|
||||
with atomic_open_for_write(self.lockfile_location, newline=newlines) as f:
|
||||
f.write(s)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import pytest
|
||||
import os
|
||||
import six
|
||||
|
||||
from pipenv.utils import temp_environ
|
||||
|
||||
@@ -348,6 +347,27 @@ requests = {git = "https://github.com/requests/requests.git", ref = "master", ed
|
||||
assert c.return_code == 0
|
||||
|
||||
|
||||
@pytest.mark.extras
|
||||
@pytest.mark.lock
|
||||
@pytest.mark.vcs
|
||||
@pytest.mark.needs_internet
|
||||
def test_lock_editable_vcs_with_extras_without_install(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi, chdir=True) as p:
|
||||
with open(p.pipfile_path, 'w') as f:
|
||||
f.write("""
|
||||
[packages]
|
||||
requests = {git = "https://github.com/requests/requests.git", editable = true, extras = ["socks"]}
|
||||
""".strip())
|
||||
c = p.pipenv('lock')
|
||||
assert c.return_code == 0
|
||||
assert 'requests' in p.lockfile['default']
|
||||
assert 'idna' in p.lockfile['default']
|
||||
assert 'chardet' in p.lockfile['default']
|
||||
assert "socks" in p.lockfile["default"]["requests"]["extras"]
|
||||
c = p.pipenv('install')
|
||||
assert c.return_code == 0
|
||||
|
||||
|
||||
@pytest.mark.lock
|
||||
@pytest.mark.skip(reason="This doesn't work for some reason.")
|
||||
def test_lock_respecting_python_version(PipenvInstance, pypi):
|
||||
|
||||
Reference in New Issue
Block a user