Repository navigation
Expand file tree
/
Copy pathelpy-check-test.el
More file actions
67 lines (63 loc) · 3.31 KB
/
Copy pathelpy-check-test.el
File metadata and controls
67 lines (63 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
(ert-deftest elpy-check-should-fail-in-buffer-without-file ()
(elpy-testcase ()
(should-error (elpy-check))))
(ert-deftest elpy-check-should-call-save-some-buffers ()
(elpy-testcase ((:project project-root "test.py"))
(find-file (f-join project-root "test.py"))
(mletf* ((save-some-buffers-called nil)
(save-some-buffers (arg pred)
(setq save-some-buffers-called t)))
(elpy-check))))
(ert-deftest elpy-check-should-call-compilation-start-for-single-file ()
(elpy-testcase ((:project project-root "test.py"))
(find-file (f-join project-root "test.py"))
(mletf* ((command nil)
(compilation-start (command-arg mode name-function)
(setq command command-arg)))
(elpy-check)
(should (equal command (format "%s %s"
python-check-command
(f-join project-root "test.py")))))))
(ert-deftest elpy-check-should-pass-extra-args-for-project-check ()
(elpy-testcase ((:project project-root "test.py"))
(find-file (f-join project-root "test.py"))
(mletf* ((command nil)
(vc-directory-exclusion-list ())
(grep-find-ignored-directories ())
(elpy-project-root project-root)
(elpy-project-ignored-directories '("foo" "bar"))
(compilation-start (command-arg mode name-function)
(setq command command-arg)))
(elpy-check t)
(should (equal command (format "%s %s --exclude=foo,bar"
python-check-command
project-root))))))
(ert-deftest elpy-check-should-pass-extra-args-for-project-check-with-pylint ()
(elpy-testcase ((:project project-root "test.py"))
(find-file (f-join project-root "test.py"))
(mletf* ((command nil)
(vc-directory-exclusion-list ())
(grep-find-ignored-directories ())
(python-check-command "pylint")
(elpy-project-root project-root)
(elpy-project-ignored-directories '("foo" "bar"))
(compilation-start (command-arg mode name-function)
(setq command command-arg)))
(elpy-check t)
(should (equal command (format "%s %s --ignore=foo,bar"
python-check-command
project-root))))))
(ert-deftest elpy-check-should-check-file-if-no-project-root ()
(elpy-testcase ((:project project-root "test.py"))
(find-file (f-join project-root "test.py"))
(mletf* ((command nil)
(vc-directory-exclusion-list ())
(grep-find-ignored-directories ())
(elpy-project-root () nil)
(elpy-project-ignored-directories '("foo" "bar"))
(compilation-start (command-arg mode name-function)
(setq command command-arg)))
(elpy-check t)
(should (equal command (format "%s %s --exclude=foo,bar"
python-check-command
(buffer-file-name)))))))