Instagram / LibCST

A concrete syntax tree parser and serializer library for Python that preserves many aspects of Python's abstract syntax tree
https://libcst.readthedocs.io/
Other
1.53k stars 189 forks source link

0.4.9: pytest is failing #818

Open kloczek opened 1 year ago

kloczek commented 1 year ago

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

Here is list of installed modules in build env

```console Package Version ----------------------------- ----------------- alabaster 0.7.12 appdirs 1.4.4 asttokens 2.0.5 attrs 22.1.0 Babel 2.11.0 backcall 0.2.0 beautifulsoup4 4.11.1 bleach 5.0.0 Brlapi 0.8.3 build 0.9.0 charset-normalizer 3.0.0 codespell 2.2.1 contourpy 1.0.5 cssselect 1.1.0 cycler 0.11.0 debugpy 1.6.3 decorator 5.1.1 defusedxml 0.7.1 distro 1.7.0 dnspython 2.2.1 docutils 0.18.1 entrypoints 0.4 executing 1.1.1 extras 1.0.0 fastjsonschema 2.16.1 fixtures 4.0.0 fonttools 4.38.0 gpg 1.17.1-unknown html5lib 1.1 hypothesis 6.41.0 hypothesmith 0.2.0 idna 3.4 imagesize 1.4.1 importlib-metadata 5.0.0 importlib-resources 5.9.0 iniconfig 1.1.1 ipykernel 6.17.1 ipython 8.5.0 jedi 0.18.1 Jinja2 3.1.1 jsonschema 4.17.0 jupyter_client 7.4.5 jupyter_core 5.0.0 jupyterlab-pygments 0.1.2 kiwisolver 1.4.4 lark 1.1.4 libcomps 0.1.19 libcst 0.3.20 louis 3.23.0 lxml 4.9.1 MarkupSafe 2.1.1 matplotlib 3.6.0 matplotlib-inline 0.1.5 mistune 2.0.4 mypy-extensions 0.4.3 nbclient 0.7.0 nbconvert 7.2.2 nbformat 5.7.0 nbsphinx 0.8.9 nest-asyncio 1.5.6 numpy 1.23.1 olefile 0.46 packaging 21.3 pandocfilters 1.5.0 parso 0.8.3 pbr 5.9.0 pep517 0.13.0 pexpect 4.8.0 pickleshare 0.7.5 Pillow 9.2.0 pip 22.2.2 pkgutil_resolve_name 1.3.10 platformdirs 2.5.2 pluggy 1.0.0 prompt-toolkit 3.0.29 psutil 5.9.2 ptyprocess 0.7.0 pure-eval 0.2.2 py 1.11.0 Pygments 2.13.0 PyGObject 3.42.2 pyparsing 3.0.9 pyrsistent 0.19.2 pytest 7.1.3 python-dateutil 2.8.2 pytz 2022.4 PyYAML 6.0 pyzmq 24.0.0 requests 2.28.1 rpm 4.17.0 scour 0.38.2 semantic-version 2.9.0 setuptools 65.5.1 setuptools-rust 1.5.2 setuptools-scm 7.0.5 six 1.16.0 snowballstemmer 2.2.0 sortedcontainers 2.4.0 soupsieve 2.3.2.post1 Sphinx 5.3.0 sphinx-rtd-theme 1.1.0 sphinxcontrib-applehelp 1.0.2.dev20220730 sphinxcontrib-devhelp 1.0.2.dev20220730 sphinxcontrib-htmlhelp 2.0.0 sphinxcontrib-jsmath 1.0.1.dev20220730 sphinxcontrib-qthelp 1.0.3.dev20220730 sphinxcontrib-serializinghtml 1.1.5 stack-data 0.5.1 testtools 2.5.0 tinycss2 1.2.1 tomli 2.0.1 tornado 6.2 traitlets 5.4.0 typing_extensions 4.3.0 typing-inspect 0.7.1 urllib3 1.26.12 wcwidth 0.2.5 webencodings 0.5.1 wheel 0.37.1 zipp 3.9.0 ```
kloczek commented 1 year ago

