• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PulpQE / pulp-smash / 2496
63%

Build:
DEFAULT BRANCH: master
Ran 21 May 2018 06:16PM UTC
Jobs 3
Files 7
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
2496

push

travis-ci

Ichimonji10
Revamp PulpSmashConfig object

The `PulpSmashConfig` object has a weird constructor: all arguments are
optional. As a result, it's excessively easy to create a new object that
has an invalid state. For example, this will raise an exception, as
necessary information is not available:

    config.PulpSmashConfig().get_base_url()

From a design perspective, this is bad. No amount of linting can help
discover improperly written code when the underlying code doesn't even
define constructor parameters as required.

Why is this done? Because certain methods, like `read`, are instance
methods. This code needs to work:

    config.PulpSmashConfig().read()

What's to be done? The obvious solution is to change methods which don't
require instance data from instance to class or static methods. This
makes it possible to define constructor parameters as required. And it
opens the door to more aggressive input validation in the future, if so
desired. To summarize: this change leads to more efficient *and* more
correct code.

Given how fundamental this change is, it's also a good time to review
other aspects of `PulpSmashConfig`'s design. And as it happens, there
are a few other improvements to be made:

* There are two types of paths that are especially useful for users of
  the `PulpSmashConfig` class: a path to which one might save settings,
  and a path from which one might load settings. The
  `default_config_file_path` and `get_config_file_path` methods provide
  this information, respectively. These method names aren't terribly
  obvious. Rename them to `get_save_path` and `get_load_path`,
  respectively.
* The `read` method verifies that the file being read from disk is a
  file. This is an overly aggressive check. It prevents interesting use
  cases such as the file on disk being a symlink.
* It's quite possible that a corresponding `write` method might be
  written in the future. But the names "read" and "write" don't convey
  quite the right semantics. The... (continued)

526 of 840 relevant lines covered (62.62%)

1.88 hits per line

Jobs
ID Job ID Ran Files Coverage
1 2496.1 21 May 2018 06:17PM UTC 0
62.62
Travis Job 2496.1
2 2496.2 21 May 2018 06:16PM UTC 0
62.62
Travis Job 2496.2
3 2496.3 21 May 2018 06:16PM UTC 0
62.62
Travis Job 2496.3
Source Files on build 2496
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #2496
  • c5d5884e on github
  • Prev Build on master (#2494)
  • Next Build on master (#2499)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc