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

Python 3 compatible? #1

Open
hoogervorst opened this issue Mar 1, 2017 · 5 comments · Fixed by qhirmer/monkeypatch#1 · May be fixed by #2
Open

Python 3 compatible? #1

hoogervorst opened this issue Mar 1, 2017 · 5 comments · Fixed by qhirmer/monkeypatch#1 · May be fixed by #2

Comments

@hoogervorst
Copy link

Getting an error while installing. Guess the code is not Python 3 compatible?

File "../T/pip-build-1rsdc20f/monkeypatch/setup.py", line 99
except ImportError, e:
^
SyntaxError: invalid syntax

@TimurNurlygayanov
Copy link

No :) Not compatible. The same issue for me.

TimurNurlygayanov added a commit to TimurNurlygayanov/monkeypatch that referenced this issue Apr 20, 2017
@TimurNurlygayanov TimurNurlygayanov linked a pull request Apr 20, 2017 that will close this issue
@joaoe
Copy link

joaoe commented May 23, 2019

This has been fixed long ago. Can be closed.

@macetw
Copy link

macetw commented May 7, 2020

@joaoe This should not be closed without a fix released. According to the release notes, there was no release since 2011. "pip3 install monkeypatch" tries to install 0.1rc3. That's the most recent one, from 2011, but this was fixed in 2017. That fix hasn't found its way to the public yet.

I see this error today on the command line, using python 3.7.

@vitodsk
Copy link

vitodsk commented May 11, 2020

@joaoe This should not be closed without a fix released. According to the release notes, there was no release since 2011. "pip3 install monkeypatch" tries to install 0.1rc3. That's the most recent one, from 2011, but this was fixed in 2017. That fix hasn't found its way to the public yet.

I see this error today on the command line, using python 3.7.

I totally quote. Trying to install it today as of May 2020 and pip3 cannot install it. The fix should be included in the release.

@macetw
Copy link

macetw commented May 11, 2020

I overcame the problem by using monkeypatch differently. Monkeypatch is a module within a module: a module within pytest. I don't pip3 install it directly. I use it like so:

from _pytest.monkeypatch import MonkeyPatch

def _fake_subprocess_call(monkeypatch: MonkeyPatch):
     def _fake_subprocess_call( args, cwd ):
            do_whatever_other_thing(...)
     monkeypatch.setattr(function_i_made.subprocess, "run", _fake_subprocess_call)

I suggest removing it from pip3 entirely, if this is the way to do this in python3. And keep it there for python-2-based pip.

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