Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def make_proxy(monitor_factory, callback, logger):
from hupper.reloader import FileMonitorProxy
proxy = FileMonitorProxy(callback, logger)
proxy.monitor = monitor_factory(proxy.file_changed)
return proxy
def test_ignore_files():
class DummyMonitor(object):
paths = set()
def add_path(self, path):
self.paths.add(path)
from hupper.reloader import FileMonitorProxy
cb = DummyCallback()
proxy = FileMonitorProxy(cb, None, {'/a/*'})
monitor = proxy.monitor = DummyMonitor()
path = 'foo.txt'
assert path not in monitor.paths
proxy.add_path(path)
assert path in monitor.paths
path = '/a/foo.txt'
assert path not in monitor.paths
proxy.add_path(path)
assert path not in monitor.paths