diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2015-08-04 02:26:29 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2015-08-04 02:26:29 +0200 |
commit | 29aad0a5becffa8a141d0ce0e48492e1a39eaca6 (patch) | |
tree | 7e998caf073a4cb790ed8392adee4acc01f77494 | |
parent | 2d2bfe6de68bc375453247058776d9d92358eb8f (diff) | |
download | psutil-29aad0a5becffa8a141d0ce0e48492e1a39eaca6.tar.gz |
attempt some fixes for OSX/travis failures; also update HISTORY/CREDITS with @mrjefftang contributions
-rw-r--r-- | .ci/README | 3 | ||||
-rw-r--r-- | .ci/appveyor/README (renamed from .appveyor/README) | 0 | ||||
-rw-r--r-- | .ci/appveyor/install.ps1 (renamed from .appveyor/install.ps1) | 0 | ||||
-rw-r--r-- | .ci/appveyor/run_with_compiler.cmd (renamed from .appveyor/run_with_compiler.cmd) | 0 | ||||
-rw-r--r-- | .ci/travis/README | 2 | ||||
-rwxr-xr-x | .ci/travis/install.sh (renamed from .travis/install.sh) | 0 | ||||
-rwxr-xr-x | .ci/travis/run.sh (renamed from .travis/run.sh) | 3 | ||||
-rw-r--r-- | .travis.yml | 7 | ||||
-rw-r--r-- | CREDITS | 8 | ||||
-rw-r--r-- | DEVGUIDE.rst | 13 | ||||
-rw-r--r-- | HISTORY.rst | 4 | ||||
-rw-r--r-- | MANIFEST.in | 3 | ||||
-rw-r--r-- | appveyor.yml | 4 | ||||
-rw-r--r-- | test/_osx.py | 8 | ||||
-rw-r--r-- | test/test_psutil.py | 18 |
15 files changed, 42 insertions, 31 deletions
diff --git a/.ci/README b/.ci/README new file mode 100644 index 00000000..86b72afb --- /dev/null +++ b/.ci/README @@ -0,0 +1,3 @@ +This directory contains support scripts for Travis and Appveyor continuous +integration services. +Travis is used to run tests on Linux and OSX, Appveyor runs tests on Windows. diff --git a/.appveyor/README b/.ci/appveyor/README index 2e092a07..2e092a07 100644 --- a/.appveyor/README +++ b/.ci/appveyor/README diff --git a/.appveyor/install.ps1 b/.ci/appveyor/install.ps1 index 3f056282..3f056282 100644 --- a/.appveyor/install.ps1 +++ b/.ci/appveyor/install.ps1 diff --git a/.appveyor/run_with_compiler.cmd b/.ci/appveyor/run_with_compiler.cmd index 3a472bc8..3a472bc8 100644 --- a/.appveyor/run_with_compiler.cmd +++ b/.ci/appveyor/run_with_compiler.cmd diff --git a/.ci/travis/README b/.ci/travis/README new file mode 100644 index 00000000..d9d5f65a --- /dev/null +++ b/.ci/travis/README @@ -0,0 +1,2 @@ +This directory contains support files for Travis, a continuous integration +service which runs tests on Linux and Windows on every push. diff --git a/.travis/install.sh b/.ci/travis/install.sh index 23d9ce04..23d9ce04 100755 --- a/.travis/install.sh +++ b/.ci/travis/install.sh diff --git a/.travis/run.sh b/.ci/travis/run.sh index b12c0150..41167aa8 100755 --- a/.travis/run.sh +++ b/.ci/travis/run.sh @@ -7,7 +7,6 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then if which pyenv > /dev/null; then eval "$(pyenv init -)" fi - pyenv activate psutil fi @@ -16,4 +15,4 @@ python setup.py install coverage run test/test_psutil.py --include="psutil/*" --omit="test/*,*setup*" python test/test_memory_leaks.py flake8 -pep8
\ No newline at end of file +pep8 diff --git a/.travis.yml b/.travis.yml index e355449b..d883c653 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,5 @@ sudo: false - language: python - matrix: include: - python: 2.6 @@ -24,10 +22,9 @@ matrix: - language: generic os: osx env: PYVER=py34 - install: - - ./.travis/install.sh + - ./.ci/travis/install.sh script: - - ./.travis/run.sh + - ./.ci/travis/run.sh after_success: - coveralls # upload reports to coveralls.io @@ -29,6 +29,10 @@ E: jloden@gmail.com D: original co-author, initial design/bootstrap and occasional bug fixes W: http://www.jayloden.com +N: Jeff Tang +W: https://github.com/mrjefftang +I: 340, 529, 616, 653, 654, 648 + N: Jeremy Whitlock E: jcscoobyrs@gmail.com D: great help with OSX C development. @@ -253,10 +257,6 @@ N: msabramo E: msabramo@gmail.com I: 492 -N: Jeff Tang -W: https://github.com/mrjefftang -I: 340, 529, 616, 653, 654 - N: Yaolong Huang E: airekans@gmail.com W: http://airekans.github.io/ diff --git a/DEVGUIDE.rst b/DEVGUIDE.rst index d8df9434..cfbc1789 100644 --- a/DEVGUIDE.rst +++ b/DEVGUIDE.rst @@ -74,15 +74,18 @@ All of the services listed below are automatically run on ``git push``. Tests ----- -Tests are automatically run on push on Linux and Windows by using: +Tests are automatically run for every GIT push on **Linux**, **OSX** and +**Windows** by using: -- `Travis <https://travis-ci.org/giampaolo/psutil>`_ (Linux) +- `Travis <https://travis-ci.org/giampaolo/psutil>`_ (Linux, OSX) - `Appveyor <https://ci.appveyor.com/project/giampaolo/psutil>`_ (Windows) -Test files controlling these are `.travis.yml <https://github.com/giampaolo/psutil/blob/master/.travis.yml>`_ -and `appveyor.yml <https://github.com/giampaolo/psutil/blob/master/appveyor.yml>`_. +Test files controlling these are +`.travis.yml <https://github.com/giampaolo/psutil/blob/master/.travis.yml>`_ +and +`appveyor.yml <https://github.com/giampaolo/psutil/blob/master/appveyor.yml>`_. Both services run psutil test suite against all supported python version -(2.6 - 3.5). +(2.6 - 3.4). Two icons in the home page (README) always show the build status: .. image:: https://api.travis-ci.org/giampaolo/psutil.png?branch=master diff --git a/HISTORY.rst b/HISTORY.rst index d6e81e08..1830d972 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,10 @@ Bug tracker at https://github.com/giampaolo/psutil/issues 3.1.2 - XXXX-XX-XX ================== +**Enhancements** + +- #648: CI test integration for OSX. (patch by Jeff Tang) + **Bug fixes** - #659: [Linux] compilation error on Suse 10. diff --git a/MANIFEST.in b/MANIFEST.in index 175cf79f..a95f32f4 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,6 +2,7 @@ include .coveragerc include .git-pre-commit include .gitignore include .travis.yml +include appveyor.yml include CREDITS include HISTORY.rst include INSTALL.rst @@ -14,7 +15,7 @@ include setup.py include TODO include tox.ini recursive-exclude docs/_build * -recursive-include .appveyor/* +recursive-include .ci/* recursive-include docs * recursive-include examples *.py recursive-include psutil *.py *.c *.h diff --git a/appveyor.yml b/appveyor.yml index 752ec887..df5d8a97 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,7 +4,7 @@ environment: # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the # /E:ON and /V:ON options are not enabled in the batch script intepreter # See: http://stackoverflow.com/a/13751649/163740 - WITH_COMPILER: "cmd /E:ON /V:ON /C .\\.appveyor\\run_with_compiler.cmd" + WITH_COMPILER: "cmd /E:ON /V:ON /C .\\.ci\appveyor\\run_with_compiler.cmd" matrix: # Pre-installed Python versions, which Appveyor may upgrade to @@ -48,7 +48,7 @@ init: - "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%" install: - - "powershell .appveyor\\install.ps1" + - "powershell .ci\\appveyor\\install.ps1" # - ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py') # - "%PYTHON%/python.exe C:/get-pip.py" # - "%PYTHON%/python.exe -m pip install ..." diff --git a/test/_osx.py b/test/_osx.py index 6e6e4380..9bc807a6 100644 --- a/test/_osx.py +++ b/test/_osx.py @@ -138,15 +138,15 @@ class OSXSpecificTestCase(unittest.TestCase): self.assertEqual(psutil.swap_memory().sout, num) def test_swapmem_total(self): - tot1 = psutil.swap_memory().total - tot2 = 0 + psutil_total = psutil.swap_memory().total + sys_total = 0 # OSX uses multiple cache files: # http://en.wikipedia.org/wiki/Paging#OS_X for name in os.listdir("/var/vm/"): file = os.path.join("/var/vm", name) if os.path.isfile(file): - tot2 += os.path.getsize(file) - self.assertEqual(tot1, tot2) + sys_total += os.path.getsize(file) + self.assertEqual(psutil_total, sys_total) def main(): diff --git a/test/test_psutil.py b/test/test_psutil.py index b12275de..93f522ec 100644 --- a/test/test_psutil.py +++ b/test/test_psutil.py @@ -440,7 +440,9 @@ def retry_before_failing(ntimes=None): def decorator(fun): @functools.wraps(fun) def wrapper(*args, **kwargs): - for x in range(ntimes or NO_RETRIES): + times = ntimes or NO_RETRIES + assert times, times + for x in range(times): try: return fun(*args, **kwargs) except AssertionError: @@ -1641,20 +1643,20 @@ class TestProcess(unittest.TestCase): # Test that name(), exe() and cmdline() correctly handle programs # with funky chars such as spaces and ")", see: # https://github.com/giampaolo/psutil/issues/628 - funky_name = "/tmp/foo bar )" + funky_path = os.path.join(tempfile.gettempdir(), "foo bar )") _, c_file = tempfile.mkstemp(prefix='psutil-', suffix='.c', dir="/tmp") - self.addCleanup(lambda: safe_remove(c_file)) - self.addCleanup(lambda: safe_remove(funky_name)) + self.addCleanup(safe_remove, c_file) + self.addCleanup(safe_remove, funky_path) with open(c_file, "w") as f: f.write("void main() { pause(); }") - subprocess.check_call(["gcc", c_file, "-o", funky_name]) + subprocess.check_call(["gcc", c_file, "-o", funky_path]) sproc = get_test_subprocess( - [funky_name, "arg1", "arg2", "", "arg3", ""]) + [funky_path, "arg1", "arg2", "", "arg3", ""]) p = psutil.Process(sproc.pid) # ...in order to try to prevent occasional failures on travis wait_for_pid(p.pid) - self.assertEqual(p.name(), "foo bar )") - self.assertEqual(p.exe(), "/tmp/foo bar )") + self.assertEqual(p.name(), os.path.basename(funky_path)) + self.assertEqual(p.exe(), funky_path) self.assertEqual( p.cmdline(), ["/tmp/foo bar )", "arg1", "arg2", "", "arg3", ""]) |