Skip to content

problem collecting files with spaces in filename (regressed in 2.9.2 version) #1706

@ldiary

Description

@ldiary

I have this code working in pytest 2.9.1 version:

>>> import os
>>> import pytest
>>> saved_path = os.getcwd()
>>> path = "testbooks\colo\Service_and_Order"
>>> os.chdir(os.path.join(saved_path, path))
>>> os.getcwd()
'C:\\Users\\ernesto.luzon\\tronline\\nboss-ci\\testrunner\\testbooks\\colo\\Service_and_Order'
>>> arguments = '-sv --collect-only --junitxml=616_testlog.xml "Provision Colo Service.ipynb"'
>>> pytest.main(args=arguments)
============================= test session starts =============================
platform win32 -- Python 3.5.1, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 -- C:\Users\ernesto.luzon\tronline\pyenv351\Scripts\python.exe
cachedir: ..\..\.cache
rootdir: C:\Users\ernesto.luzon\tronline\nboss-ci\testrunner\testbooks, inifile: pytest.ini
plugins: testbook-0.0.5
collected 23 items
<Testbook 'Provision Colo Service'>
  <Teststep 'when_i_prepare_customer'>
  <Teststep 'when_i_prepare_contact'>
  <Teststep 'when_i_create_and_edit_room'>
  <Teststep 'when_i_create_and_edit_room'>
  <Teststep 'when_i_create_and_edit_rack'>
  <Teststep 'when_i_create_and_edit_cage'>
  <Teststep 'when_i_create_and_edit_sensor'>
  <Teststep 'when_i_create_and_edit_gate'>
  <Teststep 'when_i_prepare_account_manager'>
  <Teststep 'when_i_create_an_order'>
  <Teststep 'when_i_add_colo_service'>
  <Teststep 'when_i_submit_order'>
  <Teststep 'when_i_link_to_project'>
  <Teststep 'when_i_start_actioning'>
  <Teststep 'when_set_live_date'>
  <Teststep 'when_i_add_colo_cab'>
  <Teststep 'when_i_create_a_colo_permission_for_the_contact'>
  <Teststep 'when_i_activate_colo_cab'>
  <Teststep 'when_i_activate_service'>
  <Teststep 'when_i_complete_the_order'>
  <Teststep 'when_i_deploy_to_customer_portal'>
  <Teststep 'when_i_set_portal_password'>
  <Teststep 'when_i_access_colo_cab_from_customer_portal'>

 generated xml file: C:\Users\ernesto.luzon\tronline\nboss-ci\testrunner\testbooks\colo\Service_and_Order\616_testlog.xml
======================== no tests ran in 0.77 seconds =========================
0
>>> exit()

After the 2.9.2 release, the same code no longer works:

>>> import pytest
>>> import os
>>> saved_path = os.getcwd()
>>> path = "testbooks\colo\Service_and_Order"
>>> os.chdir(os.path.join(saved_path, path))
>>> os.getcwd()
'C:\\Users\\ernesto.luzon\\tronline\\nboss-ci\\testrunner\\testbooks\\colo\\Service_and_Order'
>>> arguments = '-sv --collect-only --junitxml=616_testlog.xml "Provision Colo Service.ipynb"'
>>> pytest.main(args=arguments)
============================= test session starts =============================
platform win32 -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1 -- C:\Users\ernesto.luzon\tronline\pyenv351\Scripts\python
cachedir: ..\..\.cache
rootdir: C:\Users\ernesto.luzon\tronline\nboss-ci\testrunner\testbooks, inifile: pytest.ini
plugins: testbook-0.0.5

 generated xml file: C:\Users\ernesto.luzon\tronline\nboss-ci\testrunner\testbooks\colo\Service_and_Order\616_testlog.xml
======================== no tests ran in 0.75 seconds =========================
ERROR: file not found: A
4
>>> exit()

Perhaps related to what the change log says:
"Fix win32 path issue when puttinging custom config file with absolute path in pytest.main("-c your_absolute_path")."
But I don't know yet which commit to look at and how to figure a workaround on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions