Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make swift and obj-c patterns Python3 compatible #203

Merged
merged 3 commits into from
Dec 2, 2020

Conversation

changusmc
Copy link
Contributor

@changusmc changusmc commented Dec 2, 2020

Fixes an issue that causes the stone generation to blow up when running in Python3.

SwiftyDropbox/stone/stone/backends/swift_types.py", line 238, in _determine_validator_type
Dec  2 18:05:18.716: [10:05:18]: ▸ pat = pat.encode('unicode_escape').replace("\"", "\\\"") if pat else pat
Dec  2 18:05:18.716: [10:05:18]: ▸ TypeError: a bytes-like object is required, not 'str'

Checklist

General Contributing

  • Have you read the Code of Conduct and signed the CLA? Didn't sign CLA, I'm a Dropbox employee

Is This a Code Change?

  • Non-code related change (markdown/git settings etc)
  • Code Change
  • Example/Test Code Change

Validation

  • Have you ran tox?
  • Do the tests pass?
    They don't pass locally, but they seem to fail on a main checkout as well.
____________________________________ TestGeneratedPythonTypes.test_namespace_comments _____________________________________

self = <test.test_python_types.TestGeneratedPythonTypes testMethod=test_namespace_comments>

    def test_namespace_comments(self):
        # type: () -> None
        ns = ApiNamespace('files')
>       ns.add_doc("Test Doc testing a :type:`Type`.")

test/test_python_types.py:66:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = ApiNamespace('files'), docstring = 'Test Doc testing a :type:`Type`.'

    def add_doc(self, docstring):
        # type: (six.text_type) -> None
        """Adds a docstring for this namespace.

        The input docstring is normalized to have no leading whitespace and
        no trailing whitespace except for a newline at the end.

        If a docstring already exists, the new normalized docstring is appended
        to the end of the existing one with two newlines separating them.
        """
>       assert isinstance(docstring, six.text_type), type(docstring)
E       AssertionError: <type 'str'>

stone/ir/api.py:132: AssertionError
========================================== 1 failed, 161 passed in 34.37 seconds ==========================================
ERROR: InvocationError for command /Users/changd/dev/stone/.tox/codecov/bin/coverage run --rcfile=.coveragerc -m pytest (exited with code 1)```

@codecov
Copy link

codecov bot commented Dec 2, 2020

Codecov Report

Merging #203 (a4efd21) into main (0b49b05) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #203      +/-   ##
==========================================
- Coverage   51.73%   51.72%   -0.02%     
==========================================
  Files          37       37              
  Lines        8367     8369       +2     
  Branches     1786     1786              
==========================================
  Hits         4329     4329              
- Misses       3724     3726       +2     
  Partials      314      314              
Flag Coverage Δ
unit 51.72% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
stone/backends/obj_c_types.py 0.00% <0.00%> (ø)
stone/backends/swift_types.py 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0b49b05...a4efd21. Read the comment docs.

@rogebrd rogebrd merged commit 27a566a into dropbox:main Dec 2, 2020
changusmc added a commit to changusmc/stone that referenced this pull request Dec 3, 2020
* Make swift and obj-c patterns Python3 compatible
* Remove trailing whitespace
* Bump six version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants