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

Fix pytest for mac by replacing grep with perl #2930

Merged
merged 2 commits into from
Apr 22, 2020

Conversation

tanujkhattar
Copy link
Collaborator

grep -P does not work on mac anymore. Replace it with perl -nle instead.

@googlebot googlebot added the cla: yes Makes googlebot stop complaining. label Apr 21, 2020
@vtomole
Copy link
Collaborator

vtomole commented Apr 22, 2020

mac anymore

Since when? What version of Mac? This is not the only place we call grep.

@tanujkhattar
Copy link
Collaborator Author

This is the only place we call grep -P i.e. use perl regex with grep.

It looks it's been quite a while, so I guess for this project it might have never worked on a mac by default, unless people have a GNU grep version installed. I can dig in more to find relevant information on the difference if that's necessary.

@vtomole
Copy link
Collaborator

vtomole commented Apr 22, 2020

@tanujkhattar

The macOS that we are running on Github Workflow doesn't seem to be running into this problem. What version of mac gives this error? The version we are running must be different.

@tanujkhattar
Copy link
Collaborator Author

$> grep --version
grep (BSD grep) 2.5.1-FreeBSD

Copy link
Collaborator

@viathor viathor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked on my Mac and indeed, -P is missing:

usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
	[-e pattern] [-f file] [--binary-files=value] [--color=when]
	[--context[=num]] [--directories=action] [--label] [--line-buffered]
	[--null] [pattern] [file ...]

Also, checked that the perl command works on my Mac and Linux.

@tanujkhattar tanujkhattar merged commit d0ec891 into quantumlib:master Apr 22, 2020
@tanujkhattar tanujkhattar deleted the fix_pytest_mac branch April 22, 2020 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants