This commit is contained in:
Michael 2018-12-17 00:38:12 +05:00
parent aca25db85d
commit 35a9a8a8ba
10 changed files with 32 additions and 32 deletions

View file

@ -1,7 +1,7 @@
from nose.tools import eq_ as eq
import logging
from ConfigParser import RawConfigParser
from configparser import RawConfigParser
from gitosis import access

View file

@ -1,7 +1,7 @@
from nose.tools import eq_ as eq
import os
from ConfigParser import RawConfigParser
from configparser import RawConfigParser
from gitosis import gitdaemon
from gitosis.test.util import maketemp, writeFile

View file

@ -1,8 +1,8 @@
from nose.tools import eq_ as eq
import os
from ConfigParser import RawConfigParser
from cStringIO import StringIO
from configparser import RawConfigParser
from io import StringIO
from gitosis import gitweb
from gitosis.test.util import mkdir, maketemp, readFile, writeFile

View file

@ -1,6 +1,6 @@
from nose.tools import eq_ as eq, assert_raises
from ConfigParser import RawConfigParser
from configparser import RawConfigParser
from gitosis import group

View file

@ -2,7 +2,7 @@ from nose.tools import eq_ as eq
from gitosis.test.util import assert_raises, maketemp
import os
from ConfigParser import RawConfigParser
from configparser import RawConfigParser
from gitosis import init
from gitosis import repository
@ -113,7 +113,7 @@ def test_init_admin_repository():
'hooks',
'post-update',
)
util.check_mode(hook, 0755, is_file=True)
util.check_mode(hook, 0o755, is_file=True)
got = util.readFile(hook).splitlines()
assert 'gitosis-run-hook post-update' in got
export_dir = os.path.join(tmp, 'export')

View file

