Re: Problems Running tests with fixtures

2010-10-03 Thread Timothy Washington
Iiinteresting. It turns out that I wasn't calling (x) in the :once code. It
looks like that prevents :each test from running.


(ns utest)
(use 'clojure.test)

(defn f [x] (println f before) (x) (println f after))
(use-fixtures :each f)

(defn g [x] (println g1) *(x)* (println g2))
(use-fixtures :once g)

(deftest test-me (is ( = 1 1)))
(deftest test-me-2 (is ( = 2 2 )))

(run-tests)


Thanks
Tim


On Fri, Oct 1, 2010 at 2:17 PM, Timothy Washington twash...@gmail.comwrote:

 Hmmm, I'm using clojure 1.2. I'll try out 1.3 when I get home.

 Thanks
 Tim


 On Thu, Sep 30, 2010 at 10:09 PM, Sean Corfield seancorfi...@gmail.comwrote:

 On Thu, Sep 30, 2010 at 2:44 PM, Timothy Washington twash...@gmail.com
 wrote:
  Just in case anyone comes across this, I did get around it. In fig. 2 I
 was
  trying to run (use-fixtures) twice. One with a :once, and one with
 :each.

 I just tried that and it worked fine for me:

 (ns utest)
 (use 'clojure.test)
 (defn f [x] (println f before) (x) (println f after))
 (use-fixtures :each f)
 (defn g [x] (println g1)(x)(println g2))
 (use-fixtures :once g)
 (deftest test-me (is ( = 1 1)))
 (deftest test-me-2 (is ( = 2 2 )))
 (run-tests)

 Produced:


 Testing utest
 g1
 f before
 f after
 f before
 f after
 g2

 Ran 2 tests containing 2 assertions.
 0 failures, 0 errors.
 {:type :summary, :pass 2, :test 2, :error 0, :fail 0}

 I'm using Clojure 1.3.0 master.
 --
 Sean A Corfield -- (904) 302-SEAN
 Railo Technologies, Inc. -- http://getrailo.com/
 An Architect's View -- http://corfield.org/

 If you're not annoying somebody, you're not really alive.
 -- Margaret Atwood

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en




-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Problems Running tests with fixtures

2010-10-01 Thread Timothy Washington
Hmmm, I'm using clojure 1.2. I'll try out 1.3 when I get home.

Thanks
Tim


On Thu, Sep 30, 2010 at 10:09 PM, Sean Corfield seancorfi...@gmail.comwrote:

 On Thu, Sep 30, 2010 at 2:44 PM, Timothy Washington twash...@gmail.com
 wrote:
  Just in case anyone comes across this, I did get around it. In fig. 2 I
 was
  trying to run (use-fixtures) twice. One with a :once, and one with :each.

 I just tried that and it worked fine for me:

 (ns utest)
 (use 'clojure.test)
 (defn f [x] (println f before) (x) (println f after))
 (use-fixtures :each f)
 (defn g [x] (println g1)(x)(println g2))
 (use-fixtures :once g)
 (deftest test-me (is ( = 1 1)))
 (deftest test-me-2 (is ( = 2 2 )))
 (run-tests)

 Produced:


 Testing utest
 g1
 f before
 f after
 f before
 f after
 g2

 Ran 2 tests containing 2 assertions.
 0 failures, 0 errors.
 {:type :summary, :pass 2, :test 2, :error 0, :fail 0}

 I'm using Clojure 1.3.0 master.
 --
 Sean A Corfield -- (904) 302-SEAN
 Railo Technologies, Inc. -- http://getrailo.com/
 An Architect's View -- http://corfield.org/

 If you're not annoying somebody, you're not really alive.
 -- Margaret Atwood

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Problems Running tests with fixtures

2010-09-30 Thread Timothy Washington
Just in case anyone comes across this, I did get around it. In fig. 2 I was
trying to run (use-fixtures) twice. One with a :once, and one with :each. I
just commented out the :once call and executed manually.


*(use-fixtures :once login-test/test-fixture-shell )*
*(use-fixtures :each login-test/test-fixture-db )*

*(test-fixture-shell nil)*
*;;(use-fixtures :once login-test/test-fixture-shell )*
*(use-fixtures :each login-test/test-fixture-db )*


Tim


On Tue, Sep 28, 2010 at 6:08 PM, Timothy Washington twash...@gmail.comwrote:

 Oh that's my mistake in the example code. My actual code does have an (is )
 function. The example code should look like:

 (deftest test-code []
 *(is (= 5 5)) *
 )

 Tim


 On Tue, Sep 28, 2010 at 12:29 PM, Kevin Downey redc...@gmail.com wrote:

 your test has no (is ...)

 On Mon, Sep 27, 2010 at 5:16 PM, Timothy Washington twash...@gmail.com
 wrote:
  I suppose I've been looking at this code for too long, so I need a 2nd
 pair
  of eyes on it. I'm not getting some 'test.is' code to run. I'm trying
 to run
  the tests as in fig. 1. Suppose the tests are defined in a file called
  utests.clj (fig. 2).
 
  (use 'clojure.test)
  (require 'utests)
  (run-tests 'utests)
  fig. 1 - run attempts
 
  (ns utests)
  (defn test-fixture-1 [test-func]
 
  (setup-code)
  (test-func)
  (teardown-code)
  )
  (use-fixtures :each test-fixture-1)
  (deftest test-code []
  (= 5 5))
  )
  fig. 2 - utests.clj
 
  Ran 0 tests containing 0 assertions.
  0 failures, 0 errors.
  {:type :summary, :test 0, :pass 0, :fail 0, :error 0}
  fig. 3 - output
 
 
  Q. The thing that I'm missing is...
 
  Thanks in advance
  Tim
 
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clojure@googlegroups.com
  Note that posts from new members are moderated - please be patient with
 your
  first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en



 --
 And what is good, Phaedrus,
 And what is not good—
 Need we ask anyone to tell us these things?

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en




-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Problems Running tests with fixtures

2010-09-30 Thread Sean Corfield
On Thu, Sep 30, 2010 at 2:44 PM, Timothy Washington twash...@gmail.com wrote:
 Just in case anyone comes across this, I did get around it. In fig. 2 I was
 trying to run (use-fixtures) twice. One with a :once, and one with :each.

I just tried that and it worked fine for me:

(ns utest)
(use 'clojure.test)
(defn f [x] (println f before) (x) (println f after))
(use-fixtures :each f)
(defn g [x] (println g1)(x)(println g2))
(use-fixtures :once g)
(deftest test-me (is ( = 1 1)))
(deftest test-me-2 (is ( = 2 2 )))
(run-tests)

Produced:


Testing utest
g1
f before
f after
f before
f after
g2

Ran 2 tests containing 2 assertions.
0 failures, 0 errors.
{:type :summary, :pass 2, :test 2, :error 0, :fail 0}

I'm using Clojure 1.3.0 master.
-- 
Sean A Corfield -- (904) 302-SEAN
Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/

If you're not annoying somebody, you're not really alive.
-- Margaret Atwood

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Problems Running tests with fixtures

2010-09-28 Thread Kevin Downey
your test has no (is ...)

On Mon, Sep 27, 2010 at 5:16 PM, Timothy Washington twash...@gmail.com wrote:
 I suppose I've been looking at this code for too long, so I need a 2nd pair
 of eyes on it. I'm not getting some 'test.is' code to run. I'm trying to run
 the tests as in fig. 1. Suppose the tests are defined in a file called
 utests.clj (fig. 2).

 (use 'clojure.test)
 (require 'utests)
 (run-tests 'utests)
 fig. 1 - run attempts

 (ns utests)
 (defn test-fixture-1 [test-func]

     (setup-code)
     (test-func)
     (teardown-code)
 )
 (use-fixtures :each test-fixture-1)
 (deftest test-code []
     (= 5 5))
 )
 fig. 2 - utests.clj

 Ran 0 tests containing 0 assertions.
 0 failures, 0 errors.
 {:type :summary, :test 0, :pass 0, :fail 0, :error 0}
 fig. 3 - output


 Q. The thing that I'm missing is...

 Thanks in advance
 Tim

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en



-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en