How to use the hupper.reloader.FileMonitorProxy function in hupper

To help you get started, we’ve selected a few hupper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Pylons / hupper / tests / test_reloader.py View on Github external
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
github Pylons / hupper / tests / test_reloader.py View on Github external
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