def test_module_file(self): m1 = Mock() m1.__file__ = "/opt/foo/xyz.pyc" self.assertEqual(module_file(m1), "/opt/foo/xyz.py") m2 = Mock() m2.__file__ = "/opt/foo/xyz.py" self.assertEqual(module_file(m1), "/opt/foo/xyz.py")
def test_module_file(self): m1 = Mock() m1.__file__ = '/opt/foo/xyz.pyc' self.assertEqual(module_file(m1), '/opt/foo/xyz.py') m2 = Mock() m2.__file__ = '/opt/foo/xyz.py' self.assertEqual(module_file(m1), '/opt/foo/xyz.py')
def test_module_file(): m1 = Mock() m1.__file__ = '/opt/foo/xyz.pyc' assert module_file(m1) == '/opt/foo/xyz.py' m2 = Mock() m2.__file__ = '/opt/foo/xyz.py' assert module_file(m1) == '/opt/foo/xyz.py'
def on_init(self): files = [module_file(sys.modules[m]) for m in self.modules] self._hashes = dict((f, file_hash(f)) for f in files) self._monitor = self.Monitor(files, self.on_change, shutdown_event=self._is_shutdown, **self.options)
def on_init(self): files = self.file_to_module files.update(dict((module_file(sys.modules[m]), m) for m in self.modules)) self._monitor = self.Monitor(files, self.on_change, shutdown_event=self._is_shutdown, **self.options) self._hashes = dict([(f, file_hash(f)) for f in files])
def on_init(self): files = self.file_to_module files.update({module_file(sys.modules[m]): m for m in self.modules}) self._monitor = self.Monitor(files, self.on_change, shutdown_event=self._is_shutdown, **self.options) self._hashes = {f: file_hash(f) for f in files}
def body(self): files = [module_file(sys.modules[m]) for m in self.modules] self._monitor = self.Monitor(files, self.on_change, shutdown_event=self._is_shutdown, **self.options) self._hashes = dict([(f, file_hash(f)) for f in files]) try: self._monitor.start() except OSError, exc: if exc.errno not in (errno.EINTR, errno.EAGAIN): raise
def on_init(self): files = self.file_to_module files.update({ module_file(sys.modules[m]): m for m in self.modules }) self._monitor = self.Monitor( files, self.on_change, shutdown_event=self._is_shutdown, **self.options) self._hashes = {f: file_hash(f) for f in files}