November 30, 2021Testing Argparse Applications - the Better WayWhen you are creating command line applications in Python, you probably heard of argparse, which is a great library for exactly doing this, and it is even included in Python’s standard library. Imagine you have created the following argparse application: <main.py> import argparse def main(): parser = argparse.ArgumentParser() parser.add_argument('--name', required=True) args = parser.parse_args() print(f'Hello {args.name}') if __name__ == '__main__': sys.exit(main()) Looks straightforward, works great, but at one point, you certainly want to add tests for it, right?...
November 3, 2021How to Compare Two Directories on LinuxWhile migrating a couple of Bazaar repositories to git, I experienced some problems with one Bazaar repository, or let’s say the exporter did not work properly on one of its commit. In order to find out what exactly happened, I needed to compare both the tip of the git and the Bazaar repository. Turns out, diff can not only compare files, but also directories… recursively! $ diff -qr bzr/wadllib/ git/wadllib/ Only in bzr/wadllib/: ....