diff --git a/README.md b/README.md index 9b815c4..bcff77f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# GSLab Python Library Collection 4.0.0 +# GSLab Python Library Collection 4.0.1 Overview -------- diff --git a/gslab_scons/misc.py b/gslab_scons/misc.py index 2b47daa..5eb0f74 100644 --- a/gslab_scons/misc.py +++ b/gslab_scons/misc.py @@ -34,10 +34,13 @@ def state_of_repo(maxit): "===================================\n\n GIT STATUS" + "\n\n===================================\n") f.write("Last commit:\n\n") - os.system("git log -n 1 >> state_of_repo.log") + + # https://stackoverflow.com/questions/876239/how-can-i-redirect-and-append-both-stdout-and-stderr-to-a-file-with-bash + os.system("git log -n 1 >> state_of_repo.log 2>&1") with open(outfile, 'ab') as f: f.write("\n\nFiles changed since last commit:\n\n") - os.system("git diff --name-only >> state_of_repo.log") + os.system("git diff --name-only >> state_of_repo.log 2>&1") + with open(outfile, 'ab') as f: f.write("\n===================================\n\n FILE STATUS" + "\n\n===================================\n") diff --git a/gslab_scons/size_warning.py b/gslab_scons/size_warning.py index 71a4397..fb9b1d3 100644 --- a/gslab_scons/size_warning.py +++ b/gslab_scons/size_warning.py @@ -13,7 +13,7 @@ def issue_size_warnings(look_in = ['source', 'raw', 'release'], '''Issue warnings if versioned files are large''' bytes_in_MB = 1000000 # Compile a list of files that are not versioned. - ignored = list_ignored_files(look_in) + ignored = list_ignored_files(look_in) versioned = create_size_dictionary(look_in) versioned = {k: versioned[k] for k in versioned.keys() if k not in ignored} @@ -118,8 +118,8 @@ def create_size_dictionary(dirs): for path in dirs: if not os.path.isdir(path): - raise ReleaseError("The path argument does not specify an " - "existing directory.") + print("WARNING: '%s' is not an existing directory." % path) + continue for root, _, files in os.walk(path): for file_name in files: file_path = os.path.join(root, file_name) diff --git a/gslab_scons/tests/test_size_warning.py b/gslab_scons/tests/test_size_warning.py index f10ed4d..683e34c 100644 --- a/gslab_scons/tests/test_size_warning.py +++ b/gslab_scons/tests/test_size_warning.py @@ -206,10 +206,11 @@ def test_create_size_dictionary(self, mock_isdir, mock_walk, mock_getsize): sizes = sw.create_size_dictionary(['.']) self.assertEqual(len(sizes), 4) - # Check that the function raises an error when its path argument + # Check that the function does not raise an error when its path argument # is not a directory. - with self.assertRaises(ReleaseError), nostderrout(): - sizes = sw.create_size_dictionary(['nonexistent_directory']) + sizes = sw.create_size_dictionary(['nonexistent_directory']) + self.assertEqual(sizes, dict()) + # The path argument must be a string with self.assertRaises(TypeError), nostderrout(): sizes = sw.create_size_dictionary([10]) diff --git a/setup.py b/setup.py index 25d1113..a3deafa 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,7 @@ def run(self): requirements = ['requests'] setup(name = 'GSLab_Tools', - version = '4.0.0', + version = '4.0.1', description = 'Python tools for GSLab', url = 'https://github.com/gslab-econ/gslab_python', author = 'Matthew Gentzkow, Jesse Shapiro', diff --git a/test.log b/test.log index 5e3d7ee..a3007ea 100644 --- a/test.log +++ b/test.log @@ -1,14 +1,4 @@ running pytest -Searching for pytest -Best match: pytest 3.1.3 -Processing pytest-3.1.3-py2.7.egg - -Using /Users/arosenbe/Desktop/gslab_python/.eggs/pytest-3.1.3-py2.7.egg -Searching for py>=1.4.33 -Best match: py 1.4.34 -Processing py-1.4.34-py2.7.egg - -Using /Users/arosenbe/Desktop/gslab_python/.eggs/py-1.4.34-py2.7.egg running egg_info creating GSLab_Tools.egg-info writing requirements to GSLab_Tools.egg-info/requires.txt @@ -20,8 +10,8 @@ reading manifest file 'GSLab_Tools.egg-info/SOURCES.txt' writing manifest file 'GSLab_Tools.egg-info/SOURCES.txt' running build_ext ============================= test session starts ============================== -platform darwin -- Python 2.7.10, pytest-3.1.3, py-1.4.34, pluggy-0.4.0 -rootdir: /Users/arosenbe/Desktop/gslab_python, inifile: +platform darwin -- Python 2.7.13, pytest-3.0.5, py-1.4.32, pluggy-0.4.0 +rootdir: /Users/leviboxell/Desktop/gslab_python, inifile: collected 123 items gencat/tests/test_checkDicts.py ... @@ -45,7 +35,7 @@ gslab_scons/tests/test_release_function.py .... gslab_scons/tests/test_release_tools.py .... gslab_scons/tests/test_size_warning.py ..... -========================== 123 passed in 1.25 seconds ========================== +========================== 123 passed in 1.28 seconds ========================== Name Stmts Miss Branch BrPart Cover Missing ------------------------------------------------------------------------------------------- gencat/gencat.py 79 6 28 4 91% 72-73, 81, 89, 97, 101, 57->exit, 71->72, 96->97, 100->101 @@ -87,10 +77,10 @@ gslab_scons/builders/build_r.py 32 1 4 1 94 gslab_scons/builders/build_stata.py 34 0 0 0 100% gslab_scons/builders/build_tables.py 31 0 2 0 100% gslab_scons/configuration_tests.py 94 0 34 0 100% -gslab_scons/log.py 70 18 16 3 73% 53-57, 86, 92-103, 52->53, 83->86, 91->92 -gslab_scons/misc.py 184 3 72 3 98% 257-258, 289, 58->46, 256->257, 288->289 +gslab_scons/log.py 74 21 16 3 71% 53-59, 87, 92-93, 97-108, 52->53, 84->87, 96->97 +gslab_scons/misc.py 184 3 72 3 98% 260-261, 292, 61->49, 259->260, 291->292 gslab_scons/release.py 41 41 20 0 0% 1-72 -gslab_scons/size_warning.py 69 0 30 0 100% +gslab_scons/size_warning.py 70 0 30 0 100% gslab_scons/tests/_side_effects.py 112 2 28 7 94% 34-35, 31->34, 37->exit, 49->exit, 73->78, 144->156, 160->exit, 246->252 gslab_scons/tests/_test_helpers.py 95 4 34 3 93% 27-28, 102, 117, 76->88, 99->102, 112->117 gslab_scons/tests/test_build_lyx.py 52 1 8 3 93% 108, 26->exit, 103->exit, 107->108 @@ -104,6 +94,6 @@ gslab_scons/tests/test_log.py 112 10 12 3 86 gslab_scons/tests/test_misc.py 192 2 28 6 96% 179, 363, 178->179, 282->exit, 289->exit, 314->exit, 342->exit, 362->363 gslab_scons/tests/test_release_function.py 121 3 22 2 97% 293-294, 324, 184->exit, 323->324 gslab_scons/tests/test_release_tools.py 64 1 2 1 97% 153, 152->153 -gslab_scons/tests/test_size_warning.py 183 5 46 6 95% 276, 293, 309, 373, 379, 272->276, 273->276, 292->293, 304->309, 370->373, 378->379 +gslab_scons/tests/test_size_warning.py 183 5 46 6 95% 277, 294, 310, 374, 380, 273->277, 274->277, 293->294, 305->310, 371->374, 379->380 ------------------------------------------------------------------------------------------- -TOTAL 4598 1302 1292 86 67% +TOTAL 4603 1305 1292 86 66%