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

jitlog/objects.py iter_ranges() broken on Python 2.7 #188

Open
ejona86 opened this issue Jan 8, 2019 · 0 comments
Open

jitlog/objects.py iter_ranges() broken on Python 2.7 #188

ejona86 opened this issue Jan 8, 2019 · 0 comments

Comments

@ejona86
Copy link

ejona86 commented Jan 8, 2019

PEP 479 changed the behavior of generators such that raising StopException would produce an actual exception instead of marking the end. Instead, you should simply return. As can be seen from the transition plan, the new behavior was made default in Python 2.7.

============================= test session starts ==============================
platform linux -- Python 3.7.2, pytest-4.1.0, py-1.7.0, pluggy-0.8.0
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/build/python-vmprof/src/vmprof-python-0.4.12/.hypothesis/examples')
rootdir: /build/python-vmprof/src/vmprof-python-0.4.12, inifile: pytest.ini
plugins: hypothesis-3.86.6
collected 62 items

jitlog/test/test_encoding.py ...                                         [  4%]
jitlog/test/test_jitlog.py ..........F.........                          [ 37%]
jitlog/test/test_query.py .....                                          [ 45%]
vmprof/test/test_c_source.py ....s.                                      [ 54%]
vmprof/test/test_c_symboltable.py ..                                     [ 58%]
vmprof/test/test_config.py ...                                           [ 62%]
vmprof/test/test_reader.py ..                                            [ 66%]
vmprof/test/test_run.py ........XXXX......                               [ 95%]
vmprof/test/test_stats.py ..s                                            [100%]

=================================== FAILURES ===================================
_______________________________ test_iter_ranges _______________________________

numbers = []

    def iter_ranges(numbers):
        if len(numbers) == 0:
>           raise StopIteration
E           StopIteration

jitlog/objects.py:374: StopIteration

The above exception was the direct cause of the following exception:

    def test_iter_ranges():
        r = lambda a,b: list(range(a,b))
        if PY3:
            r = range
>       assert list(iter_ranges([])) == []
E       RuntimeError: generator raised StopIteration

jitlog/test/test_jitlog.py:166: RuntimeError
=============================== warnings summary ===============================
jitlog/marks.py:103
  /build/python-vmprof/src/vmprof-python-0.4.12/jitlog/marks.py:103: DeprecationWarning: invalid escape sequence \(
    TOKEN_REGEX = re.compile("TargetToken\((\d+)\)")

vmprof/test/test_config.py::test_parser_config
  /build/python-vmprof/src/vmprof-python-0.4.12/vmprof/cli.py:114: DeprecationWarning: This method will be removed in future versions.  Use 'parser.read_file()' instead.
    self.ini_parser.readfp(f)

vmprof/test/test_config.py::test_parser_arg_precedence
  /build/python-vmprof/src/vmprof-python-0.4.12/vmprof/cli.py:114: DeprecationWarning: This method will be removed in future versions.  Use 'parser.read_file()' instead.
    self.ini_parser.readfp(f)

vmprof/test/test_config.py::test_parser_without_section
  /build/python-vmprof/src/vmprof-python-0.4.12/vmprof/cli.py:114: DeprecationWarning: This method will be removed in future versions.  Use 'parser.read_file()' instead.
    self.ini_parser.readfp(f)

-- Docs: https://docs.pytest.org/en/latest/warnings.html
==== 1 failed, 55 passed, 2 skipped, 4 xpassed, 4 warnings in 12.29 seconds ====
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

No branches or pull requests

1 participant