It looks like in come units is hardcoded python interpreter name (it shopuld be used sys.executable)

Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-libcst-0.4.9-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-libcst-0.4.9-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra --ignore libcst/tests/test_fuzz.py =========================================================================== test session starts ============================================================================ platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/LibCST-0.4.9 plugins: hypothesis-6.41.0 collected 1980 items libcst/_nodes/tests/test_assert.py .......... [ 0%] libcst/_nodes/tests/test_assign.py ......................... [ 1%] libcst/_nodes/tests/test_atom.py ................................................................................................................................... [ 8%] ..... [ 8%] libcst/_nodes/tests/test_attribute.py ..... [ 8%] libcst/_nodes/tests/test_await.py .......... [ 9%] libcst/_nodes/tests/test_binary_op.py .................. [ 10%] libcst/_nodes/tests/test_boolean_op.py ........ [ 10%] libcst/_nodes/tests/test_call.py ................................. [ 12%] libcst/_nodes/tests/test_classdef.py ....................... [ 13%] libcst/_nodes/tests/test_comment.py ...... [ 13%] libcst/_nodes/tests/test_comparison.py ....................... [ 15%] libcst/_nodes/tests/test_cst_node.py ............ [ 15%] libcst/_nodes/tests/test_del.py ..... [ 15%] libcst/_nodes/tests/test_dict.py ............... [ 16%] libcst/_nodes/tests/test_dict_comp.py ......... [ 17%] libcst/_nodes/tests/test_docstring.py ................ [ 17%] libcst/_nodes/tests/test_else.py .. [ 17%] libcst/_nodes/tests/test_empty_line.py ....... [ 18%] libcst/_nodes/tests/test_flatten_behavior.py ... [ 18%] libcst/_nodes/tests/test_for.py ............ [ 19%] libcst/_nodes/tests/test_funcdef.py .......................................................ssssssssssss....................s................. [ 24%] libcst/_nodes/tests/test_global.py .......... [ 24%] libcst/_nodes/tests/test_if.py ........ [ 25%] libcst/_nodes/tests/test_ifexp.py ...... [ 25%] libcst/_nodes/tests/test_import.py ...................................................... [ 28%] libcst/_nodes/tests/test_indented_block.py ............. [ 28%] libcst/_nodes/tests/test_lambda.py ...................................................... [ 31%] libcst/_nodes/tests/test_leaf_small_statements.py ... [ 31%] libcst/_nodes/tests/test_list.py .......... [ 32%] libcst/_nodes/tests/test_match.py .......... [ 32%] libcst/_nodes/tests/test_matrix_multiply.py ...... [ 33%] libcst/_nodes/tests/test_module.py ....................... [ 34%] libcst/_nodes/tests/test_namedexpr.py ........... [ 34%] libcst/_nodes/tests/test_newline.py ...... [ 35%] libcst/_nodes/tests/test_nonlocal.py .......... [ 35%] libcst/_nodes/tests/test_number.py ............. [ 36%] libcst/_nodes/tests/test_raise.py ................ [ 37%] libcst/_nodes/tests/test_removal_behavior.py ........ [ 37%] libcst/_nodes/tests/test_return.py ........ [ 37%] libcst/_nodes/tests/test_set.py .......... [ 38%] libcst/_nodes/tests/test_simple_comp.py ............................ [ 39%] libcst/_nodes/tests/test_simple_statement.py ........................... [ 41%] libcst/_nodes/tests/test_simple_string.py . [ 41%] libcst/_nodes/tests/test_simple_whitespace.py .............. [ 42%] libcst/_nodes/tests/test_small_statement.py ............ [ 42%] libcst/_nodes/tests/test_subscript.py ............................. [ 44%] libcst/_nodes/tests/test_trailing_whitespace.py ..... [ 44%] libcst/_nodes/tests/test_try.py .............................. [ 45%] libcst/_nodes/tests/test_tuple.py ...................... [ 46%] libcst/_nodes/tests/test_unary_op.py .......... [ 47%] libcst/_nodes/tests/test_while.py ......... [ 47%] libcst/_nodes/tests/test_with.py .................... [ 48%] libcst/_nodes/tests/test_yield.py ........................ [ 50%] libcst/_parser/parso/tests/test_fstring.py ... [ 50%] libcst/_parser/parso/tests/test_tokenize.py ......................................... [ 52%] libcst/_parser/parso/tests/test_utils.py ..................... [ 53%] libcst/_parser/tests/test_config.py . [ 53%] libcst/_parser/tests/test_detect_config.py ................. [ 54%] libcst/_parser/tests/test_footer_behavior.py ....... [ 54%] libcst/_parser/tests/test_node_identity.py . [ 54%] libcst/_parser/tests/test_parse_errors.py ............. [ 55%] libcst/_parser/tests/test_version_compare.py ................. [ 56%] libcst/_parser/tests/test_whitespace_parser.py ......... [ 56%] libcst/_parser/tests/test_wrapped_tokenize.py ................ [ 57%] libcst/_parser/types/tests/test_config.py ........... [ 58%] libcst/codegen/tests/test_codegen_clean.py FFF [ 58%] libcst/codemod/commands/tests/test_add_pyre_directive.py ....... [ 58%] libcst/codemod/commands/tests/test_add_trailing_commas.py ...... [ 58%] libcst/codemod/commands/tests/test_convert_format_to_fstring.py .............. [ 59%] libcst/codemod/commands/tests/test_convert_namedtuple_to_dataclass.py ........ [ 60%] libcst/codemod/commands/tests/test_convert_percent_format_to_fstring.py ... [ 60%] libcst/codemod/commands/tests/test_convert_type_comments.py ................ [ 60%] libcst/codemod/commands/tests/test_ensure_import_present.py ..... [ 61%] libcst/codemod/commands/tests/test_fix_pyre_directives.py .......... [ 61%] libcst/codemod/commands/tests/test_noop.py . [ 61%] libcst/codemod/commands/tests/test_remove_pyre_directive.py .......... [ 62%] libcst/codemod/commands/tests/test_remove_unused_imports.py ........... [ 62%] libcst/codemod/commands/tests/test_rename.py ................................... [ 64%] libcst/codemod/commands/tests/test_strip_strings_from_types.py ........ [ 65%] libcst/codemod/commands/tests/test_unnecessary_format_string.py . [ 65%] libcst/codemod/tests/test_codemod.py .xx. [ 65%] libcst/codemod/tests/test_codemod_cli.py F [ 65%] libcst/codemod/tests/test_metadata.py . [ 65%] libcst/codemod/tests/test_runner.py .... [ 65%] libcst/codemod/visitors/tests/test_add_imports.py .............................. [ 67%] libcst/codemod/visitors/tests/test_apply_type_annotations.py ................................................................................ [ 71%] libcst/codemod/visitors/tests/test_gather_comments.py .. [ 71%] libcst/codemod/visitors/tests/test_gather_exports.py ........... [ 71%] libcst/codemod/visitors/tests/test_gather_global_names.py ... [ 71%] libcst/codemod/visitors/tests/test_gather_imports.py ......... [ 72%] libcst/codemod/visitors/tests/test_gather_string_annotation_names.py ...... [ 72%] libcst/codemod/visitors/tests/test_gather_unused_imports.py ......... [ 73%] libcst/codemod/visitors/tests/test_remove_imports.py .................................. [ 74%] libcst/helpers/tests/test_expression.py .............. [ 75%] libcst/helpers/tests/test_module.py ............................................... [ 77%] libcst/helpers/tests/test_template.py ........... [ 78%] libcst/matchers/tests/test_decorators.py ......................... [ 79%] libcst/matchers/tests/test_extract.py ................ [ 80%] libcst/matchers/tests/test_findall.py ...... [ 80%] libcst/matchers/tests/test_matchers.py .................................. [ 82%] libcst/matchers/tests/test_matchers_with_metadata.py .............. [ 83%] libcst/matchers/tests/test_replace.py ........... [ 83%] libcst/matchers/tests/test_visitors.py ...................................... [ 85%] libcst/metadata/tests/test_accessor_provider.py ... [ 85%] libcst/metadata/tests/test_base_provider.py .... [ 86%] libcst/metadata/tests/test_expression_context_provider.py ...................... [ 87%] libcst/metadata/tests/test_full_repo_manager.py .... [ 87%] libcst/metadata/tests/test_metadata_provider.py .......... [ 87%] libcst/metadata/tests/test_metadata_wrapper.py ....... [ 88%] libcst/metadata/tests/test_name_provider.py ....................... [ 89%] libcst/metadata/tests/test_parent_node_provider.py ... [ 89%] libcst/metadata/tests/test_position_provider.py ........... [ 90%] libcst/metadata/tests/test_reentrant_codegen.py ..... [ 90%] libcst/metadata/tests/test_scope_provider.py .............................................................. [ 93%] libcst/metadata/tests/test_span_provider.py ....... [ 93%] libcst/metadata/tests/test_type_inference_provider.py EEE [ 94%] libcst/tests/test_add_slots.py .. [ 94%] libcst/tests/test_batched_visitor.py .. [ 94%] libcst/tests/test_deep_clone.py . [ 94%] libcst/tests/test_deep_replace.py ..... [ 94%] libcst/tests/test_e2e.py . [ 94%] libcst/tests/test_exceptions.py ..... [ 94%] libcst/tests/test_pyre_integration.py . [ 94%] libcst/tests/test_tabs.py ........ [ 95%] libcst/tests/test_tool.py ........ [ 95%] libcst/tests/test_type_enforce.py ................................................................................... [ 99%] libcst/tests/test_visitor.py .. [100%] ================================================================================== ERRORS ================================================================================== _______________________________________________________ ERROR at setup of TypeInferenceProviderTest.test_gen_cache_0 _______________________________________________________ cls = @classmethod def setUpClass(cls) -> None: os.chdir(TEST_SUITE_PATH) try: > subprocess.run(["pyre", "-n", "start", "--no-watchman"]) /home/tkloczko/rpmbuild/BUILD/LibCST-0.4.9/libcst/metadata/tests/test_type_inference_provider.py:64: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , args = ['pyre', '-n', 'start', '--no-watchman'], executable = b'pyre', preexec_fn = None, close_fds = True pass_fds = (), cwd = None, env = None, startupinfo = None, creationflags = 0, shell = False, p2cread = -1, p2cwrite = -1, c2pread = -1, c2pwrite = -1, errread = -1 errwrite = -1, restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'pyre' /usr/lib64/python3.8/subprocess.py:1704: FileNotFoundError __________________________________________________ ERROR at setup of TypeInferenceProviderTest.test_simple_class_types_0 ___________________________________________________ cls = @classmethod def setUpClass(cls) -> None: os.chdir(TEST_SUITE_PATH) try: > subprocess.run(["pyre", "-n", "start", "--no-watchman"]) /home/tkloczko/rpmbuild/BUILD/LibCST-0.4.9/libcst/metadata/tests/test_type_inference_provider.py:64: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , args = ['pyre', '-n', 'start', '--no-watchman'], executable = b'pyre', preexec_fn = None, close_fds = True pass_fds = (), cwd = None, env = None, startupinfo = None, creationflags = 0, shell = False, p2cread = -1, p2cwrite = -1, c2pread = -1, c2pwrite = -1, errread = -1 errwrite = -1, restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'pyre' /usr/lib64/python3.8/subprocess.py:1704: FileNotFoundError ____________________________________________________ ERROR at setup of TypeInferenceProviderTest.test_with_empty_cache _____________________________________________________ cls = @classmethod def setUpClass(cls) -> None: os.chdir(TEST_SUITE_PATH) try: > subprocess.run(["pyre", "-n", "start", "--no-watchman"]) /home/tkloczko/rpmbuild/BUILD/LibCST-0.4.9/libcst/metadata/tests/test_type_inference_provider.py:64: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , args = ['pyre', '-n', 'start', '--no-watchman'], executable = b'pyre', preexec_fn = None, close_fds = True pass_fds = (), cwd = None, env = None, startupinfo = None, creationflags = 0, shell = False, p2cread = -1, p2cwrite = -1, c2pread = -1, c2pwrite = -1, errread = -1 errwrite = -1, restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'pyre' /usr/lib64/python3.8/subprocess.py:1704: FileNotFoundError ================================================================================= FAILURES ================================================================================= ___________________________________________________________ TestCodegenClean.test_codegen_clean_matcher_classes ____________________________________________________________ self = def test_codegen_clean_matcher_classes(self) -> None: """ Verifies that codegen of matcher classes would not result in a changed file. If this test fails, please run 'python -m libcst.codegen.generate all' to generate new files. """ new_code = clean_generated_code("\n".join(matcher_codegen.generated_code)) new_file = os.path.join( os.path.dirname(os.path.abspath(__file__)), "matcher_codegen.deleteme.py" ) with open(new_file, "w") as fp: fp.write(new_code) try: format_file(new_file) except Exception: # We failed to format, but this is probably due to invalid code that # black doesn't like. This test will still fail and report to run codegen. pass with open(new_file, "r") as fp: new_code = fp.read() os.remove(new_file) with open( os.path.join( os.path.dirname(os.path.abspath(__file__)), "../../matchers/__init__.py" ), "r", ) as fp: old_code = fp.read() # Now that we've done simple codegen, verify that it matches. > self.assert_code_matches(old_code, new_code, "libcst.matchers.__init__") libcst/codegen/tests/test_codegen_clean.py:92: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ libcst/codegen/tests/test_codegen_clean.py:23: in assert_code_matches self.assertTrue( E AssertionError: False is not true : libcst.matchers.__init__ needs new codegen, see `python -m libcst.codegen.generate --help` for instructions, or run `python -m libcst.codegen.generate all` _____________________________________________________________ TestCodegenClean.test_codegen_clean_return_types _____________________________________________________________ self = def test_codegen_clean_return_types(self) -> None: """ Verifies that codegen of return types would not result in a changed file. If this test fails, please run 'python -m libcst.codegen.generate all' to generate new files. """ new_code = clean_generated_code("\n".join(type_codegen.generated_code)) new_file = os.path.join( os.path.dirname(os.path.abspath(__file__)), "type_codegen.deleteme.py" ) with open(new_file, "w") as fp: fp.write(new_code) try: format_file(new_file) except Exception: # We failed to format, but this is probably due to invalid code that # black doesn't like. This test will still fail and report to run codegen. pass with open(new_file, "r") as fp: new_code = fp.read() os.remove(new_file) with open( os.path.join( os.path.dirname(os.path.abspath(__file__)), "../../matchers/_return_types.py", ), "r", ) as fp: old_code = fp.read() # Now that we've done simple codegen, verify that it matches. > self.assert_code_matches(old_code, new_code, "libcst.matchers._return_types") libcst/codegen/tests/test_codegen_clean.py:125: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ libcst/codegen/tests/test_codegen_clean.py:23: in assert_code_matches self.assertTrue( E AssertionError: False is not true : libcst.matchers._return_types needs new codegen, see `python -m libcst.codegen.generate --help` for instructions, or run `python -m libcst.codegen.generate all` __________________________________________________________ TestCodegenClean.test_codegen_clean_visitor_functions ___________________________________________________________ self = def test_codegen_clean_visitor_functions(self) -> None: """ Verifies that codegen of visitor functions would not result in a changed file. If this test fails, please run 'python -m libcst.codegen.generate all' to generate new files. """ new_code = clean_generated_code("\n".join(visitor_codegen.generated_code)) new_file = os.path.join( os.path.dirname(os.path.abspath(__file__)), "visitor_codegen.deleteme.py" ) with open(new_file, "w") as fp: fp.write(new_code) try: format_file(new_file) except Exception: # We failed to format, but this is probably due to invalid code that # black doesn't like. This test will still fail and report to run codegen. pass with open(new_file, "r") as fp: new_code = fp.read() os.remove(new_file) with open( os.path.join( os.path.dirname(os.path.abspath(__file__)), "../../_typed_visitor.py" ), "r", ) as fp: old_code = fp.read() # Now that we've done simple codegen, verify that it matches. > self.assert_code_matches(old_code, new_code, "libcst._typed_visitor") libcst/codegen/tests/test_codegen_clean.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ libcst/codegen/tests/test_codegen_clean.py:23: in assert_code_matches self.assertTrue( E AssertionError: False is not true : libcst._typed_visitor needs new codegen, see `python -m libcst.codegen.generate --help` for instructions, or run `python -m libcst.codegen.generate all` ____________________________________________________________ TestCodemodCLI.test_codemod_formatter_error_input _____________________________________________________________ self = def test_codemod_formatter_error_input(self) -> None: > rlt = subprocess.run( [ "python", "-m", "libcst.tool", "codemod", "remove_unused_imports.RemoveUnusedImportsCommand", # `ArgumentParser.parse_known_args()`'s behavior dictates that options # need to go after instead of before the codemod command identifier. "--python-version", "3.6", str(Path(__file__).parent / "codemod_formatter_error_input.py.txt"), ], stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) libcst/codemod/tests/test_codemod_cli.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-m', 'libcst.tool', 'codemod', 'remove_unused_imports.RemoveUnusedImportsCommand', '--python-version', ...], executable = b'python', preexec_fn = None close_fds = True, pass_fds = (), cwd = None, env = None, startupinfo = None, creationflags = 0, shell = False, p2cread = -1, p2cwrite = -1, c2pread = 13, c2pwrite = 14 errread = 15, errwrite = 16, restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1704: FileNotFoundError ============================================================================= warnings summary ============================================================================= libcst/codemod/tests/test_metadata.py:15 /home/tkloczko/rpmbuild/BUILD/LibCST-0.4.9/libcst/codemod/tests/test_metadata.py:15: PytestCollectionWarning: cannot collect test class 'TestingCollector' because it has a __init__ constructor (from: libcst/codemod/tests/test_metadata.py) class TestingCollector(ContextAwareVisitor): libcst/codemod/tests/test_metadata.py:24 /home/tkloczko/rpmbuild/BUILD/LibCST-0.4.9/libcst/codemod/tests/test_metadata.py:24: PytestCollectionWarning: cannot collect test class 'TestingTransform' because it has a __init__ constructor (from: libcst/codemod/tests/test_metadata.py) class TestingTransform(ContextAwareTransformer): -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ========================================================================= short test summary info ========================================================================== SKIPPED [2] libcst/_nodes/tests/test_funcdef.py:710: Disabled for native parser SKIPPED [10] libcst/_nodes/tests/test_funcdef.py:2156: Skipped for non-native parser SKIPPED [1] libcst/_nodes/tests/test_funcdef.py:1848: disabled for pure python parser XFAIL libcst/codemod/tests/test_codemod.py::TestSkipDetection::test_did_not_skip_but_should reason: XFAIL libcst/codemod/tests/test_codemod.py::TestSkipDetection::test_skipped_but_should_not reason: ERROR libcst/metadata/tests/test_type_inference_provider.py::TypeInferenceProviderTest::test_gen_cache_0 - FileNotFoundError: [Errno 2] No such file or directory: 'pyre' ERROR libcst/metadata/tests/test_type_inference_provider.py::TypeInferenceProviderTest::test_simple_class_types_0 - FileNotFoundError: [Errno 2] No such file or director... ERROR libcst/metadata/tests/test_type_inference_provider.py::TypeInferenceProviderTest::test_with_empty_cache - FileNotFoundError: [Errno 2] No such file or directory: '... FAILED libcst/codegen/tests/test_codegen_clean.py::TestCodegenClean::test_codegen_clean_matcher_classes - AssertionError: False is not true : libcst.matchers.__init__ ne... FAILED libcst/codegen/tests/test_codegen_clean.py::TestCodegenClean::test_codegen_clean_return_types - AssertionError: False is not true : libcst.matchers._return_types ... FAILED libcst/codegen/tests/test_codegen_clean.py::TestCodegenClean::test_codegen_clean_visitor_functions - AssertionError: False is not true : libcst._typed_visitor nee... FAILED libcst/codemod/tests/test_codemod_cli.py::TestCodemodCLI::test_codemod_formatter_error_input - FileNotFoundError: [Errno 2] No such file or directory: 'python' =============================================== 4 failed, 1958 passed, 13 skipped, 2 xfailed, 2 warnings, 3 errors in 53.99s =============================================== ```
kloczek commented 1 year ago

