Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Suppress annoy warning, when executing AR's testcases. #7432

Merged
merged 2 commits into from

4 participants

Toshinori Kajihara Carlos Antonio da Silva Aaron Patterson Rafael Mendonça França
Toshinori Kajihara
Collaborator

We always see the follwing warning, when executing rake test_mysql

...warning: instance variable errno not initialized...

I know we shouldn't hide warnings, but I guess that development for mysql gem is not active.

BTW:
according to https://github.com/luislavena/mysql-gem/blob/master/ext/mysql_api/mysql.c#L1873
and https://github.com/luislavena/mysql-gem/blob/master/ext/mysql_api/mysql.c#L171, we can't access this iv ?

Carlos Antonio da Silva

This message is very annoying yeah, and I'm happy to merge it. I just thought that perhaps we should move it to our tests setup instead of the connection adapter, since it's a hack for our tests only, wdyt?

Aaron Patterson
Owner

I agree with @carlosantoniodasilva on this. We should probably move to the test cases.

Toshinori Kajihara
Collaborator

@carlosantoniodasilva @tenderlove I moved to the testcases.

BTW, I found the below comment in mysql_adapter

  8 class Mysql
  9   class Time
 10     ###
 11     # This monkey patch is for test_additional_columns_from_join_table
 12     def to_date
 13       Date.new(year, month, day)
 14     end
 15   end

Should we move it to the testcases ?

Rafael Mendonça França

@kennyj I don't think this code is used only in tests. I guess it is fixing some issue. But I'm just guessing

Toshinori Kajihara
Collaborator

@rafaelfranca
When I remove Mysql::Time#to_date, many testcases are failed, and I confirm some functionalities depend on the method. I'll remove this comment.

Toshinori Kajihara
Collaborator

I added 48498da .

Rafael Mendonça França rafaelfranca merged commit 7b2363f into from
Rafael Mendonça França

Great! Thanks

Andrey Deryabin aderyabin referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
2  activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
View
@@ -7,8 +7,6 @@
class Mysql
class Time
- ###
- # This monkey patch is for test_additional_columns_from_join_table
def to_date
Date.new(year, month, day)
end
2  activerecord/test/cases/helper.rb
View
@@ -22,6 +22,8 @@
# Connect to the database
ARTest.connect
+require 'support/mysql'
+
# Quote "type" if it's a reserved word for the current connection.
QUOTED_TYPE = ActiveRecord::Base.connection.quote_column_name('type')
11 activerecord/test/support/mysql.rb
View
@@ -0,0 +1,11 @@
+if defined?(Mysql)
+ class Mysql
+ class Error
+ # This monkey patch fixes annoy warning with mysql-2.8.1.gem when executing testcases.
+ def errno_with_fix_warnings
+ silence_warnings { errno_without_fix_warnings }
+ end
+ alias_method_chain :errno, :fix_warnings
+ end
+ end
+end
Something went wrong with that request. Please try again.