import os
import shutil

from nose.tools import *

import beastling.beastxml
import beastling.configuration
import beastling.extractor

def test_extractor():
    config = beastling.configuration.Configuration(configfile="tests/configs/embed_data.conf")
    config.process()
    xml = beastling.beastxml.BeastXml(config)
    os.makedirs("testing_tmp_dir")
    os.chdir("testing_tmp_dir")
    xml.write_file("beastling.xml")
    beastling.extractor.extract("beastling.xml")
    os.chdir("..")
    shutil.rmtree("testing_tmp_dir")
    assert not os.path.exists("testing_tmp_dir")

import os
import shutil

from nose.tools import *

import beastling.beastxml
import beastling.configuration
import beastling.extractor

_test_dir = os.path.dirname(__file__)

def test_extractor():
    config = beastling.configuration.Configuration(configfile="tests/configs/embed_data.conf")
    config.process()
    xml = beastling.beastxml.BeastXml(config)
    os.makedirs("testing_tmp_dir")
    os.chdir("testing_tmp_dir")
    xml.write_file("beastling.xml")
    beastling.extractor.extract("beastling.xml")

def teardown():
    os.chdir(os.path.join(_test_dir, ".."))
    shutil.rmtree("testing_tmp_dir")

Clean up afterwards, even if test fails.
Clean up afterwards, even if test fails.

  import os
  import shutil
  
  from nose.tools import *
  
  import beastling.beastxml
  import beastling.configuration
  import beastling.extractor
  
+ _test_dir = os.path.dirname(__file__)
+ 
  def test_extractor():
      config = beastling.configuration.Configuration(configfile="tests/configs/embed_data.conf")
      config.process()
      xml = beastling.beastxml.BeastXml(config)
      os.makedirs("testing_tmp_dir")
      os.chdir("testing_tmp_dir")
      xml.write_file("beastling.xml")
      beastling.extractor.extract("beastling.xml")
-     os.chdir("..")
+ 
+ def teardown():
+     os.chdir(os.path.join(_test_dir, ".."))
      shutil.rmtree("testing_tmp_dir")
-     assert not os.path.exists("testing_tmp_dir")
  
Clean up afterwards, even if test fails.
## Code Before:
import os
import shutil

from nose.tools import *

import beastling.beastxml
import beastling.configuration
import beastling.extractor

def test_extractor():
    config = beastling.configuration.Configuration(configfile="tests/configs/embed_data.conf")
    config.process()
    xml = beastling.beastxml.BeastXml(config)
    os.makedirs("testing_tmp_dir")
    os.chdir("testing_tmp_dir")
    xml.write_file("beastling.xml")
    beastling.extractor.extract("beastling.xml")
    os.chdir("..")
    shutil.rmtree("testing_tmp_dir")
    assert not os.path.exists("testing_tmp_dir")

## Instruction:
Clean up afterwards, even if test fails.
## Code After:
import os
import shutil

from nose.tools import *

import beastling.beastxml
import beastling.configuration
import beastling.extractor

_test_dir = os.path.dirname(__file__)

def test_extractor():
    config = beastling.configuration.Configuration(configfile="tests/configs/embed_data.conf")
    config.process()
    xml = beastling.beastxml.BeastXml(config)
    os.makedirs("testing_tmp_dir")
    os.chdir("testing_tmp_dir")
    xml.write_file("beastling.xml")
    beastling.extractor.extract("beastling.xml")

def teardown():
    os.chdir(os.path.join(_test_dir, ".."))
    shutil.rmtree("testing_tmp_dir")
