old_contents: from paste.fixture import TestApp
  
  import vcontrol
  
  import pytest
  import web
  
  def test_web():
      vc_inst = vcontrol.VControl()
      urls = vc_inst.urls()
      app = web.application(urls, globals())
      testApp = TestApp(app.wsgifunc())
  
      # test index
      r = testApp.get('/v1')
      assert r.status == 200
      assert r.normal_body == "vcontrol"
      r = testApp.get('/v1/')
      assert r.status == 200
      assert r.normal_body == "vcontrol"
  
      # test version
      r = testApp.get('/v1/version')
      assert r.status == 200
      with open('VERSION', 'r') as f: v = f.read().strip()
      assert r.normal_body == v
  
new_contents: from paste.fixture import TestApp
  
  import vcontrol
  
  import pytest
  import web
  
  def start_web_app():
      """ starts the web app in a TestApp for testing """
      vc_inst = vcontrol.VControl()
      urls = vc_inst.urls()
      app = web.application(urls, globals())
      testApp = TestApp(app.wsgifunc())
      return testApp
  
  def test_index_r():
      """ tests the restful endpoint: index """
      # get web app
      testApp = start_web_app()
  
      # test index
      r = testApp.get('/v1')
      assert r.status == 200
      assert r.normal_body == "vcontrol"
      r = testApp.get('/v1/')
      assert r.status == 200
      assert r.normal_body == "vcontrol"
  
  def test_version_r():
      """ tests the restful endpoint: version """
      # get web app
      testApp = start_web_app()
  
      # test version
      r = testApp.get('/v1/version')
      assert r.status == 200
      with open('VERSION', 'r') as f: v = f.read().strip()
      assert r.normal_body == v
  
subject: break out tests