grosser / autotest Goto Github PK
View Code? Open in Web Editor NEWThis project forked from seattlerb/zentest
Save a file, autotest will run the matching tests! (Autotest without ZenTest)
This project forked from seattlerb/zentest
Save a file, autotest will run the matching tests! (Autotest without ZenTest)
Hello,
Attempting to add autotest to a Rails 3.2, Ruby 1.9.3, Postgres project on Mac OS X 10.8.5. We use Test::Unit and parallel_tests.
When I run autotest nothing appears. Running autotest -v shows "No tests matched" for, basically, every file under our \test directory (recursively).
Contents of .autotest
require 'autotest/fsevent'
Contents of /autotest/discover.rb
Autotest.add_discovery { "rails" }
Not sure what is going on... Perhaps it is thinking we are using rspec? Is there a way to force it to use test:unit? Naturally, changing a model in our projects does nothing - Autotest just sits there.
Installation was via sudo gem install autotest-standalone and then sudo gem install autotest-rails-pure
Any help would be appreciated!
I can't force autotest to use rspec2 tests instead of test/unit.
# autotest
loading autotest/cucumber_rails
style: CucumberRails
�[f/usr/bin/ruby-svn -I.:lib:test -rubygems -e "['test/unit', 'test/unit/helpers/companies_helper_test.rb', 'test/unit/user_test.rb', 'test/unit/company_test.rb', 'test/functional/companies_controller_test.rb'].each { |f| require f }" | /usr/lib/ruby/gems/svn/gems/autotest-4.2.9/bin/unit_diff -u
But rspec spec/ works fine. And autotest/discover.rb have rspec2 line:
# cat autotest/discover.rb
Autotest.add_discovery { "rails" }
Autotest.add_discovery { "rspec2" }
Arch Linux x86_64
ruby 1.9.3dev (2010-05-08 trunk 27674) x86_64-linux
Rails 3.0.0.beta.3
# gem-svn list | grep rspec
rspec (2.0.0.beta.8)
rspec-core (2.0.0.beta.8)
rspec-expectations (2.0.0.beta.8)
rspec-mocks (2.0.0.beta.8)
rspec-rails (2.0.0.beta.8)gem-svn list | grep autotest
autotest (4.2.9)
autotest-growl (0.2.4)
autotest-rails-pure (4.1.0)
Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.0.beta3'
gem 'devise', '1.1.rc1'
gem 'mysql'
group :test do
gem 'database_cleaner'
gem 'rspec-rails', '>=2.0.0.beta.8'
gem 'rspec', '>=2.0.0.beta.8'
gem 'test-unit'
gem 'cucumber', '0.7.2'
gem 'cucumber-rails', '0.3.1'#, :git => 'git://github.com/aslakhellesoy/cucumber-rails.git'
gem 'capybara'
gem 'autotest'
gem 'autotest-rails-pure'
gem 'autotest-growl'
gem 'machinist'
end
cat /home/petrushka/.autotest
require 'autotest/growl'
cat .autotest
Autotest.add_hook :initialize do |at|
at.add_exception 'tmp'
at.add_exception 'rerun.txt'
at.add_exception 'vendor'
at.add_exception '.git'
end
Using rvm, I received this error:
~/.rvm/gems/ruby-1.9.2-p0@bvo/gems/ZenTest-4.4.2/lib/unit_diff.rb:74:in `===': invalid byte sequence in US-ASCII (ArgumentError)
All my files have the encoding utf-8 in top.
note: using the command $ rake test my tests passes
I'm getting the following error, when I run autotest:
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:805:in `report_activate_error': Could not find RubyGem ZenTest (>= 0) (Gem::LoadError)
Any clues?
~ Mark
I'm using autotest-growl with Rails on Windows and it works just fine unless there is a space in the path to my Rails project. Here's the error I get:
The pertinent bit is No such file or directory - D:/Users/charlesr/Documents/My (Errno::ENOENT) where you can see the path has been truncated at the space.
When tests passes right after failing, tests get run twice. Any idea why?
autotest 4.4.6
rails 3.0.0
rspec 2.5.0
Ubuntu 10.04
I get this error when trying to run autotest-standalone. When I replaced putc of lib/autotest.rb @ 284 to 'print', it worked fine. I know 'print' breaks the coloring on windows machines. Is this a problem with autotest or my ruby version?
Gems installed :
autotest (4.4.5)
autotest-rails-pure (4.1.2)
ruby --version :
ruby 1.8.6 (2010-02-04 patchlevel 398) [i386-mingw32]
First, thanks so much for working on this project for everybody! But I can't get it to work for some reason.
running either
$autotest
or
$autotest -f
gets the same result:
$ rspec /spec works ok. This is on Ubuntu 9.04, Ruby 1.9.2, Rails 3, autotest 4.3.2, autotest-rails 4.1.0, and rspec 2.0.0.beta.20.
If I run $autotest -v, it finds my one controller spec file (or at least doesn't say that no tests match it), gives me the "# Waiting..." line, and then if I change anything in the controller or the spec, I get a hash of {[changed file] => [timestamp]}, displayed twice.
Just updated from 4.5.6 to 4.5.8, but how do I find out what the changes are ? History.txt seems out of date.
It would be amazing if the -p switch could be made to work for rspec as well!
:)
when i use rails3+ruby1.9.2 and autotest ,i got erros as:
internal:lib/rubygems/custom_require:29: warning: loading in progress, circular require considered harmful
but when i use rails3.0RC and ruby1.9.2-rc2, it works well??
fonsan$ autotest -f -n
loading autotest/rails
Enter a notification description, followed by newline, followed by Ctrl-D (End of File). To cancel, press Ctrl-C.
fonsan$ growlnotify --help
Usage: growlnotify [-hsvuwc] [-i ext] [-I filepath] [--image filepath]
[-a appname] [-p priority] [-H host] [-P password]
[--port port] [-n name] [-A method] [--progress value]
[--html] [-m message] [-t] [title]
Options:
-h,--help Display this help
-v,--version Display version number
-n,--name Set the name of the application that sends the notification
[Default: growlnotify]
-s,--sticky Make the notification sticky
-a,--appIcon Specify an application name to take the icon from
-i,--icon Specify a file type or extension to look up for the
notification icon
-I,--iconpath Specify a file whose icon will be the notification icon
--image Specify an image file to be used for the notification icon
-m,--message Sets the message to be used instead of using stdin
Passing - as the argument means read from stdin
-p,--priority Specify an int or named key (default is 0)
-d,--identifier Specify a notification identifier (used for coalescing)
-H,--host Specify a hostname to which to send a remote notification.
-P,--password Password used for remote notifications.
-u,--udp Use UDP instead of DO to send a remote notification.
--port Port number for UDP notifications.
-A,--auth Specify digest algorithm for UDP authentication.
Either MD5 [Default], SHA256 or NONE.
-c,--crypt Encrypt UDP notifications.
-w,--wait Wait until the notification has been dismissed.
--progress Set a progress value for this notification.
Display a notification using the title given on the command-line and the
message given in the standard input.
Priority can be one of the following named keys: Very Low, Moderate, Normal,
High, Emergency. It can also be an int between -2 and 2.
To be compatible with gNotify the following switch is accepted:
-t,--title Does nothing. Any text following will be treated as the
title because that's the default argument behaviour
therefore it should be a simple fix for now to change the -t option to a -m
Since Rspec 1.2.9 it's possible to require the spec_helper.rb file with just "require 'spec_helper" instead of "require File.dirname(FILE) + '/spec_helper'" (see https://rspec.lighthouseapp.com/projects/5645/tickets/733-figure-out-some-what-to-just-require-spec_helper).
But if you do this autotest doesn't work (The specs fail with "no such file to load -- spec_helper (MissingSourceFile").
It can be fixed by adding "spec" to the -I parameter of the ruby command that autotest calls.
I have a Sinatra app with the code inside lib/ and the tests inside spec/.
How do I configure Autotest to run all tests whenever a file changes in either lib/ or spec/?
from https://github.com/grosser/autotest#tips. What does this mean?
[RSpec] if you want to use require 'spec_helper' -> rspec --configure autotest
I have a rails3 project with Rspec 2, my ruby version is 1.9.2. I have only windows 7 x64 at work, and I can't run autotest.
My console log:
C:\Ruby192\web\app>autotest
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from C:/Ruby192/lib/ruby/gems/1.9.1/gems/ZenTest-4.5.0/lib/autotest.rb:226.
NOTE: Gem::SourceIndex#gems is deprecated with no replacement. It will be removed on or after 2011-1
1-01.
Gem::SourceIndex#gems called from C:/Ruby192/lib/ruby/gems/1.9.1/gems/ZenTest-4.5.0/lib/autotest.rb:
226.
loading autotest/rails_rspec2
C:\Ruby192\bin\ruby -rrubygems -S C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.0/bin/rspec --t
ty 'C:/Ruby192/web/app/spec/news_controller_spec.rb'
C:\Ruby192\bin\ruby: No such file or directory -- C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.7
.0/bin/rspec (LoadError)
I have checked ..gems/rspec-core-2.7.0/bin/ - this folder doesn't exists in windows. There is only 'exe' folder. How can I fix it?
Is it possible to run autotest with spork ? I'm using test:unit not rspec, and have both spork and autotest running independently.
It appears autotest doesn't work with rails out of the box. Instead I have to install autotest-rails. However, that has a dependency on ZenTest (which kinda defeats the point of using autotest instead). Since I don't want ZenTest, I try to uninstall it & of course get the dependency warning: autotest-rails-4.1.0 depends on [ZenTest (>= 0)]
. If I go ahead with uninstalling ZenTest & then try to run autotest I get
loading autotest/rails
Autotest style autotest/rails doesn't seem to exist. Aborting.
My only way to have a working setup was clear all autotest/ZenTest gems. Install autotest-rails (which also installs ZenTest). Then install autotest, then autotest-growl, autotest-fsevent. While this seems to work, I still had to install ZenTest & leave it installed. Is there an easier way that can be more reliably applied to other machines?
Guard executes from filesave to running the test pretty quick. Autotest initialize sets sleep=1 by default. Why is this? I looked at Activity Monitor while setting sleep to 0 and didn't see much impact. With polling, cpu is very obvious 10-20% on a core.
In my .autotest file:
# tighten up the time before the test is run
ObjectSpace.each_object(Autotest).first.sleep = 0
Which makes it run a bit like Guard. Is this terrible? I don't know what can be done. It's not a singleton, maybe Autotest should be? Maybe nothing needs to be changed but just documenting the workaround.
*** LOCAL GEMS ***
autotest-fsevent (0.2.8)
autotest-rails-pure (4.1.2)
autotest-standalone (4.5.9)
Autotest is not starting win32console on Windows and so it renders a bunch on escape codes to the screen instead of colours. Rspec handles it like this:
http://github.com/dchelimsky/rspec/blob/master/lib/spec/runner/options.rb#L187
While in Rails itself, I add the following to config/environments/development.rb:
loading autotest/minitest_rails_rspec2
Autotest style autotest/minitest_rails_rspec2 doesn't seem to exist. Aborting.
With autotest
C:\ruby200\bin\ruby -I.;lib;test -rubygems -e "['test/unit', 'test/controllers/admin_controller_test.rb', 'test/controllers/votes_controller_test.rb', 'test/integration/integration_helper.rb', 'test/helpers/posts_helper_test.rb', 'test/integration/comment_integration_test.rb', 'test/controllers/index_controller_test.rb', 'test/controllers/users_controller_test.rb', 'test/controllers/bitcoin_gateway_test.rb', 'test/helpers/comments_helper_test.rb', 'test/helpers/admin_helper_test.rb', 'test/controllers/comments_controller_test.rb', 'test/helpers/votes_helper_test.rb', 'test/integration/user_flows_test.rb', 'test/controllers/tags_controller_test.rb', 'test/helpers/user_helper_test.rb', 'test/helpers/tags_helper_test.rb', 'test/helpers/index_helper_test.rb', 'test/integration/post_integration_test.rb', 'test/controllers/posts_controller_test.rb'].each { |f| require f }" | ruby C:/ruby200/lib/ruby/gems/2.0.0/gems/autotest-standalone-4.5.11/bin/unit_diff -u
62 tests, 187 assertions, 0 failures, 0 errors, 0 skips
ruby -v: ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
With rake test
Finished tests in 26.777545s, 2.6515 tests/s, 7.4689 assertions/s.
71 tests, 200 assertions, 0 failures, 0 errors, 0 skips
All the tests under test/models/
are missing!
*** LOCAL GEMS ***
autotest-rails-pure (4.1.2)
autotest-standalone (4.5.11)
There appears to be a bad path to unit_diff. Whenever I call autotest I get an error sh: CURRENT_WORKING_DIRECTORY/Library/Ruby/Gems/1.8/gems/autotest-4.2.5/bin/unit_diff: No such file or directory
There is no issue tracking on autotest-rails-pure so I'm reporting this here... I noticed that autotest-rails-pure does not list autotest as a dependency. I don't see a reason you'd install this gem and not want autotest. It would also simplify the Rails Gemfile slightly when using autotest-rails-pure.
Ubuntu 11.04 beta and 10.10 (these are the two machines I've reproduced this on).
Autotest has stopped responding to Ctrl-C on these machines. I've tried autotest 4.4.6 and autotest-standaline 4.5.5. If I type Ctrl-C, then Ctrl-Z to background autotest, then fg to bring it back, it will see the Ctrl-C I have typed. Also, if I use strace to connect to a "hung" autotest process, I see a constant string of "sched_yield() =0" calls. What's kinda weird is that once strace is running, I can go to the terminal running autotest, and Ctrl-C works.
Tests run fine... I just can't kill autotest or force a retest with Ctrl-C.
If I have spec/ (with real specs) and test/ (with scaffold tests) in rails project tree I got an error:
�[f/usr/lib/ruby/gems/svn/gems/rspec-rails-2.0.0.beta.8/lib/autotest/rails_rspec2.rb:36:in block (2 levels) in <top (required)>': undefined method
singularize' for "companies":String (NoMethodError)
from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:529:in call' from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:529:in
test_files_for'
from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:401:in block in find_files_to_test' from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:401:in
each'
from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:401:in map' from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:401:in
find_files_to_test'
from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:256:in run_tests' from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:245:in
get_to_green'
from /usr/lib/ruby/gems/svn/gems/cucumber-0.7.2/lib/autotest/cucumber_mixin.rb:54:in get_to_green' from /usr/lib/ruby/gems/svn/gems/cucumber-0.7.2/lib/autotest/cucumber_mixin.rb:28:in
block in run'
from /usr/lib/ruby/gems/svn/gems/cucumber-0.7.2/lib/autotest/cucumber_mixin.rb:26:in loop' from /usr/lib/ruby/gems/svn/gems/cucumber-0.7.2/lib/autotest/cucumber_mixin.rb:26:in
run'
from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:135:in run' from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/bin/autotest:54:in
<top (required)>'
from /usr/bin/autotest:19:in load' from /usr/bin/autotest:19:in
'
But if I move test/ to test2/ all is ok.
My system settings:
Arch Linux x86_64
ruby 1.9.3dev (2010-05-08 trunk 27674) x86_64-linux
Rails 3.0.0.beta.3
# gem-svn list | grep rspec
rspec (2.0.0.beta.8)
rspec-core (2.0.0.beta.8)
rspec-expectations (2.0.0.beta.8)
rspec-mocks (2.0.0.beta.8)
rspec-rails (2.0.0.beta.8)gem-svn list | grep autotest
autotest (4.2.10)
autotest-growl (0.2.4)
autotest-rails-pure (4.1.0)
Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.0.beta3'
gem 'devise', '1.1.rc1'
gem 'mysql'
group :test do
gem 'database_cleaner'
gem 'rspec-rails', '>=2.0.0.beta.8'
gem 'rspec', '>=2.0.0.beta.8'
gem 'test-unit'
gem 'cucumber', '0.7.2'
gem 'cucumber-rails', '0.3.1'#, :git => 'git://github.com/aslakhellesoy/cucumber-rails.git'
gem 'capybara'
gem 'autotest'
gem 'autotest-rails-pure'
gem 'autotest-growl'
gem 'machinist'
end
I tried to follow the guidelines of issue no. 6 to get autotest with rspec 2 , rails 3 and ruby 1.9 working, but found out the following issue:
If rails's test_framework is set to rspec, and if you run rails g rspec:install, then autospec won't work. It gives no erros message ( even with -v ), it just exits withouth a word.
Here's the minimal procedure for reproduction:
$rails auto_test
$vim Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.0.beta3'
gem 'sqlite3'
group :test do
gem 'rspec-rails', '>=2.0.0.beta.8'
gem 'rspec', '>=2.0.0.beta.8'
gem 'autotest-rails-pure'
gem 'autotest-growl'
end
$vim config/application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require :default, Rails.env
module AutoTest
class Application < Rails::Application
config.generators do |g|
g.test_framework :rspec, :fixture => true
end
config.filter_parameters << :password
end
end
$rails g rspec:install
$rails g model User
$autotest
To make it work, you could remove spec folder, comment g.test_framework on config/application, and run rails g rspec:install again.
This was tested with ruby 1.9.1p376, on a Ubuntu 10.04.
This may be an issue with rspec, but since its repercussion seems to be only on autotest, i thought to open the issue here.
When I try to run autotest
under Rails 3.0.0.beta3/Rspec 2.0.0.beta8, I get:
$ autotest
(Not running features. To run features in autotest, set AUTOFEATURE=true.)
loading autotest/rails_rspec2
Error loading Autotest style autotest/rails_rspec2 (no such file to load -- autotest/rails_rspec2). Aborting.
My rspec-rails gem is bundled (in ~/.bundle) rather than installed through rubygems. As a result, autotest doesn't find 'autotest/rails_rspec2' in its load path.
I am debating two solutions:
autotest
to use Bundler when a Gemfile exists (c.f. config/boot.rb in Rails 3)For now I'm using the first approach, despite not wanting to cloud my system with prerelease gems. I think the second approach is cleaner but I haven't been able to get it to work yet. It appears that calling Bundler.setup
blows away the rubygems load path, causing other issues.
Hopefully this saves someone else some time. I had followed the instructions in gist.github.com/365816 and was still having problems since the gems were in ~/.bundle and not in my rubygems install dir.
I get this error when running autotest in a rails project.
Gems installed :
autotest (4.4.5)
autotest-rails-pure (4.1.2)
If i install ZenTest gem, the error goes away. Why is this so?
Hi
"autotest -p" tries to start parallel_test like this
parallel_test 'test/unit/user_test.rb'
But it cannot find the test files this way. Instead it should do something like this, starting rom the current directory:
parallel_test './test/unit/user_test.rb'
This is on Ruby 1.9.2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.