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

[Bug]: coders_property_based_test flaky #23254

Closed
Abacn opened this issue Sep 15, 2022 · 6 comments
Closed

[Bug]: coders_property_based_test flaky #23254

Abacn opened this issue Sep 15, 2022 · 6 comments

Comments

@Abacn
Copy link
Contributor

Abacn commented Sep 15, 2022

What happened?

e.g. https://ci-beam.apache.org/job/beam_PreCommit_Python_Commit/24753/

following test failed

apache_beam.coders.coders_property_based_test.ProperyTestingCoders.test_row_coder
apache_beam.coders.coders_property_based_test.ProperyTestingCoders.test_row_coder

error message:

ValueError: Type names and field names cannot be a keyword: 'as'
Falsifying example: test_row_coder(
    data=data(...),
    self=<apache_beam.coders.coders_property_based_test.ProperyTestingCoders testMethod=test_row_coder>,
)
Draw 1: [('as', <class 'str'>, False)]

You can reproduce this example by temporarily adding @reproduce_failure('6.54.5', b'AAEBJQE3AAAAAA==') as a decorator on your test case
Stacktrace
self = <apache_beam.coders.coders_property_based_test.ProperyTestingCoders testMethod=test_row_coder>

    @settings(deadline=None, print_blob=True)
>   @given(st.data())

apache_beam/coders/coders_property_based_test.py:119: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
apache_beam/coders/coders_property_based_test.py:135: in test_row_coder
    RowType = typing.NamedTuple(  # type: ignore
/usr/lib/python3.8/typing.py:1704: in __new__
    return _make_nmtuple(typename, fields)
/usr/lib/python3.8/typing.py:1594: in _make_nmtuple
    nm_tpl = collections.namedtuple(name, [n for n, t in types])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

typename = 'RandomRowType', field_names = ['as']

    def namedtuple(typename, field_names, *, rename=False, defaults=None, module=None):
        """Returns a new subclass of tuple with named fields.
    
        >>> Point = namedtuple('Point', ['x', 'y'])
        >>> Point.__doc__                   # docstring for the new class
        'Point(x, y)'
        >>> p = Point(11, y=22)             # instantiate with positional args or keywords
        >>> p[0] + p[1]                     # indexable like a plain tuple
        33
        >>> x, y = p                        # unpack like a regular tuple
        >>> x, y
        (11, 22)
        >>> p.x + p.y                       # fields also accessible by name
        33
        >>> d = p._asdict()                 # convert to a dictionary
        >>> d['x']
        11
        >>> Point(**d)                      # convert from a dictionary
        Point(x=11, y=22)
        >>> p._replace(x=100)               # _replace() is like str.replace() but targets named fields
        Point(x=100, y=22)
    
        """
    
        # Validate the field names.  At the user's option, either generate an error
        # message or automatically replace the field name with a valid name.
        if isinstance(field_names, str):
            field_names = field_names.replace(',', ' ').split()
        field_names = list(map(str, field_names))
        typename = _sys.intern(str(typename))
    
        if rename:
            seen = set()
            for index, name in enumerate(field_names):
                if (not name.isidentifier()
                    or _iskeyword(name)
                    or name.startswith('_')
                    or name in seen):
                    field_names[index] = f'_{index}'
                seen.add(name)
    
        for name in [typename] + field_names:
            if type(name) is not str:
                raise TypeError('Type names and field names must be strings')
            if not name.isidentifier():
                raise ValueError('Type names and field names must be valid '
                                 f'identifiers: {name!r}')
            if _iskeyword(name):
>               raise ValueError('Type names and field names cannot be a '
                                 f'keyword: {name!r}')
E               ValueError: Type names and field names cannot be a keyword: 'as'
E               Falsifying example: test_row_coder(
E                   data=data(...),
E                   self=<apache_beam.coders.coders_property_based_test.ProperyTestingCoders testMethod=test_row_coder>,
E               )
E               Draw 1: [('as', <class 'str'>, False)]
E               
E               You can reproduce this example by temporarily adding @reproduce_failure('6.54.5', b'AAEBJQE3AAAAAA==') as a decorator on your test case

/usr/lib/python3.8/collections/__init__.py:361: ValueError

Not sure this is transient or flakes. Will track.

Issue Priority

Priority: 2

Issue Component

Component: test-failures

@Abacn
Copy link
Contributor Author

Abacn commented Sep 15, 2022

CC: @pabloem

@Abacn
Copy link
Contributor Author

Abacn commented Sep 15, 2022

Also happens on cron job: https://ci-beam.apache.org/job/beam_PreCommit_Python_Cron/6125/

@kennknowles
Copy link
Member

Is there a rollback possible?

@pabloem
Copy link
Member

pabloem commented Sep 15, 2022

yeah we can roll this back

@pabloem
Copy link
Member

pabloem commented Sep 15, 2022

Rollback PR: #23265

@Abacn
Copy link
Contributor Author

Abacn commented Sep 19, 2022

.close-issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants