def _find_specs(): parser = argparse.ArgumentParser(prog='nimoy', description='Run a suite of Nimoy specs.') parser.add_argument('specs', metavar='S', type=str, nargs='*', help='A path to a spec file to execute or a directory to scan for spec files') args = parser.parse_args() suggested_locations = args.specs return SpecFinder(os.getcwd()).find(suggested_locations)
def relative_spec_path(self): with when: spec_locations = SpecFinder('/some/working/dir').find( ['jim_spec.py']) with then: len(spec_locations) == 1 spec_locations[0].spec_path @ '/some/working/dir/jim_spec.py'
def explicit_spec_directory(self): with when: spec_locations = SpecFinder('/some/working/dir').find( [os.path.dirname(temp_spec.name)]) with then: len(spec_locations) == 1 spec_locations[0].spec_path @ temp_spec.name
def explicit_spec_path(self): with when: spec_locations = SpecFinder('/some/working/dir').find( [temp_spec.name]) with then: len(spec_locations) == 1 spec_locations[0].spec_path @ temp_spec.name
def implicit_location(self): with when: spec_locations = SpecFinder(os.path.dirname(temp_spec.name)).find( []) with then: len(spec_locations) == 1 spec_locations[0].spec_path @ temp_spec.name
def full_path(self): with when: spec_locations = SpecFinder('/some/working/dir').find( ['jim_spec.py::SpecName::feature_name']) with then: len(spec_locations) == 1 spec_locations[0].spec_path @ '/some/working/dir/jim_spec.py' spec_locations[0].spec_name == 'SpecName' spec_locations[0].feature_name == 'feature_name'
def _find_specs(): parser = argparse.ArgumentParser( prog='nimoy', description='Run a suite of Nimoy specs.') parser.add_argument( 'specs', metavar='S', type=str, nargs='*', help= """A path to a spec file to execute or a directory to scan for spec files. When naming a file it is possible to select which spec or feature to run. some_spec.py[::SpecName[::feature_name]] """) args = parser.parse_args() suggested_locations = args.specs return SpecFinder(os.getcwd()).find(suggested_locations)