mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Combine tests/functional/test_vcs.py with other test modules.
This commit is contained in:
parent
f115d1fa2d
commit
48b55eb95e
3 changed files with 30 additions and 32 deletions
0
news/5CACBF2F-4917-4C85-9F41-32C2F998E8AD.trivial
Normal file
0
news/5CACBF2F-4917-4C85-9F41-32C2F998E8AD.trivial
Normal file
|
@ -1,32 +0,0 @@
|
|||
import os
|
||||
|
||||
from pip._internal.utils.temp_dir import TempDirectory
|
||||
from pip._internal.vcs.git import Git
|
||||
|
||||
|
||||
def test_git_dir_ignored():
|
||||
"""
|
||||
Test that a GIT_DIR environment variable is ignored.
|
||||
"""
|
||||
git = Git()
|
||||
with TempDirectory() as temp:
|
||||
temp_dir = temp.path
|
||||
env = {'GIT_DIR': 'foo'}
|
||||
# If GIT_DIR is not ignored, then os.listdir() will return ['foo'].
|
||||
git.run_command(['init', temp_dir], cwd=temp_dir, extra_environ=env)
|
||||
assert os.listdir(temp_dir) == ['.git']
|
||||
|
||||
|
||||
def test_git_work_tree_ignored():
|
||||
"""
|
||||
Test that a GIT_WORK_TREE environment variable is ignored.
|
||||
"""
|
||||
git = Git()
|
||||
with TempDirectory() as temp:
|
||||
temp_dir = temp.path
|
||||
git.run_command(['init', temp_dir], cwd=temp_dir)
|
||||
# Choose a directory relative to the cwd that does not exist.
|
||||
# If GIT_WORK_TREE is not ignored, then the command will error out
|
||||
# with: "fatal: This operation must be run in a work tree".
|
||||
env = {'GIT_WORK_TREE': 'foo'}
|
||||
git.run_command(['status', temp_dir], extra_environ=env, cwd=temp_dir)
|
|
@ -2,6 +2,8 @@
|
|||
Contains functional tests of the Git class.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from pip._internal.utils.temp_dir import TempDirectory
|
||||
|
@ -40,6 +42,34 @@ def check_rev(repo_dir, rev, expected_sha):
|
|||
assert git.get_revision_sha(repo_dir, rev) == expected_sha
|
||||
|
||||
|
||||
def test_git_dir_ignored():
|
||||
"""
|
||||
Test that a GIT_DIR environment variable is ignored.
|
||||
"""
|
||||
git = Git()
|
||||
with TempDirectory() as temp:
|
||||
temp_dir = temp.path
|
||||
env = {'GIT_DIR': 'foo'}
|
||||
# If GIT_DIR is not ignored, then os.listdir() will return ['foo'].
|
||||
git.run_command(['init', temp_dir], cwd=temp_dir, extra_environ=env)
|
||||
assert os.listdir(temp_dir) == ['.git']
|
||||
|
||||
|
||||
def test_git_work_tree_ignored():
|
||||
"""
|
||||
Test that a GIT_WORK_TREE environment variable is ignored.
|
||||
"""
|
||||
git = Git()
|
||||
with TempDirectory() as temp:
|
||||
temp_dir = temp.path
|
||||
git.run_command(['init', temp_dir], cwd=temp_dir)
|
||||
# Choose a directory relative to the cwd that does not exist.
|
||||
# If GIT_WORK_TREE is not ignored, then the command will error out
|
||||
# with: "fatal: This operation must be run in a work tree".
|
||||
env = {'GIT_WORK_TREE': 'foo'}
|
||||
git.run_command(['status', temp_dir], extra_environ=env, cwd=temp_dir)
|
||||
|
||||
|
||||
def test_get_revision_sha(script):
|
||||
with TempDirectory(kind="testing") as temp:
|
||||
repo_dir = temp.path
|
||||
|
|
Loading…
Reference in a new issue