Navigation Menu

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

1.12.0: test_automatic_rename_option failure #788

Closed
dvzrv opened this issue Aug 1, 2022 · 8 comments
Closed

1.12.0: test_automatic_rename_option failure #788

dvzrv opened this issue Aug 1, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@dvzrv
Copy link

dvzrv commented Aug 1, 2022

Step 1: Provide a summary of your problem

Hi! Upon trying to package 1.12.0 for Arch Linux I ran into issues with test_automatic_rename_option.

Step 2: Provide tmuxp details

  • python 3.10.5
  • tmuxp 1.12.0
  • libtmux 0.12.0
  • kaptan 0.5.12
  • colorama 0.4.5
  • click 8.1.3
  • pytest 7.1.2

Step 3: Describe the problem:

Steps to reproduce:

  1. python -m build --wheel --no-isolation
  2. pytest -vv
  3. ...

Observed Results:

=================================== FAILURES ===================================
_________________________ test_automatic_rename_option _________________________

session = Session($1 libtmux_5qtbopkd)

    def test_automatic_rename_option(session):
        """With option automatic-rename: on."""
        yaml_config = test_utils.read_config_file(
            "workspacebuilder/window_automatic_rename.yaml"
        )
        s = session
        sconfig = kaptan.Kaptan(handler="yaml")
        sconfig = sconfig.import_config(yaml_config).get()

        # This should be a command guaranteed to be terminal name across systems
        portable_command = sconfig["windows"][0]["panes"][0]["shell_command"][0]["cmd"]
        # If a command is like "man ls", get the command base name, "ls"
        if " " in portable_command:
            portable_command = portable_command.split(" ")[0]

        builder = WorkspaceBuilder(sconf=sconfig)

        window_count = len(session._windows)  # current window count
        assert len(s._windows) == window_count
        for w, wconf in builder.iter_create_windows(s):

            for p in builder.iter_create_panes(w, wconf):
                w.select_layout("tiled")  # fix glitch with pane size
                p = p
                assert len(s._windows), window_count
            assert isinstance(w, Window)
            assert w.show_window_option("automatic-rename") == "on"

            assert len(s._windows) == window_count

            window_count += 1
            w.select_layout(wconf["layout"])

        assert s.name != "tmuxp"
        w = s.windows[0]

        def check_window_name_mismatch() -> bool:
            session.server._update_windows()
            return w.name != portable_command

        assert retry_until(check_window_name_mismatch, 2, interval=0.25)

        pane_base_index = w.show_window_option("pane-base-index", g=True)
        w.select_pane(pane_base_index)

        def check_window_name_match() -> bool:
            session.server._update_windows()
            return w.name == portable_command

>       assert retry_until(
            check_window_name_match, 2, interval=0.25
        ), f"Window name {w.name} should be {portable_command}"

tests/test_workspacebuilder.py:401:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

fun = <function test_automatic_rename_option.<locals>.check_window_name_match at 0x6d9ff9bb44c0>
seconds = 2

    def retry_until(
        fun: Callable,
        seconds: float = RETRY_TIMEOUT_SECONDS,
        *,
        interval: float = RETRY_INTERVAL_SECONDS,
        raises: Optional[bool] = True,
    ) -> bool:
        """
        Retry a function until a condition meets or the specified time passes.

        Parameters
        ----------
        fun : callable
            A function that will be called repeatedly until it returns ``True``  or
            the specified time passes.
        seconds : float
            Seconds to retry. Defaults to ``8``, which is configurable via
            ``RETRY_TIMEOUT_SECONDS`` environment variables.
        interval : float
            Time in seconds to wait between calls. Defaults to ``0.05`` and is
            configurable via ``RETRY_INTERVAL_SECONDS`` environment variable.
        raises : bool
            Wether or not to raise an exception on timeout. Defaults to ``True``.

        Examples
        --------

        >>> def f():
        ...     p = w.attached_pane
        ...     p.server._update_panes()
        ...     return p.current_path == pane_path
        ...
        ... retry(f)

        In pytest:

        >>> assert retry(f, raises=False)
        """
        ini = time.time()

        while not fun():
            end = time.time()
            if end - ini >= seconds:
                if raises:
>                   raise WaitTimeout()
E                   libtmux.exc.WaitTimeout

/usr/lib/python3.10/site-packages/libtmux/test.py:115: WaitTimeout
=============================== warnings summary ===============================
../../../../usr/lib/python3.10/site-packages/libtmux/common.py:484: 1 warning
tests/test_cli.py: 226 warnings
tests/test_plugin.py: 10 warnings
tests/test_util.py: 8 warnings
tests/test_workspacebuilder.py: 205 warnings
tests/test_workspacefreezer.py: 5 warnings
tests/tests/test_helpers.py: 12 warnings
  /usr/lib/python3.10/site-packages/libtmux/common.py:484: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    return LooseVersion(version)

../../../../usr/lib/python3.10/site-packages/libtmux/common.py:569
  /usr/lib/python3.10/site-packages/libtmux/common.py:569: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    return get_version() < LooseVersion(max_version)

tests/test_cli.py: 172 warnings
tests/test_util.py: 8 warnings
tests/test_workspacebuilder.py: 205 warnings
tests/test_workspacefreezer.py: 5 warnings
tests/tests/test_helpers.py: 12 warnings
  /usr/lib/python3.10/site-packages/libtmux/common.py:535: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    return get_version() >= LooseVersion(min_version)

tests/test_cli.py: 52 warnings
  /usr/lib/python3.10/site-packages/libtmux/common.py:602: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if get_version() < LooseVersion(TMUX_MIN_VERSION):

tests/test_cli.py: 1 warning
tests/test_plugin.py: 10 warnings
  /build/tmuxp/src/tmuxp-1.12.0/tmuxp/plugin.py:87: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    self.tmuxp_version = LooseVersion(__version__)

tests/test_cli.py: 3 warnings
tests/test_plugin.py: 48 warnings
  /build/tmuxp/src/tmuxp-1.12.0/tmuxp/plugin.py:138: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if vmin and version < LooseVersion(vmin):

tests/test_cli.py: 1 warning
tests/test_plugin.py: 34 warnings
  /usr/lib/python3.10/site-packages/setuptools/_distutils/version.py:351: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    other = LooseVersion(other)

tests/test_cli.py: 1 warning
tests/test_plugin.py: 11 warnings
  /build/tmuxp/src/tmuxp-1.12.0/tmuxp/plugin.py:140: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if vmax and version > LooseVersion(vmax):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_workspacebuilder.py::test_automatic_rename_option - libtmux...
=========== 1 failed, 178 passed, 2 skipped, 1031 warnings in 27.14s ===========

Full build log:
tmuxp-1.12.0-1-x86_64-build.log

Full test log:
tmuxp-1.12.0-1-x86_64-check.log

Expected Results:

All tests pass

Relevant Code:

@tony tony added the bug Something isn't working label Aug 1, 2022
@tony
Copy link
Member

tony commented Aug 1, 2022

Looks like we're not out of the woods yet as far as bug fixes go.

Do you know of any github actions that would let us test on Arch? https://github.com/uraimo/run-on-arch-action?

@dvzrv
Copy link
Author

dvzrv commented Aug 2, 2022

You can directly incorporate the official Arch Linux container in github's CI, install all required packages to it, build the same way we do (using PEP517) and run tests with pytest in there. If I find time, I can have a look into providing a PR for this, unless your setup is very complex ;-)

@tony
Copy link
Member

tony commented Aug 2, 2022

I can have a look into providing a PR for this, unless your setup is very complex ;-)

You can try, or alternatively show an example github CI file of an arch workflow

@dvzrv
Copy link
Author

dvzrv commented Sep 24, 2022

FWIW, this is still an issue with 1.15.1

@dvzrv
Copy link
Author

dvzrv commented Sep 24, 2022

You can try, or alternatively show an example github CI file of an arch workflow

You can have a look at this for using the official Arch Linux container: https://github.com/jackaudio/jack-example-tools/blob/c3d07f03454da5bb8f4a03acd1417efd53f2cff0/.github/workflows/build.yml#L36-L49

@tony
Copy link
Member

tony commented Sep 24, 2022

@dvzrv Thank you for keeping in touch on this test! I am actively working on improving the tests to work perfectly across platforms

You can have a look at this for using the official Arch Linux container: https://github.com/jackaudio/jack-example-tools/blob/c3d07f03454da5bb8f4a03acd1417efd53f2cff0/.github/workflows/build.yml#L36-L49

Thank you for this!

@tony
Copy link
Member

tony commented Dec 28, 2022

@dvzrv Does tests/workspace/test_builder.py::test_automatic_rename_option still fail with the latest tmuxp/libtmux?

@dvzrv
Copy link
Author

dvzrv commented Dec 30, 2022

This seems fixed with libtmux 0.18.1/ tmuxp 1.22.1

Thank you!

@dvzrv dvzrv closed this as completed Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants