old_contents: #!/usr/bin/env python
  
  import sys
  import os
  import unittest
  from subprocess import Popen, PIPE
  
  
  ROOT_DIR = os.path.join(os.path.dirname(__file__), "..")
  sys.path.append(ROOT_DIR)
  
  from supercron import SuperCron
  
  
  class RunTests(unittest.TestCase):
  	"""class that tests supercron for behavior correctness"""
  
  	def setUp(self):
  		pass
  
  	def get_crontab(self):
  		p = Popen(["crontab", "-l"], stdout=PIPE)
  		crontab_out, crontab_err = p.communicate()
  		return crontab_out
  
  	def test_midnight(self):
  		entry1 = b"@daily ls # ls"
  		entry2  = b"0 0 * * * ls # ls"
  		SuperCron.add_job("ls", "ls", "midnight")
  		user_crontab = self.get_crontab()
  		self.assertTrue(entry1 in user_crontab or entry2 in user_crontab)
  
  	def test_every_x_minutes(self):
  		hour, minute = SuperCron.get_time_now()
  		entry = b"*/5 {} * * * ls # ls".format(hour)
  		SuperCron.add_job("ls", "ls", "once every 5 minutes")
  		user_crontab = self.get_crontab()
  		self.assertTrue(entry in user_crontab)
  
  
  if __name__ == "__main__":
  	unittest.main()
  
new_contents: #!/usr/bin/env python
  
  import sys
  import os
  import unittest
  from subprocess import Popen, PIPE
  
  
  ROOT_DIR = os.path.join(os.path.dirname(__file__), "..")
  sys.path.append(ROOT_DIR)
  
  from supercron import SuperCron
  
  
  class RunTests(unittest.TestCase):
  	"""class that tests supercron for behavior correctness"""
  
  	def setUp(self):
  		pass
  
  	def tearDown(self):
  		SuperCron.delete_job("ls")
  
  	def get_crontab(self):
  		p = Popen(["crontab", "-l"], stdout=PIPE, stderr=PIPE)
  		crontab_out, crontab_err = p.communicate()
  		return crontab_out
  
  	def test_midnight(self):
  		entry1 = b"@daily ls # ls"
  		entry2  = b"0 0 * * * ls # ls"
  		SuperCron.add_job("ls", "ls", "midnight")
  		user_crontab = self.get_crontab()
  		self.assertTrue(entry1 in user_crontab or entry2 in user_crontab)
  
  	def test_every_x_minutes(self):
  		hour, minute = SuperCron.get_time_now()
  		entry = b"*/5 {} * * * ls # ls".format(hour)
  		SuperCron.add_job("ls", "ls", "once every 5 minutes")
  		user_crontab = self.get_crontab()
  		self.assertTrue(entry in user_crontab)
  
  
  if __name__ == "__main__":
  	unittest.main()
  
subject: Delete the jobs in tearDown() in tests