old_contents: # -*- coding: utf-8 -*-
  """Tests for vcspull svn repos."""
  from __future__ import (absolute_import, division, print_function,
                          unicode_literals, with_statement)
  
  import os
  import tempfile
  import unittest
  
  from vcspull.exc import VCSPullException
  from vcspull.repo import create_repo
  from vcspull.util import run, which
  from .helpers import ConfigTestCase, RepoTestMixin, stdouts
  
  
  def has_svn():
      try:
          which('svn')
          return True
      except VCSPullException:
          return False
  
  
  @unittest.skipUnless(has_svn(), "requires SVN")
  class RepoSVN(RepoTestMixin, ConfigTestCase, unittest.TestCase):
  
      @stdouts
      def test_repo_svn(self, *args):
          repo_dir = os.path.join(self.TMP_DIR, '.repo_dir')
          repo_name = 'my_svn_project'
  
          svn_repo = create_repo(**{
              'url': 'svn+file://' + os.path.join(repo_dir, repo_name),
              'parent_dir': self.TMP_DIR,
              'name': repo_name
          })
  
          svn_checkout_dest = os.path.join(self.TMP_DIR, svn_repo['name'])
  
          os.mkdir(repo_dir)
  
          run(['svnadmin', 'create', svn_repo['name']], cwd=repo_dir)
  
          svn_repo.obtain()
  
          self.assertTrue(os.path.exists(svn_checkout_dest))
  
          tempFile = tempfile.NamedTemporaryFile(dir=svn_checkout_dest)
  
          run(['svn', 'add', '--non-interactive', tempFile.name],
              cwd=svn_checkout_dest)
          run(
              ['svn', 'commit', '-m', 'a test file for %s' % svn_repo['name']],
              cwd=svn_checkout_dest
          )
          self.assertEqual(svn_repo.get_revision(), 0)
  
          self.assertEqual(
              os.path.join(svn_checkout_dest, tempFile.name),
              tempFile.name
          )
          self.assertEqual(svn_repo.get_revision(tempFile.name), 1)
  
new_contents: # -*- coding: utf-8 -*-
  """Tests for vcspull svn repos."""
  from __future__ import (absolute_import, division, print_function,
                          unicode_literals, with_statement)
  
  import os
  
  import pytest
  
  from vcspull.exc import VCSPullException
  from vcspull.repo import create_repo
  from vcspull.util import run, which
  
  
  def has_svn():
      try:
          which('svn')
          return True
      except VCSPullException:
          return False
  
  
  @pytest.fixture
  def svn_dummy_repo_dir(tmpdir_repoparent, scope='session'):
      """Create a git repo with 1 commit, used as a remote."""
      name = 'dummyrepo'
      repo_path = str(tmpdir_repoparent.join(name))
  
      run(['svnadmin', 'create', name], cwd=str(tmpdir_repoparent))
  
      testfile_filename = 'testfile.test'
  
      run(['touch', testfile_filename],
          cwd=repo_path)
  
      run(['svn', 'add', '--non-interactive', testfile_filename],
          cwd=repo_path)
      run(
          ['svn', 'commit', '-m', 'a test file for %s' % name],
          cwd=repo_path
      )
  
      return repo_path
  
  
  def test_repo_svn(tmpdir, svn_dummy_repo_dir):
      repo_name = 'my_svn_project'
  
      svn_repo = create_repo(**{
          'url': 'svn+file://' + svn_dummy_repo_dir,
          'parent_dir': str(tmpdir),
          'name': repo_name
      })
  
      svn_repo.obtain()
      svn_repo.update_repo()
  
      assert svn_repo.get_revision() == 0
  
      assert os.path.exists(str(tmpdir.join(repo_name)))
  
subject: Clean up svn tests