| 6 | |
| 7 | |
| 8 | def test_version_print(): |
| 9 | # Load up the contents of the VERSION file out-of-band |
| 10 | from wal_e import cmd |
| 11 | place = path.join(path.dirname(cmd.__file__), 'VERSION') |
| 12 | with open(place, 'rb') as f: |
| 13 | expected = f.read() |
| 14 | |
| 15 | # Try loading it via command line invocation |
| 16 | try: |
| 17 | proc = subprocess.Popen(['wal-e', 'version'], stdout=subprocess.PIPE) |
| 18 | except EnvironmentError as e: |
| 19 | if e.errno == errno.ENOENT: |
| 20 | pytest.skip('wal-e must be in $PATH to test version output') |
| 21 | result = proc.communicate()[0] |
| 22 | |
| 23 | # Make sure the two versions match and the command exits |
| 24 | # successfully. |
| 25 | assert proc.returncode == 0 |
| 26 | assert result == expected |