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

Pytest on cygwin doesn't find files #2196

Closed
leavens opened this issue Jan 14, 2017 · 1 comment
Closed

Pytest on cygwin doesn't find files #2196

leavens opened this issue Jan 14, 2017 · 1 comment

Comments

@leavens
Copy link

leavens commented Jan 14, 2017

When I run pytest from the cygwin shell, I get output like:

/home/leavens/temp/class$ pytest
============================= test session starts =============================
platform win32 -- Python 3.6.0, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: C:\cygwin64\home\leavens\temp\class, inifile:

======================== no tests ran in 0.01 seconds =========================
ERROR: file not found:

But in this directory, things work fine if I run it from the Windows command shell:

c:\cygwin64\home\leavens\temp\class>pytest
============================= test session starts =============================
platform win32 -- Python 3.6.0, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: c:\cygwin64\home\leavens\temp\class, inifile:
collected 1 items

test_multiply.py .

========================== 1 passed in 0.04 seconds ===========================

Back in cygwin, if I run pytest -v it seems to think there is an '\r' specified as an implicit argument:

/home/leavens/temp/class$ pytest -v
usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: argument -v/--verbose: ignored explicit argument '\r'

To me this indicates some kind of error in the command line parsing on cygwin. When I run pytest -v from the Windows cmd shell I get the expected result:

C:\cygwin64\home\leavens\temp\class>pytest -v
============================= test session starts =============================
platform win32 -- Python 3.6.0, pytest-3.0.5, py-1.4.32, pluggy-0.4.0 -- c:\user
s\leave\appdata\local\programs\python\python36-32\python.exe
cachedir: .cache
rootdir: C:\cygwin64\home\leavens\temp\class, inifile:
collected 1 items

test_multiply.py::test_multiply PASSED

========================== 1 passed in 0.03 seconds ===========================

Back in cygwin, I have a similar problem with pytest -h:

/home/leavens/temp/class$ pytest -h
usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: argument -h/--help: ignored explicit argument '\r'
/home/leavens/temp/class$

Again this behaves as expected (showing the help info) from the Windows cmd shell.

To me all of this points to some configuration or parsing difference between the command lines on cygwin and the Windows cmd shell. This makes pytest virtually unusable on cygwin for me.

The following is the output of "pip list" (on cygwin, with the same output from the Windows cmd shell):

/home/leavens/temp/class$ pip list
DEPRECATION: The default format will switch to columns in the future. You can us
e --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.con
f under the [list] section) to disable this warning.
colorama (0.3.7)
pip (9.0.1)
py (1.4.32)
pytest (3.0.5)
setuptools (28.8.0)

I'm using pytest 3.0.5 under Python 3.6 and Windows 10

I'm attaching a zip of the files in my directory:
files.zip
multiply.py and test_multiply.py.

@leavens
Copy link
Author

leavens commented Jan 14, 2017

I found that the problem was my shell script to call pytest didn't have Unix line endings (instead it had DOS line endings). Once I fixed my shell script, all is well and the problem reported goes away. Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant