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

📄 basic_tests.py

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 PY
📖 第 1 页 / 共 5 页
字号:
  # issue 687 delete directory with uncommitted directory child  svntest.actions.run_and_verify_svn(None, None, [],                                     'rm', '--force', Y_parent_path)  expected_status.tweak('A/D', status='D ')  expected_status.remove('A/D/Y')  svntest.actions.run_and_verify_status(wc_dir, expected_status)  # check files have been removed  verify_file_deleted("Failed to remove text modified file", rho_path)  verify_file_deleted("Failed to remove prop modified file", chi_path)  verify_file_deleted("Failed to remove unversioned file", sigma_path)  verify_file_deleted("Failed to remove unmodified file",                      os.path.join(E_path, 'alpha'))  # check versioned dir is not removed  if not can_cd_to_dir(F_path):    print "Removed versioned dir"    ### we should raise a less generic error here. which?    raise svntest.Failure    # check unversioned and added dirs has been removed  if can_cd_to_dir(Q_path):    print "Failed to remove unversioned dir"    ### we should raise a less generic error here. which?    raise svntest.Failure  if can_cd_to_dir(X_path):    print "Failed to remove added dir"    ### we should raise a less generic error here. which?    raise svntest.Failure  # Deleting unversioned file explicitly  foo_path = os.path.join(wc_dir, 'foo')  svntest.main.file_append(foo_path, 'unversioned foo')  svntest.actions.run_and_verify_svn(None, None, [],                                     'rm', '--force', foo_path)  verify_file_deleted("Failed to remove unversioned file foo", foo_path)  # At one stage deleting an URL dumped core  iota_URL = svntest.main.current_repo_url + '/iota'  svntest.actions.run_and_verify_svn(None,                                     ["\n", "Committed revision 2.\n"], [],                                     'rm', '-m', 'delete iota URL',                                     '--username', svntest.main.wc_author,                                     '--password', svntest.main.wc_passwd,                                     iota_URL)#----------------------------------------------------------------------def basic_checkout_deleted(sbox):  "checkout a path no longer in HEAD"  sbox.build()  wc_dir = sbox.wc_dir  # Delete A/D and commit.  D_path = os.path.join(wc_dir, 'A', 'D')  svntest.actions.run_and_verify_svn("error scheduling A/D for deletion",                                     None, [], 'rm', '--force', D_path)    expected_output = wc.State(wc_dir, {    'A/D' : Item(verb='Deleting'),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)  expected_status.tweak(wc_rev=1)  expected_status.remove('A/D', 'A/D/G', 'A/D/G/rho', 'A/D/G/pi', 'A/D/G/tau',                         'A/D/H', 'A/D/H/chi', 'A/D/H/psi', 'A/D/H/omega',                         'A/D/gamma')  svntest.actions.run_and_verify_commit(wc_dir,                                        expected_output, expected_status,                                        None, None, None, None, None,                                        wc_dir)  # Now try to checkout revision 1 of A/D.  url = svntest.main.current_repo_url + '/A/D'  wc2 = os.path.join (sbox.wc_dir, 'new_D')  svntest.actions.run_and_verify_svn("error checking out r1 of A/D",                                     None, [], 'co', '-r', '1',                                     '--username',                                     svntest.main.wc_author,                                     '--password',                                     svntest.main.wc_passwd,                                     url + "@1", wc2)  #----------------------------------------------------------------------# Issue 846, changing a deleted file to an added directory is not# supported.def basic_node_kind_change(sbox):  "attempt to change node kind"  sbox.build()  wc_dir = sbox.wc_dir    # Schedule a file for deletion  gamma_path = os.path.join(wc_dir, 'A', 'D', 'gamma')  svntest.main.run_svn(None, 'rm', gamma_path)  # Status shows deleted file  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)  expected_status.tweak('A/D/gamma', status='D ')  svntest.actions.run_and_verify_status(wc_dir, expected_status)  # Try and fail to create a directory (file scheduled for deletion)  svntest.actions.run_and_verify_svn('Cannot change node kind',                                     None, SVNAnyOutput,                                     'mkdir', gamma_path)  # Status is unchanged  svntest.actions.run_and_verify_status(wc_dir, expected_status)  # Commit file deletion  expected_output = wc.State(wc_dir, {    'A/D/gamma' : Item(verb='Deleting'),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)  expected_status.tweak(wc_rev=1)  expected_status.remove('A/D/gamma')  svntest.actions.run_and_verify_commit(wc_dir,                                        expected_output, expected_status,                                        None, None, None, None, None,                                        wc_dir)  # Try and fail to create a directory (file deleted)  svntest.actions.run_and_verify_svn('Cannot change node kind',                                     None, SVNAnyOutput,                                     'mkdir', gamma_path)  # Status is unchanged  svntest.actions.run_and_verify_status(wc_dir, expected_status)  # Update to finally get rid of file  svntest.actions.run_and_verify_svn(None, None, [], 'up', wc_dir)  # mkdir should succeed  svntest.actions.run_and_verify_svn(None, None, [], 'mkdir', gamma_path)  expected_status.tweak(wc_rev=2)  expected_status.add({    'A/D/gamma' : Item(status='A ', wc_rev=0),    })  svntest.actions.run_and_verify_status(wc_dir, expected_status)#----------------------------------------------------------------------def basic_import(sbox):  "basic import of single new file"  sbox.build()  wc_dir = sbox.wc_dir  # create a new directory with files of various permissions  new_path = os.path.join(wc_dir, 'new_file')  svntest.main.file_append(new_path, "some text")  # import new files into repository  url = svntest.main.current_repo_url + "/dirA/dirB/new_file"  output, errput =   svntest.actions.run_and_verify_svn(    'Cannot change node kind', None, [], 'import',    '--username', svntest.main.wc_author,    '--password', svntest.main.wc_passwd,    '-m', 'Log message for new import', new_path, url)  lastline = string.strip(output.pop())  cm = re.compile ("(Committed|Imported) revision [0-9]+.")  match = cm.search (lastline)  if not match:    ### we should raise a less generic error here. which?    raise svntest.Failure  # remove (uncontrolled) local file  os.remove(new_path)  # Create expected disk tree for the update (disregarding props)  expected_disk = svntest.main.greek_state.copy()  expected_disk.add({    'dirA/dirB/new_file' : Item('some text'),    })  # Create expected status tree for the update (disregarding props).  # Newly imported file should be at revision 2.  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)  expected_status.add({    'dirA'                : Item(status='  ', wc_rev=2),    'dirA/dirB'           : Item(status='  ', wc_rev=2),    'dirA/dirB/new_file'  : Item(status='  ', wc_rev=2),    })  # Create expected output tree for the update.  expected_output = svntest.wc.State(wc_dir, {    'dirA'               : Item(status='A '),    'dirA/dirB'          : Item(status='A '),    'dirA/dirB/new_file' : Item(status='A '),  })  # do update and check three ways  svntest.actions.run_and_verify_update(wc_dir,                                        expected_output,                                        expected_disk,                                        expected_status,                                        None, None, None,                                        None, None, 1)#----------------------------------------------------------------------def basic_cat(sbox):  "basic cat of files"  sbox.build()  wc_dir = sbox.wc_dir  mu_path = os.path.join(wc_dir, 'A', 'mu')  # Get repository text even if wc is modified  svntest.main.file_append(mu_path, "some text")  svntest.actions.run_and_verify_svn(None, ["This is the file 'mu'.\n"],                                     [], 'cat',                                     ###TODO is user/pass really necessary?                                     '--username', svntest.main.wc_author,                                     '--password', svntest.main.wc_passwd,                                     mu_path)#----------------------------------------------------------------------def basic_ls(sbox):  'basic ls'  sbox.build()  wc_dir = sbox.wc_dir  # Even on Windows, the output will use forward slashes, so that's  # what we expect below.  cwd = os.getcwd()  try:    os.chdir(wc_dir)    svntest.actions.run_and_verify_svn("ls implicit current directory",                                       ["A/\n", "iota\n"],                                       [], 'ls',                                       '--username', svntest.main.wc_author,                                       '--password', svntest.main.wc_passwd)  finally:    os.chdir(cwd)  svntest.actions.run_and_verify_svn('ls the root of working copy',                                     ['A/\n', 'iota\n'],                                     [], 'ls',                                     '--username', svntest.main.wc_author,                                     '--password', svntest.main.wc_passwd,                                     wc_dir)  svntest.actions.run_and_verify_svn('ls a working copy directory',                                     ['B/\n', 'C/\n', 'D/\n', 'mu\n'],                                     [], 'ls',                                     '--username', svntest.main.wc_author,                                     '--password', svntest.main.wc_passwd,                                     os.path.join(wc_dir, 'A'))  svntest.actions.run_and_verify_svn('ls working copy directory with -r BASE',                                     ['B/\n', 'C/\n', 'D/\n', 'mu\n'],                                     [], 'ls', '-r', 'BASE',                                     '--username', svntest.main.wc_author,                                     '--password', svntest.main.wc_passwd,                                     os.path.join(wc_dir, 'A'))  svntest.actions.run_and_verify_svn('ls a single file',                                     ['mu\n'],                                     [], 'ls',                                     '--username', svntest.main.wc_author,                                     '--password', svntest.main.wc_passwd,                                     os.path.join(wc_dir, 'A', 'mu'))  svntest.actions.run_and_verify_svn('recursive ls',                                     ['E/\n', 'E/alpha\n', 'E/beta\n', 'F/\n',                                      'lambda\n' ], [], 'ls', '-R',                                     '--username', svntest.main.wc_author,                                     '--password', svntest.main.wc_passwd,                                     os.path.join(wc_dir, 'A', 'B'))#----------------------------------------------------------------------def nonexistent_repository(sbox):  "'svn log file:///nonexistent_path' should fail"  # The bug was that  #  #   $ svn log file:///nonexistent_path  #  # would go into an infinite loop, instead of failing immediately as  # it should.  The loop was because svn_ra_local__split_URL() used  # svn_path_split() to lop off components and look for a repository  # in each shorter path in turn, depending on svn_path_is_empty()  # to test if it had reached the end.  Somewhere along the line we  # changed the path functions (perhaps revision 3113?), and  # svn_path_split() stopped cooperating with svn_path_is_empty() in  # this particular context -- svn_path_split() would reach "/",  # svn_path_is_empty() would correctly claim that "/" is not empty,  # the next svn_path_split() would return "/" again, and so on,  # forever.  #  # This bug was fixed in revision 3150, by checking for "/"  # explicitly in svn_ra_local__split_URL().  By the time you read  # this, that may or may not be the settled fix, however, so check  # the logs to see if anything happened later.  #  # Anyway: this test _always_ operates on a file:/// path.  Note that  # if someone runs this test on a system with "/nonexistent_path" in  # the root directory, the test could fail, and that's just too bad :-).   output, errput = svntest.actions.run_and_verify_svn(    None, None, SVNAnyOutput,    'log', 'file:///nonexistent_path')  for line in errput:    if re.match(".*Unable to open an ra_local session to URL.*", line):      return      # Else never matched the expected error output, so the test failed.  raise svntest.main.SVNUnmatchedError#----------------------------------------------------------------------# Issue 1064. This test is only useful if running over ra_dav# with authentication enabled, otherwise it will pass trivially.def basic_auth_cache(sbox):  "basic auth caching"  sbox.build()  wc_dir         = sbox.wc_dir    repo_dir       = sbox.repo_dir  repo_url       = sbox.repo_url  # Create a working copy without auth tokens  svntest.main.safe_rmtree(wc_dir)  svntest.actions.run_and_verify_svn(None, None, [],                                     'checkout',                                     '--username', svntest.main.wc_author,                                     '--password', svntest.main.wc_passwd,                                     '--no-auth-cache',                                     repo_url, wc_dir)  # Failed with "not locked" error on missing directory  svntest.main.safe_rmtree(os.path.join(wc_dir, 'A', 'B', 'E'))

⌨️ 快捷键说明

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