def test_captures_exceptions(self): result = functions.stat_path('/does/not/exist') assert result['exception']['attributes']['errno'] == '2' assert result['exception']['name'] in ['FileNotFoundError', 'OSError']
def test_no_callables(self, tmpdir): result = functions.stat_path(str(tmpdir)) for value in result.values(): assert callable(value) is False
def test_stat_dir(self, tmpdir): result = functions.stat_path(str(tmpdir)) assert result != {}
def test_exception_is_empty_on_success(self, tmpdir): filename = os.path.join(str(tmpdir), 'file') make_test_file(filename) result = functions.stat_path(filename) assert not result["exception"]
def test_includes_file_content(self, tmpdir): filename = os.path.join(str(tmpdir), 'file') make_test_file(filename, contents="foo") result = functions.stat_path(filename, get_contents=True) assert result["contents"] == "foo"
def test_stat_file_includes_group(self, tmpdir): filename = os.path.join(str(tmpdir), 'file') make_test_file(filename) result = functions.stat_path(filename) assert "group" in result