import subprocess
import sys
import time
import unittest

import sneakersync.main

import test_synchronize_base

class TestMain(test_synchronize_base.TestSynchronizeBase):
    def test_send_receive(self):
        self.drives[0].rename(self.drive)
        
        # with (self.drive / "module_1" / "new").open("w") as fd:
        #     fd.write("new file")
        (self.drive / "module_1" / "foo.1").unlink()
        # with (self.drive / "module_3" / "foo.3").open("w") as fd:
        #     fd.write("Modified file")
        # subprocess.check_call([
        #     "touch", "-a", "-t", "2001" "02" "03" "23" "24" ".25",
        #     self.drive / "module_1" / "subdir" / "bar.1"])
        # subprocess.check_call([
        #     "touch", "-m", "-t", "2002" "03" "04" "22" "21" ".20",
        #     self.drive / "module_3" / "bar.3"])
        
        sys.argv = [sys.argv[0], "send", str(self.sneakerdrive)]
        sneakersync.main.main()
        self.drive.rename(self.drives[0])
        
        time.sleep(1)
        
        self.drives[1].rename(self.drive)
        sys.argv = [sys.argv[0], "receive", str(self.sneakerdrive)]
        sneakersync.main.main()
        self.drive.rename(self.drives[1])
        
        self._check_synchronized()

if __name__ == "__main__":
    sys.exit(unittest.main())

@@ -248,34 +248,32 @@
         %0A       
- #
  with (self.driv
@@ -312,34 +312,32 @@
 ) as fd:%0A       
- #
      fd.write(%22n
@@ -406,18 +406,16 @@
 %0A       
- #
  with (s
@@ -468,26 +468,24 @@
  fd:%0A       
- #
      fd.writ
@@ -502,34 +502,32 @@
 d file%22)%0A       
- #
  subprocess.chec
@@ -534,34 +534,32 @@
 k_call(%5B%0A       
- #
      %22touch%22, %22-
@@ -601,34 +601,32 @@
 %22 %22.25%22,%0A       
- #
      self.drive 
@@ -668,18 +668,16 @@
 %0A       
- #
  subproc
@@ -696,26 +696,24 @@
 ll(%5B%0A       
- #
      %22touch%22
@@ -771,10 +771,8 @@
     
- #
     

Improve main CLI test