Just tested 1.0.1 and pytest is stil failing but now different way

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-libcst-1.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-libcst-1.0.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network' --import-mode=importlib
============================= test session starts ==============================
platform linux -- Python 3.8.16, pytest-7.3.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/LibCST-1.0.1
plugins: hypothesis-6.75.3
collected 2003 items / 2 errors

==================================== ERRORS ====================================
_______ ERROR collecting libcst/metadata/tests/test_full_repo_manager.py _______
libcst/metadata/tests/test_full_repo_manager.py:11: in <module>
    from libcst.metadata.tests.test_type_inference_provider import _test_simple_class_helper
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:172: in exec_module
    exec(co, module.__dict__)
../../BUILDROOT/python-libcst-1.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages/libcst/metadata/tests/test_type_inference_provider.py:19: in <module>
    from libcst.tests.test_pyre_integration import TEST_SUITE_PATH
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:172: in exec_module
    exec(co, module.__dict__)
../../BUILDROOT/python-libcst-1.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages/libcst/tests/test_pyre_integration.py:87: in <module>
    class PyreIntegrationTest(UnitTest):
../../BUILDROOT/python-libcst-1.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages/libcst/testing/utils.py:168: in __new__
    populate_data_provider_tests(dct)
../../BUILDROOT/python-libcst-1.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages/libcst/testing/utils.py:94: in populate_data_provider_tests
    raise ValueError(
E   ValueError: No data_provider tests were created for test_type_availability! Please double check your data.
____ ERROR collecting libcst/metadata/tests/test_type_inference_provider.py ____
libcst/metadata/tests/test_type_inference_provider.py:19: in <module>
    from libcst.tests.test_pyre_integration import TEST_SUITE_PATH
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:172: in exec_module
    exec(co, module.__dict__)
../../BUILDROOT/python-libcst-1.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages/libcst/tests/test_pyre_integration.py:87: in <module>
    class PyreIntegrationTest(UnitTest):
../../BUILDROOT/python-libcst-1.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages/libcst/testing/utils.py:168: in __new__
    populate_data_provider_tests(dct)
../../BUILDROOT/python-libcst-1.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages/libcst/testing/utils.py:94: in populate_data_provider_tests
    raise ValueError(
E   ValueError: No data_provider tests were created for test_type_availability! Please double check your data.
=============================== warnings summary ===============================
libcst/codemod/tests/test_metadata.py:15
  /home/tkloczko/rpmbuild/BUILD/LibCST-1.0.1/libcst/codemod/tests/test_metadata.py:15: PytestCollectionWarning: cannot collect test class 'TestingCollector' because it has a __init__ constructor (from: libcst/codemod/tests/test_metadata.py)
    class TestingCollector(ContextAwareVisitor):

libcst/codemod/tests/test_metadata.py:23
  /home/tkloczko/rpmbuild/BUILD/LibCST-1.0.1/libcst/codemod/tests/test_metadata.py:23: PytestCollectionWarning: cannot collect test class 'TestingTransform' because it has a __init__ constructor (from: libcst/codemod/tests/test_metadata.py)
    class TestingTransform(ContextAwareTransformer):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
ERROR libcst/metadata/tests/test_full_repo_manager.py - ValueError: No data_p...
ERROR libcst/metadata/tests/test_type_inference_provider.py - ValueError: No ...
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!
======================== 2 warnings, 2 errors in 9.48s =========================
kloczek commented 1 year ago

Here is pytest output after add those two files to --ignore list:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-libcst-1.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-libcst-1.0.1-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' --import-mode=importlib --ignore libcst/metadata/tests/test_full_repo_manager.py --ignore libcst/metadata/tests/test_type_inference_provider.py ============================= test session starts ============================== platform linux -- Python 3.8.16, pytest-7.3.1, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/LibCST-1.0.1 plugins: hypothesis-6.75.3 collected 2003 items libcst/_nodes/tests/test_assert.py .......... [ 0%] libcst/_nodes/tests/test_assign.py ......................... [ 1%] libcst/_nodes/tests/test_atom.py ....................................... [ 3%] ........................................................................ [ 7%] .......................s. [ 8%] libcst/_nodes/tests/test_attribute.py ..... [ 8%] libcst/_nodes/tests/test_await.py .......... [ 9%] libcst/_nodes/tests/test_binary_op.py .................. [ 10%] libcst/_nodes/tests/test_boolean_op.py ........ [ 10%] libcst/_nodes/tests/test_call.py ................................. [ 12%] libcst/_nodes/tests/test_classdef.py ....................... [ 13%] libcst/_nodes/tests/test_comment.py ...... [ 13%] libcst/_nodes/tests/test_comparison.py ....................... [ 14%] libcst/_nodes/tests/test_cst_node.py ............ [ 15%] libcst/_nodes/tests/test_del.py ..... [ 15%] libcst/_nodes/tests/test_dict.py ..............s [ 16%] libcst/_nodes/tests/test_dict_comp.py .......... [ 16%] libcst/_nodes/tests/test_docstring.py ................ [ 17%] libcst/_nodes/tests/test_else.py .. [ 17%] libcst/_nodes/tests/test_empty_line.py ....... [ 18%] libcst/_nodes/tests/test_flatten_behavior.py ... [ 18%] libcst/_nodes/tests/test_for.py ............ [ 18%] libcst/_nodes/tests/test_funcdef.py .................................... [ 20%] ......................................................................s [ 24%] libcst/_nodes/tests/test_global.py .......... [ 24%] libcst/_nodes/tests/test_if.py ........ [ 25%] libcst/_nodes/tests/test_ifexp.py ........ [ 25%] libcst/_nodes/tests/test_import.py ..................................... [ 27%] ................. [ 28%] libcst/_nodes/tests/test_indented_block.py ............. [ 28%] libcst/_nodes/tests/test_lambda.py ..................................... [ 30%] .................. [ 31%] libcst/_nodes/tests/test_leaf_small_statements.py ... [ 31%] libcst/_nodes/tests/test_list.py .........s [ 32%] libcst/_nodes/tests/test_match.py .......... [ 32%] libcst/_nodes/tests/test_matrix_multiply.py ...s.s [ 33%] libcst/_nodes/tests/test_module.py ....................s.. [ 34%] libcst/_nodes/tests/test_namedexpr.py ............ [ 34%] libcst/_nodes/tests/test_newline.py ...... [ 35%] libcst/_nodes/tests/test_nonlocal.py .......... [ 35%] libcst/_nodes/tests/test_number.py ............. [ 36%] libcst/_nodes/tests/test_raise.py ................ [ 37%] libcst/_nodes/tests/test_removal_behavior.py ........ [ 37%] libcst/_nodes/tests/test_return.py ........ [ 37%] libcst/_nodes/tests/test_set.py .........s [ 38%] libcst/_nodes/tests/test_simple_comp.py ............................... [ 39%] libcst/_nodes/tests/test_simple_statement.py ........................... [ 41%] [ 41%] libcst/_nodes/tests/test_simple_string.py . [ 41%] libcst/_nodes/tests/test_simple_whitespace.py .............. [ 42%] libcst/_nodes/tests/test_small_statement.py ............ [ 42%] libcst/_nodes/tests/test_subscript.py ............................. [ 44%] libcst/_nodes/tests/test_trailing_whitespace.py ..... [ 44%] libcst/_nodes/tests/test_try.py .............................. [ 45%] libcst/_nodes/tests/test_tuple.py .....................s [ 46%] libcst/_nodes/tests/test_unary_op.py .......... [ 47%] libcst/_nodes/tests/test_while.py ......... [ 47%] libcst/_nodes/tests/test_with.py ....................s [ 48%] libcst/_nodes/tests/test_yield.py .......................s [ 50%] libcst/_parser/parso/tests/test_fstring.py ... [ 50%] libcst/_parser/parso/tests/test_tokenize.py ............................ [ 51%] ............. [ 52%] libcst/_parser/parso/tests/test_utils.py ..................... [ 53%] libcst/_parser/tests/test_config.py . [ 53%] libcst/_parser/tests/test_detect_config.py ................. [ 54%] libcst/_parser/tests/test_footer_behavior.py ....... [ 54%] libcst/_parser/tests/test_node_identity.py . [ 54%] libcst/_parser/tests/test_parse_errors.py ............. [ 55%] libcst/_parser/tests/test_version_compare.py ................. [ 56%] libcst/_parser/tests/test_whitespace_parser.py ......... [ 56%] libcst/_parser/tests/test_wrapped_tokenize.py ................ [ 57%] libcst/_parser/types/tests/test_config.py ........... [ 57%] libcst/codegen/tests/test_codegen_clean.py FFF [ 58%] libcst/codemod/commands/tests/test_add_pyre_directive.py ....... [ 58%] libcst/codemod/commands/tests/test_add_trailing_commas.py ...... [ 58%] libcst/codemod/commands/tests/test_convert_format_to_fstring.py ........ [ 59%] ...... [ 59%] libcst/codemod/commands/tests/test_convert_namedtuple_to_dataclass.py .. [ 59%] ...... [ 59%] libcst/codemod/commands/tests/test_convert_percent_format_to_fstring.py . [ 59%] .. [ 60%] libcst/codemod/commands/tests/test_convert_type_comments.py ............ [ 60%] .... [ 60%] libcst/codemod/commands/tests/test_ensure_import_present.py ..... [ 61%] libcst/codemod/commands/tests/test_fix_pyre_directives.py .......... [ 61%] libcst/codemod/commands/tests/test_noop.py . [ 61%] libcst/codemod/commands/tests/test_remove_pyre_directive.py .......... [ 62%] libcst/codemod/commands/tests/test_remove_unused_imports.py ........... [ 62%] libcst/codemod/commands/tests/test_rename.py ........................... [ 64%] ........ [ 64%] libcst/codemod/commands/tests/test_strip_strings_from_types.py ........ [ 64%] libcst/codemod/commands/tests/test_unnecessary_format_string.py . [ 64%] libcst/codemod/tests/test_codemod.py .xx. [ 65%] libcst/codemod/tests/test_codemod_cli.py FF [ 65%] libcst/codemod/tests/test_metadata.py . [ 65%] libcst/codemod/tests/test_runner.py .... [ 65%] libcst/codemod/visitors/tests/test_add_imports.py ...................... [ 66%] ......... [ 66%] libcst/codemod/visitors/tests/test_apply_type_annotations.py ........... [ 67%] ........................................................................ [ 71%] ...... [ 71%] libcst/codemod/visitors/tests/test_gather_comments.py .. [ 71%] libcst/codemod/visitors/tests/test_gather_exports.py ........... [ 72%] libcst/codemod/visitors/tests/test_gather_global_names.py ... [ 72%] libcst/codemod/visitors/tests/test_gather_imports.py ......... [ 72%] libcst/codemod/visitors/tests/test_gather_string_annotation_names.py ... [ 72%] ... [ 72%] libcst/codemod/visitors/tests/test_gather_unused_imports.py ......... [ 73%] libcst/codemod/visitors/tests/test_remove_imports.py ................... [ 74%] ............... [ 75%] libcst/helpers/tests/test_expression.py .............. [ 75%] libcst/helpers/tests/test_module.py .................................... [ 77%] ............. [ 78%] libcst/helpers/tests/test_paths.py . [ 78%] libcst/helpers/tests/test_template.py ........... [ 78%] libcst/matchers/tests/test_decorators.py ........................s [ 80%] libcst/matchers/tests/test_extract.py ................ [ 80%] libcst/matchers/tests/test_findall.py ...... [ 81%] libcst/matchers/tests/test_matchers.py ................................. [ 82%] . [ 82%] libcst/matchers/tests/test_matchers_with_metadata.py .............. [ 83%] libcst/matchers/tests/test_replace.py ........... [ 84%] libcst/matchers/tests/test_visitors.py ................................. [ 85%] ..... [ 86%] libcst/metadata/tests/test_accessor_provider.py ... [ 86%] libcst/metadata/tests/test_base_provider.py .... [ 86%] libcst/metadata/tests/test_expression_context_provider.py .............. [ 87%] ........ [ 87%] libcst/metadata/tests/test_file_path_provider.py .. [ 87%] libcst/metadata/tests/test_metadata_provider.py .......... [ 88%] libcst/metadata/tests/test_metadata_wrapper.py ....... [ 88%] libcst/metadata/tests/test_name_provider.py ....................... [ 89%] libcst/metadata/tests/test_parent_node_provider.py ... [ 89%] libcst/metadata/tests/test_position_provider.py ........... [ 90%] libcst/metadata/tests/test_reentrant_codegen.py ..... [ 90%] libcst/metadata/tests/test_scope_provider.py ........................... [ 91%] ................................... [ 93%] libcst/metadata/tests/test_span_provider.py ....... [ 93%] libcst/tests/test_add_slots.py .. [ 94%] libcst/tests/test_batched_visitor.py .. [ 94%] libcst/tests/test_deep_clone.py . [ 94%] libcst/tests/test_deep_replace.py ..... [ 94%] libcst/tests/test_e2e.py . [ 94%] libcst/tests/test_exceptions.py ..... [ 94%] libcst/tests/test_fuzz.py sss [ 94%] libcst/tests/test_pyre_integration.py . [ 94%] libcst/tests/test_tabs.py ........ [ 95%] libcst/tests/test_tool.py ........ [ 95%] libcst/tests/test_type_enforce.py ...................................... [ 97%] ............................................. [ 99%] libcst/tests/test_visitor.py .. [100%] =================================== FAILURES =================================== _____________ TestCodegenClean.test_codegen_clean_matcher_classes ______________ self = def test_codegen_clean_matcher_classes(self) -> None: """ Verifies that codegen of matcher classes would not result in a changed file. If this test fails, please run 'python -m libcst.codegen.generate all' to generate new files. """ new_code = clean_generated_code("\n".join(matcher_codegen.generated_code)) new_file = os.path.join( os.path.dirname(os.path.abspath(__file__)), "matcher_codegen.deleteme.py" ) with open(new_file, "w") as fp: fp.write(new_code) try: format_file(new_file) except Exception: # We failed to format, but this is probably due to invalid code that # black doesn't like. This test will still fail and report to run codegen. pass with open(new_file, "r") as fp: new_code = fp.read() os.remove(new_file) with open( os.path.join( os.path.dirname(os.path.abspath(__file__)), "../../matchers/__init__.py" ), "r", ) as fp: old_code = fp.read() # Now that we've done simple codegen, verify that it matches. > self.assert_code_matches(old_code, new_code, "libcst.matchers.__init__") libcst/codegen/tests/test_codegen_clean.py:92: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ libcst/codegen/tests/test_codegen_clean.py:23: in assert_code_matches self.assertTrue( E AssertionError: False is not true : libcst.matchers.__init__ needs new codegen, see `python -m libcst.codegen.generate --help` for instructions, or run `python -m libcst.codegen.generate all` _______________ TestCodegenClean.test_codegen_clean_return_types _______________ self = def test_codegen_clean_return_types(self) -> None: """ Verifies that codegen of return types would not result in a changed file. If this test fails, please run 'python -m libcst.codegen.generate all' to generate new files. """ new_code = clean_generated_code("\n".join(type_codegen.generated_code)) new_file = os.path.join( os.path.dirname(os.path.abspath(__file__)), "type_codegen.deleteme.py" ) with open(new_file, "w") as fp: fp.write(new_code) try: format_file(new_file) except Exception: # We failed to format, but this is probably due to invalid code that # black doesn't like. This test will still fail and report to run codegen. pass with open(new_file, "r") as fp: new_code = fp.read() os.remove(new_file) with open( os.path.join( os.path.dirname(os.path.abspath(__file__)), "../../matchers/_return_types.py", ), "r", ) as fp: old_code = fp.read() # Now that we've done simple codegen, verify that it matches. > self.assert_code_matches(old_code, new_code, "libcst.matchers._return_types") libcst/codegen/tests/test_codegen_clean.py:125: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ libcst/codegen/tests/test_codegen_clean.py:23: in assert_code_matches self.assertTrue( E AssertionError: False is not true : libcst.matchers._return_types needs new codegen, see `python -m libcst.codegen.generate --help` for instructions, or run `python -m libcst.codegen.generate all` ____________ TestCodegenClean.test_codegen_clean_visitor_functions _____________ self = def test_codegen_clean_visitor_functions(self) -> None: """ Verifies that codegen of visitor functions would not result in a changed file. If this test fails, please run 'python -m libcst.codegen.generate all' to generate new files. """ new_code = clean_generated_code("\n".join(visitor_codegen.generated_code)) new_file = os.path.join( os.path.dirname(os.path.abspath(__file__)), "visitor_codegen.deleteme.py" ) with open(new_file, "w") as fp: fp.write(new_code) try: format_file(new_file) except Exception: # We failed to format, but this is probably due to invalid code that # black doesn't like. This test will still fail and report to run codegen. pass with open(new_file, "r") as fp: new_code = fp.read() os.remove(new_file) with open( os.path.join( os.path.dirname(os.path.abspath(__file__)), "../../_typed_visitor.py" ), "r", ) as fp: old_code = fp.read() # Now that we've done simple codegen, verify that it matches. > self.assert_code_matches(old_code, new_code, "libcst._typed_visitor") libcst/codegen/tests/test_codegen_clean.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ libcst/codegen/tests/test_codegen_clean.py:23: in assert_code_matches self.assertTrue( E AssertionError: False is not true : libcst._typed_visitor needs new codegen, see `python -m libcst.codegen.generate --help` for instructions, or run `python -m libcst.codegen.generate all` _____________________ TestCodemodCLI.test_codemod_external _____________________ self = def test_codemod_external(self) -> None: # Test running the NOOP command as an "external command" # against this very file. > output = subprocess.check_output( [ sys.executable, "-m", "libcst.tool", "codemod", "-x", # external module "libcst.codemod.commands.noop.NOOPCommand", str(Path(__file__)), ], encoding="utf-8", stderr=subprocess.STDOUT, ) libcst/codemod/tests/test_codemod_cli.py:52: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True popenargs = (['/usr/bin/python3', '-m', 'libcst.tool', 'codemod', '-x', 'libcst.codemod.commands.noop.NOOPCommand', ...],) kwargs = {'encoding': 'utf-8', 'stderr': -2, 'stdout': -1} process = stdout = 'Calculating full-repo metadata...\nExecuting codemod...\n\n\x1b[2KCodemodding /home/tkloczko/rpmbuild/BUILD/LibCST-1....Transformed 0 files successfully.\n - Skipped 0 files.\n - Failed to codemod 1 files.\n - 0 warnings were generated.\n' stderr = None, retcode = 1 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'libcst.tool', 'codemod', '-x', 'libcst.codemod.commands.noop.NOOPCommand', '/home/tkloczko/rpmbuild/BUILD/LibCST-1.0.1/libcst/codemod/tests/test_codemod_cli.py']' returned non-zero exit status 1. /usr/lib64/python3.8/subprocess.py:516: CalledProcessError ______________ TestCodemodCLI.test_codemod_formatter_error_input _______________ self = @skipIf(platform.system() == "Windows", "Windows") def test_codemod_formatter_error_input(self) -> None: rlt = subprocess.run( [ sys.executable, "-m", "libcst.tool", "codemod", "remove_unused_imports.RemoveUnusedImportsCommand", # `ArgumentParser.parse_known_args()`'s behavior dictates that options # need to go after instead of before the codemod command identifier. "--python-version", "3.6", str(Path(__file__).parent / "codemod_formatter_error_input.py.txt"), ], stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) if not is_native(): self.assertIn( "ParserSyntaxError: Syntax Error @ 14:11.", rlt.stderr.decode("utf-8"), ) else: > self.assertIn( "error: cannot format -: Cannot parse: 13:10: async with AsyncExitStack() as stack:", rlt.stderr.decode("utf-8"), ) E AssertionError: 'error: cannot format -: Cannot parse: 13:10: async with AsyncExitStack() as stack:' not found in 'Calculating full-repo metadata...\nExecuting codemod...\n\r\x1b[2KCodemodding /home/tkloczko/rpmbuild/BUILD/LibCST-1.0.1/libcst/codemod/tests/codemod_formatter_error_input.py.txt\nTraceback (most recent call last):\n File "/home/tkloczko/rpmbuild/BUILD/LibCST-1.0.1/libcst/codemod/_cli.py", line 271, in _execute_transform\n input_tree = parse_module(\n File "/home/tkloczko/rpmbuild/BUILD/LibCST-1.0.1/libcst/_parser/entrypoints.py", line 109, in parse_module\n result = _parse(\n File "/home/tkloczko/rpmbuild/BUILD/LibCST-1.0.1/libcst/_parser/entrypoints.py", line 42, in _parse\n from libcst.native import parse_expression, parse_module, parse_statement\nModuleNotFoundError: No module named \'libcst.native\'\n\nFailed to codemod /home/tkloczko/rpmbuild/BUILD/LibCST-1.0.1/libcst/codemod/tests/codemod_formatter_error_input.py.txt\n\n\r\x1b[2K0.00s 0% complete, [calculating] estimated for 1 files to go...\r\x1b[2KFinished codemodding 1 files!\n - Transformed 0 files successfully.\n - Skipped 0 files.\n - Failed to codemod 1 files.\n - 0 warnings were generated.\n' libcst/codemod/tests/test_codemod_cli.py:44: AssertionError =============================== warnings summary =============================== libcst/codemod/tests/test_metadata.py:15 /home/tkloczko/rpmbuild/BUILD/LibCST-1.0.1/libcst/codemod/tests/test_metadata.py:15: PytestCollectionWarning: cannot collect test class 'TestingCollector' because it has a __init__ constructor (from: libcst/codemod/tests/test_metadata.py) class TestingCollector(ContextAwareVisitor): libcst/codemod/tests/test_metadata.py:23 /home/tkloczko/rpmbuild/BUILD/LibCST-1.0.1/libcst/codemod/tests/test_metadata.py:23: PytestCollectionWarning: cannot collect test class 'TestingTransform' because it has a __init__ constructor (from: libcst/codemod/tests/test_metadata.py) class TestingTransform(ContextAwareTransformer): -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ SKIPPED [1] libcst/_nodes/tests/test_atom.py:1172: parse errors are disabled for native parser SKIPPED [1] libcst/_nodes/tests/test_dict.py:176: parse errors are disabled for native parser SKIPPED [1] libcst/_nodes/tests/test_funcdef.py:2151: parse errors are disabled for native parser SKIPPED [1] libcst/_nodes/tests/test_list.py:114: parse errors are disabled for native parser SKIPPED [2] libcst/_nodes/tests/test_matrix_multiply.py:48: parse errors are disabled for native parser SKIPPED [1] libcst/_nodes/tests/test_module.py:78: Disabled for native parser SKIPPED [1] libcst/_nodes/tests/test_set.py:121: parse errors are disabled for native parser SKIPPED [1] libcst/_nodes/tests/test_tuple.py:274: parse errors are disabled for native parser SKIPPED [1] libcst/_nodes/tests/test_with.py:298: parse errors are disabled for native parser SKIPPED [1] libcst/_nodes/tests/test_yield.py:229: parse errors are disabled for native parser SKIPPED [1] libcst/matchers/tests/test_decorators.py:1001: new union syntax not available SKIPPED [1] libcst/tests/test_fuzz.py:77: Hypothesis not requested SKIPPED [1] libcst/tests/test_fuzz.py:50: Hypothesis not requested SKIPPED [1] libcst/tests/test_fuzz.py:105: Hypothesis not requested XFAIL libcst/codemod/tests/test_codemod.py::TestSkipDetection::test_did_not_skip_but_should - reason: XFAIL libcst/codemod/tests/test_codemod.py::TestSkipDetection::test_skipped_but_should_not - reason: FAILED libcst/codegen/tests/test_codegen_clean.py::TestCodegenClean::test_codegen_clean_matcher_classes FAILED libcst/codegen/tests/test_codegen_clean.py::TestCodegenClean::test_codegen_clean_return_types FAILED libcst/codegen/tests/test_codegen_clean.py::TestCodegenClean::test_codegen_clean_visitor_functions FAILED libcst/codemod/tests/test_codemod_cli.py::TestCodemodCLI::test_codemod_external FAILED libcst/codemod/tests/test_codemod_cli.py::TestCodemodCLI::test_codemod_formatter_error_input = 5 failed, 1981 passed, 15 skipped, 2 xfailed, 2 warnings in 61.16s (0:01:01) = ```
zsol commented 1 year ago

Looks like the issue here is that pytest is running from an installed wheel. Some test cases include test data, which is not part of the installed wheel, and so they blow up in this weird way. I'm not even sure the tests themselves should be packaged with the wheel, to be honest.

kloczek commented 1 year ago

Just found that libcst/tests is part of the installed resources. Test suite should not be installed.

mtelka commented 7 months ago

Tests fails similarly when run from sdist too. So it looks like the sdist is missing some data, as suggested above.