chains/sources/packet_streamer.py (code showing use of pypcap for 'sniffing').The github 'chains' project uses both pypcap and dpkt for exactly this kind of thing (Disclaimer: I'm involved with all three projects :) This isn't theīest solution: it doesn't understand how changes to your source code affects it.The question is old but for new people who might hit this. To let the class reload the test framework (and reduce possibilities of multiple-run bugs).Īfter subclassing, set sniffer_instance parameter to your custom class when calling runįor linux, there is an exception that is sometimes thrown when terminating.Ĭurrently the program only looks for changes in the current working directory. You should perform you imports inside the function instead of outside, The property, test_args, are arguments gathered through -config=blah and -x.*Ĭonfiguration options. Override the run, method to configure what you need to be done. Which is the class that handles running tests, or whatever you want. If you want to run another unit testing framework, you can do so by overriding sniffer.Sniffer, Other Uses Running with Other Test Frameworks This will run the nose for modifications to Python files and mocha when run( argv = list( runnable def javascript_tests( * args):Ĭommand = "mocha tests/js-tests.js" return call( command, shell = True) = 0 startswith( runnable def python_tests( * args): js file is changed select_runnable( 'javascript_tests') file_validator def js_files( filename): # Here we instruct the 'javascript_tests' runnable to be kicked off # when a. py file is changed select_runnable( 'python_tests') file_validator def py_files( filename): # Here we instruct the 'python_tests' runnable to be kicked off # when a. Or any other combination you can come up with. Useful if you want to run nose for Python files, mocha for JavaScript files,Īnd csslint for CSS. There is also support for selecting a runnable function by file validator. run( argv = list( args))Īnd that's the basic case. The function should return logically True if the validation passed # and logicially False if it fails. # sys.argv and any arguments passed via -x prefix will be sent to this function as # it's arguments. # For anything you want to get constantly reloaded, do an import in the function. This is ideal for running tests of some sort. py extension and not prefixed # with a period. # This fires runnables only if files ending with. Return # True to invoke any runnable functions, False otherwise. # this gets invoked on every file that gets changed in the directory. bg_default # All lists in this variable will be under surveillance for changes. api import * # import the really small API import os, termstyle # you can customize the pass/fail colors like this pass_fg_color = termstyle. Here's an example of what you can do so far:įrom sniffer. This has been resolved in subsequent autonose versions, using watchdog.ĭon't want to run nose? You can do whatever you really want. py-notify for LibNotify support (Linux).osxnotify and libosxnotify for native OS X notifications (Max OS X 10.9.4 and newer).If you want support for other notification systems, you can install: If you use Mac OS X 10.5+ (Leopard), you'll need to install MacFSEvents.If you use Windows, you'll need to install pywin32.If you use Linux, you'll need to install pyinotify.The library is dependent on your operating system: Third-party library can help fix the problem. Although the default install of sniffer shares the same problem, installing a To the pure python implementation - manually walking through the file system to see what'sĬhanged. The problem with autonose, is that the autodetect can be slow to detect changes. You can use sniffer -help for options And like autonose, you can pass the noseĪrguments with -x prefix: -x-with-doctest or -x-config. Simply run sniffer in your project directory. I'm currently leaving this project on maintance mode (respond to issues, merge pull requests), but I'm not dedicating most of my free time towards this project.Ĭontact me on twitter or via email if you're interested in taking over the helm of this project. I am looking for a new maintainer to carry on this project to new heights. However, sniffer will still work without any of those libraries. Library (see below), the CPU usage of file system monitoring is reduced in comparison Sniffer will automatically re-run tests if your code changes. NEW: sniffer can now be customize to run anything, see 'Advanced Usage'. Sniffer is a autotest tool for Python using the nosetest library.
0 Comments
Leave a Reply. |