guard-pytest 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +9 -0
- data/lib/guard/pytest.rb +17 -2
- data/lib/guard/pytest/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8c2ebf8826539d9e40b6ea106137cfa368eb2945daaf60c252f8f425859f50a2
|
4
|
+
data.tar.gz: 70dfa78064b3066d464e482d04584e6395e384cad73fb7e2b9f2af4b6d65e659
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 266c006e9d8a7aaa671d0c60e31caa5e0322a6d863370ca16f4605c6be994799c44c0de7fd0c5154b7c2c4b96359e43893a4e3128ad8fc2dcc73629f4e8f48e5
|
7
|
+
data.tar.gz: 33d8c4cee090dd76e7ef45bc776de5e473c51314e0080297b8351b7ded3b9849a13dd5c61c02c2819f081ec2a5ff417bf35bf31188587a7a0d4622797cbed136
|
data/README.md
CHANGED
@@ -30,6 +30,15 @@ guard :pytest, pytest_option: "--doctest-modules --color=yes" do
|
|
30
30
|
end
|
31
31
|
```
|
32
32
|
|
33
|
+
specify custom pytest command
|
34
|
+
```ruby
|
35
|
+
guard :pytest, pytest_cmd: "pipenv run py.test", pytest_option: "--doctest-modules --color=yes" do
|
36
|
+
watch(%r{^((?!test/).*)\.py$}) {|m| "test/#{m[1]}_test.py" }
|
37
|
+
watch(%r{^test/.*_test\.py$})
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
|
33
42
|
## Contributing
|
34
43
|
|
35
44
|
Bug reports and pull requests are welcome on GitHub at https://github.com/kazufusa/guard-pytest. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
data/lib/guard/pytest.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'guard/compat/plugin'
|
2
2
|
require 'guard/pytest/version'
|
3
3
|
|
4
|
+
require 'shellwords'
|
5
|
+
|
4
6
|
module Guard
|
5
7
|
class Pytest < Plugin
|
6
8
|
def initialize(options = {})
|
@@ -17,14 +19,27 @@ module Guard
|
|
17
19
|
end
|
18
20
|
|
19
21
|
def run_all
|
20
|
-
|
22
|
+
opts = Shellwords.shellsplit(options[:pytest_option])
|
23
|
+
run_tests(opts)
|
21
24
|
true
|
22
25
|
end
|
23
26
|
|
24
27
|
def run_on_modifications(paths)
|
25
|
-
|
28
|
+
opts = Shellwords.shellsplit(options[:pytest_option])
|
29
|
+
run_tests(opts, paths)
|
26
30
|
true
|
27
31
|
end
|
28
32
|
|
33
|
+
private
|
34
|
+
|
35
|
+
def pytest_cmd
|
36
|
+
pytest_cmd = options[:pytest_cmd] || "py.test"
|
37
|
+
pytest_cmd.split(" ")
|
38
|
+
end
|
39
|
+
|
40
|
+
def run_tests(options, files = nil)
|
41
|
+
result = system(*pytest_cmd, *options, *files)
|
42
|
+
throw(:task_has_failed) unless result
|
43
|
+
end
|
29
44
|
end
|
30
45
|
end
|
data/lib/guard/pytest/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-pytest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kazufusa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
@@ -120,9 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.
|
123
|
+
rubygems_version: 2.7.7
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: Guard gem for Pytest
|
127
127
|
test_files: []
|
128
|
-
has_rdoc:
|