Skip to content

Instantly share code, notes, and snippets.

@christianmlong
Created July 20, 2015 20:12
Show Gist options
  • Save christianmlong/f3fb115c2ff65cd6602d to your computer and use it in GitHub Desktop.
Save christianmlong/f3fb115c2ff65cd6602d to your computer and use it in GitHub Desktop.
How to uninstall the obsolete version of pytest that pylint comes with
# Are we in a virtual environment? We can't return values from bash functions.
# Instead, in the calling function, use command substitution to get the result.
# For example:
# MY_VAR=$(in_virtualenv)
function in_virtualenv
{
python -c 'import sys; print(sys.real_prefix)' > /dev/null 2>&1 && INVENV=1 || INVENV=0
echo "$INVENV"
}
# Remove obsolete "pytest" script, that comes with pylint
function remove_obsolete_pytest
{
INVENV=$(in_virtualenv)
if [[ $INVENV -eq 0 ]]; then
echo "Not in a virtual environment"
else
PYTEST_PATH=$VIRTUAL_ENV/bin/pytest
# Remove the obsolete `pytest` script that pylint installs.
if [[ -a $PYTEST_PATH ]]; then
rm $PYTEST_PATH
echo "Removed obsolete pytest script"
else
echo "Obsolete pytest script not found"
fi
echo $PYTEST_PATH
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment