Skip to content
Snippets Groups Projects
Verified Commit f3660f70 authored by James Graham's avatar James Graham
Browse files

feat: add flag to get version number

parent d23c2c85
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ import argparse
import cProfile
import logging
import pathlib
import pkg_resources
import sys
import textwrap
import time
......@@ -143,10 +144,14 @@ class BooleanAction(argparse.Action):
def parse_arguments(arg_list):
# yapf: disable
parser = argparse.ArgumentParser(
prog='pycgtool',
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description="Generate coarse-grained molecular dynamics models from atomistic trajectories."
)
parser.add_argument('-v', '--version', action='version',
version=pkg_resources.get_distribution('pycgtool').version)
# Input files
input_files = parser.add_argument_group("input files")
......
......@@ -42,11 +42,13 @@ class PycgtoolTest(unittest.TestCase):
base_dir = pathlib.Path(__file__).absolute().parent
data_dir = base_dir.joinpath('data')
def test_run_help(self):
self.assertEqual(
0,
subprocess.check_call(["python", "-m", "pycgtool", "-h"],
stdout=subprocess.PIPE))
def test_pycgtool_help(self):
subprocess.check_call(["python", "-m", "pycgtool", "-h"])
subprocess.check_call(["python", "-m", "pycgtool", "--help"])
def test_pycgtool_version(self):
subprocess.check_call(['python', '-m', 'pycgtool', '-v'])
subprocess.check_call(['python', '-m', 'pycgtool', '--version'])
def test_parse_arguments(self):
args = main.parse_arguments([
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment