Skip to content
Snippets Groups Projects
  1. Jan 23, 2020
    • Adam J. Stewart's avatar
      Use `spack commands --format=bash` to generate shell completion (#14393) · 11f2b612
      Adam J. Stewart authored
      
      This PR adds a `--format=bash` option to `spack commands` to
      auto-generate the Bash programmable tab completion script. It can be
      extended to work for other shells.
      
      Progress:
      
      - [x] Fix bug in superclass initialization in `ArgparseWriter`
      - [x] Refactor `ArgparseWriter` (see below)
      - [x] Ensure that output of old `--format` options remains the same
      - [x] Add `ArgparseCompletionWriter` and `BashCompletionWriter`
      - [x] Add `--aliases` option to add command aliases
      - [x] Standardize positional argument names
      - [x] Tests for `spack commands --format=bash` coverage
      - [x] Tests to make sure `spack-completion.bash` stays up-to-date
      - [x] Tests for `spack-completion.bash` coverage
      - [x] Speed up `spack-completion.bash` by caching subroutine calls
      
      This PR also necessitates a significant refactoring of
      `ArgparseWriter`. Previously, `ArgparseWriter` was mostly a single
      `_write` method which handled everything from extracting the information
      we care about from the parser to formatting the output. Now, `_write`
      only handles recursion, while the information extraction is split into a
      separate `parse` method, and the formatting is handled by `format`. This
      allows subclasses to completely redefine how the format will appear
      without overriding all of `_write`.
      
      Co-Authored-by: default avatarTodd Gamblin <tgamblin@llnl.gov>
      11f2b612
  2. Dec 30, 2018
  3. Jan 20, 2018
    • Massimiliano Culpo's avatar
      Restore multiprocessing in unit tests (#6949) · 621388e5
      Massimiliano Culpo authored
      * Revert "Travis: use --concurrency=multiprocessing only on build tests (#6872)"
      
      This reverts commit 596d4637.
      
      * Removing 'coverage combine' in test script
      
      According to what was discovered in #6887, one of the problems is
      calling 'coverage combine' twice without the '-a' flag. This removes
      the first call within our test scripts.
      Unverified
      621388e5
  4. Jan 10, 2018
    • Massimiliano Culpo's avatar
      Travis: use --concurrency=multiprocessing only on build tests (#6872) · 596d4637
      Massimiliano Culpo authored
      On a local workstation, it seems that tracking multiple processes during
      coverage may result in malformed coverage reports for unit tests and not
      for build tests.
      
      Given that multiple processes make a difference in coverage mainly for
      build tests, try to disable the tracking for unit tests to see if we get
      more stable coverage results.
      596d4637
  5. Dec 29, 2016
    • Massimiliano Culpo's avatar
      unit tests: replace nose with pytest (#2502) · 7ea10e76
      Massimiliano Culpo authored
      * Porting: substitute nose with ytest
      
      This huge commit substitutes nose with pytest as a testing system. Things done here:
      
      * deleted external/nose as it is no longer used
      * moved mock resources in their own directory 'test/mock/'
      * ported two tests (cmd/find, build_system) to pytest native syntax as an example
      * build_environment, log: used monkeypatch instead of try/catch
      * moved global mocking of fetch_cache to an auto-used fixture
      * moved global mocking from test/__init__.py to conftest.py
      * made `spack test` a wrapper around pytest
      * run-unit-tests: avoid running python 2.6 tests under coverage to speed them up
      * use `pytest --cov` instead of coverage run to cut down testing time
      
      * mock/packages_test: moved mock yaml configuration to files instead of leaving it in the code as string literals
      
      * concretize.py: ported tests to native pytest, reverted multiprocessing in pytest.ini as it was creating the wrong report for coveralls
      
      * conftest.py, fixtures: added docstrings
      
      * concretize_preferences.py: uses fixtures instead of subclassing MockPackagesTest
      
      * directory_layout.py: uses fixtures instead of subclassing MockPackagesTest
      
      * install.py: uses fixtures instead of subclassing MockPackagesTest
      
      * optional_deps.py: uses fixtures instead of subclassing MockPackagesTest
      
      optional_deps.py: uses fixtures instead of subclassing MockPackagesTest
      
      * packages.py: uses fixtures instead of subclassing MockPackagesTest
      
      * provider_index.py: uses fixtures instead of subclassing MockPackagesTest
      
      * spec_yaml.py: uses fixtures instead of subclassing MockPackagesTest
      
      * multimethod.py: uses fixtures instead of subclassing MockPackagesTest
      
      * install.py: now uses mock_archive_url
      
      * git_fetch.py: uses fixtures instead of subclassing MockPackagesTest
      
      * hg_fetch.py: uses fixtures instead of subclassing MockPackagesTest
      
      * svn_fetch.py, mirror.py: uses fixtures instead of subclassing MockPackagesTest
      repo.py: deleted
      
      * test_compiler_cmd.py: uses fixtures instead of subclassing MockPackagesTest
      
      * cmd/module.py, cmd/uninstall.py: uses fixtures instead of subclassing MockDatabase
      
      * database.py: uses fixtures instead of subclassing MockDatabase, removed mock/database
      
      * pytest: uncluttering fixture implementations
      
      * database: changing the scope to 'module'
      
      * config.py: uses fixtures instead of subclassing MockPackagesTest
      
      * spec_dag.py, spec_semantics.py: uses fixtures instead of subclassing MockPackagesTest
      
      * stage.py: uses fixtures instead of subclassing MockPackagesTest. Removed mock directory
      
      * pytest: added docstrings to all the fixtures
      
      * pytest: final cleanup
      
      * build_system_guess.py: fixed naming and docstrings as suggested by @scheibelp
      
      * spec_syntax.py: added expected failure on parsing multiple specs closes #1976
      
      * Add pytest and pytest-cov to Spack externals.
      
      * Make `spack flake8` ignore externals.
      
      * run-unit-tests runs spack test and not pytest.
      
      * Remove all the special stuff for `spack test`
      
      - Remove `conftest.py` magic and all the special case stuff in `bin/spack`
      
      - Spack commands can optionally take unknown arguments, if they want to
        handle them.
      
      - `spack test` is now a command like the others.
      
      - `spack test` now just delegates its arguments to `pytest`, but it does
        it by receiving unknown arguments and NOT taking an explicit
        help argument.
      
      * Fix error in fixtures.
      
      * Improve `spack test` command a bit.
      
      - Now supports an approximation of the old simple interface
      - Also supports full pytest options if you want them.
      
      * Use external coverage instead of pytest-cov
      
      * Make coverage use parallel-mode.
      
      * change __init__.py docs to include pytest
      7ea10e76
  6. May 10, 2016
  7. Jan 19, 2016
Loading