⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basic_tests.py

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 PY
📖 第 1 页 / 共 5 页
字号:
  svntest.actions.run_and_verify_svn(None, None, [],                                     'status', '-u',                                     '--username', svntest.main.wc_author,                                     '--password', svntest.main.wc_passwd,                                     os.path.join(wc_dir, 'A', 'B'))  # Failed with "already locked" error on new dir  svntest.actions.run_and_verify_svn(None, None, [],                                     'copy',                                     '--username', svntest.main.wc_author,                                     '--password', svntest.main.wc_passwd,                                     repo_url + '/A/B/E',                                     os.path.join(wc_dir, 'A', 'D', 'G'))#----------------------------------------------------------------------def basic_add_ignores(sbox):  'ignored files in added dirs should not be added'  # The bug was that  #  #   $ svn add dir  #  # where dir contains some items that match the ignore list and some  # do not would add all items, ignored or not.  sbox.build()  wc_dir = sbox.wc_dir  dir_path = os.path.join(wc_dir, 'dir')  foo_c_path = os.path.join(dir_path, 'foo.c')  foo_o_path = os.path.join(dir_path, 'foo.o')  os.mkdir(dir_path, 0755)  open(foo_c_path, 'w')  open(foo_o_path, 'w')  output, err = svntest.actions.run_and_verify_svn(    "No output where some expected", SVNAnyOutput, [],    'add', dir_path)  for line in output:    # If we see foo.o in the add output, fail the test.    if re.match(r'^A\s+.*foo.o$', line):      raise svntest.actions.SVNUnexpectedOutput  # Else never matched the unwanted output, so the test passed.#----------------------------------------------------------------------def basic_add_local_ignores(sbox):  'ignore files matching local ignores in added dirs'  #Issue #2243   #svn add command not keying off svn:ignore value  sbox.build()  wc_dir = sbox.wc_dir  dir_path = os.path.join(wc_dir, 'dir')  file_path = os.path.join(dir_path, 'app.lock')  svntest.actions.run_and_verify_svn(None, SVNAnyOutput, [],                                     'mkdir', dir_path)  svntest.main.run_svn(None, 'propset', 'svn:ignore', '*.lock', dir_path)   open(file_path, 'w')  svntest.actions.run_and_verify_svn(None, [], [],                                     'add', '--force', dir_path)#----------------------------------------------------------------------def basic_add_no_ignores(sbox):  'add ignored files in added dirs'  # add ignored files using the '--no-ignore' option  sbox.build()  wc_dir = sbox.wc_dir  dir_path = os.path.join(wc_dir, 'dir')  foo_c_path = os.path.join(dir_path, 'foo.c')  # add a few files that match the default ignore patterns  foo_o_path = os.path.join(dir_path, 'foo.o')  foo_lo_path = os.path.join(dir_path, 'foo.lo')  foo_rej_path = os.path.join(dir_path, 'foo.rej')  os.mkdir(dir_path, 0755)  open(foo_c_path, 'w')  open(foo_o_path, 'w')  open(foo_lo_path, 'w')  open(foo_rej_path, 'w')  output, err = svntest.actions.run_and_verify_svn(    "No output where some expected", SVNAnyOutput, [],    'add', '--no-ignore', dir_path)  for line in output:    # If we don't see ignores in the add output, fail the test.    if not re.match(r'^A\s+.*(foo.(o|rej|lo|c)|dir)$', line):      raise svntest.actions.SVNUnexpectedOutput#----------------------------------------------------------------------def uri_syntax(sbox):  'make sure URI syntaxes are parsed correctly'  sbox.build(create_wc = False)  local_dir = sbox.wc_dir  # Revision 6638 made 'svn co http://host' seg fault, this tests the fix.  url = svntest.main.current_repo_url  scheme = url[:string.find(url, ":")]  url = scheme + "://some_nonexistent_host_with_no_trailing_slash"  svntest.actions.run_and_verify_svn("No error where one expected",                                     None, SVNAnyOutput,                                     'co', url, local_dir)  # Different RA layers give different errors for failed checkouts;  # for us, it's only important to know that it _did_ error (as  # opposed to segfaulting), so we don't examine the error text.#----------------------------------------------------------------------def basic_checkout_file(sbox):  "trying to check out a file should fail"  sbox.build()  iota_url = svntest.main.current_repo_url + '/iota'  output, errput = svntest.main.run_svn(1, 'co', iota_url)  for line in errput:    if string.find(line, "refers to a file") != -1:      break  else:    raise svntest.Failure#----------------------------------------------------------------------def basic_info(sbox):  "basic info command"  def check_paths(lines, expected_paths):    "check that paths found on input lines beginning 'Path: ' are as expected"    paths = []    for line in lines:      if line.startswith('Path: '):        paths.append(line[6:].rstrip())    if paths != expected_paths:      print "Reported paths:", paths      print "Expected paths:", expected_paths      raise svntest.Failure  sbox.build()  cwd = os.getcwd()  try:    os.chdir(sbox.wc_dir)    # Check that "info" works with 0, 1 and more than 1 explicit targets.    output, errput = svntest.main.run_svn(None, 'info')    check_paths(output, ['.'])    output, errput = svntest.main.run_svn(None, 'info', 'iota')    check_paths(output, ['iota'])    output, errput = svntest.main.run_svn(None, 'info', 'iota', '.')    check_paths(output, ['iota', '.'])  finally:    os.chdir(cwd)def repos_root(sbox):  "check that repos root gets set on checkout"  def check_repos_root(lines):    for line in lines:      if line == "Repository Root: " + svntest.main.current_repo_url + "\n":        break    else:      print "Bad or missing repository root"      raise svntest.Failure  sbox.build()  output, errput = svntest.main.run_svn (None, "info",                                         sbox.wc_dir)  check_repos_root(output)  output, errput = svntest.main.run_svn (None, "info",                                         os.path.join(sbox.wc_dir, "A"))  check_repos_root(output)  output, errput = svntest.main.run_svn (None, "info",                                         os.path.join(sbox.wc_dir, "A", "B",                                                       "lambda"))  check_repos_root(output)def basic_peg_revision(sbox):  "checks peg revision on filename with @ sign"  sbox.build()  wc_dir = sbox.wc_dir  repos_dir = sbox.repo_url  filename = 'abc@abc'  wc_file = wc_dir + '/' + filename  url = repos_dir + '/' + filename  svntest.main.file_append(wc_file, 'xyz\n')  svntest.main.run_svn(None, 'add', wc_file)  svntest.main.run_svn(None, 'ci', '-m', 'secret log msg', wc_file)  # Without the trailing "@", expect failure.  output, errlines = svntest.actions.run_and_verify_svn(\    None, None, ".*Syntax error parsing revision 'abc'", 'cat', wc_file)  output, errlines = svntest.actions.run_and_verify_svn(\    None, None, ".*Syntax error parsing revision 'abc'", 'cat', url)  # With the trailing "@", expect success.  output, errlines = svntest.actions.run_and_verify_svn(None, ["xyz\n"], [],                                                        'cat', wc_file+'@')  output, errlines = svntest.actions.run_and_verify_svn(None, ["xyz\n"], [],                                                        'cat', url+'@')def info_nonhead(sbox):  "info on file not existing in HEAD"  sbox.build()  wc_dir = sbox.wc_dir  repo_url = sbox.repo_url  fname = os.path.join(wc_dir, 'iota')  furl = repo_url + "/iota"  # Remove iota and commit.  svntest.actions.run_and_verify_svn(None, None, [],                                     "delete", fname)  expected_output = svntest.wc.State(wc_dir, {    'iota' : Item(verb='Deleting'),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)  expected_status.remove("iota")  svntest.actions.run_and_verify_commit (wc_dir,                                         expected_output,                                         expected_status,                                         None,                                         None, None,                                         None, None,                                         wc_dir)  # Get info for old iota at r1.  output, errput = svntest.actions.run_and_verify_svn(None, None, [],                                                      'info',                                                      furl + '@1', '-r1')  got_url = 0  for line in output:    if line.find("URL:") >= 0:      got_url = 1  if not got_url:    print "Info didn't output an URL."    raise svntest.Failure#----------------------------------------------------------------------# Issue #2442.def ls_nonhead(sbox):  "ls a path no longer in HEAD"  sbox.build()  wc_dir = sbox.wc_dir  # Delete A/D/rho and commit.  G_path = os.path.join(wc_dir, 'A', 'D', 'G')  svntest.actions.run_and_verify_svn("error scheduling A/D/G for deletion",                                     None, [], 'rm', G_path)    expected_output = wc.State(wc_dir, {    'A/D/G' : Item(verb='Deleting'),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)  expected_status.remove('A/D/G', 'A/D/G/rho', 'A/D/G/pi', 'A/D/G/tau',)  svntest.actions.run_and_verify_commit(wc_dir,                                        expected_output, expected_status,                                        None, None, None, None, None,                                        wc_dir)  # Check that we can list a file in A/D/G at revision 1.  rho_url = sbox.repo_url + "/A/D/G/rho"  svntest.actions.run_and_verify_svn(None, '.* rho\n', [],                                     'ls', '--verbose', rho_url + '@1')  #----------------------------------------------------------------------# Issue #2315.def cat_added_PREV(sbox):  "cat added file using -rPREV"  sbox.build()  wc_dir = sbox.wc_dir  f_path = os.path.join(wc_dir, 'f')  # Create and add a file.  svntest.main.file_append (f_path, 'new text')  svntest.actions.run_and_verify_svn("adding file",                                     None, [], 'add', f_path)    # Cat'ing the previous version should fail.  svntest.actions.run_and_verify_svn("cat PREV version of file",                                     None, ".*has no committed revision.*",                                     'cat', '-rPREV', f_path)def checkout_creates_intermediate_folders(sbox):  "checkout and create some intermediate folders"  sbox.build(create_wc = False)  checkout_target = os.path.join(sbox.wc_dir, 'a', 'b', 'c')    # checkout a working copy in a/b/c, should create these intermediate   # folders  expected_output = svntest.main.greek_state.copy()  expected_output.wc_dir = checkout_target  expected_output.tweak(status='A ', contents=None)  expected_wc = svntest.main.greek_state    svntest.actions.run_and_verify_checkout(sbox.repo_url,                          checkout_target,                          expected_output,                          expected_wc)# Test that, if a peg revision is provided without an explicit revision, # svn will checkout the directory as it was at rPEG, rather than at HEAD.def checkout_peg_rev(sbox):  "checkout with peg revision"  sbox.build()  wc_dir = sbox.wc_dir  # create a new revision  mu_path = os.path.join(wc_dir, 'A', 'mu')  svntest.main.file_append (mu_path, 'appended mu text')  svntest.actions.run_and_verify_svn(None, None, [],                                    'ci', '-m', 'changed file mu', wc_dir)  # now checkout the repo@1 in another folder, this should create our initial  # wc without the change in mu.  checkout_target = sbox.add_wc_path('checkout')  os.mkdir(checkout_target)  expected_output = svntest.main.greek_state.copy()  expected_output.wc_dir = checkout_target  expected_output.tweak(stat

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -