diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 1788b4e..6a506e6 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -118,7 +118,7 @@ To regenerate fixture remove it from tests/fixtures and run tests again:: $ rm tests/fixtures/NAME.yaml $ py.test -In order for py.test to have run, you will have had to create an environment variable containing a valid tiingo API key so that the test runner can make a valid api call. One way to do that is to:: +In order for py.test to run, you will have had to create an environment variable containing a valid tiingo API key so that the test runner can make a valid api call. One way to do that is to:: $ export TIINGO_API_KEY='...insert api key here...' diff --git a/tools/api_key_tool.py b/tools/api_key_tool.py index c2d260f..1d42d09 100644 --- a/tools/api_key_tool.py +++ b/tools/api_key_tool.py @@ -9,10 +9,6 @@ zeroapiregex = r'(\[Token )0{40}(\])' anyapiregex = r'(\[Token ).{40}(\])' zeroapistring = '[Token '+40*'0'+']' -parser = argparse.ArgumentParser() -parser.add_argument("path", help="path to test fixtures", - nargs='?', default=fixturesDirectory) -args = parser.parse_args() def api_key_detector(file): ''' @@ -55,4 +51,8 @@ def main(path): print("Changed {} files.".format(nFilesChanged)) if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument("path", help="path to test fixtures", + nargs='?', default=fixturesDirectory) + args = parser.parse_args() main(args.path)