@ -23,17 +23,17 @@ def test_init_simple():
tmp = maketemp()
path = os.path.join(tmp, 'repo.git')
repository.init(path)
check_mode(path, 0750, is_dir=True)
check_mode(path, 0o750, is_dir=True)
check_bare(path)
def test_init_exist_dir():
tmp = maketemp()
path = os.path.join(tmp, 'repo.git')
mkdir(path, 0710)
check_mode(path, 0710, is_dir=True)
mkdir(path, 0o710)
check_mode(path, 0o710, is_dir=True)
repository.init(path)
# my weird access mode is preserved
check_mode(path, 0710, is_dir=True)
check_mode(path, 0o710, is_dir=True)
check_bare(path)
def test_init_exist_git():
@ -41,7 +41,7 @@ def test_init_exist_git():
path = os.path.join(tmp, 'repo.git')
repository.init(path)
repository.init(path)
check_mode(path, 0750, is_dir=True)
check_mode(path, 0o750, is_dir=True)
check_bare(path)
def test_init_templates():
@ -53,7 +53,7 @@ def test_init_templates():
)
# for reproducibility
os.umask(0022)
os.umask(0o022)
repository.init(path, template=templatedir)
repository.init(path)
@ -61,7 +61,7 @@ def test_init_templates():
eq(got, 'i should show up\n')
check_mode(
os.path.join(path, 'hooks', 'post-update'),
0755,
0o755,
is_file=True,
)
got = readFile(os.path.join(path, 'hooks', 'post-update'))
@ -91,7 +91,7 @@ PATH="${PATH#*:}"
exec git "$@"
''')
os.chmod(mockgit, 0755)
os.chmod(mockgit, 0o755)
magic_cookie = '%d' % random.randint(1, 100000)
good_path = os.environ['PATH']
try:
@ -130,7 +130,7 @@ PATH="${PATH#*:}"
exec git "$@"
''')
os.chmod(mockgit, 0755)
os.chmod(mockgit, 0o755)
magic_cookie = '%d' % random.randint(1, 100000)
good_path = os.environ['PATH']
try:
@ -226,7 +226,7 @@ PATH="${PATH#*:}"
exec git "$@"
''')
os.chmod(mockgit, 0755)
os.chmod(mockgit, 0o755)
repository.init(path=git_dir)
repository.fast_import(
git_dir=git_dir,
@ -301,7 +301,7 @@ PATH="${PATH#*:}"
exec git "$@"
''')
os.chmod(mockgit, 0755)
os.chmod(mockgit, 0o755)
repository.init(path=tmp)
repository.fast_import(
git_dir=tmp,

View file

@ -1,8 +1,8 @@
from nose.tools import eq_ as eq
import os
from ConfigParser import RawConfigParser
from cStringIO import StringIO
from configparser import RawConfigParser
from io import StringIO
from gitosis import init, repository, run_hook
from gitosis.test.util import maketemp, readFile

View file

@ -3,8 +3,8 @@ from gitosis.test.util import assert_raises
import logging
import os
from cStringIO import StringIO
from ConfigParser import RawConfigParser
from io import StringIO
from configparser import RawConfigParser
from gitosis import serve
from gitosis import repository
@ -354,7 +354,7 @@ def test_push_inits_subdir_parent_missing():
)
eq(os.listdir(repositories), ['foo'])
foo = os.path.join(repositories, 'foo')
util.check_mode(foo, 0750, is_dir=True)
util.check_mode(foo, 0o750, is_dir=True)
eq(os.listdir(foo), ['bar.git'])
assert os.path.isfile(os.path.join(repositories, 'foo', 'bar.git', 'HEAD'))
@ -366,7 +366,7 @@ def test_push_inits_subdir_parent_exists():
os.mkdir(repositories)
foo = os.path.join(repositories, 'foo')
# silly mode on purpose; not to be touched
os.mkdir(foo, 0751)
os.mkdir(foo, 0o751)
cfg.set('gitosis', 'repositories', repositories)
generated = os.path.join(tmp, 'generated')
os.mkdir(generated)
@ -380,7 +380,7 @@ def test_push_inits_subdir_parent_exists():
command="git-receive-pack 'foo/bar.git'",
)
eq(os.listdir(repositories), ['foo'])
util.check_mode(foo, 0751, is_dir=True)
util.check_mode(foo, 0o751, is_dir=True)
eq(os.listdir(foo), ['bar.git'])
assert os.path.isfile(os.path.join(repositories, 'foo', 'bar.git', 'HEAD'))

View file

@ -1,7 +1,7 @@
from nose.tools import eq_ as eq, assert_raises
import os
from cStringIO import StringIO
from io import StringIO
from gitosis import ssh
from gitosis.test.util import mkdir, maketemp, writeFile, readFile
@ -171,7 +171,7 @@ class WriteAuthorizedKeys_Test(object):
def test_simple(self):
tmp = maketemp()
path = os.path.join(tmp, 'authorized_keys')
f = file(path, 'w')
f = open(path, 'w')
try:
f.write('''\
# foo

View file

@ -9,7 +9,7 @@ import sys
def mkdir(*a, **kw):
try:
os.mkdir(*a, **kw)
except OSError, e:
except OSError as e:
if e.errno == errno.EEXIST:
pass
else:
@ -27,7 +27,7 @@ def maketemp():
tmp = os.path.join(tmp, name)
try:
shutil.rmtree(tmp)
except OSError, e:
except OSError as e:
if e.errno == errno.ENOENT:
pass
else:
@ -37,7 +37,7 @@ def maketemp():
def writeFile(path, content):
tmp = '%s.tmp' % path
f = file(tmp, 'w')
f = open(tmp, 'w')
try:
f.write(content)
finally:
@ -45,7 +45,7 @@ def writeFile(path, content):
os.rename(tmp, path)
def readFile(path):
f = file(path)
f = open(path)
try:
data = f.read()
finally:
@ -58,7 +58,7 @@ def assert_raises(excClass, callableObj, *args, **kwargs):
"""
try:
callableObj(*args, **kwargs)
except excClass, e:
except excClass as e:
return e
else:
if hasattr(excClass,'__name__'): excName = excClass.__name__