diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..3f11fb0 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,2 @@ +[DEFAULT] +test_path=./pyafsmon/tests \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..bb3ec5f --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include README.md diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..4dc6964 --- /dev/null +++ b/README.rst @@ -0,0 +1,3 @@ +pyafsmon +======== + diff --git a/pyafsmon/pyafsmon.py b/pyafsmon/pyafsmon.py new file mode 100644 index 0000000..a2aca8a --- /dev/null +++ b/pyafsmon/pyafsmon.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import argparse +import sys + +def main(args=None): + + if args is None: + args = sys.argv[1:] + + parser = argparse.ArgumentParser( + description='An AFS monitoring tool') + + opts = parser.parse_args(args) + + sys.exit(0) diff --git a/pyafsmon/tests/__init__.py b/pyafsmon/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pyafsmon/tests/base.py b/pyafsmon/tests/base.py new file mode 100644 index 0000000..8b4427d --- /dev/null +++ b/pyafsmon/tests/base.py @@ -0,0 +1,50 @@ +# Copyright 2010-2011 OpenStack Foundation +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import os + +import fixtures +import testtools + +_TRUE_VALUES = ('True', 'true', '1', 'yes') + + +class TestCase(testtools.TestCase): + """Test case base class for all unit tests.""" + + def setUp(self): + """Run before each test method to initialize test environment.""" + + super(TestCase, self).setUp() + test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0) + try: + test_timeout = int(test_timeout) + except ValueError: + # If timeout value is invalid do not set a timeout. + test_timeout = 0 + if test_timeout > 0: + self.useFixture(fixtures.Timeout(test_timeout, gentle=True)) + + self.useFixture(fixtures.NestedTempfile()) + self.useFixture(fixtures.TempHomeDir()) + + if os.environ.get('OS_STDOUT_CAPTURE') in _TRUE_VALUES: + stdout = self.useFixture(fixtures.StringStream('stdout')).stream + self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout)) + if os.environ.get('OS_STDERR_CAPTURE') in _TRUE_VALUES: + stderr = self.useFixture(fixtures.StringStream('stderr')).stream + self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr)) + + self.log_fixture = self.useFixture(fixtures.FakeLogger()) diff --git a/pyafsmon/tests/test_pyafsmon.py b/pyafsmon/tests/test_pyafsmon.py new file mode 100644 index 0000000..8388d35 --- /dev/null +++ b/pyafsmon/tests/test_pyafsmon.py @@ -0,0 +1,28 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from pyafsmon.tests import base + +""" +test_pyafsmon +---------------------------------- + +Tests for `pyafsmon` module. +""" + +class TestPyAFSMon(base.TestCase): + + def setUp(self): + super(TestPyAFSMon, self).setUp() + + def test_blank(self): + self.assertEqual(0, 0) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..7acf1b0 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. + +pbr!=2.1.0,>=2.0.0 # Apache-2.0 +Babel!=2.4.0,>=2.3.4 # BSD diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..d9dabf1 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,27 @@ +[metadata] +name = pyafsmon +summary = Monitoring for AFS +description-file = + README.rst +author = Ian Wienand +author-email = ian@wienand.org +home-page = https://github.com/ianw/pyafsmon +classifier = + Intended Audience :: Information Technology + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.3 + Programming Language :: Python :: 3.4 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + +[files] +packages = + pyafsmon + +[entry_points] +console_scripts = + afsmon = pyafsmon.pyafsmon:main + diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..782bb21 --- /dev/null +++ b/setup.py @@ -0,0 +1,29 @@ +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools + +# In python < 2.7.4, a lazy loading of package `pbr` will break +# setuptools if some other modules registered functions in `atexit`. +# solution from: http://bugs.python.org/issue15881#msg170215 +try: + import multiprocessing # noqa +except ImportError: + pass + +setuptools.setup( + setup_requires=['pbr>=1.8'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..a01d22c --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,4 @@ +hacking +mock +stestr + diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..4b01645 --- /dev/null +++ b/tox.ini @@ -0,0 +1,22 @@ +[tox] +minversion = 1.6 +envlist = py36,py36,py34,py36,pep8 +skipsdist = True + +[testenv] +usedevelop = True +install_command = pip install -U {opts} {packages} +setenv = + VIRTUAL_ENV={envdir} +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = + stestr run {posargs} + +[testenv:pep8] +commands = flake8 + +[testenv:venv] +commands = {posargs} + +