Skip to content

"OSError: [WinError 6] The handle is invalid" on Windows for some votable validation tests #14791

Description

@pllim

astropy v5.3rc1

_____________________________________________ test_validate_output_invalid _____________________________________________

    def test_validate_output_invalid():
...
        # When output is not set, check that validate returns a bool
>       validate_out = validate(invalid_votable_filepath)

C:\...\astropy\io\votable\tests\table_test.py:368:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  

source = 'C:\\...\\astropy\\io\\votable\\tests\\data\\regression.xml'
output = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, xmllint = False
filename = 'C:\\...\\astropy\\io\\votable\\tests\\data\\regression.xml'

    def validate(source, output=sys.stdout, xmllint=False, filename=None):
...
        content_buffer.seek(0)
>       output.write(f"Validation report for {filename}\n\n")
E       OSError: [WinError 6] The handle is invalid

C:\...\astropy\io\votable\table.py:309: OSError
______________________________________________ test_validate_output_valid ______________________________________________

    def test_validate_output_valid():
...
        # When output is not set, check that validate returns a bool
>       validate_out = validate(valid_votable_filepath)

C:\...\astropy\io\votable\tests\table_test.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  

source = 'C:\\...\\astropy\\io\\votable\\tests\\data\\valid_votable.xml'
output = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, xmllint = False
filename = 'C:\\...\\astropy\\io\\votable\\tests\\data\\valid_votable.xml'

    def validate(source, output=sys.stdout, xmllint=False, filename=None):
...
>       output.write(f"Validation report for {filename}\n\n")
E       OSError: [WinError 6] The handle is invalid

C:\...\astropy\io\votable\table.py:309: OSError
_______________________________________________ test_validate_tilde_path _______________________________________________

home_is_data = None

    def test_validate_tilde_path(home_is_data):
>       validate(os.path.join("~", "valid_votable.xml"))

C:\...\astropy\io\votable\tests\table_test.py:397:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  

source = 'C:\\...\\astropy\\io\\votable\\tests\\data\\valid_votable.xml'
output = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, xmllint = False
filename = 'C:\\...\\astropy\\io\\votable\\tests\\data\\valid_votable.xml'

    def validate(source, output=sys.stdout, xmllint=False, filename=None):
...
        content_buffer.seek(0)
>       output.write(f"Validation report for {filename}\n\n")
E       OSError: [WinError 6] The handle is invalid

C:\...\astropy\io\votable\table.py:309: OSError
______________________________________________ test_validate_xmllint_true ______________________________________________

mock_subproc_popen = <MagicMock name='Popen' id='...'>

    @mock.patch("subprocess.Popen")
    def test_validate_xmllint_true(mock_subproc_popen):
...
>       assert validate(get_pkg_data_filename("data/empty_table.xml"), xmllint=True)

C:\...\astropy\io\votable\tests\vo_test.py:836:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  

source = 'C:\\...\\astropy\\io\\votable\\tests\\data\\empty_table.xml'
output = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, xmllint = True
filename = 'C:\\...\\astropy\\io\\votable\\tests\\data\\empty_table.xml'

    def validate(source, output=sys.stdout, xmllint=False, filename=None):
...
        content_buffer.seek(0)
>       output.write(f"Validation report for {filename}\n\n")
E       OSError: [WinError 6] The handle is invalid

C:\...\astropy\io\votable\table.py:309: OSError

Note to self: Had the hardest building astropy from source on Windows to debug this. Future self, please see pypa/setuptools#2028 (comment) and then if astropy.__version__ not found, delete the extra astropy folder in site-packages. pytest from CLI complains about too many conftest.py but calling astropy.test(...) works.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions