Skip to content

ERROR: test_open_windows (tests.test_output.TestFileOutput) ... AttributeError: <module 'streamlink_cli.output' does not have the attribute 'msvcrt' #4102

@mjevans

Description

@mjevans

Checklist

Streamlink version

Latest build from the master branch

Description

I use the archlinux package (streamlink-git) which pulls from the master / main branch on github. By default the build script runs the unit tests too.

It looks like test_open_windows() is generating an AttributeError because of msvcrt, which only exists for Micorosft Windows platforms.

Example of working

@unittest.skipIf(not is_win32, "test only applicable on Windows")

BUG

@windows_only

Though it would be more future proof if is_Nix or similar existed rather than just is_win32 vs not is_win32.

Debug log

test_close_before_open (tests.utils.test_named_pipe.TestNamedPipeWindows) ... skipped 'test only applicable on Windows'
test_create (tests.utils.test_named_pipe.TestNamedPipeWindows) ... skipped 'test only applicable on Windows'
test_export (tests.utils.test_named_pipe.TestNamedPipeWindows) ... skipped 'test only applicable on Windows'
test_named_pipe (tests.utils.test_named_pipe.TestNamedPipeWindows) ... skipped 'test only applicable on Windows'
test_parse_json (tests.utils.test_parse.TestUtilsParse) ... ok
test_parse_qsd (tests.utils.test_parse.TestUtilsParse) ... ok
test_parse_xml (tests.utils.test_parse.TestUtilsParse) ... ok
test_parse_xml_entities (tests.utils.test_parse.TestUtilsParse) ... ok
test_parse_xml_entities_fail (tests.utils.test_parse.TestUtilsParse) ... ok
test_parse_xml_fail (tests.utils.test_parse.TestUtilsParse) ... ok
test_parse_xml_ns (tests.utils.test_parse.TestUtilsParse) ... ok
test_parse_xml_ns_ignore (tests.utils.test_parse.TestUtilsParse) ... ok
test_parse_xml_validate (tests.utils.test_parse.TestUtilsParse) ... ok
test_swf_decompress (tests.utils.test_swf.TestUtilsSWF) ... ok
test_hours_minutes_seconds (tests.utils.test_times.TestUtilsTimes) ... ok
test_seconds_to_hhmmss (tests.utils.test_times.TestUtilsTimes) ... ok

======================================================================
ERROR: test_open_windows (tests.test_output.TestFileOutput)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/unittest/mock.py", line 1334, in patched
    with self.decoration_helper(patched,
  File "/usr/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/usr/lib/python3.9/unittest/mock.py", line 1316, in decoration_helper
    arg = exit_stack.enter_context(patching)
  File "/usr/lib/python3.9/contextlib.py", line 448, in enter_context
    result = _cm_type.__enter__(cm)
  File "/usr/lib/python3.9/unittest/mock.py", line 1405, in __enter__
    original, local = self.get_original()
  File "/usr/lib/python3.9/unittest/mock.py", line 1378, in get_original
    raise AttributeError(
AttributeError: <module 'streamlink_cli.output' from '~/.cache/yay/streamlink-git/src/streamlink/src/streamlink_cli/output.py'> does not have the attribute 'msvcrt'

----------------------------------------------------------------------
Ran 640 tests in 11.437s

FAILED (errors=1, skipped=23)

cd ; git log -n 1  
commit 765f969dfd6348a5d07c442c8980ea674bf6035f (HEAD -> master, origin/master, origin/HEAD)
Author: bastimeyer <mail@bastimeyer.de>
Date:   Thu Oct 14 00:03:01 2021 +0200

    ci.github: switch to codecov-action@v2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions